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
103 DateTime *dateTime, /* date and time */
104 Buffer *mBuf /* message buffer */
107 S16 cmPkDateTime(dateTime, mBuf)
108 DateTime *dateTime; /* date and time */
109 Buffer *mBuf; /* message buffer */
113 /*-- cm_gen_c_001.main_36 - added for micro seconds --*/
114 #ifdef SS_DATETIME_USEC
115 CMCHKPK(oduUnpackUInt32, dateTime->usec, mBuf);
116 #endif /*-- SS_DATETIME_USEC --*/
117 CMCHKPK(oduUnpackUInt8, dateTime->tenths, mBuf);
118 CMCHKPK(oduUnpackUInt8, dateTime->sec, mBuf);
119 CMCHKPK(oduUnpackUInt8, dateTime->min, mBuf);
120 CMCHKPK(oduUnpackUInt8, dateTime->hour, mBuf);
121 CMCHKPK(oduUnpackUInt8, dateTime->year, mBuf);
122 CMCHKPK(oduUnpackUInt8, dateTime->day, mBuf);
123 CMCHKPK(oduUnpackUInt8, dateTime->month, mBuf);
126 } /* end of cmPkDateTime */
133 * Desc: This function packs the Duration structure
146 Duration *duration, /* duration */
147 Buffer *mBuf /* message buffer */
150 S16 cmPkDuration(duration, mBuf)
151 Duration *duration; /* duration */
152 Buffer *mBuf; /* message buffer */
156 CMCHKPK(oduUnpackUInt8, duration->tenths, mBuf);
157 CMCHKPK(oduUnpackUInt8, duration->secs, mBuf);
158 CMCHKPK(oduUnpackUInt8, duration->mins, mBuf);
159 CMCHKPK(oduUnpackUInt8, duration->hours, mBuf);
160 CMCHKPK(oduUnpackUInt8, duration->days, mBuf);
163 } /* end of cmPkDuration */
167 * Fun: oduPackPointer
169 * Desc: This function packs the pointer
182 PTR ptr, /* pointer */
183 Buffer *mBuf /* message buffer */
186 S16 oduPackPointer(ptr, mBuf)
187 PTR ptr; /* pointer */
188 Buffer *mBuf; /* message buffer */
191 Data pkArray[PTRSIZE]; /* array for packing */
192 S16 ret; /* return code */
193 uint16_t tmp; /* temporary value */
195 #if (defined(ALPHA) || defined(BIT_64))
204 #ifndef FCSPKINT /* backward compatibility, packing order */
205 pkArray[0] = (Data) GetHiByte(ptr);
206 pkArray[1] = (Data) GetLoByte(ptr);
207 #else /* forward compatibility, packing order */
208 pkArray[1] = (Data) GetHiByte(ptr);
209 pkArray[0] = (Data) GetLoByte(ptr);
211 ret = SAddPreMsgMult(pkArray, (MsgLen) 2, mBuf);
215 #ifndef FCSPKINT /* backward compatibility, packing order */
216 tmp = (uint16_t) GetHiWord(ptr);
217 pkArray[0] = (Data) GetHiByte(tmp);
218 pkArray[1] = (Data) GetLoByte(tmp);
219 tmp = (uint16_t) GetLoWord(ptr);
220 pkArray[2] = (Data) GetHiByte(tmp);
221 pkArray[3] = (Data) GetLoByte(tmp);
222 #else /* forward compatibility, packing order */
223 tmp = (uint16_t) GetHiWord(ptr);
224 pkArray[3] = (Data) GetHiByte(tmp);
225 pkArray[2] = (Data) GetLoByte(tmp);
226 tmp = (uint16_t) GetLoWord(ptr);
227 pkArray[1] = (Data) GetHiByte(tmp);
228 pkArray[0] = (Data) GetLoByte(tmp);
230 ret = SAddPreMsgMult(pkArray, (MsgLen) 4, mBuf);
234 #if (defined(ALPHA) || defined(BIT_64))
235 #ifndef FCSPKINT /* backward compatibility, packing order */
236 tmp32 = (uint32_t) GetHi32Bit(ptr);
237 tmp = (uint16_t) GetHiWord(tmp32);
238 pkArray[0] = (Data) GetHiByte(tmp);
239 pkArray[1] = (Data) GetLoByte(tmp);
240 tmp = (uint16_t) GetLoWord(tmp32);
241 pkArray[2] = (Data) GetHiByte(tmp);
242 pkArray[3] = (Data) GetLoByte(tmp);
243 tmp32 = (uint32_t) GetLo32Bit(ptr);
244 tmp = (uint16_t) GetHiWord(tmp32);
245 pkArray[4] = (Data) GetHiByte(tmp);
246 pkArray[5] = (Data) GetLoByte(tmp);
247 tmp = (uint16_t) GetLoWord(tmp32);
248 pkArray[6] = (Data) GetHiByte(tmp);
249 pkArray[7] = (Data) GetLoByte(tmp);
250 #else /* forward compatibility, packing order */
251 tmp32 = (uint32_t) GetHi32Bit(ptr);
252 tmp = (uint16_t) GetHiWord(tmp32);
253 pkArray[7] = (Data) GetHiByte(tmp);
254 pkArray[6] = (Data) GetLoByte(tmp);
255 tmp = (uint16_t) GetLoWord(tmp32);
256 pkArray[5] = (Data) GetHiByte(tmp);
257 pkArray[4] = (Data) GetLoByte(tmp);
258 tmp32 = (uint32_t) GetLo32Bit(ptr);
259 tmp = (uint16_t) GetHiWord(tmp32);
260 pkArray[3] = (Data) GetHiByte(tmp);
261 pkArray[2] = (Data) GetLoByte(tmp);
262 tmp = (uint16_t) GetLoWord(tmp32);
263 pkArray[1] = (Data) GetHiByte(tmp);
264 pkArray[0] = (Data) GetLoByte(tmp);
266 ret = SAddPreMsgMult(pkArray, (MsgLen) 8, mBuf);
270 /* no support for uint64_t */
275 } /* end of oduPackPointer */
282 * Desc: This function packs the EntityId structure
295 EntityId *entityId, /* entity id */
296 Buffer *mBuf /* message buffer */
299 S16 cmPkEntityId(entityId, mBuf)
300 EntityId *entityId; /* entity id */
301 Buffer *mBuf; /* message buffer */
305 CMCHKPK(cmPkInst, entityId->inst, mBuf);
306 CMCHKPK(cmPkEnt, entityId->ent, mBuf);
309 } /* end of cmPkEntityId */
316 * Desc: This function packs the ElmntId structure
329 ElmntId *elmntId, /* element id */
330 Buffer *mBuf /* message buffer */
333 S16 cmPkElmntId(elmntId, mBuf)
334 ElmntId *elmntId; /* element id */
335 Buffer *mBuf; /* message buffer */
339 CMCHKPK(cmPkElmntInst3, elmntId->elmntInst3, mBuf);
340 CMCHKPK(cmPkElmntInst2, elmntId->elmntInst2, mBuf);
341 CMCHKPK(cmPkElmntInst1, elmntId->elmntInst1, mBuf);
342 CMCHKPK(cmPkElmnt, elmntId->elmnt, mBuf);
345 } /* end of cmPkElmntId */
352 * Desc: This function packs the MemoryId structure
365 MemoryId *memoryId, /* memoryId */
366 Buffer *mBuf /* message buffer */
369 S16 cmPkMemoryId(memoryId, mBuf)
370 MemoryId *memoryId; /* memoryId */
371 Buffer *mBuf; /* message buffer */
375 CMCHKPK(cmPkPool, memoryId->pool, mBuf);
376 CMCHKPK(cmPkRegion, memoryId->region, mBuf);
379 } /* end of cmPkMemoryId */
386 * Desc: This function packs the System Id structure
399 SystemId *systemId, /* system id */
400 Buffer *mBuf /* message buffer */
403 S16 cmPkSystemId(systemId, mBuf)
404 SystemId *systemId; /* system id */
405 Buffer *mBuf; /* message buffer */
408 Txt *p; /* part number string */
411 for (p = systemId->ptNmb; *p; p++);
413 for (; p != systemId->ptNmb; p--)
415 CMCHKPK(cmPkTxt, *p, mBuf);
417 CMCHKPK(cmPkTxt, *p, mBuf);
419 CMCHKPK(SPkS16, systemId->bRev, mBuf);
420 CMCHKPK(SPkS16, systemId->bVer, mBuf);
421 CMCHKPK(SPkS16, systemId->mRev, mBuf);
422 CMCHKPK(SPkS16, systemId->mVer, mBuf);
425 } /* end of cmPkSystemId */
433 * Desc: This function will pack protocol address.
435 * Ret: ROK on success
447 ProtAddr *pAddr, /* protocol address */
448 Buffer *mBuf /* buffer */
451 S16 cmPkProtAddr(pAddr, mBuf)
452 ProtAddr *pAddr; /* protocol address */
453 Buffer *mBuf; /* buffer */
456 uint8_t j; /* Index */
460 CMCHKPK(oduUnpackUInt32, pAddr->autoSysId, mBuf);
461 CMCHKPK(oduPackBool, pAddr->autoSysIdPres, mBuf);
464 for (j = pAddr->len; j; j--)
465 CMCHKPK(oduUnpackUInt8, pAddr->address[j - 1], mBuf);
467 CMCHKPK(oduUnpackUInt8, pAddr->preLen, mBuf);
468 CMCHKPK(oduUnpackUInt8, pAddr->len, mBuf);
469 CMCHKPK(oduUnpackUInt16, pAddr->protType, mBuf);
473 } /* end of cmPkProtAddr */
479 * Fun: cmPkProtAddrTbl
481 * Desc: This function will pack protocol addresses.
483 * Ret: ROK on success
495 ProtAddrTbl *protAddr, /* protocol address table */
496 Buffer *mBuf /* buffer */
499 S16 cmPkProtAddrTbl(protAddr, mBuf)
500 ProtAddrTbl *protAddr; /* protocol address table */
501 Buffer *mBuf; /* buffer */
504 uint8_t i; /* index */
505 uint8_t j; /* Index */
506 ProtAddr *pAddr; /* protocol Address */
509 if (protAddr->count > MAX_PROT_ADDRS)
512 for (i = protAddr->count; i; i--)
514 pAddr = &(protAddr->addr[i - 1]);
517 CMCHKPK(oduUnpackUInt32, pAddr->autoSysId, mBuf);
518 CMCHKPK(oduPackBool, pAddr->autoSysIdPres, mBuf);
521 for (j = pAddr->len; j; j--)
522 CMCHKPK(oduUnpackUInt8, pAddr->address[j - 1], mBuf);
524 CMCHKPK(oduUnpackUInt8, pAddr->preLen, mBuf);
525 CMCHKPK(oduUnpackUInt8, pAddr->len, mBuf);
526 CMCHKPK(oduUnpackUInt16, pAddr->protType, mBuf);
529 CMCHKPK(oduUnpackUInt8, protAddr->count, mBuf);
532 } /* end of cmPkProtAddrTbl */
539 * Desc: This function packs the address structure for a loosely
553 Addrs *addrs, /* address */
554 Buffer *mBuf /* message buffer */
557 S16 cmPkAddrs(addrs, mBuf)
558 Addrs *addrs; /* address */
559 Buffer *mBuf; /* message buffer */
562 uint8_t i; /* loop counter */
565 if (addrs->length > ADRLEN)
568 for (i = addrs->length; i; i--)
570 CMCHKPK(oduUnpackUInt8, addrs->strg[i-1], mBuf);
573 CMCHKPK(oduUnpackUInt8, addrs->length, mBuf);
576 } /* end of cmPkAddrs */
583 * Desc: This function packs the short address structure for a loosely
597 ShrtAddrs *addrs, /* address */
598 Buffer *mBuf /* message buffer */
601 S16 cmPkShrtAddrs(addrs, mBuf)
602 ShrtAddrs *addrs; /* address */
603 Buffer *mBuf; /* message buffer */
606 uint8_t i; /* loop counter */
609 if (addrs->length > SHRTADRLEN)
612 for (i = addrs->length; i; i--)
614 CMCHKPK(oduUnpackUInt8, addrs->strg[i-1], mBuf);
617 CMCHKPK(oduUnpackUInt8, addrs->length, mBuf);
620 } /* end of cmPkShrtAddrs */
627 * Desc: This function address mask array.
640 uint8_t *mask, /* pointer to address mask array */
641 Buffer *mBuf /* message buffer */
644 S16 cmPkAddrMask(mask, mBuf)
645 uint8_t *mask; /* pointer to address mask array */
646 Buffer *mBuf; /* message buffer */
652 /* pack address mask */
653 for (i = (ADRLEN - 1); i >= 0; i--)
655 CMCHKPK(oduUnpackUInt8, mask[i], mBuf);
659 } /* end of cmPkAddrMask */
666 * Desc: This function packs the BndCfg structure
679 BndCfg *bndCfg, /* bndCfg */
680 Buffer *mBuf /* message buffer */
683 S16 cmPkBndCfg(bndCfg, mBuf)
684 BndCfg *bndCfg; /* bndCfg */
685 Buffer *mBuf; /* message buffer */
688 Txt *p; /* temporary */
691 CMCHKPK(cmPkSelector, bndCfg->selector, mBuf);
692 CMCHKPK(cmPkAddrs, &bndCfg->sapAdr, mBuf);
693 CMCHKPK(cmPkRoute, bndCfg->route, mBuf);
694 CMCHKPK(cmPkPrior, bndCfg->prior, mBuf);
695 CMCHKPK(cmPkPool, bndCfg->pool, mBuf);
696 CMCHKPK(cmPkRegion, bndCfg->region, mBuf);
697 CMCHKPK(cmPkInst, bndCfg->inst, mBuf);
698 CMCHKPK(cmPkEnt, bndCfg->ent, mBuf);
699 CMCHKPK(oduUnpackUInt8, bndCfg->wdw, mBuf);
700 CMCHKPK(oduUnpackUInt8, bndCfg->flcTyp, mBuf);
701 CMCHKPK(oduUnpackUInt8, bndCfg->bufOwnshp, mBuf);
703 for (p = bndCfg->usrId; *p; p++);
704 for (; p != bndCfg->usrId; p--);
705 CMCHKPK(cmPkTxt, *p, mBuf);
708 } /* end of cmPkBndCfg */
715 * Desc: pack post structure
731 S16 cmPkPst(pst, mBuf)
737 CMCHKPK(cmPkEvent, pst->event, mBuf);
738 CMCHKPK(cmPkInst, pst->srcInst, mBuf);
739 CMCHKPK(cmPkEnt, pst->srcEnt, mBuf);
740 CMCHKPK(cmPkProcId, pst->srcProcId, mBuf);
741 CMCHKPK(cmPkInst, pst->dstInst, mBuf);
742 CMCHKPK(cmPkEnt, pst->dstEnt, mBuf);
743 CMCHKPK(cmPkProcId, pst->dstProcId, mBuf);
744 CMCHKPK(cmPkRoute, pst->route, mBuf);
745 CMCHKPK(cmPkPrior, pst->prior, mBuf);
746 CMCHKPK(cmPkPool, pst->pool, mBuf);
747 CMCHKPK(cmPkRegion, pst->region, mBuf);
748 CMCHKPK(cmPkSelector, pst->selector, mBuf);
749 #ifdef TDS_ROLL_UPGRADE_SUPPORT
750 CMCHKPK(cmPkIntfVer, pst->intfVer, mBuf);
754 } /* end of cmPkPst */
760 * Desc: Pack element header
773 ElmtHdr *m, /* element header */
774 Buffer *mBuf /* message buffer */
777 S16 cmPkElmtHdr(m, mBuf)
778 ElmtHdr *m; /* element header */
779 Buffer *mBuf; /* message buffer */
783 #if (LCAMT || ATM_BISUP)
784 CMCHKPK(oduUnpackUInt16, m->compInd, mBuf);
785 #endif /* LCAMT || ATM_BISUP */
787 #if (LCAMT || ATM_BISUP)
788 /* Pack action indicator field */
791 CMCHKPK(oduUnpackUInt8, m->actnInd, mBuf);
796 CMCHKPK(oduPackBool, m->pres, mBuf);
799 } /* end of cmPkElmtHdr */
806 * Desc: This function packs a token uint8_t
819 TknUInt8 *tknUInt8, /* token uint8_t */
820 Buffer *mBuf /* message buffer */
823 S16 cmPkTknUInt8(tknUInt8, mBuf)
824 TknUInt8 *tknUInt8; /* token uint8_t */
825 Buffer *mBuf; /* message buffer */
832 CMCHKPK(oduUnpackUInt8, tknUInt8->val, mBuf);
836 CMCHKPK(oduUnpackUInt8, tknUInt8->pres, mBuf);
839 } /* end of cmPkTknUInt8 */
846 * Desc: This function packs a token S8
859 TknS8 *tknS8, /* token S8 */
860 Buffer *mBuf /* message buffer */
863 S16 cmPkTknS8(tknS8, mBuf)
864 TknS8 *tknS8; /* token S8 */
865 Buffer *mBuf; /* message buffer */
872 CMCHKPK(SPkS8, tknS8->val, mBuf);
876 CMCHKPK(oduUnpackUInt8, tknS8->pres, mBuf);
879 } /* end of cmPkTknS8 */
886 * Desc: This function packs a token uint16_t
899 TknUInt16 *tknUInt16, /* token uint16_t */
900 Buffer *mBuf /* message buffer */
903 S16 cmPkTknUInt16(tknUInt16, mBuf)
904 TknUInt16 *tknUInt16; /* token uint16_t */
905 Buffer *mBuf; /* message buffer */
912 CMCHKPK(oduUnpackUInt16, tknUInt16->val, mBuf);
916 CMCHKPK(oduUnpackUInt8, tknUInt16->pres, mBuf);
919 } /* end of cmPkTknUInt16 */
926 * Desc: This function packs a token uint32_t
939 TknUInt32 *tknUInt32, /* token uint32_t */
940 Buffer *mBuf /* message buffer */
943 S16 cmPkTknUInt32(tknUInt32, mBuf)
944 TknUInt32 *tknUInt32; /* token uint32_t */
945 Buffer *mBuf; /* message buffer */
952 CMCHKPK(oduUnpackUInt32, tknUInt32->val, mBuf);
956 CMCHKPK(oduUnpackUInt8, tknUInt32->pres, mBuf);
959 } /* end of cmPkTknUInt32 */
966 * Desc: This function packs a token string - regular size
979 TknStr *tknStr, /* token string */
980 Buffer *mBuf /* message buffer */
983 S16 cmPkTknStr(tknStr, mBuf)
984 TknStr *tknStr; /* token string */
985 Buffer *mBuf; /* message buffer */
988 Cntr i; /* counter */
994 for (i = 0; i < (S16) tknStr->len; i++)
996 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
1000 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
1004 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
1007 } /* end of cmPkTknStr */
1014 * Desc: This function packs a token string - medium size
1027 TknStrM *tknStr, /* token string */
1028 Buffer *mBuf /* message buffer */
1031 S16 cmPkTknStrM(tknStr, mBuf)
1032 TknStrM *tknStr; /* token string */
1033 Buffer *mBuf; /* message buffer */
1036 Cntr i; /* counter */
1042 for (i = 0; i < (S16) tknStr->len; i++)
1044 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
1048 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
1052 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
1055 } /* end of cmPkTknStrM */
1062 * Desc: This function packs a token string - small size
1075 TknStrS *tknStr, /* token string */
1076 Buffer *mBuf /* message buffer */
1079 S16 cmPkTknStrS(tknStr, mBuf)
1080 TknStrS *tknStr; /* token string */
1081 Buffer *mBuf; /* message buffer */
1084 Cntr i; /* counter */
1090 for (i = 0; i < (S16) tknStr->len; i++)
1092 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
1096 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
1100 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
1103 } /* end of cmPkTknStrS */
1110 * Desc: This function packs a token string - extended size
1123 TknStrE *tknStr, /* token string */
1124 Buffer *mBuf /* message buffer */
1127 S16 cmPkTknStrE(tknStr, mBuf)
1128 TknStrE *tknStr; /* token string */
1129 Buffer *mBuf; /* message buffer */
1132 Cntr i; /* counter */
1138 for (i = 0; i < (S16) tknStr->len; i++)
1140 CMCHKPK(oduUnpackUInt8, tknStr->val[i], mBuf);
1144 CMCHKPK(oduUnpackUInt8, tknStr->len, mBuf);
1148 CMCHKPK(oduUnpackUInt8, tknStr->pres, mBuf);
1151 } /* end of cmPkTknStrE */
1153 #ifndef CMFILE_REORG_1
1160 * Desc: This function packs a PnNodeId structure into a buffer
1173 PnNodeId *src, /* source PNNI Node Id */
1174 Buffer *mBuf /* message buffer */
1177 S16 cmPkPnNodeId (src, mBuf)
1178 PnNodeId *src; /* source PNNI Node Id */
1179 Buffer *mBuf; /* message buffer */
1185 for (i = PN_NODEID_LEN - 1; i >= 0; i--)
1187 CMCHKPK(oduUnpackUInt8, src->id[i], mBuf);
1191 } /* cmPkPnNodeId */
1193 #endif /* CMFILE_REORG_1 */
1200 * Desc: This function packs a token string of size 4
1213 TknStr4 *tknStr, /* token string */
1214 Buffer *mBuf /* message buffer */
1217 S16 cmPkTknStr4(tknStr, mBuf)
1218 TknStr4 *tknStr; /* token string */
1219 Buffer *mBuf; /* message buffer */
1223 CMPKTKNSTR(tknStr, mBuf);
1227 } /* end of cmPkTknStr4 */
1235 * Desc: This function packs a token string of size 4
1248 TknStr12 *tknStr, /* token string */
1249 Buffer *mBuf /* message buffer */
1252 S16 cmPkTknStr12(tknStr, mBuf)
1253 TknStr12 *tknStr; /* token string */
1254 Buffer *mBuf; /* message buffer */
1258 CMPKTKNSTR(tknStr, mBuf);
1262 } /* end of cmPkTknStr12 */
1269 * Desc: This function packs a token string of size 4
1282 TknStr32 *tknStr, /* token string */
1283 Buffer *mBuf /* message buffer */
1286 S16 cmPkTknStr32(tknStr, mBuf)
1287 TknStr32 *tknStr; /* token string */
1288 Buffer *mBuf; /* message buffer */
1292 CMPKTKNSTR(tknStr, mBuf);
1296 } /* end of cmPkTknStr32 */
1303 * Desc: This function packs a token string of size 4
1316 TknStr64 *tknStr, /* token string */
1317 Buffer *mBuf /* message buffer */
1320 S16 cmPkTknStr64(tknStr, mBuf)
1321 TknStr64 *tknStr; /* token string */
1322 Buffer *mBuf; /* message buffer */
1326 CMPKTKNSTR(tknStr, mBuf);
1330 } /* end of cmPkTknStr64 */
1335 * Fun: cmPkTknStr132
1337 * Desc: This function packs a token string of size 4
1350 TknStr132 *tknStr, /* token string */
1351 Buffer *mBuf /* message buffer */
1354 S16 cmPkTknStr132(tknStr, mBuf)
1355 TknStr132 *tknStr; /* token string */
1356 Buffer *mBuf; /* message buffer */
1360 CMPKTKNSTR(tknStr, mBuf);
1364 } /* end of cmPkTknStr132 */
1369 * Fun: cmPkTknStr256
1371 * Desc: This function packs a token string of size 4
1384 TknStr256 *tknStr, /* token string */
1385 Buffer *mBuf /* message buffer */
1388 S16 cmPkTknStr256(tknStr, mBuf)
1389 TknStr256 *tknStr; /* token string */
1390 Buffer *mBuf; /* message buffer */
1394 CMPKTKNSTR(tknStr, mBuf);
1398 } /* end of cmPkTknStr256 */
1405 * Desc: This function packs a Object Identifier token
1418 TknOid *tknOid, /* Object Identifier token */
1419 Buffer *mBuf /* message buffer */
1422 S16 cmPkTknOid(tknOid, mBuf)
1423 TknOid *tknOid; /* Object Identifier token */
1424 Buffer *mBuf; /* message buffer */
1430 if (tknOid->pres == TRUE)
1432 /* Pack the value */
1433 for (i = 0; i < (uint16_t)tknOid->len; i++)
1435 /* cm_gen_c_001.main_33: changes for TknOid value from uint16_t to uint32_t
1436 * with compilation flag TKNOID_UINT16 */
1437 #ifndef TKNOID_UINT16
1438 CMCHKPK(oduUnpackUInt32, tknOid->val[i], mBuf);
1440 CMCHKPK(oduUnpackUInt16, tknOid->val[i], mBuf);
1441 #endif /* !TKNOID_UINT16 */
1443 /* Pack the length */
1444 CMCHKPK(oduUnpackUInt8, tknOid->len, mBuf);
1446 /* Pack the token header */
1447 CMCHKPK(oduUnpackUInt8, tknOid->pres, mBuf);
1450 } /* end of cmPkTknOid */
1457 * Desc: This function packs a token S32
1470 TknS32 *tknS32, /* token S32 */
1471 Buffer *mBuf /* message buffer */
1474 S16 cmPkTknS32(tknS32, mBuf)
1475 TknS32 *tknS32; /* token S32 */
1476 Buffer *mBuf; /* message buffer */
1483 CMCHKPK(SPkS32, tknS32->val, mBuf);
1487 CMCHKPK(oduUnpackUInt8, tknS32->pres, mBuf);
1490 } /* end of cmPkTknS32 */
1497 * Desc: This function packs the header structure
1510 Header *header, /* header */
1511 Buffer *mBuf /* message buffer */
1514 S16 cmPkHeader(header, mBuf)
1515 Header *header; /* header */
1516 Buffer *mBuf; /* message buffer */
1521 CMCHKPK(cmPkMemoryId, &header->response.mem, mBuf);
1522 CMCHKPK(cmPkRoute, header->response.route, mBuf);
1523 CMCHKPK(cmPkPriority, header->response.prior, mBuf);
1524 CMCHKPK(cmPkSelector, header->response.selector, mBuf);
1525 CMCHKPK(cmPkTranId, header->transId, mBuf);
1527 CMCHKPK(cmPkElmntId, &header->elmId, mBuf);
1528 CMCHKPK(cmPkEntityId, &header->entId, mBuf);
1529 CMCHKPK(oduUnpackUInt16, header->seqNmb, mBuf);
1530 CMCHKPK(oduUnpackUInt8, header->version, mBuf);
1531 CMCHKPK(oduUnpackUInt8, header->msgType, mBuf);
1532 CMCHKPK(oduUnpackUInt16, header->msgLen, mBuf);
1535 } /* end of cmPkHeader */
1542 * Desc: This function packs common management status structure
1555 CmStatus *sta, /* status structure */
1556 Buffer *mBuf /* message buffer */
1559 S16 cmPkCmStatus(sta, mBuf)
1560 CmStatus *sta; /* status structure */
1561 Buffer *mBuf; /* message buffer */
1565 CMCHKPK(oduUnpackUInt16, sta->reason, mBuf);
1566 CMCHKPK(oduUnpackUInt16, sta->status, mBuf);
1569 } /* end of cmPkCmStatus */
1576 * Desc: This function packs common management alarm structure
1589 CmAlarm *alarm, /* alarm structure */
1590 Buffer *mBuf /* message buffer */
1593 S16 cmPkCmAlarm(alarm, mBuf)
1594 CmAlarm *alarm; /* alarm structure */
1595 Buffer *mBuf; /* message buffer */
1599 CMCHKPK(oduUnpackUInt16, alarm->cause, mBuf);
1600 CMCHKPK(oduUnpackUInt16, alarm->event, mBuf);
1601 CMCHKPK(oduUnpackUInt16, alarm->category, mBuf);
1602 CMCHKPK(cmPkDateTime, &alarm->dt, mBuf);
1605 } /* end of cmPkCmAlarm */
1612 * Desc: This function packs the stack manager structure
1625 SmCfg *smCfg, /* stack manager */
1626 Buffer *mBuf /* message buffer */
1629 S16 cmPkSmCfg(smCfg, mBuf)
1630 SmCfg *smCfg; /* stack manager */
1631 Buffer *mBuf; /* message buffer */
1635 CMCHKPK(cmPkSelector, smCfg->selector, mBuf);
1636 CMCHKPK(cmPkRoute, smCfg->route, mBuf);
1637 CMCHKPK(cmPkPrior, smCfg->prior, mBuf);
1638 CMCHKPK(cmPkPool, smCfg->pool, mBuf);
1639 CMCHKPK(cmPkRegion, smCfg->region, mBuf);
1640 CMCHKPK(cmPkInst, smCfg->inst, mBuf);
1641 CMCHKPK(cmPkEnt, smCfg->ent, mBuf);
1644 } /* end of cmPkSmCfg */
1651 * Desc: This function packs the timer configuration structure
1664 TmrCfg *tmrCfg, /* timer configuration */
1665 Buffer *mBuf /* message buffer */
1668 S16 cmPkTmrCfg(tmrCfg, mBuf)
1669 TmrCfg *tmrCfg; /* timer configuration */
1670 Buffer *mBuf; /* message buffer */
1674 CMCHKPK(oduUnpackUInt16, tmrCfg->val, mBuf);
1675 CMCHKPK(oduPackBool, tmrCfg->enb, mBuf);
1678 } /* end of cmPkTmrCfg */
1685 * Desc: This function packs a token buffer
1698 TknBuf *tknBuf, /* token string */
1699 Buffer *mBuf /* message buffer */
1702 S16 cmPkTknBuf(tknBuf, mBuf)
1703 TknBuf *tknBuf; /* token string */
1704 Buffer *mBuf; /* message buffer */
1712 SFndLenMsg(tknBuf->val, &msgLen);
1713 if( SCatMsg(mBuf, tknBuf->val, M2M1) != ROK )
1717 cmPkMsgLen(msgLen, mBuf);
1718 SPutMsg(tknBuf->val);
1722 CMCHKPK(oduUnpackUInt8, tknBuf->pres, mBuf);
1725 } /* end of cmPkTknBuf */
1727 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1732 * Desc: This function packs the interface information
1745 CmIntf *intf, /* interface info */
1746 Buffer *mBuf /* message buffer */
1749 S16 cmPkIntf(intf, mBuf)
1750 CmIntf *intf; /* interface info */
1751 Buffer *mBuf; /* message buffer */
1755 CMCHKPK(cmPkIntfId, intf->intfId, mBuf);
1756 CMCHKPK(cmPkIntfVer, intf->intfVer, mBuf);
1759 } /* end of cmPkIntf */
1760 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
1764 * common unpacking functions
1770 * Fun: cmUnpkDateTime
1772 * Desc: This function is used to Unpack Pack Date Time structure
1785 DateTime *dateTime, /* date/time structure */
1786 Buffer *mBuf /* message buffer */
1789 S16 cmUnpkDateTime(dateTime, mBuf)
1790 DateTime *dateTime; /* date/time structure */
1791 Buffer *mBuf; /* message buffer */
1795 CMCHKUNPK(oduPackUInt8, &dateTime->month, mBuf);
1796 CMCHKUNPK(oduPackUInt8, &dateTime->day, mBuf);
1797 CMCHKUNPK(oduPackUInt8, &dateTime->year, mBuf);
1798 CMCHKUNPK(oduPackUInt8, &dateTime->hour, mBuf);
1799 CMCHKUNPK(oduPackUInt8, &dateTime->min, mBuf);
1800 CMCHKUNPK(oduPackUInt8, &dateTime->sec, mBuf);
1801 CMCHKUNPK(oduPackUInt8, &dateTime->tenths, mBuf);
1803 /*-- added for micro seconds --*/
1804 #ifdef SS_DATETIME_USEC
1805 CMCHKUNPK(oduPackUInt32, &dateTime->usec, mBuf);
1806 #endif /*-- SS_DATETIME_USEC --*/
1809 } /* end of cmUnpkDateTime */
1814 * Fun: cmUnpkDuration
1816 * Desc: This function is used to Unpack Pack Duration structure
1829 Duration *duration, /* duration structure */
1830 Buffer *mBuf /* message buffer */
1833 S16 cmUnpkDuration(duration, mBuf)
1834 Duration *duration; /* duration structure */
1835 Buffer *mBuf; /* message buffer */
1839 CMCHKUNPK(oduPackUInt8, &duration->days, mBuf);
1840 CMCHKUNPK(oduPackUInt8, &duration->hours, mBuf);
1841 CMCHKUNPK(oduPackUInt8, &duration->mins, mBuf);
1842 CMCHKUNPK(oduPackUInt8, &duration->secs, mBuf);
1843 CMCHKUNPK(oduPackUInt8, &duration->tenths, mBuf);
1846 } /* end of cmUnpkDuration */
1850 * Fun: oduUnpackPointer
1852 * Desc: This function is used to Unpack Ptr type
1863 S16 oduUnpackPointer
1865 PTR *ptr, /* duration structure */
1866 Buffer *mBuf /* message buffer */
1869 S16 oduUnpackPointer(ptr, mBuf)
1870 PTR *ptr; /* duration structure */
1871 Buffer *mBuf; /* message buffer */
1874 uint16_t tmp16; /* temporary value */
1875 uint32_t tmp32; /* temporary value */
1876 Data unpkArray[PTRSIZE]; /* unpacking array */
1877 S16 ret; /* return code */
1879 #if (defined(ALPHA) || defined(BIT_64))
1887 ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
1892 #ifndef FCSPKINT /* backward compatibility, packing order */
1893 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1894 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1895 #else /* forward compatibility, packing order */
1896 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1897 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1903 ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
1909 #ifndef FCSPKINT /* backward compatibility, packing order */
1910 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
1911 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
1912 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1913 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1914 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1915 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1916 #else /* forward compatibility, packing order */
1917 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1918 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1919 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1920 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
1921 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
1922 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1928 #if(defined(ALPHA) || defined(BIT_64))
1929 ret = SRemPreMsgMult(unpkArray, (MsgLen) 8, mBuf);
1936 #ifndef FCSPKINT /* backward compatibility, packing order */
1937 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[7]);
1938 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[6]);
1939 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1940 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[5]);
1941 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[4]);
1942 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1943 tmp64 = (uint64_t) PutHi32Bit(tmp64, tmp32);
1944 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
1945 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
1946 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1947 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
1948 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
1949 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1950 tmp64 = (uint64_t) PutLo32Bit(tmp64, tmp32);
1951 #else /* forward compatibility, packing order */
1952 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
1953 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
1954 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1955 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
1956 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
1957 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1958 tmp64 = (uint64_t) PutHi32Bit(tmp64, tmp32);
1959 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[4]);
1960 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[5]);
1961 tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
1962 tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[6]);
1963 tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[7]);
1964 tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
1965 tmp64 = (uint64_t) PutLo32Bit(tmp64, tmp32);
1971 /* no support for uint64_t */
1976 } /* end of oduUnpackPointer */
1981 * Fun: cmUnpkEntityId
1983 * Desc: This function unpacks the EntityId structure
1996 EntityId *entityId, /* entity id */
1997 Buffer *mBuf /* message buffer */
2000 S16 cmUnpkEntityId(entityId, mBuf)
2001 EntityId *entityId; /* entity id */
2002 Buffer *mBuf; /* message buffer */
2006 CMCHKUNPK(cmUnpkEnt, &entityId->ent, mBuf);
2007 CMCHKUNPK(cmUnpkInst, &entityId->inst, mBuf);
2010 } /* end of cmUnpkEntityId */
2015 * Fun: cmUnpkElmntId
2017 * Desc: This function unpacks the ElmntId structure
2030 ElmntId *elmntId, /* element id */
2031 Buffer *mBuf /* message buffer */
2034 S16 cmUnpkElmntId(elmntId, mBuf)
2035 ElmntId *elmntId; /* element id */
2036 Buffer *mBuf; /* message buffer */
2040 CMCHKUNPK(cmUnpkElmnt, &elmntId->elmnt, mBuf);
2041 CMCHKUNPK(cmUnpkElmntInst1, &elmntId->elmntInst1, mBuf);
2042 CMCHKUNPK(cmUnpkElmntInst2, &elmntId->elmntInst2, mBuf);
2043 CMCHKUNPK(cmUnpkElmntInst3, &elmntId->elmntInst3, mBuf);
2046 } /* end of cmUnpkElmntId */
2051 * Fun: cmUnpkMemoryId
2053 * Desc: This function unpacks the MemoryId structure
2066 MemoryId *memoryId, /* memoryId */
2067 Buffer *mBuf /* message buffer */
2070 S16 cmUnpkMemoryId(memoryId, mBuf)
2071 MemoryId *memoryId; /* memoryId */
2072 Buffer *mBuf; /* message buffer */
2076 CMCHKUNPK(cmUnpkRegion, &memoryId->region, mBuf);
2077 CMCHKUNPK(cmUnpkPool, &memoryId->pool, mBuf);
2080 } /* end of cmUnpkMemoryId */
2085 * Fun: cmUnpkSystemId
2087 * Desc: This function packs the System Id structure
2100 SystemId *systemId, /* system id */
2101 Buffer *mBuf /* message buffer */
2104 S16 cmUnpkSystemId(systemId, mBuf)
2105 SystemId *systemId; /* system id */
2106 Buffer *mBuf; /* message buffer */
2109 S16 i; /* loop counter */
2113 CMCHKUNPK(SUnpkS16, &systemId->mVer, mBuf);
2114 CMCHKUNPK(SUnpkS16, &systemId->mRev, mBuf);
2115 CMCHKUNPK(SUnpkS16, &systemId->bVer, mBuf);
2116 CMCHKUNPK(SUnpkS16, &systemId->bRev, mBuf);
2118 SFndLenMsg(mBuf, &len);
2120 for (i = 0; i < len; i++)
2122 CMCHKUNPK(cmUnpkTxt, &systemId->ptNmb[i], mBuf);
2126 } /* end of cmUnpkSystemId */
2132 * Fun: cmUnpkProtAddr
2134 * Desc: This function will unpack protocol address.
2136 * Ret: ROK on success
2148 ProtAddr *pAddr, /* protocol address */
2149 Buffer *mBuf /* buffer */
2152 S16 cmUnpkProtAddr(pAddr, mBuf)
2153 ProtAddr *pAddr; /* protocol address table */
2154 Buffer *mBuf; /* buffer */
2157 uint8_t j; /* Index */
2160 CMCHKUNPK(oduPackUInt16, &(pAddr->protType), mBuf);
2161 CMCHKUNPK(oduPackUInt8, &(pAddr->len), mBuf);
2162 CMCHKUNPK(oduPackUInt8, &(pAddr->preLen), mBuf);
2164 for (j =0; j < pAddr->len; j++)
2165 CMCHKUNPK(oduPackUInt8, &pAddr->address[j], mBuf);
2168 CMCHKUNPK(oduUnpackBool, &(pAddr->autoSysIdPres), mBuf);
2169 CMCHKUNPK(oduPackUInt32, &(pAddr->autoSysId), mBuf);
2170 #endif /* CM_ARI2 */
2173 } /* end of cmUnpkProtAddr */
2178 * Fun: cmUnpkProtAddrTbl
2180 * Desc: This function will pack protocol addresses.
2182 * Ret: ROK on success
2192 S16 cmUnpkProtAddrTbl
2194 ProtAddrTbl *protAddr, /* protocol address table */
2195 Buffer *mBuf /* buffer */
2198 S16 cmUnpkProtAddrTbl(protAddr, mBuf)
2199 ProtAddrTbl *protAddr; /* protocol address table */
2200 Buffer *mBuf; /* buffer */
2203 uint8_t i; /* index */
2204 uint8_t j; /* Index */
2205 ProtAddr *pAddr; /* Protocol Address */
2208 CMCHKUNPK(oduPackUInt8, &protAddr->count, mBuf);
2209 for (i = 0; i < protAddr->count; i++)
2211 pAddr = &(protAddr->addr[i]);
2213 CMCHKUNPK(oduPackUInt16, &(pAddr->protType), mBuf);
2214 CMCHKUNPK(oduPackUInt8, &(pAddr->len), mBuf);
2215 CMCHKUNPK(oduPackUInt8, &(pAddr->preLen), mBuf);
2218 for (j =0; j < pAddr->len; j++)
2219 CMCHKUNPK(oduPackUInt8, &pAddr->address[j], mBuf);
2222 CMCHKUNPK(oduUnpackBool, &(pAddr->autoSysIdPres), mBuf);
2223 CMCHKUNPK(oduPackUInt32, &(pAddr->autoSysId), mBuf);
2224 #endif /* CM_ARI2 */
2227 } /* end of cmUnpkProtAddrTbl */
2234 * Desc: This function is used to unpack the Addrs structure
2247 Addrs *addrs, /* address */
2248 Buffer *mBuf /* message buffer */
2251 S16 cmUnpkAddrs(addrs, mBuf)
2252 Addrs *addrs; /* address */
2253 Buffer *mBuf; /* message buffer */
2256 uint8_t i; /* loop counter */
2259 CMCHKUNPK(oduPackUInt8, &addrs->length, mBuf);
2261 if (addrs->length > ADRLEN)
2264 for(i = 0; i < addrs->length; i++)
2266 CMCHKUNPK(oduPackUInt8, &addrs->strg[i], mBuf);
2270 } /* end of cmUnpkAddrs */
2274 * Fun: cmUnpkShrtAddrs
2276 * Desc: This function is used to unpack the ShrtAddrs structure
2289 ShrtAddrs *addrs, /* address */
2290 Buffer *mBuf /* message buffer */
2293 S16 cmUnpkShrtAddrs(addrs, mBuf)
2294 ShrtAddrs *addrs; /* address */
2295 Buffer *mBuf; /* message buffer */
2298 uint8_t i; /* loop counter */
2301 CMCHKUNPK(oduPackUInt8, &addrs->length, mBuf);
2303 if (addrs->length > SHRTADRLEN)
2306 for(i = 0; i < addrs->length; i++)
2308 CMCHKUNPK(oduPackUInt8, &addrs->strg[i], mBuf);
2311 } /* end of cmUnpkShrtAddrs */
2316 * Fun: cmUnpkAddrMask
2318 * Desc: This unpacks address mask.
2331 uint8_t *mask, /* pointer to address mask */
2332 Buffer *mBuf /* message buffer */
2335 S16 cmUnpkAddrMask(mask, mBuf)
2336 uint8_t *mask; /* pointer to address mask */
2337 Buffer *mBuf; /* message buffer */
2340 S16 i; /* counter */
2343 /* unpack address mask */
2344 for (i = 0; i< ADRLEN; i++)
2346 CMCHKUNPK(oduPackUInt8, &mask[i], mBuf);
2349 } /* end of cmUnpkAddrMask */
2356 * Desc: This function unpacks the BndCfg structure
2369 BndCfg *bndCfg, /* bndCfg */
2370 Buffer *mBuf /* message buffer */
2373 S16 cmUnpkBndCfg(bndCfg, mBuf)
2374 BndCfg *bndCfg; /* bndCfg */
2375 Buffer *mBuf; /* message buffer */
2378 S16 i; /* loop counter */
2381 for (i = 0; bndCfg->usrId[i]; i++);
2382 CMCHKUNPK(cmUnpkTxt, bndCfg->usrId+i, mBuf);
2384 CMCHKUNPK(oduPackUInt8, &bndCfg->bufOwnshp, mBuf);
2385 CMCHKUNPK(oduPackUInt8, &bndCfg->flcTyp, mBuf);
2386 CMCHKUNPK(oduPackUInt8, &bndCfg->wdw, mBuf);
2387 CMCHKUNPK(cmUnpkEnt, &bndCfg->ent, mBuf);
2388 CMCHKUNPK(cmUnpkInst, &bndCfg->inst, mBuf);
2389 CMCHKUNPK(cmUnpkRegion, &bndCfg->region, mBuf);
2390 CMCHKUNPK(cmUnpkPool, &bndCfg->pool, mBuf);
2391 CMCHKUNPK(cmUnpkPrior, &bndCfg->prior, mBuf);
2392 CMCHKUNPK(cmUnpkRoute, &bndCfg->route, mBuf);
2393 CMCHKUNPK(cmUnpkAddrs, &bndCfg->sapAdr, mBuf);
2394 CMCHKUNPK(cmUnpkSelector, &bndCfg->selector, mBuf);
2397 } /* end of cmUnpkBndCfg */
2404 * Desc: pack post structure
2420 S16 cmUnpkPst(pst, mBuf)
2426 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2427 CMCHKUNPK(cmUnpkIntfVer, &pst->intfVer, mBuf);
2429 CMCHKUNPK(cmUnpkSelector, &pst->selector, mBuf);
2430 CMCHKUNPK(cmUnpkRegion, &pst->region, mBuf);
2431 CMCHKUNPK(cmUnpkPool, &pst->pool, mBuf);
2432 CMCHKUNPK(cmUnpkPrior, &pst->prior, mBuf);
2433 CMCHKUNPK(cmUnpkRoute, &pst->route, mBuf);
2434 CMCHKUNPK(cmUnpkProcId, &pst->dstProcId, mBuf);
2435 CMCHKUNPK(cmUnpkEnt, &pst->dstEnt, mBuf);
2436 CMCHKUNPK(cmUnpkInst, &pst->dstInst, mBuf);
2437 CMCHKUNPK(cmUnpkProcId, &pst->srcProcId, mBuf);
2438 CMCHKUNPK(cmUnpkEnt, &pst->srcEnt, mBuf);
2439 CMCHKUNPK(cmUnpkInst, &pst->srcInst, mBuf);
2440 CMCHKUNPK(cmUnpkEvent, &pst->event, mBuf);
2443 } /* end of cmUnpkPst */
2447 * Fun: cmUnpkElmtHdr
2449 * Desc: Unpack element header
2462 ElmtHdr *m, /* element header */
2463 Buffer *mBuf /* message buffer */
2466 S16 cmUnpkElmtHdr(m, mBuf)
2467 ElmtHdr *m; /* element header */
2468 Buffer *mBuf; /* message buffer */
2473 CMCHKUNPK(oduUnpackBool, &m->pres , mBuf);
2475 #if (LCAMT || ATM_BISUP)
2476 /* Unpack action indicator field */
2479 CMCHKUNPK(oduPackUInt8, &m->actnInd, mBuf);
2483 #if (LCAMT || ATM_BISUP)
2484 CMCHKUNPK(oduPackUInt16, &m->compInd, mBuf);
2485 #endif /* LCAMT || ATM_BISUP */
2488 } /* end of cmUnpkElmtHdr */
2493 * Fun: cmUnpkTknUInt8
2495 * Desc: This function unpacks a token uint8_t
2508 TknUInt8 *tknUInt8, /* token uint8_t */
2509 Buffer *mBuf /* message buffer */
2512 S16 cmUnpkTknUInt8(tknUInt8, mBuf)
2513 TknUInt8 *tknUInt8; /* token uint8_t */
2514 Buffer *mBuf; /* message buffer */
2519 CMCHKUNPK(oduPackUInt8, &tknUInt8->pres, mBuf);
2524 CMCHKUNPK(oduPackUInt8, &tknUInt8->val, mBuf);
2528 } /* end of cmUnpkTknUInt8 */
2535 * Desc: This function unpacks a token S8
2548 TknS8 *tknS8, /* token S8 */
2549 Buffer *mBuf /* message buffer */
2552 S16 cmUnpkTknS8(tknS8, mBuf)
2553 TknS8 *tknS8; /* token S8 */
2554 Buffer *mBuf; /* message buffer */
2559 CMCHKUNPK(oduPackUInt8, &tknS8->pres, mBuf);
2564 CMCHKUNPK(SUnpkS8, &tknS8->val, mBuf);
2568 } /* end of cmUnpkTknS8 */
2573 * Fun: cmUnpkTknUInt16
2575 * Desc: This function unpacks a token uint16_t
2588 TknUInt16 *tknUInt16, /* token uint16_t */
2589 Buffer *mBuf /* message buffer */
2592 S16 cmUnpkTknUInt16(tknUInt16, mBuf)
2593 TknUInt16 *tknUInt16; /* token uint16_t */
2594 Buffer *mBuf; /* message buffer */
2599 CMCHKUNPK(oduPackUInt8, &tknUInt16->pres, mBuf);
2601 if (tknUInt16->pres)
2604 CMCHKUNPK(oduPackUInt16, &tknUInt16->val, mBuf);
2608 } /* end of cmUnpkTknUInt16 */
2613 * Fun: cmUnpkTknUInt32
2615 * Desc: This function unpacks a token uint32_t
2628 TknUInt32 *tknUInt32, /* token uint32_t */
2629 Buffer *mBuf /* message buffer */
2632 S16 cmUnpkTknUInt32(tknUInt32, mBuf)
2633 TknUInt32 *tknUInt32; /* token uint32_t */
2634 Buffer *mBuf; /* message buffer */
2639 CMCHKUNPK(oduPackUInt8, &tknUInt32->pres, mBuf);
2641 if (tknUInt32->pres)
2644 CMCHKUNPK(oduPackUInt32, &tknUInt32->val, mBuf);
2648 } /* end of cmUnpkTknUInt32 */
2654 * Desc: This function unpacks a token string - regular size
2667 TknStr *tknStr, /* token string */
2668 Buffer *mBuf /* message buffer */
2671 S16 cmUnpkTknStr(tknStr, mBuf)
2672 TknStr *tknStr; /* token string */
2673 Buffer *mBuf; /* message buffer */
2676 Cntr i; /* counter */
2680 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2685 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2688 for (i = (tknStr->len - 1); i >= 0; i--)
2690 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2697 } /* end of cmUnpkTknStr */
2701 * Fun: cmUnpkTknStrM
2703 * Desc: This function unpacks a token string - medium size
2716 TknStrM *tknStr, /* token string */
2717 Buffer *mBuf /* message buffer */
2720 S16 cmUnpkTknStrM(tknStr, mBuf)
2721 TknStrM *tknStr; /* token string */
2722 Buffer *mBuf; /* message buffer */
2725 Cntr i; /* counter */
2729 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2734 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2737 for (i = (tknStr->len - 1); i >= 0; i--)
2739 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2746 } /* end of cmUnpkTknStrM */
2751 * Fun: cmUnpkTknStrS
2753 * Desc: This function unpacks a token string - small size
2766 TknStrS *tknStr, /* token string */
2767 Buffer *mBuf /* message buffer */
2770 S16 cmUnpkTknStrS(tknStr, mBuf)
2771 TknStrS *tknStr; /* token string */
2772 Buffer *mBuf; /* message buffer */
2775 Cntr i; /* counter */
2779 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2784 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2787 for (i = (tknStr->len - 1); i >= 0; i--)
2789 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2796 } /* end of cmUnpkTknStrS */
2801 * Fun: cmUnpkTknStrE
2803 * Desc: This function unpacks a token string - extended size
2816 TknStrE *tknStr, /* token string */
2817 Buffer *mBuf /* message buffer */
2820 S16 cmUnpkTknStrE(tknStr, mBuf)
2821 TknStrE *tknStr; /* token string */
2822 Buffer *mBuf; /* message buffer */
2825 Cntr i; /* counter */
2829 CMCHKUNPK(oduPackUInt8, &tknStr->pres, mBuf);
2834 CMCHKUNPK(oduPackUInt8, &tknStr->len, mBuf);
2837 for (i = (tknStr->len - 1); i >= 0; i--)
2839 CMCHKUNPK(oduPackUInt8, &tknStr->val[i], mBuf);
2846 } /* end of cmUnpkTknStrE */
2848 #ifndef CMFILE_REORG_1
2853 * Fun: cmUnpkPnNodeId
2855 * Desc: This function unpacks a PnNodeId structure from a buffer
2868 PnNodeId *dst, /* source PNNI Node Id */
2869 Buffer *mBuf /* message buffer */
2872 S16 cmUnpkPnNodeId (dst, mBuf)
2873 PnNodeId *dst; /* source PNNI Node Id */
2874 Buffer *mBuf; /* message buffer */
2880 for (i = 0; i < PN_NODEID_LEN; i++)
2882 CMCHKUNPK(oduPackUInt8, &dst->id[i], mBuf);
2886 } /* cmUnpkPnNodeId */
2888 #endif /* CMFILE_REORG_1 */
2893 * Fun: cmUnpkTknStr4
2895 * Desc: This function packs a token string of size 4
2908 TknStr4 *tknStr, /* token string */
2909 Buffer *mBuf /* message buffer */
2912 S16 cmUnpkTknStr4(tknStr, mBuf)
2913 TknStr4 *tknStr; /* token string */
2914 Buffer *mBuf; /* message buffer */
2918 CMUNPKTKNSTR(tknStr, mBuf);
2922 } /* end of cmUnpkTknStr4 */
2928 * Fun: cmUnpkTknStr12
2930 * Desc: This function packs a token string of size 4
2943 TknStr12 *tknStr, /* token string */
2944 Buffer *mBuf /* message buffer */
2947 S16 cmUnpkTknStr12(tknStr, mBuf)
2948 TknStr12 *tknStr; /* token string */
2949 Buffer *mBuf; /* message buffer */
2953 CMUNPKTKNSTR(tknStr, mBuf);
2957 } /* end of cmUnpkTknStr12 */
2962 * Fun: cmUnpkTknStr32
2964 * Desc: This function packs a token string of size 4
2977 TknStr32 *tknStr, /* token string */
2978 Buffer *mBuf /* message buffer */
2981 S16 cmUnpkTknStr32(tknStr, mBuf)
2982 TknStr32 *tknStr; /* token string */
2983 Buffer *mBuf; /* message buffer */
2987 CMUNPKTKNSTR(tknStr, mBuf);
2991 } /* end of cmUnpkTknStr32 */
2996 * Fun: cmUnpkTknStr64
2998 * Desc: This function packs a token string of size 4
3011 TknStr64 *tknStr, /* token string */
3012 Buffer *mBuf /* message buffer */
3015 S16 cmUnpkTknStr64(tknStr, mBuf)
3016 TknStr64 *tknStr; /* token string */
3017 Buffer *mBuf; /* message buffer */
3021 CMUNPKTKNSTR(tknStr, mBuf);
3025 } /* end of cmUnpkTknStr64 */
3030 * Fun: cmUnpkTknStr132
3032 * Desc: This function packs a token string of size 4
3045 TknStr132 *tknStr, /* token string */
3046 Buffer *mBuf /* message buffer */
3049 S16 cmUnpkTknStr132(tknStr, mBuf)
3050 TknStr132 *tknStr; /* token string */
3051 Buffer *mBuf; /* message buffer */
3055 CMUNPKTKNSTR(tknStr, mBuf);
3059 } /* end of cmUnpkTknStr132 */
3064 * Fun: cmUnpkTknStr256
3066 * Desc: This function packs a token string of size 4
3079 TknStr256 *tknStr, /* token string */
3080 Buffer *mBuf /* message buffer */
3083 S16 cmUnpkTknStr256(tknStr, mBuf)
3084 TknStr256 *tknStr; /* token string */
3085 Buffer *mBuf; /* message buffer */
3089 CMUNPKTKNSTR(tknStr, mBuf);
3093 } /* end of cmUnpkTknStr256 */
3100 * Desc: This function packs a Object Identifier token
3113 TknOid *tknOid, /* Object Identifier token */
3114 Buffer *mBuf /* message buffer */
3117 S16 cmUnpkTknOid(tknOid, mBuf)
3118 TknOid *tknOid; /* Object Identifier token */
3119 Buffer *mBuf; /* message buffer */
3125 /* Unpack the token header */
3126 CMCHKUNPK(oduPackUInt8, &tknOid->pres, mBuf);
3128 if (tknOid->pres == TRUE)
3130 /* Unpack the length */
3131 CMCHKUNPK(oduPackUInt8, &tknOid->len, mBuf);
3133 /* Pack the value */
3134 for (i = 1; i <= (uint16_t)tknOid->len; i++)
3136 /* cm_gen_c_001.main_33: changes for TknOid value from uint16_t to uint32_t
3137 * with compilation flag TKNOID_UINT16 */
3138 #ifndef TKNOID_UINT16
3139 CMCHKUNPK(oduPackUInt32, &tknOid->val[tknOid->len - i], mBuf);
3141 CMCHKUNPK(oduPackUInt16, &tknOid->val[tknOid->len - i], mBuf);
3142 #endif /* !TKNOID_UINT16 */
3147 } /* end of cmUnpkTknOid */
3154 * Desc: This function unpacks a token S32
3167 TknS32 *tknS32, /* token S32 */
3168 Buffer *mBuf /* message buffer */
3171 S16 cmUnpkTknS32(tknS32, mBuf)
3172 TknS32 *tknS32; /* token S32 */
3173 Buffer *mBuf; /* message buffer */
3178 CMCHKUNPK(oduPackUInt8, &tknS32->pres, mBuf);
3183 CMCHKUNPK(SUnpkS32, &tknS32->val, mBuf);
3187 } /* end of cmUnpkTknS32 */
3194 * Desc: This function is used to Unpack Header structure
3207 Header *header, /* header structure */
3208 Buffer *mBuf /* message buffer */
3211 S16 cmUnpkHeader(header, mBuf)
3212 Header *header; /* header structure */
3213 Buffer *mBuf; /* message buffer */
3217 CMCHKUNPK(oduPackUInt16, &header->msgLen, mBuf);
3218 CMCHKUNPK(oduPackUInt8, &header->msgType, mBuf);
3219 CMCHKUNPK(oduPackUInt8, &header->version, mBuf);
3220 CMCHKUNPK(oduPackUInt16, &header->seqNmb, mBuf);
3221 CMCHKUNPK(cmUnpkEntityId, &header->entId, mBuf);
3222 CMCHKUNPK(cmUnpkElmntId, &header->elmId, mBuf);
3224 CMCHKUNPK(cmUnpkTranId, &header->transId, mBuf);
3225 CMCHKUNPK(cmUnpkSelector, &header->response.selector, mBuf);
3226 CMCHKUNPK(cmUnpkPriority, &header->response.prior, mBuf);
3227 CMCHKUNPK(cmUnpkRoute, &header->response.route, mBuf);
3228 CMCHKUNPK(cmUnpkMemoryId, &header->response.mem, mBuf);
3232 } /* end of cmUnpkHeader */
3237 * Fun: cmUnpkCmStatus
3239 * Desc: This function unpacks common management status structure
3252 CmStatus *sta, /* status structure */
3253 Buffer *mBuf /* message buffer */
3256 S16 cmUnpkCmStatus(sta, mBuf)
3257 CmStatus *sta; /* status structure */
3258 Buffer *mBuf; /* message buffer */
3262 CMCHKUNPK(oduPackUInt16, &sta->status, mBuf);
3263 CMCHKUNPK(oduPackUInt16, &sta->reason, mBuf);
3266 } /* end of cmUnpkCmStatus */
3271 * Fun: cmUnpkCmAlarm
3273 * Desc: This function unpacks common management alarm structure
3286 CmAlarm *alarm, /* alarm structure */
3287 Buffer *mBuf /* message buffer */
3290 S16 cmUnpkCmAlarm(alarm, mBuf)
3291 CmAlarm *alarm; /* alarm structure */
3292 Buffer *mBuf; /* message buffer */
3296 CMCHKUNPK(cmUnpkDateTime, &alarm->dt, mBuf);
3297 CMCHKUNPK(oduPackUInt16, &alarm->category, mBuf);
3298 CMCHKUNPK(oduPackUInt16, &alarm->event, mBuf);
3299 CMCHKUNPK(oduPackUInt16, &alarm->cause, mBuf);
3302 } /* end of cmUnpkCmAlarm */
3309 * Desc: This function unpacks the stack manager structure
3322 SmCfg *smCfg, /* stack manager */
3323 Buffer *mBuf /* message buffer */
3326 S16 cmUnpkSmCfg(smCfg, mBuf)
3327 SmCfg *smCfg; /* stack manager */
3328 Buffer *mBuf; /* message buffer */
3332 CMCHKUNPK(cmUnpkEnt, &smCfg->ent, mBuf);
3333 CMCHKUNPK(cmUnpkInst, &smCfg->inst, mBuf);
3334 CMCHKUNPK(cmUnpkRegion, &smCfg->region, mBuf);
3335 CMCHKUNPK(cmUnpkPool, &smCfg->pool, mBuf);
3336 CMCHKUNPK(cmUnpkPrior, &smCfg->prior, mBuf);
3337 CMCHKUNPK(cmUnpkRoute, &smCfg->route, mBuf);
3338 CMCHKUNPK(cmUnpkSelector, &smCfg->selector, mBuf);
3341 } /* end of cmUnpkSmCfg */
3348 * Desc: This function unpacks the timer configuration structure
3361 TmrCfg *tmrCfg, /* timer configuration */
3362 Buffer *mBuf /* message buffer */
3365 S16 cmUnpkTmrCfg(tmrCfg, mBuf)
3366 TmrCfg *tmrCfg; /* timer configuration */
3367 Buffer *mBuf; /* message buffer */
3371 CMCHKUNPK(oduUnpackBool, &tmrCfg->enb, mBuf);
3372 CMCHKUNPK(oduPackUInt16, &tmrCfg->val, mBuf);
3375 } /* end of cmUnpkTmrCfg */
3381 * Desc: This function unpacks a token buffer
3394 TknBuf *tknBuf, /* token string */
3395 Buffer **tBuf /* message buffer */
3398 S16 cmUnpkTknBuf(tknBuf, tBuf)
3399 TknBuf *tknBuf; /* token string */
3400 Buffer **tBuf; /* message buffer */
3410 CMCHKUNPK(oduPackUInt8, &tknBuf->pres, mBuf);
3414 MsgLen msgLen, buflen;
3415 Region region; /* region */
3416 Pool pool; /* pool */
3418 cmUnpkMsgLen(&msgLen, mBuf);
3419 SFndLenMsg(mBuf, &buflen);
3420 if (buflen > msgLen)
3422 if( SSegMsg(mBuf, msgLen, &tknBuf->val) != ROK )
3429 /* Allocate the buffer for tknbuf->val */
3430 SGetBufRegionPool(mBuf, ®ion, &pool);
3431 SGetMsg(region, pool, &(tknBuf->val));
3434 /* now Swap the two Buffer pointers */
3435 SSwapMsg(mBuf,tknBuf->val);
3442 } /* end of cmUnpkTknBuf */
3444 #ifdef TDS_ROLL_UPGRADE_SUPPORT
3449 * Desc: This function unpacks the interface information
3462 CmIntf *intf, /* interface info */
3463 Buffer *mBuf /* message buffer */
3466 S16 cmUnpkIntf(intf, mBuf)
3467 CmIntf *intf; /* interface info */
3468 Buffer *mBuf; /* message buffer */
3472 CMCHKUNPK(cmUnpkIntfVer, &intf->intfVer, mBuf);
3473 CMCHKUNPK(cmUnpkIntfId, &intf->intfId, mBuf);
3476 } /* end of cmUnpkIntf */
3477 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
3483 * Desc: This function return the transaction ID used for interface transactions
3490 uint16_t getTransId()
3492 gTransId = (gTransId%65535) + 1;
3495 /**********************************************************************
3497 **********************************************************************/