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 */
78 /* private variable declarations */
82 * common packing functions
90 * Desc: This function packs the Date Time structure
101 PUBLIC S16 cmPkDateTime
103 DateTime *dateTime, /* date and time */
104 Buffer *mBuf /* message buffer */
107 PUBLIC S16 cmPkDateTime(dateTime, mBuf)
108 DateTime *dateTime; /* date and time */
109 Buffer *mBuf; /* message buffer */
114 /*-- cm_gen_c_001.main_36 - added for micro seconds --*/
115 #ifdef SS_DATETIME_USEC
116 CMCHKPK(SPkU32, dateTime->usec, mBuf);
117 #endif /*-- SS_DATETIME_USEC --*/
118 CMCHKPK(SPkU8, dateTime->tenths, mBuf);
119 CMCHKPK(SPkU8, dateTime->sec, mBuf);
120 CMCHKPK(SPkU8, dateTime->min, mBuf);
121 CMCHKPK(SPkU8, dateTime->hour, mBuf);
122 CMCHKPK(SPkU8, dateTime->year, mBuf);
123 CMCHKPK(SPkU8, dateTime->day, mBuf);
124 CMCHKPK(SPkU8, dateTime->month, mBuf);
127 } /* end of cmPkDateTime */
134 * Desc: This function packs the Duration structure
145 PUBLIC S16 cmPkDuration
147 Duration *duration, /* duration */
148 Buffer *mBuf /* message buffer */
151 PUBLIC S16 cmPkDuration(duration, mBuf)
152 Duration *duration; /* duration */
153 Buffer *mBuf; /* message buffer */
158 CMCHKPK(SPkU8, duration->tenths, mBuf);
159 CMCHKPK(SPkU8, duration->secs, mBuf);
160 CMCHKPK(SPkU8, duration->mins, mBuf);
161 CMCHKPK(SPkU8, duration->hours, mBuf);
162 CMCHKPK(SPkU8, duration->days, mBuf);
165 } /* end of cmPkDuration */
171 * Desc: This function packs the pointer
184 PTR ptr, /* pointer */
185 Buffer *mBuf /* message buffer */
188 PUBLIC S16 cmPkPtr(ptr, mBuf)
189 PTR ptr; /* pointer */
190 Buffer *mBuf; /* message buffer */
193 Data pkArray[PTRSIZE]; /* array for packing */
194 S16 ret; /* return code */
195 U16 tmp; /* temporary value */
197 #if (defined(ALPHA) || defined(BIT_64))
207 #ifndef FCSPKINT /* backward compatibility, packing order */
208 pkArray[0] = (Data) GetHiByte(ptr);
209 pkArray[1] = (Data) GetLoByte(ptr);
210 #else /* forward compatibility, packing order */
211 pkArray[1] = (Data) GetHiByte(ptr);
212 pkArray[0] = (Data) GetLoByte(ptr);
214 ret = SAddPreMsgMult(pkArray, (MsgLen) 2, mBuf);
218 #ifndef FCSPKINT /* backward compatibility, packing order */
219 tmp = (U16) GetHiWord(ptr);
220 pkArray[0] = (Data) GetHiByte(tmp);
221 pkArray[1] = (Data) GetLoByte(tmp);
222 tmp = (U16) GetLoWord(ptr);
223 pkArray[2] = (Data) GetHiByte(tmp);
224 pkArray[3] = (Data) GetLoByte(tmp);
225 #else /* forward compatibility, packing order */
226 tmp = (U16) GetHiWord(ptr);
227 pkArray[3] = (Data) GetHiByte(tmp);
228 pkArray[2] = (Data) GetLoByte(tmp);
229 tmp = (U16) GetLoWord(ptr);
230 pkArray[1] = (Data) GetHiByte(tmp);
231 pkArray[0] = (Data) GetLoByte(tmp);
233 ret = SAddPreMsgMult(pkArray, (MsgLen) 4, mBuf);
237 #if (defined(ALPHA) || defined(BIT_64))
238 #ifndef FCSPKINT /* backward compatibility, packing order */
239 tmp32 = (U32) GetHi32Bit(ptr);
240 tmp = (U16) GetHiWord(tmp32);
241 pkArray[0] = (Data) GetHiByte(tmp);
242 pkArray[1] = (Data) GetLoByte(tmp);
243 tmp = (U16) GetLoWord(tmp32);
244 pkArray[2] = (Data) GetHiByte(tmp);
245 pkArray[3] = (Data) GetLoByte(tmp);
246 tmp32 = (U32) GetLo32Bit(ptr);
247 tmp = (U16) GetHiWord(tmp32);
248 pkArray[4] = (Data) GetHiByte(tmp);
249 pkArray[5] = (Data) GetLoByte(tmp);
250 tmp = (U16) GetLoWord(tmp32);
251 pkArray[6] = (Data) GetHiByte(tmp);
252 pkArray[7] = (Data) GetLoByte(tmp);
253 #else /* forward compatibility, packing order */
254 tmp32 = (U32) GetHi32Bit(ptr);
255 tmp = (U16) GetHiWord(tmp32);
256 pkArray[7] = (Data) GetHiByte(tmp);
257 pkArray[6] = (Data) GetLoByte(tmp);
258 tmp = (U16) GetLoWord(tmp32);
259 pkArray[5] = (Data) GetHiByte(tmp);
260 pkArray[4] = (Data) GetLoByte(tmp);
261 tmp32 = (U32) GetLo32Bit(ptr);
262 tmp = (U16) GetHiWord(tmp32);
263 pkArray[3] = (Data) GetHiByte(tmp);
264 pkArray[2] = (Data) GetLoByte(tmp);
265 tmp = (U16) GetLoWord(tmp32);
266 pkArray[1] = (Data) GetHiByte(tmp);
267 pkArray[0] = (Data) GetLoByte(tmp);
269 ret = SAddPreMsgMult(pkArray, (MsgLen) 8, mBuf);
273 /* no support for U64 */
278 } /* end of cmPkPtr */
285 * Desc: This function packs the EntityId structure
296 PUBLIC S16 cmPkEntityId
298 EntityId *entityId, /* entity id */
299 Buffer *mBuf /* message buffer */
302 PUBLIC S16 cmPkEntityId(entityId, mBuf)
303 EntityId *entityId; /* entity id */
304 Buffer *mBuf; /* message buffer */
309 CMCHKPK(cmPkInst, entityId->inst, mBuf);
310 CMCHKPK(cmPkEnt, entityId->ent, mBuf);
313 } /* end of cmPkEntityId */
320 * Desc: This function packs the ElmntId structure
331 PUBLIC S16 cmPkElmntId
333 ElmntId *elmntId, /* element id */
334 Buffer *mBuf /* message buffer */
337 PUBLIC S16 cmPkElmntId(elmntId, mBuf)
338 ElmntId *elmntId; /* element id */
339 Buffer *mBuf; /* message buffer */
344 CMCHKPK(cmPkElmntInst3, elmntId->elmntInst3, mBuf);
345 CMCHKPK(cmPkElmntInst2, elmntId->elmntInst2, mBuf);
346 CMCHKPK(cmPkElmntInst1, elmntId->elmntInst1, mBuf);
347 CMCHKPK(cmPkElmnt, elmntId->elmnt, mBuf);
350 } /* end of cmPkElmntId */
357 * Desc: This function packs the MemoryId structure
368 PUBLIC S16 cmPkMemoryId
370 MemoryId *memoryId, /* memoryId */
371 Buffer *mBuf /* message buffer */
374 PUBLIC S16 cmPkMemoryId(memoryId, mBuf)
375 MemoryId *memoryId; /* memoryId */
376 Buffer *mBuf; /* message buffer */
381 CMCHKPK(cmPkPool, memoryId->pool, mBuf);
382 CMCHKPK(cmPkRegion, memoryId->region, mBuf);
385 } /* end of cmPkMemoryId */
392 * Desc: This function packs the System Id structure
403 PUBLIC S16 cmPkSystemId
405 SystemId *systemId, /* system id */
406 Buffer *mBuf /* message buffer */
409 PUBLIC S16 cmPkSystemId(systemId, mBuf)
410 SystemId *systemId; /* system id */
411 Buffer *mBuf; /* message buffer */
414 Txt *p; /* part number string */
418 for (p = systemId->ptNmb; *p; p++);
420 for (; p != systemId->ptNmb; p--)
422 CMCHKPK(cmPkTxt, *p, mBuf);
424 CMCHKPK(cmPkTxt, *p, mBuf);
426 CMCHKPK(SPkS16, systemId->bRev, mBuf);
427 CMCHKPK(SPkS16, systemId->bVer, mBuf);
428 CMCHKPK(SPkS16, systemId->mRev, mBuf);
429 CMCHKPK(SPkS16, systemId->mVer, mBuf);
432 } /* end of cmPkSystemId */
440 * Desc: This function will pack protocol address.
442 * Ret: ROK on success
452 PUBLIC S16 cmPkProtAddr
454 ProtAddr *pAddr, /* protocol address */
455 Buffer *mBuf /* buffer */
458 PUBLIC S16 cmPkProtAddr(pAddr, mBuf)
459 ProtAddr *pAddr; /* protocol address */
460 Buffer *mBuf; /* buffer */
468 CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);
469 CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);
472 for (j = pAddr->len; j; j--)
473 CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);
475 CMCHKPK(SPkU8, pAddr->preLen, mBuf);
476 CMCHKPK(SPkU8, pAddr->len, mBuf);
477 CMCHKPK(SPkU16, pAddr->protType, mBuf);
481 } /* end of cmPkProtAddr */
487 * Fun: cmPkProtAddrTbl
489 * Desc: This function will pack protocol addresses.
491 * Ret: ROK on success
501 PUBLIC S16 cmPkProtAddrTbl
503 ProtAddrTbl *protAddr, /* protocol address table */
504 Buffer *mBuf /* buffer */
507 PUBLIC S16 cmPkProtAddrTbl(protAddr, mBuf)
508 ProtAddrTbl *protAddr; /* protocol address table */
509 Buffer *mBuf; /* buffer */
514 ProtAddr *pAddr; /* protocol Address */
516 TRC3(cmPkProtAddrTbl)
518 if (protAddr->count > MAX_PROT_ADDRS)
521 for (i = protAddr->count; i; i--)
523 pAddr = &(protAddr->addr[i - 1]);
526 CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);
527 CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);
530 for (j = pAddr->len; j; j--)
531 CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);
533 CMCHKPK(SPkU8, pAddr->preLen, mBuf);
534 CMCHKPK(SPkU8, pAddr->len, mBuf);
535 CMCHKPK(SPkU16, pAddr->protType, mBuf);
538 CMCHKPK(SPkU8, protAddr->count, mBuf);
541 } /* end of cmPkProtAddrTbl */
548 * Desc: This function packs the address structure for a loosely
562 Addrs *addrs, /* address */
563 Buffer *mBuf /* message buffer */
566 PUBLIC S16 cmPkAddrs(addrs, mBuf)
567 Addrs *addrs; /* address */
568 Buffer *mBuf; /* message buffer */
571 U8 i; /* loop counter */
575 if (addrs->length > ADRLEN)
578 for (i = addrs->length; i; i--)
580 CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
583 CMCHKPK(SPkU8, addrs->length, mBuf);
586 } /* end of cmPkAddrs */
593 * Desc: This function packs the short address structure for a loosely
605 PUBLIC S16 cmPkShrtAddrs
607 ShrtAddrs *addrs, /* address */
608 Buffer *mBuf /* message buffer */
611 PUBLIC S16 cmPkShrtAddrs(addrs, mBuf)
612 ShrtAddrs *addrs; /* address */
613 Buffer *mBuf; /* message buffer */
616 U8 i; /* loop counter */
620 if (addrs->length > SHRTADRLEN)
623 for (i = addrs->length; i; i--)
625 CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
628 CMCHKPK(SPkU8, addrs->length, mBuf);
631 } /* end of cmPkShrtAddrs */
638 * Desc: This function address mask array.
649 PUBLIC S16 cmPkAddrMask
651 U8 *mask, /* pointer to address mask array */
652 Buffer *mBuf /* message buffer */
655 PUBLIC S16 cmPkAddrMask(mask, mBuf)
656 U8 *mask; /* pointer to address mask array */
657 Buffer *mBuf; /* message buffer */
664 /* pack address mask */
665 for (i = (ADRLEN - 1); i >= 0; i--)
667 CMCHKPK(SPkU8, mask[i], mBuf);
671 } /* end of cmPkAddrMask */
678 * Desc: This function packs the BndCfg structure
689 PUBLIC S16 cmPkBndCfg
691 BndCfg *bndCfg, /* bndCfg */
692 Buffer *mBuf /* message buffer */
695 PUBLIC S16 cmPkBndCfg(bndCfg, mBuf)
696 BndCfg *bndCfg; /* bndCfg */
697 Buffer *mBuf; /* message buffer */
700 Txt *p; /* temporary */
704 CMCHKPK(cmPkSelector, bndCfg->selector, mBuf);
705 CMCHKPK(cmPkAddrs, &bndCfg->sapAdr, mBuf);
706 CMCHKPK(cmPkRoute, bndCfg->route, mBuf);
707 CMCHKPK(cmPkPrior, bndCfg->prior, mBuf);
708 CMCHKPK(cmPkPool, bndCfg->pool, mBuf);
709 CMCHKPK(cmPkRegion, bndCfg->region, mBuf);
710 CMCHKPK(cmPkInst, bndCfg->inst, mBuf);
711 CMCHKPK(cmPkEnt, bndCfg->ent, mBuf);
712 CMCHKPK(SPkU8, bndCfg->wdw, mBuf);
713 CMCHKPK(SPkU8, bndCfg->flcTyp, mBuf);
714 CMCHKPK(SPkU8, bndCfg->bufOwnshp, mBuf);
716 for (p = bndCfg->usrId; *p; p++);
717 for (; p != bndCfg->usrId; p--);
718 CMCHKPK(cmPkTxt, *p, mBuf);
721 } /* end of cmPkBndCfg */
728 * Desc: pack post structure
744 PUBLIC S16 cmPkPst(pst, mBuf)
751 CMCHKPK(cmPkEvent, pst->event, mBuf);
752 CMCHKPK(cmPkInst, pst->srcInst, mBuf);
753 CMCHKPK(cmPkEnt, pst->srcEnt, mBuf);
754 CMCHKPK(cmPkProcId, pst->srcProcId, mBuf);
755 CMCHKPK(cmPkInst, pst->dstInst, mBuf);
756 CMCHKPK(cmPkEnt, pst->dstEnt, mBuf);
757 CMCHKPK(cmPkProcId, pst->dstProcId, mBuf);
758 CMCHKPK(cmPkRoute, pst->route, mBuf);
759 CMCHKPK(cmPkPrior, pst->prior, mBuf);
760 CMCHKPK(cmPkPool, pst->pool, mBuf);
761 CMCHKPK(cmPkRegion, pst->region, mBuf);
762 CMCHKPK(cmPkSelector, pst->selector, mBuf);
763 #ifdef TDS_ROLL_UPGRADE_SUPPORT
764 CMCHKPK(cmPkIntfVer, pst->intfVer, mBuf);
768 } /* end of cmPkPst */
774 * Desc: Pack element header
785 PUBLIC S16 cmPkElmtHdr
787 ElmtHdr *m, /* element header */
788 Buffer *mBuf /* message buffer */
791 PUBLIC S16 cmPkElmtHdr(m, mBuf)
792 ElmtHdr *m; /* element header */
793 Buffer *mBuf; /* message buffer */
798 #if (LCAMT || ATM_BISUP)
799 CMCHKPK(SPkU16, m->compInd, mBuf);
800 #endif /* LCAMT || ATM_BISUP */
802 #if (LCAMT || ATM_BISUP)
803 /* Pack action indicator field */
806 CMCHKPK(SPkU8, m->actnInd, mBuf);
811 CMCHKPK(cmPkBool, m->pres, mBuf);
814 } /* end of cmPkElmtHdr */
821 * Desc: This function packs a token U8
834 TknU8 *tknU8, /* token U8 */
835 Buffer *mBuf /* message buffer */
838 PUBLIC S16 cmPkTknU8(tknU8, mBuf)
839 TknU8 *tknU8; /* token U8 */
840 Buffer *mBuf; /* message buffer */
848 CMCHKPK(SPkU8, tknU8->val, mBuf);
852 CMCHKPK(SPkU8, tknU8->pres, mBuf);
855 } /* end of cmPkTknU8 */
862 * Desc: This function packs a token S8
875 TknS8 *tknS8, /* token S8 */
876 Buffer *mBuf /* message buffer */
879 PUBLIC S16 cmPkTknS8(tknS8, mBuf)
880 TknS8 *tknS8; /* token S8 */
881 Buffer *mBuf; /* message buffer */
889 CMCHKPK(SPkS8, tknS8->val, mBuf);
893 CMCHKPK(SPkU8, tknS8->pres, mBuf);
896 } /* end of cmPkTknS8 */
903 * Desc: This function packs a token U16
914 PUBLIC S16 cmPkTknU16
916 TknU16 *tknU16, /* token U16 */
917 Buffer *mBuf /* message buffer */
920 PUBLIC S16 cmPkTknU16(tknU16, mBuf)
921 TknU16 *tknU16; /* token U16 */
922 Buffer *mBuf; /* message buffer */
930 CMCHKPK(SPkU16, tknU16->val, mBuf);
934 CMCHKPK(SPkU8, tknU16->pres, mBuf);
937 } /* end of cmPkTknU16 */
944 * Desc: This function packs a token U32
955 PUBLIC S16 cmPkTknU32
957 TknU32 *tknU32, /* token U32 */
958 Buffer *mBuf /* message buffer */
961 PUBLIC S16 cmPkTknU32(tknU32, mBuf)
962 TknU32 *tknU32; /* token U32 */
963 Buffer *mBuf; /* message buffer */
971 CMCHKPK(SPkU32, tknU32->val, mBuf);
975 CMCHKPK(SPkU8, tknU32->pres, mBuf);
978 } /* end of cmPkTknU32 */
985 * Desc: This function packs a token string - regular size
996 PUBLIC S16 cmPkTknStr
998 TknStr *tknStr, /* token string */
999 Buffer *mBuf /* message buffer */
1002 PUBLIC S16 cmPkTknStr(tknStr, mBuf)
1003 TknStr *tknStr; /* token string */
1004 Buffer *mBuf; /* message buffer */
1007 Cntr i; /* counter */
1014 for (i = 0; i < (S16) tknStr->len; i++)
1016 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1020 CMCHKPK(SPkU8, tknStr->len, mBuf);
1024 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1027 } /* end of cmPkTknStr */
1034 * Desc: This function packs a token string - medium size
1045 PUBLIC S16 cmPkTknStrM
1047 TknStrM *tknStr, /* token string */
1048 Buffer *mBuf /* message buffer */
1051 PUBLIC S16 cmPkTknStrM(tknStr, mBuf)
1052 TknStrM *tknStr; /* token string */
1053 Buffer *mBuf; /* message buffer */
1056 Cntr i; /* counter */
1063 for (i = 0; i < (S16) tknStr->len; i++)
1065 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1069 CMCHKPK(SPkU8, tknStr->len, mBuf);
1073 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1076 } /* end of cmPkTknStrM */
1083 * Desc: This function packs a token string - small size
1094 PUBLIC S16 cmPkTknStrS
1096 TknStrS *tknStr, /* token string */
1097 Buffer *mBuf /* message buffer */
1100 PUBLIC S16 cmPkTknStrS(tknStr, mBuf)
1101 TknStrS *tknStr; /* token string */
1102 Buffer *mBuf; /* message buffer */
1105 Cntr i; /* counter */
1112 for (i = 0; i < (S16) tknStr->len; i++)
1114 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1118 CMCHKPK(SPkU8, tknStr->len, mBuf);
1122 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1125 } /* end of cmPkTknStrS */
1132 * Desc: This function packs a token string - extended size
1143 PUBLIC S16 cmPkTknStrE
1145 TknStrE *tknStr, /* token string */
1146 Buffer *mBuf /* message buffer */
1149 PUBLIC S16 cmPkTknStrE(tknStr, mBuf)
1150 TknStrE *tknStr; /* token string */
1151 Buffer *mBuf; /* message buffer */
1154 Cntr i; /* counter */
1161 for (i = 0; i < (S16) tknStr->len; i++)
1163 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1167 CMCHKPK(SPkU8, tknStr->len, mBuf);
1171 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1174 } /* end of cmPkTknStrE */
1176 #ifndef CMFILE_REORG_1
1183 * Desc: This function packs a PnNodeId structure into a buffer
1194 PUBLIC S16 cmPkPnNodeId
1196 PnNodeId *src, /* source PNNI Node Id */
1197 Buffer *mBuf /* message buffer */
1200 PUBLIC S16 cmPkPnNodeId (src, mBuf)
1201 PnNodeId *src; /* source PNNI Node Id */
1202 Buffer *mBuf; /* message buffer */
1209 for (i = PN_NODEID_LEN - 1; i >= 0; i--)
1211 CMCHKPK(SPkU8, src->id[i], mBuf);
1215 } /* cmPkPnNodeId */
1217 #endif /* CMFILE_REORG_1 */
1224 * Desc: This function packs a token string of size 4
1235 PUBLIC S16 cmPkTknStr4
1237 TknStr4 *tknStr, /* token string */
1238 Buffer *mBuf /* message buffer */
1241 PUBLIC S16 cmPkTknStr4(tknStr, mBuf)
1242 TknStr4 *tknStr; /* token string */
1243 Buffer *mBuf; /* message buffer */
1248 CMPKTKNSTR(tknStr, mBuf);
1252 } /* end of cmPkTknStr4 */
1260 * Desc: This function packs a token string of size 4
1271 PUBLIC S16 cmPkTknStr12
1273 TknStr12 *tknStr, /* token string */
1274 Buffer *mBuf /* message buffer */
1277 PUBLIC S16 cmPkTknStr12(tknStr, mBuf)
1278 TknStr12 *tknStr; /* token string */
1279 Buffer *mBuf; /* message buffer */
1284 CMPKTKNSTR(tknStr, mBuf);
1288 } /* end of cmPkTknStr12 */
1295 * Desc: This function packs a token string of size 4
1306 PUBLIC S16 cmPkTknStr32
1308 TknStr32 *tknStr, /* token string */
1309 Buffer *mBuf /* message buffer */
1312 PUBLIC S16 cmPkTknStr32(tknStr, mBuf)
1313 TknStr32 *tknStr; /* token string */
1314 Buffer *mBuf; /* message buffer */
1319 CMPKTKNSTR(tknStr, mBuf);
1323 } /* end of cmPkTknStr32 */
1330 * Desc: This function packs a token string of size 4
1341 PUBLIC S16 cmPkTknStr64
1343 TknStr64 *tknStr, /* token string */
1344 Buffer *mBuf /* message buffer */
1347 PUBLIC S16 cmPkTknStr64(tknStr, mBuf)
1348 TknStr64 *tknStr; /* token string */
1349 Buffer *mBuf; /* message buffer */
1354 CMPKTKNSTR(tknStr, mBuf);
1358 } /* end of cmPkTknStr64 */
1363 * Fun: cmPkTknStr132
1365 * Desc: This function packs a token string of size 4
1376 PUBLIC S16 cmPkTknStr132
1378 TknStr132 *tknStr, /* token string */
1379 Buffer *mBuf /* message buffer */
1382 PUBLIC S16 cmPkTknStr132(tknStr, mBuf)
1383 TknStr132 *tknStr; /* token string */
1384 Buffer *mBuf; /* message buffer */
1389 CMPKTKNSTR(tknStr, mBuf);
1393 } /* end of cmPkTknStr132 */
1398 * Fun: cmPkTknStr256
1400 * Desc: This function packs a token string of size 4
1411 PUBLIC S16 cmPkTknStr256
1413 TknStr256 *tknStr, /* token string */
1414 Buffer *mBuf /* message buffer */
1417 PUBLIC S16 cmPkTknStr256(tknStr, mBuf)
1418 TknStr256 *tknStr; /* token string */
1419 Buffer *mBuf; /* message buffer */
1424 CMPKTKNSTR(tknStr, mBuf);
1428 } /* end of cmPkTknStr256 */
1435 * Desc: This function packs a Object Identifier token
1446 PUBLIC S16 cmPkTknOid
1448 TknOid *tknOid, /* Object Identifier token */
1449 Buffer *mBuf /* message buffer */
1452 PUBLIC S16 cmPkTknOid(tknOid, mBuf)
1453 TknOid *tknOid; /* Object Identifier token */
1454 Buffer *mBuf; /* message buffer */
1461 if (tknOid->pres == TRUE)
1463 /* Pack the value */
1464 for (i = 0; i < (U16)tknOid->len; i++)
1466 /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
1467 * with compilation flag TKNOID_U16 */
1469 CMCHKPK(SPkU32, tknOid->val[i], mBuf);
1471 CMCHKPK(SPkU16, tknOid->val[i], mBuf);
1472 #endif /* !TKNOID_U16 */
1474 /* Pack the length */
1475 CMCHKPK(SPkU8, tknOid->len, mBuf);
1477 /* Pack the token header */
1478 CMCHKPK(SPkU8, tknOid->pres, mBuf);
1481 } /* end of cmPkTknOid */
1488 * Desc: This function packs a token S32
1499 PUBLIC S16 cmPkTknS32
1501 TknS32 *tknS32, /* token S32 */
1502 Buffer *mBuf /* message buffer */
1505 PUBLIC S16 cmPkTknS32(tknS32, mBuf)
1506 TknS32 *tknS32; /* token S32 */
1507 Buffer *mBuf; /* message buffer */
1515 CMCHKPK(SPkS32, tknS32->val, mBuf);
1519 CMCHKPK(SPkU8, tknS32->pres, mBuf);
1522 } /* end of cmPkTknS32 */
1529 * Desc: This function packs the header structure
1540 PUBLIC S16 cmPkHeader
1542 Header *header, /* header */
1543 Buffer *mBuf /* message buffer */
1546 PUBLIC S16 cmPkHeader(header, mBuf)
1547 Header *header; /* header */
1548 Buffer *mBuf; /* message buffer */
1554 CMCHKPK(cmPkMemoryId, &header->response.mem, mBuf);
1555 CMCHKPK(cmPkRoute, header->response.route, mBuf);
1556 CMCHKPK(cmPkPriority, header->response.prior, mBuf);
1557 CMCHKPK(cmPkSelector, header->response.selector, mBuf);
1558 CMCHKPK(cmPkTranId, header->transId, mBuf);
1560 CMCHKPK(cmPkElmntId, &header->elmId, mBuf);
1561 CMCHKPK(cmPkEntityId, &header->entId, mBuf);
1562 CMCHKPK(SPkU16, header->seqNmb, mBuf);
1563 CMCHKPK(SPkU8, header->version, mBuf);
1564 CMCHKPK(SPkU8, header->msgType, mBuf);
1565 CMCHKPK(SPkU16, header->msgLen, mBuf);
1568 } /* end of cmPkHeader */
1575 * Desc: This function packs common management status structure
1586 PUBLIC S16 cmPkCmStatus
1588 CmStatus *sta, /* status structure */
1589 Buffer *mBuf /* message buffer */
1592 PUBLIC S16 cmPkCmStatus(sta, mBuf)
1593 CmStatus *sta; /* status structure */
1594 Buffer *mBuf; /* message buffer */
1599 CMCHKPK(SPkU16, sta->reason, mBuf);
1600 CMCHKPK(SPkU16, sta->status, mBuf);
1603 } /* end of cmPkCmStatus */
1610 * Desc: This function packs common management alarm structure
1621 PUBLIC S16 cmPkCmAlarm
1623 CmAlarm *alarm, /* alarm structure */
1624 Buffer *mBuf /* message buffer */
1627 PUBLIC S16 cmPkCmAlarm(alarm, mBuf)
1628 CmAlarm *alarm; /* alarm structure */
1629 Buffer *mBuf; /* message buffer */
1634 CMCHKPK(SPkU16, alarm->cause, mBuf);
1635 CMCHKPK(SPkU16, alarm->event, mBuf);
1636 CMCHKPK(SPkU16, alarm->category, mBuf);
1637 CMCHKPK(cmPkDateTime, &alarm->dt, mBuf);
1640 } /* end of cmPkCmAlarm */
1647 * Desc: This function packs the stack manager structure
1658 PUBLIC S16 cmPkSmCfg
1660 SmCfg *smCfg, /* stack manager */
1661 Buffer *mBuf /* message buffer */
1664 PUBLIC S16 cmPkSmCfg(smCfg, mBuf)
1665 SmCfg *smCfg; /* stack manager */
1666 Buffer *mBuf; /* message buffer */
1671 CMCHKPK(cmPkSelector, smCfg->selector, mBuf);
1672 CMCHKPK(cmPkRoute, smCfg->route, mBuf);
1673 CMCHKPK(cmPkPrior, smCfg->prior, mBuf);
1674 CMCHKPK(cmPkPool, smCfg->pool, mBuf);
1675 CMCHKPK(cmPkRegion, smCfg->region, mBuf);
1676 CMCHKPK(cmPkInst, smCfg->inst, mBuf);
1677 CMCHKPK(cmPkEnt, smCfg->ent, mBuf);
1680 } /* end of cmPkSmCfg */
1687 * Desc: This function packs the timer configuration structure
1698 PUBLIC S16 cmPkTmrCfg
1700 TmrCfg *tmrCfg, /* timer configuration */
1701 Buffer *mBuf /* message buffer */
1704 PUBLIC S16 cmPkTmrCfg(tmrCfg, mBuf)
1705 TmrCfg *tmrCfg; /* timer configuration */
1706 Buffer *mBuf; /* message buffer */
1711 CMCHKPK(SPkU16, tmrCfg->val, mBuf);
1712 CMCHKPK(cmPkBool, tmrCfg->enb, mBuf);
1715 } /* end of cmPkTmrCfg */
1722 * Desc: This function packs a token buffer
1733 PUBLIC S16 cmPkTknBuf
1735 TknBuf *tknBuf, /* token string */
1736 Buffer *mBuf /* message buffer */
1739 PUBLIC S16 cmPkTknBuf(tknBuf, mBuf)
1740 TknBuf *tknBuf; /* token string */
1741 Buffer *mBuf; /* message buffer */
1750 SFndLenMsg(tknBuf->val, &msgLen);
1751 if( SCatMsg(mBuf, tknBuf->val, M2M1) != ROK )
1755 cmPkMsgLen(msgLen, mBuf);
1756 SPutMsg(tknBuf->val);
1760 CMCHKPK(SPkU8, tknBuf->pres, mBuf);
1763 } /* end of cmPkTknBuf */
1765 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1770 * Desc: This function packs the interface information
1783 CmIntf *intf, /* interface info */
1784 Buffer *mBuf /* message buffer */
1787 PUBLIC S16 cmPkIntf(intf, mBuf)
1788 CmIntf *intf; /* interface info */
1789 Buffer *mBuf; /* message buffer */
1794 CMCHKPK(cmPkIntfId, intf->intfId, mBuf);
1795 CMCHKPK(cmPkIntfVer, intf->intfVer, mBuf);
1798 } /* end of cmPkIntf */
1799 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
1803 * common unpacking functions
1809 * Fun: cmUnpkDateTime
1811 * Desc: This function is used to Unpack Pack Date Time structure
1822 PUBLIC S16 cmUnpkDateTime
1824 DateTime *dateTime, /* date/time structure */
1825 Buffer *mBuf /* message buffer */
1828 PUBLIC S16 cmUnpkDateTime(dateTime, mBuf)
1829 DateTime *dateTime; /* date/time structure */
1830 Buffer *mBuf; /* message buffer */
1835 CMCHKUNPK(SUnpkU8, &dateTime->month, mBuf);
1836 CMCHKUNPK(SUnpkU8, &dateTime->day, mBuf);
1837 CMCHKUNPK(SUnpkU8, &dateTime->year, mBuf);
1838 CMCHKUNPK(SUnpkU8, &dateTime->hour, mBuf);
1839 CMCHKUNPK(SUnpkU8, &dateTime->min, mBuf);
1840 CMCHKUNPK(SUnpkU8, &dateTime->sec, mBuf);
1841 CMCHKUNPK(SUnpkU8, &dateTime->tenths, mBuf);
1843 /*-- added for micro seconds --*/
1844 #ifdef SS_DATETIME_USEC
1845 CMCHKUNPK(SUnpkU32, &dateTime->usec, mBuf);
1846 #endif /*-- SS_DATETIME_USEC --*/
1849 } /* end of cmUnpkDateTime */
1854 * Fun: cmUnpkDuration
1856 * Desc: This function is used to Unpack Pack Duration structure
1867 PUBLIC S16 cmUnpkDuration
1869 Duration *duration, /* duration structure */
1870 Buffer *mBuf /* message buffer */
1873 PUBLIC S16 cmUnpkDuration(duration, mBuf)
1874 Duration *duration; /* duration structure */
1875 Buffer *mBuf; /* message buffer */
1880 CMCHKUNPK(SUnpkU8, &duration->days, mBuf);
1881 CMCHKUNPK(SUnpkU8, &duration->hours, mBuf);
1882 CMCHKUNPK(SUnpkU8, &duration->mins, mBuf);
1883 CMCHKUNPK(SUnpkU8, &duration->secs, mBuf);
1884 CMCHKUNPK(SUnpkU8, &duration->tenths, mBuf);
1887 } /* end of cmUnpkDuration */
1893 * Desc: This function is used to Unpack Ptr type
1904 PUBLIC S16 cmUnpkPtr
1906 PTR *ptr, /* duration structure */
1907 Buffer *mBuf /* message buffer */
1910 PUBLIC S16 cmUnpkPtr(ptr, mBuf)
1911 PTR *ptr; /* duration structure */
1912 Buffer *mBuf; /* message buffer */
1915 U16 tmp16; /* temporary value */
1916 U32 tmp32; /* temporary value */
1917 Data unpkArray[PTRSIZE]; /* unpacking array */
1918 S16 ret; /* return code */
1920 #if (defined(ALPHA) || defined(BIT_64))
1929 ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
1934 #ifndef FCSPKINT /* backward compatibility, packing order */
1935 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1936 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1937 #else /* forward compatibility, packing order */
1938 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1939 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1945 ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
1951 #ifndef FCSPKINT /* backward compatibility, packing order */
1952 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
1953 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
1954 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1955 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1956 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1957 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1958 #else /* forward compatibility, packing order */
1959 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1960 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1961 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1962 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
1963 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
1964 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1970 #if(defined(ALPHA) || defined(BIT_64))
1971 ret = SRemPreMsgMult(unpkArray, (MsgLen) 8, mBuf);
1978 #ifndef FCSPKINT /* backward compatibility, packing order */
1979 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[7]);
1980 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[6]);
1981 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1982 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[5]);
1983 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[4]);
1984 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1985 tmp64 = (U64) PutHi32Bit(tmp64, tmp32);
1986 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
1987 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
1988 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1989 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1990 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1991 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1992 tmp64 = (U64) PutLo32Bit(tmp64, tmp32);
1993 #else /* forward compatibility, packing order */
1994 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1995 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1996 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1997 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
1998 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
1999 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
2000 tmp64 = (U64) PutHi32Bit(tmp64, tmp32);
2001 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[4]);
2002 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[5]);
2003 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
2004 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[6]);
2005 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[7]);
2006 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
2007 tmp64 = (U64) PutLo32Bit(tmp64, tmp32);
2013 /* no support for U64 */
2018 } /* end of cmUnpkPtr */
2023 * Fun: cmUnpkEntityId
2025 * Desc: This function unpacks the EntityId structure
2036 PUBLIC S16 cmUnpkEntityId
2038 EntityId *entityId, /* entity id */
2039 Buffer *mBuf /* message buffer */
2042 PUBLIC S16 cmUnpkEntityId(entityId, mBuf)
2043 EntityId *entityId; /* entity id */
2044 Buffer *mBuf; /* message buffer */
2047 TRC2(cmUnpkEntityId)
2049 CMCHKUNPK(cmUnpkEnt, &entityId->ent, mBuf);
2050 CMCHKUNPK(cmUnpkInst, &entityId->inst, mBuf);
2053 } /* end of cmUnpkEntityId */
2058 * Fun: cmUnpkElmntId
2060 * Desc: This function unpacks the ElmntId structure
2071 PUBLIC S16 cmUnpkElmntId
2073 ElmntId *elmntId, /* element id */
2074 Buffer *mBuf /* message buffer */
2077 PUBLIC S16 cmUnpkElmntId(elmntId, mBuf)
2078 ElmntId *elmntId; /* element id */
2079 Buffer *mBuf; /* message buffer */
2084 CMCHKUNPK(cmUnpkElmnt, &elmntId->elmnt, mBuf);
2085 CMCHKUNPK(cmUnpkElmntInst1, &elmntId->elmntInst1, mBuf);
2086 CMCHKUNPK(cmUnpkElmntInst2, &elmntId->elmntInst2, mBuf);
2087 CMCHKUNPK(cmUnpkElmntInst3, &elmntId->elmntInst3, mBuf);
2090 } /* end of cmUnpkElmntId */
2095 * Fun: cmUnpkMemoryId
2097 * Desc: This function unpacks the MemoryId structure
2108 PUBLIC S16 cmUnpkMemoryId
2110 MemoryId *memoryId, /* memoryId */
2111 Buffer *mBuf /* message buffer */
2114 PUBLIC S16 cmUnpkMemoryId(memoryId, mBuf)
2115 MemoryId *memoryId; /* memoryId */
2116 Buffer *mBuf; /* message buffer */
2119 TRC2(cmUnpkMemoryId)
2121 CMCHKUNPK(cmUnpkRegion, &memoryId->region, mBuf);
2122 CMCHKUNPK(cmUnpkPool, &memoryId->pool, mBuf);
2125 } /* end of cmUnpkMemoryId */
2130 * Fun: cmUnpkSystemId
2132 * Desc: This function packs the System Id structure
2143 PUBLIC S16 cmUnpkSystemId
2145 SystemId *systemId, /* system id */
2146 Buffer *mBuf /* message buffer */
2149 PUBLIC S16 cmUnpkSystemId(systemId, mBuf)
2150 SystemId *systemId; /* system id */
2151 Buffer *mBuf; /* message buffer */
2154 S16 i; /* loop counter */
2157 TRC2(cmUnpkSystemId)
2159 CMCHKUNPK(SUnpkS16, &systemId->mVer, mBuf);
2160 CMCHKUNPK(SUnpkS16, &systemId->mRev, mBuf);
2161 CMCHKUNPK(SUnpkS16, &systemId->bVer, mBuf);
2162 CMCHKUNPK(SUnpkS16, &systemId->bRev, mBuf);
2164 SFndLenMsg(mBuf, &len);
2166 for (i = 0; i < len; i++)
2168 CMCHKUNPK(cmUnpkTxt, &systemId->ptNmb[i], mBuf);
2172 } /* end of cmUnpkSystemId */
2178 * Fun: cmUnpkProtAddr
2180 * Desc: This function will unpack protocol address.
2182 * Ret: ROK on success
2192 PUBLIC S16 cmUnpkProtAddr
2194 ProtAddr *pAddr, /* protocol address */
2195 Buffer *mBuf /* buffer */
2198 PUBLIC S16 cmUnpkProtAddr(pAddr, mBuf)
2199 ProtAddr *pAddr; /* protocol address table */
2200 Buffer *mBuf; /* buffer */
2205 TRC3(cmUnpkProtAddr)
2207 CMCHKUNPK(SUnpkU16, &(pAddr->protType), mBuf);
2208 CMCHKUNPK(SUnpkU8, &(pAddr->len), mBuf);
2209 CMCHKUNPK(SUnpkU8, &(pAddr->preLen), mBuf);
2211 for (j =0; j < pAddr->len; j++)
2212 CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);
2215 CMCHKUNPK(cmUnpkBool, &(pAddr->autoSysIdPres), mBuf);
2216 CMCHKUNPK(SUnpkU32, &(pAddr->autoSysId), mBuf);
2217 #endif /* CM_ARI2 */
2220 } /* end of cmUnpkProtAddr */
2225 * Fun: cmUnpkProtAddrTbl
2227 * Desc: This function will pack protocol addresses.
2229 * Ret: ROK on success
2239 PUBLIC S16 cmUnpkProtAddrTbl
2241 ProtAddrTbl *protAddr, /* protocol address table */
2242 Buffer *mBuf /* buffer */
2245 PUBLIC S16 cmUnpkProtAddrTbl(protAddr, mBuf)
2246 ProtAddrTbl *protAddr; /* protocol address table */
2247 Buffer *mBuf; /* buffer */
2252 ProtAddr *pAddr; /* Protocol Address */
2254 TRC3(cmUnpkProtAddrTbl)
2256 CMCHKUNPK(SUnpkU8, &protAddr->count, mBuf);
2257 for (i = 0; i < protAddr->count; i++)
2259 pAddr = &(protAddr->addr[i]);
2261 CMCHKUNPK(SUnpkU16, &(pAddr->protType), mBuf);
2262 CMCHKUNPK(SUnpkU8, &(pAddr->len), mBuf);
2263 CMCHKUNPK(SUnpkU8, &(pAddr->preLen), mBuf);
2266 for (j =0; j < pAddr->len; j++)
2267 CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);
2270 CMCHKUNPK(cmUnpkBool, &(pAddr->autoSysIdPres), mBuf);
2271 CMCHKUNPK(SUnpkU32, &(pAddr->autoSysId), mBuf);
2272 #endif /* CM_ARI2 */
2275 } /* end of cmUnpkProtAddrTbl */
2282 * Desc: This function is used to unpack the Addrs structure
2293 PUBLIC S16 cmUnpkAddrs
2295 Addrs *addrs, /* address */
2296 Buffer *mBuf /* message buffer */
2299 PUBLIC S16 cmUnpkAddrs(addrs, mBuf)
2300 Addrs *addrs; /* address */
2301 Buffer *mBuf; /* message buffer */
2304 U8 i; /* loop counter */
2308 CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2310 if (addrs->length > ADRLEN)
2313 for(i = 0; i < addrs->length; i++)
2315 CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2319 } /* end of cmUnpkAddrs */
2323 * Fun: cmUnpkShrtAddrs
2325 * Desc: This function is used to unpack the ShrtAddrs structure
2336 PUBLIC S16 cmUnpkShrtAddrs
2338 ShrtAddrs *addrs, /* address */
2339 Buffer *mBuf /* message buffer */
2342 PUBLIC S16 cmUnpkShrtAddrs(addrs, mBuf)
2343 ShrtAddrs *addrs; /* address */
2344 Buffer *mBuf; /* message buffer */
2347 U8 i; /* loop counter */
2349 TRC2(cmUnpShrtAddrs)
2351 CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2353 if (addrs->length > SHRTADRLEN)
2356 for(i = 0; i < addrs->length; i++)
2358 CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2361 } /* end of cmUnpkShrtAddrs */
2366 * Fun: cmUnpkAddrMask
2368 * Desc: This unpacks address mask.
2379 PUBLIC S16 cmUnpkAddrMask
2381 U8 *mask, /* pointer to address mask */
2382 Buffer *mBuf /* message buffer */
2385 PUBLIC S16 cmUnpkAddrMask(mask, mBuf)
2386 U8 *mask; /* pointer to address mask */
2387 Buffer *mBuf; /* message buffer */
2390 S16 i; /* counter */
2394 /* unpack address mask */
2395 for (i = 0; i< ADRLEN; i++)
2397 CMCHKUNPK(SUnpkU8, &mask[i], mBuf);
2400 } /* end of cmUnpkAddrMask */
2407 * Desc: This function unpacks the BndCfg structure
2418 PUBLIC S16 cmUnpkBndCfg
2420 BndCfg *bndCfg, /* bndCfg */
2421 Buffer *mBuf /* message buffer */
2424 PUBLIC S16 cmUnpkBndCfg(bndCfg, mBuf)
2425 BndCfg *bndCfg; /* bndCfg */
2426 Buffer *mBuf; /* message buffer */
2429 S16 i; /* loop counter */
2433 for (i = 0; bndCfg->usrId[i]; i++);
2434 CMCHKUNPK(cmUnpkTxt, bndCfg->usrId+i, mBuf);
2436 CMCHKUNPK(SUnpkU8, &bndCfg->bufOwnshp, mBuf);
2437 CMCHKUNPK(SUnpkU8, &bndCfg->flcTyp, mBuf);
2438 CMCHKUNPK(SUnpkU8, &bndCfg->wdw, mBuf);
2439 CMCHKUNPK(cmUnpkEnt, &bndCfg->ent, mBuf);
2440 CMCHKUNPK(cmUnpkInst, &bndCfg->inst, mBuf);
2441 CMCHKUNPK(cmUnpkRegion, &bndCfg->region, mBuf);
2442 CMCHKUNPK(cmUnpkPool, &bndCfg->pool, mBuf);
2443 CMCHKUNPK(cmUnpkPrior, &bndCfg->prior, mBuf);
2444 CMCHKUNPK(cmUnpkRoute, &bndCfg->route, mBuf);
2445 CMCHKUNPK(cmUnpkAddrs, &bndCfg->sapAdr, mBuf);
2446 CMCHKUNPK(cmUnpkSelector, &bndCfg->selector, mBuf);
2449 } /* end of cmUnpkBndCfg */
2456 * Desc: pack post structure
2466 PUBLIC S16 cmUnpkPst
2472 PUBLIC S16 cmUnpkPst(pst, mBuf)
2479 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2480 CMCHKUNPK(cmUnpkIntfVer, &pst->intfVer, mBuf);
2482 CMCHKUNPK(cmUnpkSelector, &pst->selector, mBuf);
2483 CMCHKUNPK(cmUnpkRegion, &pst->region, mBuf);
2484 CMCHKUNPK(cmUnpkPool, &pst->pool, mBuf);
2485 CMCHKUNPK(cmUnpkPrior, &pst->prior, mBuf);
2486 CMCHKUNPK(cmUnpkRoute, &pst->route, mBuf);
2487 CMCHKUNPK(cmUnpkProcId, &pst->dstProcId, mBuf);
2488 CMCHKUNPK(cmUnpkEnt, &pst->dstEnt, mBuf);
2489 CMCHKUNPK(cmUnpkInst, &pst->dstInst, mBuf);
2490 CMCHKUNPK(cmUnpkProcId, &pst->srcProcId, mBuf);
2491 CMCHKUNPK(cmUnpkEnt, &pst->srcEnt, mBuf);
2492 CMCHKUNPK(cmUnpkInst, &pst->srcInst, mBuf);
2493 CMCHKUNPK(cmUnpkEvent, &pst->event, mBuf);
2496 } /* end of cmUnpkPst */
2500 * Fun: cmUnpkElmtHdr
2502 * Desc: Unpack element header
2513 PUBLIC S16 cmUnpkElmtHdr
2515 ElmtHdr *m, /* element header */
2516 Buffer *mBuf /* message buffer */
2519 PUBLIC S16 cmUnpkElmtHdr(m, mBuf)
2520 ElmtHdr *m; /* element header */
2521 Buffer *mBuf; /* message buffer */
2527 CMCHKUNPK(cmUnpkBool, &m->pres , mBuf);
2529 #if (LCAMT || ATM_BISUP)
2530 /* Unpack action indicator field */
2533 CMCHKUNPK(SUnpkU8, &m->actnInd, mBuf);
2537 #if (LCAMT || ATM_BISUP)
2538 CMCHKUNPK(SUnpkU16, &m->compInd, mBuf);
2539 #endif /* LCAMT || ATM_BISUP */
2542 } /* end of cmUnpkElmtHdr */
2549 * Desc: This function unpacks a token U8
2560 PUBLIC S16 cmUnpkTknU8
2562 TknU8 *tknU8, /* token U8 */
2563 Buffer *mBuf /* message buffer */
2566 PUBLIC S16 cmUnpkTknU8(tknU8, mBuf)
2567 TknU8 *tknU8; /* token U8 */
2568 Buffer *mBuf; /* message buffer */
2574 CMCHKUNPK(SUnpkU8, &tknU8->pres, mBuf);
2579 CMCHKUNPK(SUnpkU8, &tknU8->val, mBuf);
2583 } /* end of cmUnpkTknU8 */
2590 * Desc: This function unpacks a token S8
2601 PUBLIC S16 cmUnpkTknS8
2603 TknS8 *tknS8, /* token S8 */
2604 Buffer *mBuf /* message buffer */
2607 PUBLIC S16 cmUnpkTknS8(tknS8, mBuf)
2608 TknS8 *tknS8; /* token S8 */
2609 Buffer *mBuf; /* message buffer */
2615 CMCHKUNPK(SUnpkU8, &tknS8->pres, mBuf);
2620 CMCHKUNPK(SUnpkS8, &tknS8->val, mBuf);
2624 } /* end of cmUnpkTknS8 */
2631 * Desc: This function unpacks a token U16
2642 PUBLIC S16 cmUnpkTknU16
2644 TknU16 *tknU16, /* token U16 */
2645 Buffer *mBuf /* message buffer */
2648 PUBLIC S16 cmUnpkTknU16(tknU16, mBuf)
2649 TknU16 *tknU16; /* token U16 */
2650 Buffer *mBuf; /* message buffer */
2656 CMCHKUNPK(SUnpkU8, &tknU16->pres, mBuf);
2661 CMCHKUNPK(SUnpkU16, &tknU16->val, mBuf);
2665 } /* end of cmUnpkTknU16 */
2672 * Desc: This function unpacks a token U32
2683 PUBLIC S16 cmUnpkTknU32
2685 TknU32 *tknU32, /* token U32 */
2686 Buffer *mBuf /* message buffer */
2689 PUBLIC S16 cmUnpkTknU32(tknU32, mBuf)
2690 TknU32 *tknU32; /* token U32 */
2691 Buffer *mBuf; /* message buffer */
2697 CMCHKUNPK(SUnpkU8, &tknU32->pres, mBuf);
2702 CMCHKUNPK(SUnpkU32, &tknU32->val, mBuf);
2706 } /* end of cmUnpkTknU32 */
2712 * Desc: This function unpacks a token string - regular size
2723 PUBLIC S16 cmUnpkTknStr
2725 TknStr *tknStr, /* token string */
2726 Buffer *mBuf /* message buffer */
2729 PUBLIC S16 cmUnpkTknStr(tknStr, mBuf)
2730 TknStr *tknStr; /* token string */
2731 Buffer *mBuf; /* message buffer */
2734 Cntr i; /* counter */
2739 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2744 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2747 for (i = (tknStr->len - 1); i >= 0; i--)
2749 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2756 } /* end of cmUnpkTknStr */
2760 * Fun: cmUnpkTknStrM
2762 * Desc: This function unpacks a token string - medium size
2773 PUBLIC S16 cmUnpkTknStrM
2775 TknStrM *tknStr, /* token string */
2776 Buffer *mBuf /* message buffer */
2779 PUBLIC S16 cmUnpkTknStrM(tknStr, mBuf)
2780 TknStrM *tknStr; /* token string */
2781 Buffer *mBuf; /* message buffer */
2784 Cntr i; /* counter */
2789 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2794 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2797 for (i = (tknStr->len - 1); i >= 0; i--)
2799 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2806 } /* end of cmUnpkTknStrM */
2811 * Fun: cmUnpkTknStrS
2813 * Desc: This function unpacks a token string - small size
2824 PUBLIC S16 cmUnpkTknStrS
2826 TknStrS *tknStr, /* token string */
2827 Buffer *mBuf /* message buffer */
2830 PUBLIC S16 cmUnpkTknStrS(tknStr, mBuf)
2831 TknStrS *tknStr; /* token string */
2832 Buffer *mBuf; /* message buffer */
2835 Cntr i; /* counter */
2840 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2845 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2848 for (i = (tknStr->len - 1); i >= 0; i--)
2850 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2857 } /* end of cmUnpkTknStrS */
2862 * Fun: cmUnpkTknStrE
2864 * Desc: This function unpacks a token string - extended size
2875 PUBLIC S16 cmUnpkTknStrE
2877 TknStrE *tknStr, /* token string */
2878 Buffer *mBuf /* message buffer */
2881 PUBLIC S16 cmUnpkTknStrE(tknStr, mBuf)
2882 TknStrE *tknStr; /* token string */
2883 Buffer *mBuf; /* message buffer */
2886 Cntr i; /* counter */
2891 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2896 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2899 for (i = (tknStr->len - 1); i >= 0; i--)
2901 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2908 } /* end of cmUnpkTknStrE */
2910 #ifndef CMFILE_REORG_1
2915 * Fun: cmUnpkPnNodeId
2917 * Desc: This function unpacks a PnNodeId structure from a buffer
2928 PUBLIC S16 cmUnpkPnNodeId
2930 PnNodeId *dst, /* source PNNI Node Id */
2931 Buffer *mBuf /* message buffer */
2934 PUBLIC S16 cmUnpkPnNodeId (dst, mBuf)
2935 PnNodeId *dst; /* source PNNI Node Id */
2936 Buffer *mBuf; /* message buffer */
2941 TRC3(cmUnpkPnNodeId);
2943 for (i = 0; i < PN_NODEID_LEN; i++)
2945 CMCHKUNPK(SUnpkU8, &dst->id[i], mBuf);
2949 } /* cmUnpkPnNodeId */
2951 #endif /* CMFILE_REORG_1 */
2956 * Fun: cmUnpkTknStr4
2958 * Desc: This function packs a token string of size 4
2969 PUBLIC S16 cmUnpkTknStr4
2971 TknStr4 *tknStr, /* token string */
2972 Buffer *mBuf /* message buffer */
2975 PUBLIC S16 cmUnpkTknStr4(tknStr, mBuf)
2976 TknStr4 *tknStr; /* token string */
2977 Buffer *mBuf; /* message buffer */
2982 CMUNPKTKNSTR(tknStr, mBuf);
2986 } /* end of cmUnpkTknStr4 */
2992 * Fun: cmUnpkTknStr12
2994 * Desc: This function packs a token string of size 4
3005 PUBLIC S16 cmUnpkTknStr12
3007 TknStr12 *tknStr, /* token string */
3008 Buffer *mBuf /* message buffer */
3011 PUBLIC S16 cmUnpkTknStr12(tknStr, mBuf)
3012 TknStr12 *tknStr; /* token string */
3013 Buffer *mBuf; /* message buffer */
3016 TRC2(cmUnpkTknStr12)
3018 CMUNPKTKNSTR(tknStr, mBuf);
3022 } /* end of cmUnpkTknStr12 */
3027 * Fun: cmUnpkTknStr32
3029 * Desc: This function packs a token string of size 4
3040 PUBLIC S16 cmUnpkTknStr32
3042 TknStr32 *tknStr, /* token string */
3043 Buffer *mBuf /* message buffer */
3046 PUBLIC S16 cmUnpkTknStr32(tknStr, mBuf)
3047 TknStr32 *tknStr; /* token string */
3048 Buffer *mBuf; /* message buffer */
3051 TRC2(cmUnpkTknStr32)
3053 CMUNPKTKNSTR(tknStr, mBuf);
3057 } /* end of cmUnpkTknStr32 */
3062 * Fun: cmUnpkTknStr64
3064 * Desc: This function packs a token string of size 4
3075 PUBLIC S16 cmUnpkTknStr64
3077 TknStr64 *tknStr, /* token string */
3078 Buffer *mBuf /* message buffer */
3081 PUBLIC S16 cmUnpkTknStr64(tknStr, mBuf)
3082 TknStr64 *tknStr; /* token string */
3083 Buffer *mBuf; /* message buffer */
3086 TRC2(cmUnpkTknStr64)
3088 CMUNPKTKNSTR(tknStr, mBuf);
3092 } /* end of cmUnpkTknStr64 */
3097 * Fun: cmUnpkTknStr132
3099 * Desc: This function packs a token string of size 4
3110 PUBLIC S16 cmUnpkTknStr132
3112 TknStr132 *tknStr, /* token string */
3113 Buffer *mBuf /* message buffer */
3116 PUBLIC S16 cmUnpkTknStr132(tknStr, mBuf)
3117 TknStr132 *tknStr; /* token string */
3118 Buffer *mBuf; /* message buffer */
3121 TRC2(cmUnpkTknStr132)
3123 CMUNPKTKNSTR(tknStr, mBuf);
3127 } /* end of cmUnpkTknStr132 */
3132 * Fun: cmUnpkTknStr256
3134 * Desc: This function packs a token string of size 4
3145 PUBLIC S16 cmUnpkTknStr256
3147 TknStr256 *tknStr, /* token string */
3148 Buffer *mBuf /* message buffer */
3151 PUBLIC S16 cmUnpkTknStr256(tknStr, mBuf)
3152 TknStr256 *tknStr; /* token string */
3153 Buffer *mBuf; /* message buffer */
3156 TRC2(cmUnpkTknStr256)
3158 CMUNPKTKNSTR(tknStr, mBuf);
3162 } /* end of cmUnpkTknStr256 */
3169 * Desc: This function packs a Object Identifier token
3180 PUBLIC S16 cmUnpkTknOid
3182 TknOid *tknOid, /* Object Identifier token */
3183 Buffer *mBuf /* message buffer */
3186 PUBLIC S16 cmUnpkTknOid(tknOid, mBuf)
3187 TknOid *tknOid; /* Object Identifier token */
3188 Buffer *mBuf; /* message buffer */
3195 /* Unpack the token header */
3196 CMCHKUNPK(SUnpkU8, &tknOid->pres, mBuf);
3198 if (tknOid->pres == TRUE)
3200 /* Unpack the length */
3201 CMCHKUNPK(SUnpkU8, &tknOid->len, mBuf);
3203 /* Pack the value */
3204 for (i = 1; i <= (U16)tknOid->len; i++)
3206 /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
3207 * with compilation flag TKNOID_U16 */
3209 CMCHKUNPK(SUnpkU32, &tknOid->val[tknOid->len - i], mBuf);
3211 CMCHKUNPK(SUnpkU16, &tknOid->val[tknOid->len - i], mBuf);
3212 #endif /* !TKNOID_U16 */
3217 } /* end of cmUnpkTknOid */
3224 * Desc: This function unpacks a token S32
3235 PUBLIC S16 cmUnpkTknS32
3237 TknS32 *tknS32, /* token S32 */
3238 Buffer *mBuf /* message buffer */
3241 PUBLIC S16 cmUnpkTknS32(tknS32, mBuf)
3242 TknS32 *tknS32; /* token S32 */
3243 Buffer *mBuf; /* message buffer */
3249 CMCHKUNPK(SUnpkU8, &tknS32->pres, mBuf);
3254 CMCHKUNPK(SUnpkS32, &tknS32->val, mBuf);
3258 } /* end of cmUnpkTknS32 */
3265 * Desc: This function is used to Unpack Header structure
3276 PUBLIC S16 cmUnpkHeader
3278 Header *header, /* header structure */
3279 Buffer *mBuf /* message buffer */
3282 PUBLIC S16 cmUnpkHeader(header, mBuf)
3283 Header *header; /* header structure */
3284 Buffer *mBuf; /* message buffer */
3289 CMCHKUNPK(SUnpkU16, &header->msgLen, mBuf);
3290 CMCHKUNPK(SUnpkU8, &header->msgType, mBuf);
3291 CMCHKUNPK(SUnpkU8, &header->version, mBuf);
3292 CMCHKUNPK(SUnpkU16, &header->seqNmb, mBuf);
3293 CMCHKUNPK(cmUnpkEntityId, &header->entId, mBuf);
3294 CMCHKUNPK(cmUnpkElmntId, &header->elmId, mBuf);
3296 CMCHKUNPK(cmUnpkTranId, &header->transId, mBuf);
3297 CMCHKUNPK(cmUnpkSelector, &header->response.selector, mBuf);
3298 CMCHKUNPK(cmUnpkPriority, &header->response.prior, mBuf);
3299 CMCHKUNPK(cmUnpkRoute, &header->response.route, mBuf);
3300 CMCHKUNPK(cmUnpkMemoryId, &header->response.mem, mBuf);
3304 } /* end of cmUnpkHeader */
3309 * Fun: cmUnpkCmStatus
3311 * Desc: This function unpacks common management status structure
3322 PUBLIC S16 cmUnpkCmStatus
3324 CmStatus *sta, /* status structure */
3325 Buffer *mBuf /* message buffer */
3328 PUBLIC S16 cmUnpkCmStatus(sta, mBuf)
3329 CmStatus *sta; /* status structure */
3330 Buffer *mBuf; /* message buffer */
3333 TRC2(cmUnpkCmStatus)
3335 CMCHKUNPK(SUnpkU16, &sta->status, mBuf);
3336 CMCHKUNPK(SUnpkU16, &sta->reason, mBuf);
3339 } /* end of cmUnpkCmStatus */
3344 * Fun: cmUnpkCmAlarm
3346 * Desc: This function unpacks common management alarm structure
3357 PUBLIC S16 cmUnpkCmAlarm
3359 CmAlarm *alarm, /* alarm structure */
3360 Buffer *mBuf /* message buffer */
3363 PUBLIC S16 cmUnpkCmAlarm(alarm, mBuf)
3364 CmAlarm *alarm; /* alarm structure */
3365 Buffer *mBuf; /* message buffer */
3370 CMCHKUNPK(cmUnpkDateTime, &alarm->dt, mBuf);
3371 CMCHKUNPK(SUnpkU16, &alarm->category, mBuf);
3372 CMCHKUNPK(SUnpkU16, &alarm->event, mBuf);
3373 CMCHKUNPK(SUnpkU16, &alarm->cause, mBuf);
3376 } /* end of cmUnpkCmAlarm */
3383 * Desc: This function unpacks the stack manager structure
3394 PUBLIC S16 cmUnpkSmCfg
3396 SmCfg *smCfg, /* stack manager */
3397 Buffer *mBuf /* message buffer */
3400 PUBLIC S16 cmUnpkSmCfg(smCfg, mBuf)
3401 SmCfg *smCfg; /* stack manager */
3402 Buffer *mBuf; /* message buffer */
3407 CMCHKUNPK(cmUnpkEnt, &smCfg->ent, mBuf);
3408 CMCHKUNPK(cmUnpkInst, &smCfg->inst, mBuf);
3409 CMCHKUNPK(cmUnpkRegion, &smCfg->region, mBuf);
3410 CMCHKUNPK(cmUnpkPool, &smCfg->pool, mBuf);
3411 CMCHKUNPK(cmUnpkPrior, &smCfg->prior, mBuf);
3412 CMCHKUNPK(cmUnpkRoute, &smCfg->route, mBuf);
3413 CMCHKUNPK(cmUnpkSelector, &smCfg->selector, mBuf);
3416 } /* end of cmUnpkSmCfg */
3423 * Desc: This function unpacks the timer configuration structure
3434 PUBLIC S16 cmUnpkTmrCfg
3436 TmrCfg *tmrCfg, /* timer configuration */
3437 Buffer *mBuf /* message buffer */
3440 PUBLIC S16 cmUnpkTmrCfg(tmrCfg, mBuf)
3441 TmrCfg *tmrCfg; /* timer configuration */
3442 Buffer *mBuf; /* message buffer */
3447 CMCHKUNPK(cmUnpkBool, &tmrCfg->enb, mBuf);
3448 CMCHKUNPK(SUnpkU16, &tmrCfg->val, mBuf);
3451 } /* end of cmUnpkTmrCfg */
3457 * Desc: This function unpacks a token buffer
3468 PUBLIC S16 cmUnpkTknBuf
3470 TknBuf *tknBuf, /* token string */
3471 Buffer **tBuf /* message buffer */
3474 PUBLIC S16 cmUnpkTknBuf(tknBuf, tBuf)
3475 TknBuf *tknBuf; /* token string */
3476 Buffer **tBuf; /* message buffer */
3487 CMCHKUNPK(SUnpkU8, &tknBuf->pres, mBuf);
3491 MsgLen msgLen, buflen;
3492 Region region; /* region */
3493 Pool pool; /* pool */
3495 cmUnpkMsgLen(&msgLen, mBuf);
3496 SFndLenMsg(mBuf, &buflen);
3497 if (buflen > msgLen)
3499 if( SSegMsg(mBuf, msgLen, &tknBuf->val) != ROK )
3506 /* Allocate the buffer for tknbuf->val */
3507 SGetBufRegionPool(mBuf, ®ion, &pool);
3508 SGetMsg(region, pool, &(tknBuf->val));
3511 /* now Swap the two Buffer pointers */
3512 SSwapMsg(mBuf,tknBuf->val);
3519 } /* end of cmUnpkTknBuf */
3521 #ifdef TDS_ROLL_UPGRADE_SUPPORT
3526 * Desc: This function unpacks the interface information
3537 PUBLIC S16 cmUnpkIntf
3539 CmIntf *intf, /* interface info */
3540 Buffer *mBuf /* message buffer */
3543 PUBLIC S16 cmUnpkIntf(intf, mBuf)
3544 CmIntf *intf; /* interface info */
3545 Buffer *mBuf; /* message buffer */
3550 CMCHKUNPK(cmUnpkIntfVer, &intf->intfVer, mBuf);
3551 CMCHKUNPK(cmUnpkIntfId, &intf->intfId, mBuf);
3554 } /* end of cmUnpkIntf */
3555 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
3561 * Desc: This function return the transaction ID used for interface transactions
3570 gTransId = (gTransId%65535) + 1;
3573 /**********************************************************************
3575 **********************************************************************/