1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
20 /********************************************************************20**
26 Desc: common functions used to pack and unpack primitives and
29 - Common to all interfaces e.g. Addrs, etc.
30 These functions are always compiled.
32 All functions pack/unpack assuming that the most significant
33 bit is towards the head of the buffer.
37 *********************************************************************21*/
40 /* header include files (.h) */
42 #include "envopt.h" /* environment options */
43 #include "envdep.h" /* environment dependent */
44 #include "envind.h" /* environment independent */
46 #include "gen.h" /* general layer */
47 #include "ssi.h" /* system services */
49 #ifndef CMFILE_REORG_1
50 #include "cm_gen.h" /* common pack/unpack functions */
53 #include "cm_err.h" /* common error */
55 /* header/extern include files (.x) */
57 #include "gen.x" /* general layer */
58 #include "ssi.x" /* system services */
60 #ifndef CMFILE_REORG_1
61 #include "cm_gen.x" /* common pack/unpack functions */
71 /* forward references */
73 /* functions in other modules */
75 /* public variable declarations */
76 uint16_t gTransId = 0;
78 /* private variable declarations */
82 * common packing functions
90 * Desc: This function packs the Date Time structure
102 DateTime *dateTime, /* date and time */
103 Buffer *mBuf /* message buffer */
107 /*-- cm_gen_c_001.main_36 - added for micro seconds --*/
108 #ifdef SS_DATETIME_USEC
109 CMCHKPK(oduUnpackUInt32, dateTime->usec, mBuf);
110 #endif /*-- SS_DATETIME_USEC --*/
111 CMCHKPK(oduUnpackUInt8, dateTime->tenths, mBuf);
112 CMCHKPK(oduUnpackUInt8, dateTime->sec, mBuf);
113 CMCHKPK(oduUnpackUInt8, dateTime->min, mBuf);
114 CMCHKPK(oduUnpackUInt8, dateTime->hour, mBuf);
115 CMCHKPK(oduUnpackUInt8, dateTime->year, mBuf);
116 CMCHKPK(oduUnpackUInt8, dateTime->day, mBuf);
117 CMCHKPK(oduUnpackUInt8, dateTime->month, mBuf);
120 } /* end of cmPkDateTime */
127 * Desc: This function packs the Duration structure
139 Duration *duration, /* duration */
140 Buffer *mBuf /* message buffer */
144 CMCHKPK(oduUnpackUInt8, duration->tenths, mBuf);
145 CMCHKPK(oduUnpackUInt8, duration->secs, mBuf);
146 CMCHKPK(oduUnpackUInt8, duration->mins, mBuf);
147 CMCHKPK(oduUnpackUInt8, duration->hours, mBuf);
148 CMCHKPK(oduUnpackUInt8, duration->days, mBuf);
151 } /* end of cmPkDuration */
155 * Fun: oduPackPointer
157 * Desc: This function packs the pointer
169 PTR ptr, /* pointer */
170 Buffer *mBuf /* message buffer */
173 Data pkArray[PTRSIZE]; /* array for packing */
174 S16 ret; /* return code */
175 uint16_t tmp; /* temporary value */
177 #if (defined(ALPHA) || defined(BIT_64))
186 #ifndef FCSPKINT /* backward compatibility, packing order */
187 pkArray[0] = (Data) GetHiByte(ptr);
188 pkArray[1] = (Data) GetLoByte(ptr);
189 #else /* forward compatibility, packing order */
190 pkArray[1] = (Data) GetHiByte(ptr);
191 pkArray[0] = (Data) GetLoByte(ptr);
193 ret = SAddPreMsgMult(pkArray, (MsgLen) 2, mBuf);
197 #ifndef FCSPKINT /* backward compatibility, packing order */
198 tmp = (uint16_t) GetHiWord(ptr);
199 pkArray[0] = (Data) GetHiByte(tmp);
200 pkArray[1] = (Data) GetLoByte(tmp);
201 tmp = (uint16_t) GetLoWord(ptr);
202 pkArray[2] = (Data) GetHiByte(tmp);
203 pkArray[3] = (Data) GetLoByte(tmp);
204 #else /* forward compatibility, packing order */
205 tmp = (uint16_t) GetHiWord(ptr);
206 pkArray[3] = (Data) GetHiByte(tmp);
207 pkArray[2] = (Data) GetLoByte(tmp);
208 tmp = (uint16_t) GetLoWord(ptr);
209 pkArray[1] = (Data) GetHiByte(tmp);
210 pkArray[0] = (Data) GetLoByte(tmp);
212 ret = SAddPreMsgMult(pkArray, (MsgLen) 4, mBuf);
216 #if (defined(ALPHA) || defined(BIT_64))
217 #ifndef FCSPKINT /* backward compatibility, packing order */
218 tmp32 = (uint32_t) GetHi32Bit(ptr);
219 tmp = (uint16_t) GetHiWord(tmp32);
220 pkArray[0] = (Data) GetHiByte(tmp);
221 pkArray[1] = (Data) GetLoByte(tmp);
222 tmp = (uint16_t) GetLoWord(tmp32);
223 pkArray[2] = (Data) GetHiByte(tmp);
224 pkArray[3] = (Data) GetLoByte(tmp);
225 tmp32 = (uint32_t) GetLo32Bit(ptr);
226 tmp = (uint16_t) GetHiWord(tmp32);
227 pkArray[4] = (Data) GetHiByte(tmp);
228 pkArray[5] = (Data) GetLoByte(tmp);
229 tmp = (uint16_t) GetLoWord(tmp32);
230 pkArray[6] = (Data) GetHiByte(tmp);
231 pkArray[7] = (Data) GetLoByte(tmp);
232 #else /* forward compatibility, packing order */
233 tmp32 = (uint32_t) GetHi32Bit(ptr);
234 tmp = (uint16_t) GetHiWord(tmp32);
235 pkArray[7] = (Data) GetHiByte(tmp);
236 pkArray[6] = (Data) GetLoByte(tmp);
237 tmp = (uint16_t) GetLoWord(tmp32);
238 pkArray[5] = (Data) GetHiByte(tmp);
239 pkArray[4] = (Data) GetLoByte(tmp);
240 tmp32 = (uint32_t) GetLo32Bit(ptr);
241 tmp = (uint16_t) GetHiWord(tmp32);
242 pkArray[3] = (Data) GetHiByte(tmp);
243 pkArray[2] = (Data) GetLoByte(tmp);
244 tmp = (uint16_t) GetLoWord(tmp32);
245 pkArray[1] = (Data) GetHiByte(tmp);
246 pkArray[0] = (Data) GetLoByte(tmp);
248 ret = SAddPreMsgMult(pkArray, (MsgLen) 8, mBuf);
252 /* no support for uint64_t */
257 } /* end of oduPackPointer */
264 * Desc: This function packs the EntityId structure
276 EntityId *entityId, /* entity id */
277 Buffer *mBuf /* message buffer */
281 CMCHKPK(cmPkInst, entityId->inst, mBuf);
282 CMCHKPK(cmPkEnt, entityId->ent, mBuf);
285 } /* end of cmPkEntityId */
292 * Desc: This function packs the ElmntId structure
304 ElmntId *elmntId, /* element id */
305 Buffer *mBuf /* message buffer */
309 CMCHKPK(cmPkElmntInst3, elmntId->elmntInst3, mBuf);
310 CMCHKPK(cmPkElmntInst2, elmntId->elmntInst2, mBuf);
311 CMCHKPK(cmPkElmntInst1, elmntId->elmntInst1, mBuf);
312 CMCHKPK(cmPkElmnt, elmntId->elmnt, mBuf);
315 } /* end of cmPkElmntId */
322 * Desc: This function packs the MemoryId structure
334 MemoryId *memoryId, /* memoryId */
335 Buffer *mBuf /* message buffer */
339 CMCHKPK(cmPkPool, memoryId->pool, mBuf);
340 CMCHKPK(cmPkRegion, memoryId->region, mBuf);
343 } /* end of cmPkMemoryId */
350 * Desc: This function packs the System Id structure
362 SystemId *systemId, /* system id */
363 Buffer *mBuf /* message buffer */
366 Txt *p; /* part number string */
369 for (p = systemId->ptNmb; *p; p++);
371 for (; p != systemId->ptNmb; p--)
373 CMCHKPK(cmPkTxt, *p, mBuf);
375 CMCHKPK(cmPkTxt, *p, mBuf);
377 CMCHKPK(SPkS16, systemId->bRev, mBuf);
378 CMCHKPK(SPkS16, systemId->bVer, mBuf);
379 CMCHKPK(SPkS16, systemId->mRev, mBuf);
380 CMCHKPK(SPkS16, systemId->mVer, mBuf);
383 } /* end of cmPkSystemId */
391 * Desc: This function will pack protocol address.
393 * Ret: ROK on success
404 ProtAddr *pAddr, /* protocol address */
405 Buffer *mBuf /* buffer */
408 uint8_t j; /* Index */
412 CMCHKPK(oduUnpackUInt32, pAddr->autoSysId, mBuf);
413 CMCHKPK(oduPackBool, pAddr->autoSysIdPres, mBuf);
416 for (j = pAddr->len; j; j--)
417 CMCHKPK(oduUnpackUInt8, pAddr->address[j - 1], mBuf);
419 CMCHKPK(oduUnpackUInt8, pAddr->preLen, mBuf);
420 CMCHKPK(oduUnpackUInt8, pAddr->len, mBuf);
421 CMCHKPK(oduUnpackUInt16, pAddr->protType, mBuf);
425 } /* end of cmPkProtAddr */
431 * Fun: cmPkProtAddrTbl
433 * Desc: This function will pack protocol addresses.
435 * Ret: ROK on success
446 ProtAddrTbl *protAddr, /* protocol address table */
447 Buffer *mBuf /* buffer */
450 uint8_t i; /* index */
451 uint8_t j; /* Index */
452 ProtAddr *pAddr; /* protocol Address */
455 if (protAddr->count > MAX_PROT_ADDRS)
458 for (i = protAddr->count; i; i--)
460 pAddr = &(protAddr->addr[i - 1]);
463 CMCHKPK(oduUnpackUInt32, pAddr->autoSysId, mBuf);
464 CMCHKPK(oduPackBool, pAddr->autoSysIdPres, mBuf);
467 for (j = pAddr->len; j; j--)
468 CMCHKPK(oduUnpackUInt8, pAddr->address[j - 1], mBuf);
470 CMCHKPK(oduUnpackUInt8, pAddr->preLen, mBuf);
471 CMCHKPK(oduUnpackUInt8, pAddr->len, mBuf);
472 CMCHKPK(oduUnpackUInt16, pAddr->protType, mBuf);
475 CMCHKPK(oduUnpackUInt8, protAddr->count, mBuf);
478 } /* end of cmPkProtAddrTbl */
485 * Desc: This function packs the address structure for a loosely
498 Addrs *addrs, /* address */
499 Buffer *mBuf /* message buffer */
502 uint8_t i; /* loop counter */
505 if (addrs->length > ADRLEN)
508 for (i = addrs->length; i; i--)
510 CMCHKPK(oduUnpackUInt8, addrs->strg[i-1], mBuf);
513 CMCHKPK(oduUnpackUInt8, addrs->length, mBuf);
516 } /* end of cmPkAddrs */
523 * Desc: This function packs the short address structure for a loosely
536 ShrtAddrs *addrs, /* address */
537 Buffer *mBuf /* message buffer */
540 uint8_t i; /* loop counter */
543 if (addrs->length > SHRTADRLEN)
546 for (i = addrs->length; i; i--)
548 CMCHKPK(oduUnpackUInt8, addrs->strg[i-1], mBuf);
551 CMCHKPK(oduUnpackUInt8, addrs->length, mBuf);
554 } /* end of cmPkShrtAddrs */
561 * Desc: This function address mask array.
573 uint8_t *mask, /* pointer to address mask array */
574 Buffer *mBuf /* message buffer */
580 /* pack address mask */
581 for (i = (ADRLEN - 1); i >= 0; i--)
583 CMCHKPK(oduUnpackUInt8, mask[i], mBuf);
587 } /* end of cmPkAddrMask */
594 * Desc: This function packs the BndCfg structure
606 BndCfg *bndCfg, /* bndCfg */
607 Buffer *mBuf /* message buffer */
610 Txt *p; /* temporary */
613 CMCHKPK(cmPkSelector, bndCfg->selector, mBuf);
614 CMCHKPK(cmPkAddrs, &bndCfg->sapAdr, mBuf);
615 CMCHKPK(cmPkRoute, bndCfg->route, mBuf);
616 CMCHKPK(cmPkPrior, bndCfg->prior, mBuf);
617 CMCHKPK(cmPkPool, bndCfg->pool, mBuf);
618 CMCHKPK(cmPkRegion, bndCfg->region, mBuf);
619 CMCHKPK(cmPkInst, bndCfg->inst, mBuf);
620 CMCHKPK(cmPkEnt, bndCfg->ent, mBuf);
621 CMCHKPK(oduUnpackUInt8, bndCfg->wdw, mBuf);
622 CMCHKPK(oduUnpackUInt8, bndCfg->flcTyp, mBuf);
623 CMCHKPK(oduUnpackUInt8, bndCfg->bufOwnshp, mBuf);
625 for (p = bndCfg->usrId; *p; p++);
626 for (; p != bndCfg->usrId; p--);
627 CMCHKPK(cmPkTxt, *p, mBuf);
630 } /* end of cmPkBndCfg */
637 * Desc: pack post structure
653 CMCHKPK(cmPkEvent, pst->event, mBuf);
654 CMCHKPK(cmPkInst, pst->srcInst, mBuf);
655 CMCHKPK(cmPkEnt, pst->srcEnt, mBuf);
656 CMCHKPK(cmPkProcId, pst->srcProcId, mBuf);
657 CMCHKPK(cmPkInst, pst->dstInst, mBuf);
658 CMCHKPK(cmPkEnt, pst->dstEnt, mBuf);
659 CMCHKPK(cmPkProcId, pst->dstProcId, mBuf);
660 CMCHKPK(cmPkRoute, pst->route, mBuf);
661 CMCHKPK(cmPkPrior, pst->prior, mBuf);
662 CMCHKPK(cmPkPool, pst->pool, mBuf);
663 CMCHKPK(cmPkRegion, pst->region, mBuf);
664 CMCHKPK(cmPkSelector, pst->selector, mBuf);
665 #ifdef TDS_ROLL_UPGRADE_SUPPORT
666 CMCHKPK(cmPkIntfVer, pst->intfVer, mBuf);
670 } /* end of cmPkPst */
676 * Desc: Pack element header
688 ElmtHdr *m, /* element header */
689 Buffer *mBuf /* message buffer */
693 #if (LCAMT || ATM_BISUP)
694 CMCHKPK(oduUnpackUInt16, m->compInd, mBuf);
695 #endif /* LCAMT || ATM_BISUP */
697 #if (LCAMT || ATM_BISUP)
698 /* Pack action indicator field */
701 CMCHKPK(oduUnpackUInt8, m->actnInd, mBuf);
706 CMCHKPK(oduPackBool, m->pres, mBuf);
709 } /* end of cmPkElmtHdr */
716 * Desc: This function packs a token uint8_t
728 TknUInt8 *tknUInt8, /* token uint8_t */
729 Buffer *mBuf /* message buffer */
736 CMCHKPK(oduUnpackUInt8, tknUInt8->val, mBuf);
740 CMCHKPK(oduUnpackUInt8, tknUInt8->pres, mBuf);
743 } /* end of cmPkTknUInt8 */
750 * Desc: This function packs a token S8
762 TknS8 *tknS8, /* token S8 */
763 Buffer *mBuf /* message buffer */
770 CMCHKPK(SPkS8, tknS8->val, mBuf);
774 CMCHKPK(oduUnpackUInt8, tknS8->pres, mBuf);
777 } /* end of cmPkTknS8 */
784 * Desc: This function packs a token uint16_t
796 TknUInt16 *tknUInt16, /* token uint16_t */
797 Buffer *mBuf /* message buffer */
804 CMCHKPK(oduUnpackUInt16, tknUInt16->val, mBuf);
808 CMCHKPK(oduUnpackUInt8, tknUInt16->pres, mBuf);
811 } /* end of cmPkTknUInt16 */
818 * Desc: This function packs a token uint32_t
830 TknUInt32 *tknUInt32, /* token uint32_t */
831 Buffer *mBuf /* message buffer */
838 CMCHKPK(oduUnpackUInt32, tknUInt32->val, mBuf);
842 CMCHKPK(oduUnpackUInt8, tknUInt32->pres, mBuf);
845 } /* end of cmPkTknUInt32 */
852 * Desc: This function packs a token string - regular size
864 TknStr *tknStr, /* token string */
865 Buffer *mBuf /* message buffer */
868 Cntr i; /* counter */
874 for (i = 0; i < (S16) tknStr->len; i++)
876 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
880 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
884 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
887 } /* end of cmPkTknStr */
894 * Desc: This function packs a token string - medium size
906 TknStrM *tknStr, /* token string */
907 Buffer *mBuf /* message buffer */
910 Cntr i; /* counter */
916 for (i = 0; i < (S16) tknStr->len; i++)
918 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
922 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
926 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
929 } /* end of cmPkTknStrM */
936 * Desc: This function packs a token string - small size
948 TknStrS *tknStr, /* token string */
949 Buffer *mBuf /* message buffer */
952 Cntr i; /* counter */
958 for (i = 0; i < (S16) tknStr->len; i++)
960 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
964 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
968 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
971 } /* end of cmPkTknStrS */
978 * Desc: This function packs a token string - extended size
990 TknStrE *tknStr, /* token string */
991 Buffer *mBuf /* message buffer */
994 Cntr i; /* counter */
1000 for (i = 0; i < (S16) tknStr->len; i++)
1002 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
1006 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
1010 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
1013 } /* end of cmPkTknStrE */
1015 #ifndef CMFILE_REORG_1
1022 * Desc: This function packs a PnNodeId structure into a buffer
1034 PnNodeId *src, /* source PNNI Node Id */
1035 Buffer *mBuf /* message buffer */
1041 for (i = PN_NODEID_LEN - 1; i >= 0; i--)
1043 CMCHKPK(oduUnpackUInt8, src->id[i], mBuf);
1047 } /* cmPkPnNodeId */
1049 #endif /* CMFILE_REORG_1 */
1056 * Desc: This function packs a token string of size 4
1068 TknStr4 *tknStr, /* token string */
1069 Buffer *mBuf /* message buffer */
1073 CMPKTKNSTR(tknStr, mBuf);
1077 } /* end of cmPkTknStr4 */
1085 * Desc: This function packs a token string of size 4
1097 TknStr12 *tknStr, /* token string */
1098 Buffer *mBuf /* message buffer */
1102 CMPKTKNSTR(tknStr, mBuf);
1106 } /* end of cmPkTknStr12 */
1113 * Desc: This function packs a token string of size 4
1125 TknStr32 *tknStr, /* token string */
1126 Buffer *mBuf /* message buffer */
1130 CMPKTKNSTR(tknStr, mBuf);
1134 } /* end of cmPkTknStr32 */
1141 * Desc: This function packs a token string of size 4
1153 TknStr64 *tknStr, /* token string */
1154 Buffer *mBuf /* message buffer */
1158 CMPKTKNSTR(tknStr, mBuf);
1162 } /* end of cmPkTknStr64 */
1167 * Fun: cmPkTknStr132
1169 * Desc: This function packs a token string of size 4
1181 TknStr132 *tknStr, /* token string */
1182 Buffer *mBuf /* message buffer */
1186 CMPKTKNSTR(tknStr, mBuf);
1190 } /* end of cmPkTknStr132 */
1195 * Fun: cmPkTknStr256
1197 * Desc: This function packs a token string of size 4
1209 TknStr256 *tknStr, /* token string */
1210 Buffer *mBuf /* message buffer */
1214 CMPKTKNSTR(tknStr, mBuf);
1218 } /* end of cmPkTknStr256 */
1225 * Desc: This function packs a Object Identifier token
1237 TknOid *tknOid, /* Object Identifier token */
1238 Buffer *mBuf /* message buffer */
1244 if (tknOid->pres == TRUE)
1246 /* Pack the value */
1247 for (i = 0; i < (uint16_t)tknOid->len; i++)
1249 /* cm_gen_c_001.main_33: changes for TknOid value from uint16_t to uint32_t
1250 * with compilation flag TKNOID_UINT16 */
1251 #ifndef TKNOID_UINT16
1252 CMCHKPK(oduUnpackUInt32, tknOid->val[i], mBuf);
1254 CMCHKPK(oduUnpackUInt16, tknOid->val[i], mBuf);
1255 #endif /* !TKNOID_UINT16 */
1257 /* Pack the length */
1258 CMCHKPK(oduUnpackUInt8, tknOid->len, mBuf);
1260 /* Pack the token header */
1261 CMCHKPK(oduUnpackUInt8, tknOid->pres, mBuf);
1264 } /* end of cmPkTknOid */
1271 * Desc: This function packs a token S32
1283 TknS32 *tknS32, /* token S32 */
1284 Buffer *mBuf /* message buffer */
1291 CMCHKPK(SPkS32, tknS32->val, mBuf);
1295 CMCHKPK(oduUnpackUInt8, tknS32->pres, mBuf);
1298 } /* end of cmPkTknS32 */
1305 * Desc: This function packs the header structure
1317 Header *header, /* header */
1318 Buffer *mBuf /* message buffer */
1323 CMCHKPK(cmPkMemoryId, &header->response.mem, mBuf);
1324 CMCHKPK(cmPkRoute, header->response.route, mBuf);
1325 CMCHKPK(cmPkPriority, header->response.prior, mBuf);
1326 CMCHKPK(cmPkSelector, header->response.selector, mBuf);
1327 CMCHKPK(cmPkTranId, header->transId, mBuf);
1329 CMCHKPK(cmPkElmntId, &header->elmId, mBuf);
1330 CMCHKPK(cmPkEntityId, &header->entId, mBuf);
1331 CMCHKPK(oduUnpackUInt16, header->seqNmb, mBuf);
1332 CMCHKPK(oduUnpackUInt8, header->version, mBuf);
1333 CMCHKPK(oduUnpackUInt8, header->msgType, mBuf);
1334 CMCHKPK(oduUnpackUInt16, header->msgLen, mBuf);
1337 } /* end of cmPkHeader */
1344 * Desc: This function packs common management status structure
1356 CmStatus *sta, /* status structure */
1357 Buffer *mBuf /* message buffer */
1361 CMCHKPK(oduUnpackUInt16, sta->reason, mBuf);
1362 CMCHKPK(oduUnpackUInt16, sta->status, mBuf);
1365 } /* end of cmPkCmStatus */
1372 * Desc: This function packs common management alarm structure
1384 CmAlarm *alarm, /* alarm structure */
1385 Buffer *mBuf /* message buffer */
1389 CMCHKPK(oduUnpackUInt16, alarm->cause, mBuf);
1390 CMCHKPK(oduUnpackUInt16, alarm->event, mBuf);
1391 CMCHKPK(oduUnpackUInt16, alarm->category, mBuf);
1392 CMCHKPK(cmPkDateTime, &alarm->dt, mBuf);
1395 } /* end of cmPkCmAlarm */
1402 * Desc: This function packs the stack manager structure
1414 SmCfg *smCfg, /* stack manager */
1415 Buffer *mBuf /* message buffer */
1419 CMCHKPK(cmPkSelector, smCfg->selector, mBuf);
1420 CMCHKPK(cmPkRoute, smCfg->route, mBuf);
1421 CMCHKPK(cmPkPrior, smCfg->prior, mBuf);
1422 CMCHKPK(cmPkPool, smCfg->pool, mBuf);
1423 CMCHKPK(cmPkRegion, smCfg->region, mBuf);
1424 CMCHKPK(cmPkInst, smCfg->inst, mBuf);
1425 CMCHKPK(cmPkEnt, smCfg->ent, mBuf);
1428 } /* end of cmPkSmCfg */
1435 * Desc: This function packs the timer configuration structure
1447 TmrCfg *tmrCfg, /* timer configuration */
1448 Buffer *mBuf /* message buffer */
1452 CMCHKPK(oduUnpackUInt16, tmrCfg->val, mBuf);
1453 CMCHKPK(oduPackBool, tmrCfg->enb, mBuf);
1456 } /* end of cmPkTmrCfg */
1463 * Desc: This function packs a token buffer
1475 TknBuf *tknBuf, /* token string */
1476 Buffer *mBuf /* message buffer */
1484 SFndLenMsg(tknBuf->val, &msgLen);
1485 if( SCatMsg(mBuf, tknBuf->val, M2M1) != ROK )
1489 cmPkMsgLen(msgLen, mBuf);
1490 SPutMsg(tknBuf->val);
1494 CMCHKPK(oduUnpackUInt8, tknBuf->pres, mBuf);
1497 } /* end of cmPkTknBuf */
1499 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1504 * Desc: This function packs the interface information
1516 CmIntf *intf, /* interface info */
1517 Buffer *mBuf /* message buffer */
1521 CMCHKPK(cmPkIntfId, intf->intfId, mBuf);
1522 CMCHKPK(cmPkIntfVer, intf->intfVer, mBuf);
1525 } /* end of cmPkIntf */
1526 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
1530 * common unpacking functions
1536 * Fun: cmUnpkDateTime
1538 * Desc: This function is used to Unpack Pack Date Time structure
1550 DateTime *dateTime, /* date/time structure */
1551 Buffer *mBuf /* message buffer */
1555 CMCHKUNPK(oduPackUInt8, &dateTime->month, mBuf);
1556 CMCHKUNPK(oduPackUInt8, &dateTime->day, mBuf);
1557 CMCHKUNPK(oduPackUInt8, &dateTime->year, mBuf);
1558 CMCHKUNPK(oduPackUInt8, &dateTime->hour, mBuf);
1559 CMCHKUNPK(oduPackUInt8, &dateTime->min, mBuf);
1560 CMCHKUNPK(oduPackUInt8, &dateTime->sec, mBuf);
1561 CMCHKUNPK(oduPackUInt8, &dateTime->tenths, mBuf);
1563 /*-- added for micro seconds --*/
1564 #ifdef SS_DATETIME_USEC
1565 CMCHKUNPK(oduPackUInt32, &dateTime->usec, mBuf);
1566 #endif /*-- SS_DATETIME_USEC --*/
1569 } /* end of cmUnpkDateTime */
1574 * Fun: cmUnpkDuration
1576 * Desc: This function is used to Unpack Pack Duration structure
1588 Duration *duration, /* duration structure */
1589 Buffer *mBuf /* message buffer */
1593 CMCHKUNPK(oduPackUInt8, &duration->days, mBuf);
1594 CMCHKUNPK(oduPackUInt8, &duration->hours, mBuf);
1595 CMCHKUNPK(oduPackUInt8, &duration->mins, mBuf);
1596 CMCHKUNPK(oduPackUInt8, &duration->secs, mBuf);
1597 CMCHKUNPK(oduPackUInt8, &duration->tenths, mBuf);
1600 } /* end of cmUnpkDuration */
1604 * Fun: oduUnpackPointer
1606 * Desc: This function is used to Unpack Ptr type
1616 S16 oduUnpackPointer
1618 PTR *ptr, /* duration structure */
1619 Buffer *mBuf /* message buffer */
1622 uint16_t tmp16 =0; /* temporary value */
1623 uint32_t tmp32 =0; /* temporary value */
1624 Data unpkArray[PTRSIZE]; /* unpacking array */
1625 S16 ret =ROK; /* return code */
1627 #if (defined(ALPHA) || defined(BIT_64))
1635 ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
1640 #ifndef FCSPKINT /* backward compatibility, packing order */
1641 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1642 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1643 #else /* forward compatibility, packing order */
1644 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1645 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1651 ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
1657 #ifndef FCSPKINT /* backward compatibility, packing order */
1658 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
1659 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
1660 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1661 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1662 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1663 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1664 #else /* forward compatibility, packing order */
1665 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1666 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1667 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1668 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
1669 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
1670 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1676 #if(defined(ALPHA) || defined(BIT_64))
1677 ret = SRemPreMsgMult(unpkArray, (MsgLen) 8, mBuf);
1684 #ifndef FCSPKINT /* backward compatibility, packing order */
1685 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[7]);
1686 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[6]);
1687 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1688 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[5]);
1689 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[4]);
1690 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1691 tmp64 = (uint64_t) PutHi32Bit(tmp64, tmp32);
1692 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
1693 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
1694 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1695 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1696 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1697 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1698 tmp64 = (uint64_t) PutLo32Bit(tmp64, tmp32);
1699 #else /* forward compatibility, packing order */
1700 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1701 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1702 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1703 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
1704 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
1705 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1706 tmp64 = (uint64_t) PutHi32Bit(tmp64, tmp32);
1707 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[4]);
1708 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[5]);
1709 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1710 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[6]);
1711 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[7]);
1712 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1713 tmp64 = (uint64_t) PutLo32Bit(tmp64, tmp32);
1719 /* no support for uint64_t */
1724 } /* end of oduUnpackPointer */
1729 * Fun: cmUnpkEntityId
1731 * Desc: This function unpacks the EntityId structure
1743 EntityId *entityId, /* entity id */
1744 Buffer *mBuf /* message buffer */
1748 CMCHKUNPK(cmUnpkEnt, &entityId->ent, mBuf);
1749 CMCHKUNPK(cmUnpkInst, &entityId->inst, mBuf);
1752 } /* end of cmUnpkEntityId */
1757 * Fun: cmUnpkElmntId
1759 * Desc: This function unpacks the ElmntId structure
1771 ElmntId *elmntId, /* element id */
1772 Buffer *mBuf /* message buffer */
1776 CMCHKUNPK(cmUnpkElmnt, &elmntId->elmnt, mBuf);
1777 CMCHKUNPK(cmUnpkElmntInst1, &elmntId->elmntInst1, mBuf);
1778 CMCHKUNPK(cmUnpkElmntInst2, &elmntId->elmntInst2, mBuf);
1779 CMCHKUNPK(cmUnpkElmntInst3, &elmntId->elmntInst3, mBuf);
1782 } /* end of cmUnpkElmntId */
1787 * Fun: cmUnpkMemoryId
1789 * Desc: This function unpacks the MemoryId structure
1801 MemoryId *memoryId, /* memoryId */
1802 Buffer *mBuf /* message buffer */
1806 CMCHKUNPK(cmUnpkRegion, &memoryId->region, mBuf);
1807 CMCHKUNPK(cmUnpkPool, &memoryId->pool, mBuf);
1810 } /* end of cmUnpkMemoryId */
1815 * Fun: cmUnpkSystemId
1817 * Desc: This function packs the System Id structure
1829 SystemId *systemId, /* system id */
1830 Buffer *mBuf /* message buffer */
1833 S16 i; /* loop counter */
1837 CMCHKUNPK(SUnpkS16, &systemId->mVer, mBuf);
1838 CMCHKUNPK(SUnpkS16, &systemId->mRev, mBuf);
1839 CMCHKUNPK(SUnpkS16, &systemId->bVer, mBuf);
1840 CMCHKUNPK(SUnpkS16, &systemId->bRev, mBuf);
1842 SFndLenMsg(mBuf, &len);
1844 for (i = 0; i < len; i++)
1846 CMCHKUNPK(cmUnpkTxt, &systemId->ptNmb[i], mBuf);
1850 } /* end of cmUnpkSystemId */
1856 * Fun: cmUnpkProtAddr
1858 * Desc: This function will unpack protocol address.
1860 * Ret: ROK on success
1871 ProtAddr *pAddr, /* protocol address */
1872 Buffer *mBuf /* buffer */
1875 uint8_t j; /* Index */
1878 CMCHKUNPK(oduPackUInt16, &(pAddr->protType), mBuf);
1879 CMCHKUNPK(oduPackUInt8, &(pAddr->len), mBuf);
1880 CMCHKUNPK(oduPackUInt8, &(pAddr->preLen), mBuf);
1882 for (j =0; j < pAddr->len; j++)
1883 CMCHKUNPK(oduPackUInt8, &pAddr->address[j], mBuf);
1886 CMCHKUNPK(oduUnpackBool, &(pAddr->autoSysIdPres), mBuf);
1887 CMCHKUNPK(oduPackUInt32, &(pAddr->autoSysId), mBuf);
1888 #endif /* CM_ARI2 */
1891 } /* end of cmUnpkProtAddr */
1896 * Fun: cmUnpkProtAddrTbl
1898 * Desc: This function will pack protocol addresses.
1900 * Ret: ROK on success
1909 S16 cmUnpkProtAddrTbl
1911 ProtAddrTbl *protAddr, /* protocol address table */
1912 Buffer *mBuf /* buffer */
1915 uint8_t i; /* index */
1916 uint8_t j; /* Index */
1917 ProtAddr *pAddr; /* Protocol Address */
1920 CMCHKUNPK(oduPackUInt8, &protAddr->count, mBuf);
1921 for (i = 0; i < protAddr->count; i++)
1923 pAddr = &(protAddr->addr[i]);
1925 CMCHKUNPK(oduPackUInt16, &(pAddr->protType), mBuf);
1926 CMCHKUNPK(oduPackUInt8, &(pAddr->len), mBuf);
1927 CMCHKUNPK(oduPackUInt8, &(pAddr->preLen), mBuf);
1930 for (j =0; j < pAddr->len; j++)
1931 CMCHKUNPK(oduPackUInt8, &pAddr->address[j], mBuf);
1934 CMCHKUNPK(oduUnpackBool, &(pAddr->autoSysIdPres), mBuf);
1935 CMCHKUNPK(oduPackUInt32, &(pAddr->autoSysId), mBuf);
1936 #endif /* CM_ARI2 */
1939 } /* end of cmUnpkProtAddrTbl */
1946 * Desc: This function is used to unpack the Addrs structure
1958 Addrs *addrs, /* address */
1959 Buffer *mBuf /* message buffer */
1962 uint8_t i; /* loop counter */
1965 CMCHKUNPK(oduPackUInt8, &addrs->length, mBuf);
1967 if (addrs->length > ADRLEN)
1970 for(i = 0; i < addrs->length; i++)
1972 CMCHKUNPK(oduPackUInt8, &addrs->strg[i], mBuf);
1976 } /* end of cmUnpkAddrs */
1980 * Fun: cmUnpkShrtAddrs
1982 * Desc: This function is used to unpack the ShrtAddrs structure
1994 ShrtAddrs *addrs, /* address */
1995 Buffer *mBuf /* message buffer */
1998 uint8_t i; /* loop counter */
2001 CMCHKUNPK(oduPackUInt8, &addrs->length, mBuf);
2003 if (addrs->length > SHRTADRLEN)
2006 for(i = 0; i < addrs->length; i++)
2008 CMCHKUNPK(oduPackUInt8, &addrs->strg[i], mBuf);
2011 } /* end of cmUnpkShrtAddrs */
2016 * Fun: cmUnpkAddrMask
2018 * Desc: This unpacks address mask.
2030 uint8_t *mask, /* pointer to address mask */
2031 Buffer *mBuf /* message buffer */
2034 S16 i; /* counter */
2037 /* unpack address mask */
2038 for (i = 0; i< ADRLEN; i++)
2040 CMCHKUNPK(oduPackUInt8, &mask[i], mBuf);
2043 } /* end of cmUnpkAddrMask */
2050 * Desc: This function unpacks the BndCfg structure
2062 BndCfg *bndCfg, /* bndCfg */
2063 Buffer *mBuf /* message buffer */
2066 S16 i; /* loop counter */
2069 for (i = 0; bndCfg->usrId[i]; i++);
2070 CMCHKUNPK(cmUnpkTxt, bndCfg->usrId+i, mBuf);
2072 CMCHKUNPK(oduPackUInt8, &bndCfg->bufOwnshp, mBuf);
2073 CMCHKUNPK(oduPackUInt8, &bndCfg->flcTyp, mBuf);
2074 CMCHKUNPK(oduPackUInt8, &bndCfg->wdw, mBuf);
2075 CMCHKUNPK(cmUnpkEnt, &bndCfg->ent, mBuf);
2076 CMCHKUNPK(cmUnpkInst, &bndCfg->inst, mBuf);
2077 CMCHKUNPK(cmUnpkRegion, &bndCfg->region, mBuf);
2078 CMCHKUNPK(cmUnpkPool, &bndCfg->pool, mBuf);
2079 CMCHKUNPK(cmUnpkPrior, &bndCfg->prior, mBuf);
2080 CMCHKUNPK(cmUnpkRoute, &bndCfg->route, mBuf);
2081 CMCHKUNPK(cmUnpkAddrs, &bndCfg->sapAdr, mBuf);
2082 CMCHKUNPK(cmUnpkSelector, &bndCfg->selector, mBuf);
2085 } /* end of cmUnpkBndCfg */
2092 * Desc: pack post structure
2108 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2109 CMCHKUNPK(cmUnpkIntfVer, &pst->intfVer, mBuf);
2111 CMCHKUNPK(cmUnpkSelector, &pst->selector, mBuf);
2112 CMCHKUNPK(cmUnpkRegion, &pst->region, mBuf);
2113 CMCHKUNPK(cmUnpkPool, &pst->pool, mBuf);
2114 CMCHKUNPK(cmUnpkPrior, &pst->prior, mBuf);
2115 CMCHKUNPK(cmUnpkRoute, &pst->route, mBuf);
2116 CMCHKUNPK(cmUnpkProcId, &pst->dstProcId, mBuf);
2117 CMCHKUNPK(cmUnpkEnt, &pst->dstEnt, mBuf);
2118 CMCHKUNPK(cmUnpkInst, &pst->dstInst, mBuf);
2119 CMCHKUNPK(cmUnpkProcId, &pst->srcProcId, mBuf);
2120 CMCHKUNPK(cmUnpkEnt, &pst->srcEnt, mBuf);
2121 CMCHKUNPK(cmUnpkInst, &pst->srcInst, mBuf);
2122 CMCHKUNPK(cmUnpkEvent, &pst->event, mBuf);
2125 } /* end of cmUnpkPst */
2129 * Fun: cmUnpkElmtHdr
2131 * Desc: Unpack element header
2143 ElmtHdr *m, /* element header */
2144 Buffer *mBuf /* message buffer */
2149 CMCHKUNPK(oduUnpackBool, &m->pres , mBuf);
2151 #if (LCAMT || ATM_BISUP)
2152 /* Unpack action indicator field */
2155 CMCHKUNPK(oduPackUInt8, &m->actnInd, mBuf);
2159 #if (LCAMT || ATM_BISUP)
2160 CMCHKUNPK(oduPackUInt16, &m->compInd, mBuf);
2161 #endif /* LCAMT || ATM_BISUP */
2164 } /* end of cmUnpkElmtHdr */
2169 * Fun: cmUnpkTknUInt8
2171 * Desc: This function unpacks a token uint8_t
2183 TknUInt8 *tknUInt8, /* token uint8_t */
2184 Buffer *mBuf /* message buffer */
2189 CMCHKUNPK(oduPackUInt8, &tknUInt8->pres, mBuf);
2194 CMCHKUNPK(oduPackUInt8, &tknUInt8->val, mBuf);
2198 } /* end of cmUnpkTknUInt8 */
2205 * Desc: This function unpacks a token S8
2217 TknS8 *tknS8, /* token S8 */
2218 Buffer *mBuf /* message buffer */
2223 CMCHKUNPK(oduPackUInt8, &tknS8->pres, mBuf);
2228 CMCHKUNPK(SUnpkS8, &tknS8->val, mBuf);
2232 } /* end of cmUnpkTknS8 */
2237 * Fun: cmUnpkTknUInt16
2239 * Desc: This function unpacks a token uint16_t
2251 TknUInt16 *tknUInt16, /* token uint16_t */
2252 Buffer *mBuf /* message buffer */
2257 CMCHKUNPK(oduPackUInt8, &tknUInt16->pres, mBuf);
2259 if (tknUInt16->pres)
2262 CMCHKUNPK(oduPackUInt16, &tknUInt16->val, mBuf);
2266 } /* end of cmUnpkTknUInt16 */
2271 * Fun: cmUnpkTknUInt32
2273 * Desc: This function unpacks a token uint32_t
2285 TknUInt32 *tknUInt32, /* token uint32_t */
2286 Buffer *mBuf /* message buffer */
2291 CMCHKUNPK(oduPackUInt8, &tknUInt32->pres, mBuf);
2293 if (tknUInt32->pres)
2296 CMCHKUNPK(oduPackUInt32, &tknUInt32->val, mBuf);
2300 } /* end of cmUnpkTknUInt32 */
2306 * Desc: This function unpacks a token string - regular size
2318 TknStr *tknStr, /* token string */
2319 Buffer *mBuf /* message buffer */
2322 Cntr i; /* counter */
2326 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2331 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2334 for (i = (tknStr->len - 1); i >= 0; i--)
2336 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2343 } /* end of cmUnpkTknStr */
2347 * Fun: cmUnpkTknStrM
2349 * Desc: This function unpacks a token string - medium size
2361 TknStrM *tknStr, /* token string */
2362 Buffer *mBuf /* message buffer */
2365 Cntr i; /* counter */
2369 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2374 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2377 for (i = (tknStr->len - 1); i >= 0; i--)
2379 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2386 } /* end of cmUnpkTknStrM */
2391 * Fun: cmUnpkTknStrS
2393 * Desc: This function unpacks a token string - small size
2405 TknStrS *tknStr, /* token string */
2406 Buffer *mBuf /* message buffer */
2409 Cntr i; /* counter */
2413 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2418 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2421 for (i = (tknStr->len - 1); i >= 0; i--)
2423 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2430 } /* end of cmUnpkTknStrS */
2435 * Fun: cmUnpkTknStrE
2437 * Desc: This function unpacks a token string - extended size
2449 TknStrE *tknStr, /* token string */
2450 Buffer *mBuf /* message buffer */
2453 Cntr i; /* counter */
2457 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2462 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2465 for (i = (tknStr->len - 1); i >= 0; i--)
2467 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2474 } /* end of cmUnpkTknStrE */
2476 #ifndef CMFILE_REORG_1
2481 * Fun: cmUnpkPnNodeId
2483 * Desc: This function unpacks a PnNodeId structure from a buffer
2495 PnNodeId *dst, /* source PNNI Node Id */
2496 Buffer *mBuf /* message buffer */
2502 for (i = 0; i < PN_NODEID_LEN; i++)
2504 CMCHKUNPK(oduPackUInt8, &dst->id[i], mBuf);
2508 } /* cmUnpkPnNodeId */
2510 #endif /* CMFILE_REORG_1 */
2515 * Fun: cmUnpkTknStr4
2517 * Desc: This function packs a token string of size 4
2529 TknStr4 *tknStr, /* token string */
2530 Buffer *mBuf /* message buffer */
2534 CMUNPKTKNSTR(tknStr, mBuf);
2538 } /* end of cmUnpkTknStr4 */
2544 * Fun: cmUnpkTknStr12
2546 * Desc: This function packs a token string of size 4
2558 TknStr12 *tknStr, /* token string */
2559 Buffer *mBuf /* message buffer */
2563 CMUNPKTKNSTR(tknStr, mBuf);
2567 } /* end of cmUnpkTknStr12 */
2572 * Fun: cmUnpkTknStr32
2574 * Desc: This function packs a token string of size 4
2586 TknStr32 *tknStr, /* token string */
2587 Buffer *mBuf /* message buffer */
2591 CMUNPKTKNSTR(tknStr, mBuf);
2595 } /* end of cmUnpkTknStr32 */
2600 * Fun: cmUnpkTknStr64
2602 * Desc: This function packs a token string of size 4
2614 TknStr64 *tknStr, /* token string */
2615 Buffer *mBuf /* message buffer */
2619 CMUNPKTKNSTR(tknStr, mBuf);
2623 } /* end of cmUnpkTknStr64 */
2628 * Fun: cmUnpkTknStr132
2630 * Desc: This function packs a token string of size 4
2642 TknStr132 *tknStr, /* token string */
2643 Buffer *mBuf /* message buffer */
2647 CMUNPKTKNSTR(tknStr, mBuf);
2651 } /* end of cmUnpkTknStr132 */
2656 * Fun: cmUnpkTknStr256
2658 * Desc: This function packs a token string of size 4
2670 TknStr256 *tknStr, /* token string */
2671 Buffer *mBuf /* message buffer */
2675 CMUNPKTKNSTR(tknStr, mBuf);
2679 } /* end of cmUnpkTknStr256 */
2686 * Desc: This function packs a Object Identifier token
2698 TknOid *tknOid, /* Object Identifier token */
2699 Buffer *mBuf /* message buffer */
2705 /* Unpack the token header */
2706 CMCHKUNPK(oduPackUInt8, &tknOid->pres, mBuf);
2708 if (tknOid->pres == TRUE)
2710 /* Unpack the length */
2711 CMCHKUNPK(oduPackUInt8, &tknOid->len, mBuf);
2713 /* Pack the value */
2714 for (i = 1; i <= (uint16_t)tknOid->len; i++)
2716 /* cm_gen_c_001.main_33: changes for TknOid value from uint16_t to uint32_t
2717 * with compilation flag TKNOID_UINT16 */
2718 #ifndef TKNOID_UINT16
2719 CMCHKUNPK(oduPackUInt32, &tknOid->val[tknOid->len - i], mBuf);
2721 CMCHKUNPK(oduPackUInt16, &tknOid->val[tknOid->len - i], mBuf);
2722 #endif /* !TKNOID_UINT16 */
2727 } /* end of cmUnpkTknOid */
2734 * Desc: This function unpacks a token S32
2746 TknS32 *tknS32, /* token S32 */
2747 Buffer *mBuf /* message buffer */
2752 CMCHKUNPK(oduPackUInt8, &tknS32->pres, mBuf);
2757 CMCHKUNPK(SUnpkS32, &tknS32->val, mBuf);
2761 } /* end of cmUnpkTknS32 */
2768 * Desc: This function is used to Unpack Header structure
2780 Header *header, /* header structure */
2781 Buffer *mBuf /* message buffer */
2785 CMCHKUNPK(oduPackUInt16, &header->msgLen, mBuf);
2786 CMCHKUNPK(oduPackUInt8, &header->msgType, mBuf);
2787 CMCHKUNPK(oduPackUInt8, &header->version, mBuf);
2788 CMCHKUNPK(oduPackUInt16, &header->seqNmb, mBuf);
2789 CMCHKUNPK(cmUnpkEntityId, &header->entId, mBuf);
2790 CMCHKUNPK(cmUnpkElmntId, &header->elmId, mBuf);
2792 CMCHKUNPK(cmUnpkTranId, &header->transId, mBuf);
2793 CMCHKUNPK(cmUnpkSelector, &header->response.selector, mBuf);
2794 CMCHKUNPK(cmUnpkPriority, &header->response.prior, mBuf);
2795 CMCHKUNPK(cmUnpkRoute, &header->response.route, mBuf);
2796 CMCHKUNPK(cmUnpkMemoryId, &header->response.mem, mBuf);
2800 } /* end of cmUnpkHeader */
2805 * Fun: cmUnpkCmStatus
2807 * Desc: This function unpacks common management status structure
2819 CmStatus *sta, /* status structure */
2820 Buffer *mBuf /* message buffer */
2824 CMCHKUNPK(oduPackUInt16, &sta->status, mBuf);
2825 CMCHKUNPK(oduPackUInt16, &sta->reason, mBuf);
2828 } /* end of cmUnpkCmStatus */
2833 * Fun: cmUnpkCmAlarm
2835 * Desc: This function unpacks common management alarm structure
2847 CmAlarm *alarm, /* alarm structure */
2848 Buffer *mBuf /* message buffer */
2852 CMCHKUNPK(cmUnpkDateTime, &alarm->dt, mBuf);
2853 CMCHKUNPK(oduPackUInt16, &alarm->category, mBuf);
2854 CMCHKUNPK(oduPackUInt16, &alarm->event, mBuf);
2855 CMCHKUNPK(oduPackUInt16, &alarm->cause, mBuf);
2858 } /* end of cmUnpkCmAlarm */
2865 * Desc: This function unpacks the stack manager structure
2877 SmCfg *smCfg, /* stack manager */
2878 Buffer *mBuf /* message buffer */
2882 CMCHKUNPK(cmUnpkEnt, &smCfg->ent, mBuf);
2883 CMCHKUNPK(cmUnpkInst, &smCfg->inst, mBuf);
2884 CMCHKUNPK(cmUnpkRegion, &smCfg->region, mBuf);
2885 CMCHKUNPK(cmUnpkPool, &smCfg->pool, mBuf);
2886 CMCHKUNPK(cmUnpkPrior, &smCfg->prior, mBuf);
2887 CMCHKUNPK(cmUnpkRoute, &smCfg->route, mBuf);
2888 CMCHKUNPK(cmUnpkSelector, &smCfg->selector, mBuf);
2891 } /* end of cmUnpkSmCfg */
2898 * Desc: This function unpacks the timer configuration structure
2910 TmrCfg *tmrCfg, /* timer configuration */
2911 Buffer *mBuf /* message buffer */
2915 CMCHKUNPK(oduUnpackBool, &tmrCfg->enb, mBuf);
2916 CMCHKUNPK(oduPackUInt16, &tmrCfg->val, mBuf);
2919 } /* end of cmUnpkTmrCfg */
2925 * Desc: This function unpacks a token buffer
2937 TknBuf *tknBuf, /* token string */
2938 Buffer **tBuf /* message buffer */
2948 CMCHKUNPK(oduPackUInt8, &tknBuf->pres, mBuf);
2952 MsgLen msgLen, buflen;
2953 Region region; /* region */
2954 Pool pool; /* pool */
2956 cmUnpkMsgLen(&msgLen, mBuf);
2957 SFndLenMsg(mBuf, &buflen);
2958 if (buflen > msgLen)
2960 if( SSegMsg(mBuf, msgLen, &tknBuf->val) != ROK )
2967 /* Allocate the buffer for tknbuf->val */
2968 SGetBufRegionPool(mBuf, ®ion, &pool);
2969 SGetMsg(region, pool, &(tknBuf->val));
2972 /* now Swap the two Buffer pointers */
2973 SSwapMsg(mBuf,tknBuf->val);
2980 } /* end of cmUnpkTknBuf */
2982 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2987 * Desc: This function unpacks the interface information
2999 CmIntf *intf, /* interface info */
3000 Buffer *mBuf /* message buffer */
3004 CMCHKUNPK(cmUnpkIntfVer, &intf->intfVer, mBuf);
3005 CMCHKUNPK(cmUnpkIntfId, &intf->intfId, mBuf);
3008 } /* end of cmUnpkIntf */
3009 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
3015 * Desc: This function return the transaction ID used for interface transactions
3022 uint16_t getTransId()
3024 gTransId = (gTransId%65535) + 1;
3027 /**********************************************************************
3029 **********************************************************************/