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 */
77 /* private variable declarations */
81 * common packing functions
89 * Desc: This function packs the Date Time structure
100 PUBLIC S16 cmPkDateTime
102 DateTime *dateTime, /* date and time */
103 Buffer *mBuf /* message buffer */
106 PUBLIC S16 cmPkDateTime(dateTime, mBuf)
107 DateTime *dateTime; /* date and time */
108 Buffer *mBuf; /* message buffer */
113 /*-- cm_gen_c_001.main_36 - added for micro seconds --*/
114 #ifdef SS_DATETIME_USEC
115 CMCHKPK(SPkU32, dateTime->usec, mBuf);
116 #endif /*-- SS_DATETIME_USEC --*/
117 CMCHKPK(SPkU8, dateTime->tenths, mBuf);
118 CMCHKPK(SPkU8, dateTime->sec, mBuf);
119 CMCHKPK(SPkU8, dateTime->min, mBuf);
120 CMCHKPK(SPkU8, dateTime->hour, mBuf);
121 CMCHKPK(SPkU8, dateTime->year, mBuf);
122 CMCHKPK(SPkU8, dateTime->day, mBuf);
123 CMCHKPK(SPkU8, dateTime->month, mBuf);
126 } /* end of cmPkDateTime */
133 * Desc: This function packs the Duration structure
144 PUBLIC S16 cmPkDuration
146 Duration *duration, /* duration */
147 Buffer *mBuf /* message buffer */
150 PUBLIC S16 cmPkDuration(duration, mBuf)
151 Duration *duration; /* duration */
152 Buffer *mBuf; /* message buffer */
157 CMCHKPK(SPkU8, duration->tenths, mBuf);
158 CMCHKPK(SPkU8, duration->secs, mBuf);
159 CMCHKPK(SPkU8, duration->mins, mBuf);
160 CMCHKPK(SPkU8, duration->hours, mBuf);
161 CMCHKPK(SPkU8, duration->days, mBuf);
164 } /* end of cmPkDuration */
170 * Desc: This function packs the pointer
183 PTR ptr, /* pointer */
184 Buffer *mBuf /* message buffer */
187 PUBLIC S16 cmPkPtr(ptr, mBuf)
188 PTR ptr; /* pointer */
189 Buffer *mBuf; /* message buffer */
192 Data pkArray[PTRSIZE]; /* array for packing */
193 S16 ret; /* return code */
194 U16 tmp; /* temporary value */
196 #if (defined(ALPHA) || defined(BIT_64))
206 #ifndef FCSPKINT /* backward compatibility, packing order */
207 pkArray[0] = (Data) GetHiByte(ptr);
208 pkArray[1] = (Data) GetLoByte(ptr);
209 #else /* forward compatibility, packing order */
210 pkArray[1] = (Data) GetHiByte(ptr);
211 pkArray[0] = (Data) GetLoByte(ptr);
213 ret = SAddPreMsgMult(pkArray, (MsgLen) 2, mBuf);
217 #ifndef FCSPKINT /* backward compatibility, packing order */
218 tmp = (U16) GetHiWord(ptr);
219 pkArray[0] = (Data) GetHiByte(tmp);
220 pkArray[1] = (Data) GetLoByte(tmp);
221 tmp = (U16) GetLoWord(ptr);
222 pkArray[2] = (Data) GetHiByte(tmp);
223 pkArray[3] = (Data) GetLoByte(tmp);
224 #else /* forward compatibility, packing order */
225 tmp = (U16) GetHiWord(ptr);
226 pkArray[3] = (Data) GetHiByte(tmp);
227 pkArray[2] = (Data) GetLoByte(tmp);
228 tmp = (U16) GetLoWord(ptr);
229 pkArray[1] = (Data) GetHiByte(tmp);
230 pkArray[0] = (Data) GetLoByte(tmp);
232 ret = SAddPreMsgMult(pkArray, (MsgLen) 4, mBuf);
236 #if (defined(ALPHA) || defined(BIT_64))
237 #ifndef FCSPKINT /* backward compatibility, packing order */
238 tmp32 = (U32) GetHi32Bit(ptr);
239 tmp = (U16) GetHiWord(tmp32);
240 pkArray[0] = (Data) GetHiByte(tmp);
241 pkArray[1] = (Data) GetLoByte(tmp);
242 tmp = (U16) GetLoWord(tmp32);
243 pkArray[2] = (Data) GetHiByte(tmp);
244 pkArray[3] = (Data) GetLoByte(tmp);
245 tmp32 = (U32) GetLo32Bit(ptr);
246 tmp = (U16) GetHiWord(tmp32);
247 pkArray[4] = (Data) GetHiByte(tmp);
248 pkArray[5] = (Data) GetLoByte(tmp);
249 tmp = (U16) GetLoWord(tmp32);
250 pkArray[6] = (Data) GetHiByte(tmp);
251 pkArray[7] = (Data) GetLoByte(tmp);
252 #else /* forward compatibility, packing order */
253 tmp32 = (U32) GetHi32Bit(ptr);
254 tmp = (U16) GetHiWord(tmp32);
255 pkArray[7] = (Data) GetHiByte(tmp);
256 pkArray[6] = (Data) GetLoByte(tmp);
257 tmp = (U16) GetLoWord(tmp32);
258 pkArray[5] = (Data) GetHiByte(tmp);
259 pkArray[4] = (Data) GetLoByte(tmp);
260 tmp32 = (U32) GetLo32Bit(ptr);
261 tmp = (U16) GetHiWord(tmp32);
262 pkArray[3] = (Data) GetHiByte(tmp);
263 pkArray[2] = (Data) GetLoByte(tmp);
264 tmp = (U16) GetLoWord(tmp32);
265 pkArray[1] = (Data) GetHiByte(tmp);
266 pkArray[0] = (Data) GetLoByte(tmp);
268 ret = SAddPreMsgMult(pkArray, (MsgLen) 8, mBuf);
272 /* no support for U64 */
277 } /* end of cmPkPtr */
284 * Desc: This function packs the EntityId structure
295 PUBLIC S16 cmPkEntityId
297 EntityId *entityId, /* entity id */
298 Buffer *mBuf /* message buffer */
301 PUBLIC S16 cmPkEntityId(entityId, mBuf)
302 EntityId *entityId; /* entity id */
303 Buffer *mBuf; /* message buffer */
308 CMCHKPK(cmPkInst, entityId->inst, mBuf);
309 CMCHKPK(cmPkEnt, entityId->ent, mBuf);
312 } /* end of cmPkEntityId */
319 * Desc: This function packs the ElmntId structure
330 PUBLIC S16 cmPkElmntId
332 ElmntId *elmntId, /* element id */
333 Buffer *mBuf /* message buffer */
336 PUBLIC S16 cmPkElmntId(elmntId, mBuf)
337 ElmntId *elmntId; /* element id */
338 Buffer *mBuf; /* message buffer */
343 CMCHKPK(cmPkElmntInst3, elmntId->elmntInst3, mBuf);
344 CMCHKPK(cmPkElmntInst2, elmntId->elmntInst2, mBuf);
345 CMCHKPK(cmPkElmntInst1, elmntId->elmntInst1, mBuf);
346 CMCHKPK(cmPkElmnt, elmntId->elmnt, mBuf);
349 } /* end of cmPkElmntId */
356 * Desc: This function packs the MemoryId structure
367 PUBLIC S16 cmPkMemoryId
369 MemoryId *memoryId, /* memoryId */
370 Buffer *mBuf /* message buffer */
373 PUBLIC S16 cmPkMemoryId(memoryId, mBuf)
374 MemoryId *memoryId; /* memoryId */
375 Buffer *mBuf; /* message buffer */
380 CMCHKPK(cmPkPool, memoryId->pool, mBuf);
381 CMCHKPK(cmPkRegion, memoryId->region, mBuf);
384 } /* end of cmPkMemoryId */
391 * Desc: This function packs the System Id structure
402 PUBLIC S16 cmPkSystemId
404 SystemId *systemId, /* system id */
405 Buffer *mBuf /* message buffer */
408 PUBLIC S16 cmPkSystemId(systemId, mBuf)
409 SystemId *systemId; /* system id */
410 Buffer *mBuf; /* message buffer */
413 Txt *p; /* part number string */
417 for (p = systemId->ptNmb; *p; p++);
419 for (; p != systemId->ptNmb; p--)
421 CMCHKPK(cmPkTxt, *p, mBuf);
423 CMCHKPK(cmPkTxt, *p, mBuf);
425 CMCHKPK(SPkS16, systemId->bRev, mBuf);
426 CMCHKPK(SPkS16, systemId->bVer, mBuf);
427 CMCHKPK(SPkS16, systemId->mRev, mBuf);
428 CMCHKPK(SPkS16, systemId->mVer, mBuf);
431 } /* end of cmPkSystemId */
439 * Desc: This function will pack protocol address.
441 * Ret: ROK on success
451 PUBLIC S16 cmPkProtAddr
453 ProtAddr *pAddr, /* protocol address */
454 Buffer *mBuf /* buffer */
457 PUBLIC S16 cmPkProtAddr(pAddr, mBuf)
458 ProtAddr *pAddr; /* protocol address */
459 Buffer *mBuf; /* buffer */
467 CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);
468 CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);
471 for (j = pAddr->len; j; j--)
472 CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);
474 CMCHKPK(SPkU8, pAddr->preLen, mBuf);
475 CMCHKPK(SPkU8, pAddr->len, mBuf);
476 CMCHKPK(SPkU16, pAddr->protType, mBuf);
480 } /* end of cmPkProtAddr */
486 * Fun: cmPkProtAddrTbl
488 * Desc: This function will pack protocol addresses.
490 * Ret: ROK on success
500 PUBLIC S16 cmPkProtAddrTbl
502 ProtAddrTbl *protAddr, /* protocol address table */
503 Buffer *mBuf /* buffer */
506 PUBLIC S16 cmPkProtAddrTbl(protAddr, mBuf)
507 ProtAddrTbl *protAddr; /* protocol address table */
508 Buffer *mBuf; /* buffer */
513 ProtAddr *pAddr; /* protocol Address */
515 TRC3(cmPkProtAddrTbl)
517 if (protAddr->count > MAX_PROT_ADDRS)
520 for (i = protAddr->count; i; i--)
522 pAddr = &(protAddr->addr[i - 1]);
525 CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);
526 CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);
529 for (j = pAddr->len; j; j--)
530 CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);
532 CMCHKPK(SPkU8, pAddr->preLen, mBuf);
533 CMCHKPK(SPkU8, pAddr->len, mBuf);
534 CMCHKPK(SPkU16, pAddr->protType, mBuf);
537 CMCHKPK(SPkU8, protAddr->count, mBuf);
540 } /* end of cmPkProtAddrTbl */
547 * Desc: This function packs the address structure for a loosely
561 Addrs *addrs, /* address */
562 Buffer *mBuf /* message buffer */
565 PUBLIC S16 cmPkAddrs(addrs, mBuf)
566 Addrs *addrs; /* address */
567 Buffer *mBuf; /* message buffer */
570 U8 i; /* loop counter */
574 if (addrs->length > ADRLEN)
577 for (i = addrs->length; i; i--)
579 CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
582 CMCHKPK(SPkU8, addrs->length, mBuf);
585 } /* end of cmPkAddrs */
592 * Desc: This function packs the short address structure for a loosely
604 PUBLIC S16 cmPkShrtAddrs
606 ShrtAddrs *addrs, /* address */
607 Buffer *mBuf /* message buffer */
610 PUBLIC S16 cmPkShrtAddrs(addrs, mBuf)
611 ShrtAddrs *addrs; /* address */
612 Buffer *mBuf; /* message buffer */
615 U8 i; /* loop counter */
619 if (addrs->length > SHRTADRLEN)
622 for (i = addrs->length; i; i--)
624 CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
627 CMCHKPK(SPkU8, addrs->length, mBuf);
630 } /* end of cmPkShrtAddrs */
637 * Desc: This function address mask array.
648 PUBLIC S16 cmPkAddrMask
650 U8 *mask, /* pointer to address mask array */
651 Buffer *mBuf /* message buffer */
654 PUBLIC S16 cmPkAddrMask(mask, mBuf)
655 U8 *mask; /* pointer to address mask array */
656 Buffer *mBuf; /* message buffer */
663 /* pack address mask */
664 for (i = (ADRLEN - 1); i >= 0; i--)
666 CMCHKPK(SPkU8, mask[i], mBuf);
670 } /* end of cmPkAddrMask */
677 * Desc: This function packs the BndCfg structure
688 PUBLIC S16 cmPkBndCfg
690 BndCfg *bndCfg, /* bndCfg */
691 Buffer *mBuf /* message buffer */
694 PUBLIC S16 cmPkBndCfg(bndCfg, mBuf)
695 BndCfg *bndCfg; /* bndCfg */
696 Buffer *mBuf; /* message buffer */
699 Txt *p; /* temporary */
703 CMCHKPK(cmPkSelector, bndCfg->selector, mBuf);
704 CMCHKPK(cmPkAddrs, &bndCfg->sapAdr, mBuf);
705 CMCHKPK(cmPkRoute, bndCfg->route, mBuf);
706 CMCHKPK(cmPkPrior, bndCfg->prior, mBuf);
707 CMCHKPK(cmPkPool, bndCfg->pool, mBuf);
708 CMCHKPK(cmPkRegion, bndCfg->region, mBuf);
709 CMCHKPK(cmPkInst, bndCfg->inst, mBuf);
710 CMCHKPK(cmPkEnt, bndCfg->ent, mBuf);
711 CMCHKPK(SPkU8, bndCfg->wdw, mBuf);
712 CMCHKPK(SPkU8, bndCfg->flcTyp, mBuf);
713 CMCHKPK(SPkU8, bndCfg->bufOwnshp, mBuf);
715 for (p = bndCfg->usrId; *p; p++);
716 for (; p != bndCfg->usrId; p--);
717 CMCHKPK(cmPkTxt, *p, mBuf);
720 } /* end of cmPkBndCfg */
727 * Desc: pack post structure
743 PUBLIC S16 cmPkPst(pst, mBuf)
750 CMCHKPK(cmPkEvent, pst->event, mBuf);
751 CMCHKPK(cmPkInst, pst->srcInst, mBuf);
752 CMCHKPK(cmPkEnt, pst->srcEnt, mBuf);
753 CMCHKPK(cmPkProcId, pst->srcProcId, mBuf);
754 CMCHKPK(cmPkInst, pst->dstInst, mBuf);
755 CMCHKPK(cmPkEnt, pst->dstEnt, mBuf);
756 CMCHKPK(cmPkProcId, pst->dstProcId, mBuf);
757 CMCHKPK(cmPkRoute, pst->route, mBuf);
758 CMCHKPK(cmPkPrior, pst->prior, mBuf);
759 CMCHKPK(cmPkPool, pst->pool, mBuf);
760 CMCHKPK(cmPkRegion, pst->region, mBuf);
761 CMCHKPK(cmPkSelector, pst->selector, mBuf);
762 #ifdef TDS_ROLL_UPGRADE_SUPPORT
763 CMCHKPK(cmPkIntfVer, pst->intfVer, mBuf);
767 } /* end of cmPkPst */
773 * Desc: Pack element header
784 PUBLIC S16 cmPkElmtHdr
786 ElmtHdr *m, /* element header */
787 Buffer *mBuf /* message buffer */
790 PUBLIC S16 cmPkElmtHdr(m, mBuf)
791 ElmtHdr *m; /* element header */
792 Buffer *mBuf; /* message buffer */
797 #if (LCAMT || ATM_BISUP)
798 CMCHKPK(SPkU16, m->compInd, mBuf);
799 #endif /* LCAMT || ATM_BISUP */
801 #if (LCAMT || ATM_BISUP)
802 /* Pack action indicator field */
805 CMCHKPK(SPkU8, m->actnInd, mBuf);
810 CMCHKPK(cmPkBool, m->pres, mBuf);
813 } /* end of cmPkElmtHdr */
820 * Desc: This function packs a token U8
833 TknU8 *tknU8, /* token U8 */
834 Buffer *mBuf /* message buffer */
837 PUBLIC S16 cmPkTknU8(tknU8, mBuf)
838 TknU8 *tknU8; /* token U8 */
839 Buffer *mBuf; /* message buffer */
847 CMCHKPK(SPkU8, tknU8->val, mBuf);
851 CMCHKPK(SPkU8, tknU8->pres, mBuf);
854 } /* end of cmPkTknU8 */
861 * Desc: This function packs a token S8
874 TknS8 *tknS8, /* token S8 */
875 Buffer *mBuf /* message buffer */
878 PUBLIC S16 cmPkTknS8(tknS8, mBuf)
879 TknS8 *tknS8; /* token S8 */
880 Buffer *mBuf; /* message buffer */
888 CMCHKPK(SPkS8, tknS8->val, mBuf);
892 CMCHKPK(SPkU8, tknS8->pres, mBuf);
895 } /* end of cmPkTknS8 */
902 * Desc: This function packs a token U16
913 PUBLIC S16 cmPkTknU16
915 TknU16 *tknU16, /* token U16 */
916 Buffer *mBuf /* message buffer */
919 PUBLIC S16 cmPkTknU16(tknU16, mBuf)
920 TknU16 *tknU16; /* token U16 */
921 Buffer *mBuf; /* message buffer */
929 CMCHKPK(SPkU16, tknU16->val, mBuf);
933 CMCHKPK(SPkU8, tknU16->pres, mBuf);
936 } /* end of cmPkTknU16 */
943 * Desc: This function packs a token U32
954 PUBLIC S16 cmPkTknU32
956 TknU32 *tknU32, /* token U32 */
957 Buffer *mBuf /* message buffer */
960 PUBLIC S16 cmPkTknU32(tknU32, mBuf)
961 TknU32 *tknU32; /* token U32 */
962 Buffer *mBuf; /* message buffer */
970 CMCHKPK(SPkU32, tknU32->val, mBuf);
974 CMCHKPK(SPkU8, tknU32->pres, mBuf);
977 } /* end of cmPkTknU32 */
984 * Desc: This function packs a token string - regular size
995 PUBLIC S16 cmPkTknStr
997 TknStr *tknStr, /* token string */
998 Buffer *mBuf /* message buffer */
1001 PUBLIC S16 cmPkTknStr(tknStr, mBuf)
1002 TknStr *tknStr; /* token string */
1003 Buffer *mBuf; /* message buffer */
1006 Cntr i; /* counter */
1013 for (i = 0; i < (S16) tknStr->len; i++)
1015 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1019 CMCHKPK(SPkU8, tknStr->len, mBuf);
1023 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1026 } /* end of cmPkTknStr */
1033 * Desc: This function packs a token string - medium size
1044 PUBLIC S16 cmPkTknStrM
1046 TknStrM *tknStr, /* token string */
1047 Buffer *mBuf /* message buffer */
1050 PUBLIC S16 cmPkTknStrM(tknStr, mBuf)
1051 TknStrM *tknStr; /* token string */
1052 Buffer *mBuf; /* message buffer */
1055 Cntr i; /* counter */
1062 for (i = 0; i < (S16) tknStr->len; i++)
1064 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1068 CMCHKPK(SPkU8, tknStr->len, mBuf);
1072 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1075 } /* end of cmPkTknStrM */
1082 * Desc: This function packs a token string - small size
1093 PUBLIC S16 cmPkTknStrS
1095 TknStrS *tknStr, /* token string */
1096 Buffer *mBuf /* message buffer */
1099 PUBLIC S16 cmPkTknStrS(tknStr, mBuf)
1100 TknStrS *tknStr; /* token string */
1101 Buffer *mBuf; /* message buffer */
1104 Cntr i; /* counter */
1111 for (i = 0; i < (S16) tknStr->len; i++)
1113 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1117 CMCHKPK(SPkU8, tknStr->len, mBuf);
1121 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1124 } /* end of cmPkTknStrS */
1131 * Desc: This function packs a token string - extended size
1142 PUBLIC S16 cmPkTknStrE
1144 TknStrE *tknStr, /* token string */
1145 Buffer *mBuf /* message buffer */
1148 PUBLIC S16 cmPkTknStrE(tknStr, mBuf)
1149 TknStrE *tknStr; /* token string */
1150 Buffer *mBuf; /* message buffer */
1153 Cntr i; /* counter */
1160 for (i = 0; i < (S16) tknStr->len; i++)
1162 CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1166 CMCHKPK(SPkU8, tknStr->len, mBuf);
1170 CMCHKPK(SPkU8, tknStr->pres, mBuf);
1173 } /* end of cmPkTknStrE */
1175 #ifndef CMFILE_REORG_1
1182 * Desc: This function packs a PnNodeId structure into a buffer
1193 PUBLIC S16 cmPkPnNodeId
1195 PnNodeId *src, /* source PNNI Node Id */
1196 Buffer *mBuf /* message buffer */
1199 PUBLIC S16 cmPkPnNodeId (src, mBuf)
1200 PnNodeId *src; /* source PNNI Node Id */
1201 Buffer *mBuf; /* message buffer */
1208 for (i = PN_NODEID_LEN - 1; i >= 0; i--)
1210 CMCHKPK(SPkU8, src->id[i], mBuf);
1214 } /* cmPkPnNodeId */
1216 #endif /* CMFILE_REORG_1 */
1223 * Desc: This function packs a token string of size 4
1234 PUBLIC S16 cmPkTknStr4
1236 TknStr4 *tknStr, /* token string */
1237 Buffer *mBuf /* message buffer */
1240 PUBLIC S16 cmPkTknStr4(tknStr, mBuf)
1241 TknStr4 *tknStr; /* token string */
1242 Buffer *mBuf; /* message buffer */
1247 CMPKTKNSTR(tknStr, mBuf);
1251 } /* end of cmPkTknStr4 */
1259 * Desc: This function packs a token string of size 4
1270 PUBLIC S16 cmPkTknStr12
1272 TknStr12 *tknStr, /* token string */
1273 Buffer *mBuf /* message buffer */
1276 PUBLIC S16 cmPkTknStr12(tknStr, mBuf)
1277 TknStr12 *tknStr; /* token string */
1278 Buffer *mBuf; /* message buffer */
1283 CMPKTKNSTR(tknStr, mBuf);
1287 } /* end of cmPkTknStr12 */
1294 * Desc: This function packs a token string of size 4
1305 PUBLIC S16 cmPkTknStr32
1307 TknStr32 *tknStr, /* token string */
1308 Buffer *mBuf /* message buffer */
1311 PUBLIC S16 cmPkTknStr32(tknStr, mBuf)
1312 TknStr32 *tknStr; /* token string */
1313 Buffer *mBuf; /* message buffer */
1318 CMPKTKNSTR(tknStr, mBuf);
1322 } /* end of cmPkTknStr32 */
1329 * Desc: This function packs a token string of size 4
1340 PUBLIC S16 cmPkTknStr64
1342 TknStr64 *tknStr, /* token string */
1343 Buffer *mBuf /* message buffer */
1346 PUBLIC S16 cmPkTknStr64(tknStr, mBuf)
1347 TknStr64 *tknStr; /* token string */
1348 Buffer *mBuf; /* message buffer */
1353 CMPKTKNSTR(tknStr, mBuf);
1357 } /* end of cmPkTknStr64 */
1362 * Fun: cmPkTknStr132
1364 * Desc: This function packs a token string of size 4
1375 PUBLIC S16 cmPkTknStr132
1377 TknStr132 *tknStr, /* token string */
1378 Buffer *mBuf /* message buffer */
1381 PUBLIC S16 cmPkTknStr132(tknStr, mBuf)
1382 TknStr132 *tknStr; /* token string */
1383 Buffer *mBuf; /* message buffer */
1388 CMPKTKNSTR(tknStr, mBuf);
1392 } /* end of cmPkTknStr132 */
1397 * Fun: cmPkTknStr256
1399 * Desc: This function packs a token string of size 4
1410 PUBLIC S16 cmPkTknStr256
1412 TknStr256 *tknStr, /* token string */
1413 Buffer *mBuf /* message buffer */
1416 PUBLIC S16 cmPkTknStr256(tknStr, mBuf)
1417 TknStr256 *tknStr; /* token string */
1418 Buffer *mBuf; /* message buffer */
1423 CMPKTKNSTR(tknStr, mBuf);
1427 } /* end of cmPkTknStr256 */
1434 * Desc: This function packs a Object Identifier token
1445 PUBLIC S16 cmPkTknOid
1447 TknOid *tknOid, /* Object Identifier token */
1448 Buffer *mBuf /* message buffer */
1451 PUBLIC S16 cmPkTknOid(tknOid, mBuf)
1452 TknOid *tknOid; /* Object Identifier token */
1453 Buffer *mBuf; /* message buffer */
1460 if (tknOid->pres == TRUE)
1462 /* Pack the value */
1463 for (i = 0; i < (U16)tknOid->len; i++)
1465 /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
1466 * with compilation flag TKNOID_U16 */
1468 CMCHKPK(SPkU32, tknOid->val[i], mBuf);
1470 CMCHKPK(SPkU16, tknOid->val[i], mBuf);
1471 #endif /* !TKNOID_U16 */
1473 /* Pack the length */
1474 CMCHKPK(SPkU8, tknOid->len, mBuf);
1476 /* Pack the token header */
1477 CMCHKPK(SPkU8, tknOid->pres, mBuf);
1480 } /* end of cmPkTknOid */
1487 * Desc: This function packs a token S32
1498 PUBLIC S16 cmPkTknS32
1500 TknS32 *tknS32, /* token S32 */
1501 Buffer *mBuf /* message buffer */
1504 PUBLIC S16 cmPkTknS32(tknS32, mBuf)
1505 TknS32 *tknS32; /* token S32 */
1506 Buffer *mBuf; /* message buffer */
1514 CMCHKPK(SPkS32, tknS32->val, mBuf);
1518 CMCHKPK(SPkU8, tknS32->pres, mBuf);
1521 } /* end of cmPkTknS32 */
1528 * Desc: This function packs the header structure
1539 PUBLIC S16 cmPkHeader
1541 Header *header, /* header */
1542 Buffer *mBuf /* message buffer */
1545 PUBLIC S16 cmPkHeader(header, mBuf)
1546 Header *header; /* header */
1547 Buffer *mBuf; /* message buffer */
1553 CMCHKPK(cmPkMemoryId, &header->response.mem, mBuf);
1554 CMCHKPK(cmPkRoute, header->response.route, mBuf);
1555 CMCHKPK(cmPkPriority, header->response.prior, mBuf);
1556 CMCHKPK(cmPkSelector, header->response.selector, mBuf);
1557 CMCHKPK(cmPkTranId, header->transId, mBuf);
1559 CMCHKPK(cmPkElmntId, &header->elmId, mBuf);
1560 CMCHKPK(cmPkEntityId, &header->entId, mBuf);
1561 CMCHKPK(SPkU16, header->seqNmb, mBuf);
1562 CMCHKPK(SPkU8, header->version, mBuf);
1563 CMCHKPK(SPkU8, header->msgType, mBuf);
1564 CMCHKPK(SPkU16, header->msgLen, mBuf);
1567 } /* end of cmPkHeader */
1574 * Desc: This function packs common management status structure
1585 PUBLIC S16 cmPkCmStatus
1587 CmStatus *sta, /* status structure */
1588 Buffer *mBuf /* message buffer */
1591 PUBLIC S16 cmPkCmStatus(sta, mBuf)
1592 CmStatus *sta; /* status structure */
1593 Buffer *mBuf; /* message buffer */
1598 CMCHKPK(SPkU16, sta->reason, mBuf);
1599 CMCHKPK(SPkU16, sta->status, mBuf);
1602 } /* end of cmPkCmStatus */
1609 * Desc: This function packs common management alarm structure
1620 PUBLIC S16 cmPkCmAlarm
1622 CmAlarm *alarm, /* alarm structure */
1623 Buffer *mBuf /* message buffer */
1626 PUBLIC S16 cmPkCmAlarm(alarm, mBuf)
1627 CmAlarm *alarm; /* alarm structure */
1628 Buffer *mBuf; /* message buffer */
1633 CMCHKPK(SPkU16, alarm->cause, mBuf);
1634 CMCHKPK(SPkU16, alarm->event, mBuf);
1635 CMCHKPK(SPkU16, alarm->category, mBuf);
1636 CMCHKPK(cmPkDateTime, &alarm->dt, mBuf);
1639 } /* end of cmPkCmAlarm */
1646 * Desc: This function packs the stack manager structure
1657 PUBLIC S16 cmPkSmCfg
1659 SmCfg *smCfg, /* stack manager */
1660 Buffer *mBuf /* message buffer */
1663 PUBLIC S16 cmPkSmCfg(smCfg, mBuf)
1664 SmCfg *smCfg; /* stack manager */
1665 Buffer *mBuf; /* message buffer */
1670 CMCHKPK(cmPkSelector, smCfg->selector, mBuf);
1671 CMCHKPK(cmPkRoute, smCfg->route, mBuf);
1672 CMCHKPK(cmPkPrior, smCfg->prior, mBuf);
1673 CMCHKPK(cmPkPool, smCfg->pool, mBuf);
1674 CMCHKPK(cmPkRegion, smCfg->region, mBuf);
1675 CMCHKPK(cmPkInst, smCfg->inst, mBuf);
1676 CMCHKPK(cmPkEnt, smCfg->ent, mBuf);
1679 } /* end of cmPkSmCfg */
1686 * Desc: This function packs the timer configuration structure
1697 PUBLIC S16 cmPkTmrCfg
1699 TmrCfg *tmrCfg, /* timer configuration */
1700 Buffer *mBuf /* message buffer */
1703 PUBLIC S16 cmPkTmrCfg(tmrCfg, mBuf)
1704 TmrCfg *tmrCfg; /* timer configuration */
1705 Buffer *mBuf; /* message buffer */
1710 CMCHKPK(SPkU16, tmrCfg->val, mBuf);
1711 CMCHKPK(cmPkBool, tmrCfg->enb, mBuf);
1714 } /* end of cmPkTmrCfg */
1721 * Desc: This function packs a token buffer
1732 PUBLIC S16 cmPkTknBuf
1734 TknBuf *tknBuf, /* token string */
1735 Buffer *mBuf /* message buffer */
1738 PUBLIC S16 cmPkTknBuf(tknBuf, mBuf)
1739 TknBuf *tknBuf; /* token string */
1740 Buffer *mBuf; /* message buffer */
1749 SFndLenMsg(tknBuf->val, &msgLen);
1750 if( SCatMsg(mBuf, tknBuf->val, M2M1) != ROK )
1754 cmPkMsgLen(msgLen, mBuf);
1755 SPutMsg(tknBuf->val);
1759 CMCHKPK(SPkU8, tknBuf->pres, mBuf);
1762 } /* end of cmPkTknBuf */
1764 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1769 * Desc: This function packs the interface information
1782 CmIntf *intf, /* interface info */
1783 Buffer *mBuf /* message buffer */
1786 PUBLIC S16 cmPkIntf(intf, mBuf)
1787 CmIntf *intf; /* interface info */
1788 Buffer *mBuf; /* message buffer */
1793 CMCHKPK(cmPkIntfId, intf->intfId, mBuf);
1794 CMCHKPK(cmPkIntfVer, intf->intfVer, mBuf);
1797 } /* end of cmPkIntf */
1798 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
1802 * common unpacking functions
1808 * Fun: cmUnpkDateTime
1810 * Desc: This function is used to Unpack Pack Date Time structure
1821 PUBLIC S16 cmUnpkDateTime
1823 DateTime *dateTime, /* date/time structure */
1824 Buffer *mBuf /* message buffer */
1827 PUBLIC S16 cmUnpkDateTime(dateTime, mBuf)
1828 DateTime *dateTime; /* date/time structure */
1829 Buffer *mBuf; /* message buffer */
1834 CMCHKUNPK(SUnpkU8, &dateTime->month, mBuf);
1835 CMCHKUNPK(SUnpkU8, &dateTime->day, mBuf);
1836 CMCHKUNPK(SUnpkU8, &dateTime->year, mBuf);
1837 CMCHKUNPK(SUnpkU8, &dateTime->hour, mBuf);
1838 CMCHKUNPK(SUnpkU8, &dateTime->min, mBuf);
1839 CMCHKUNPK(SUnpkU8, &dateTime->sec, mBuf);
1840 CMCHKUNPK(SUnpkU8, &dateTime->tenths, mBuf);
1842 /*-- added for micro seconds --*/
1843 #ifdef SS_DATETIME_USEC
1844 CMCHKUNPK(SUnpkU32, &dateTime->usec, mBuf);
1845 #endif /*-- SS_DATETIME_USEC --*/
1848 } /* end of cmUnpkDateTime */
1853 * Fun: cmUnpkDuration
1855 * Desc: This function is used to Unpack Pack Duration structure
1866 PUBLIC S16 cmUnpkDuration
1868 Duration *duration, /* duration structure */
1869 Buffer *mBuf /* message buffer */
1872 PUBLIC S16 cmUnpkDuration(duration, mBuf)
1873 Duration *duration; /* duration structure */
1874 Buffer *mBuf; /* message buffer */
1879 CMCHKUNPK(SUnpkU8, &duration->days, mBuf);
1880 CMCHKUNPK(SUnpkU8, &duration->hours, mBuf);
1881 CMCHKUNPK(SUnpkU8, &duration->mins, mBuf);
1882 CMCHKUNPK(SUnpkU8, &duration->secs, mBuf);
1883 CMCHKUNPK(SUnpkU8, &duration->tenths, mBuf);
1886 } /* end of cmUnpkDuration */
1892 * Desc: This function is used to Unpack Ptr type
1903 PUBLIC S16 cmUnpkPtr
1905 PTR *ptr, /* duration structure */
1906 Buffer *mBuf /* message buffer */
1909 PUBLIC S16 cmUnpkPtr(ptr, mBuf)
1910 PTR *ptr; /* duration structure */
1911 Buffer *mBuf; /* message buffer */
1914 U16 tmp16; /* temporary value */
1915 U32 tmp32; /* temporary value */
1916 Data unpkArray[PTRSIZE]; /* unpacking array */
1917 S16 ret; /* return code */
1919 #if (defined(ALPHA) || defined(BIT_64))
1928 ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
1933 #ifndef FCSPKINT /* backward compatibility, packing order */
1934 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1935 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1936 #else /* forward compatibility, packing order */
1937 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1938 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1944 ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
1950 #ifndef FCSPKINT /* backward compatibility, packing order */
1951 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
1952 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
1953 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1954 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1955 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1956 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1957 #else /* forward compatibility, packing order */
1958 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1959 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1960 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1961 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
1962 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
1963 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1969 #if(defined(ALPHA) || defined(BIT_64))
1970 ret = SRemPreMsgMult(unpkArray, (MsgLen) 8, mBuf);
1977 #ifndef FCSPKINT /* backward compatibility, packing order */
1978 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[7]);
1979 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[6]);
1980 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1981 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[5]);
1982 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[4]);
1983 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1984 tmp64 = (U64) PutHi32Bit(tmp64, tmp32);
1985 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
1986 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
1987 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1988 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
1989 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
1990 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1991 tmp64 = (U64) PutLo32Bit(tmp64, tmp32);
1992 #else /* forward compatibility, packing order */
1993 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
1994 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
1995 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
1996 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
1997 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
1998 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
1999 tmp64 = (U64) PutHi32Bit(tmp64, tmp32);
2000 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[4]);
2001 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[5]);
2002 tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
2003 tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[6]);
2004 tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[7]);
2005 tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
2006 tmp64 = (U64) PutLo32Bit(tmp64, tmp32);
2012 /* no support for U64 */
2017 } /* end of cmUnpkPtr */
2022 * Fun: cmUnpkEntityId
2024 * Desc: This function unpacks the EntityId structure
2035 PUBLIC S16 cmUnpkEntityId
2037 EntityId *entityId, /* entity id */
2038 Buffer *mBuf /* message buffer */
2041 PUBLIC S16 cmUnpkEntityId(entityId, mBuf)
2042 EntityId *entityId; /* entity id */
2043 Buffer *mBuf; /* message buffer */
2046 TRC2(cmUnpkEntityId)
2048 CMCHKUNPK(cmUnpkEnt, &entityId->ent, mBuf);
2049 CMCHKUNPK(cmUnpkInst, &entityId->inst, mBuf);
2052 } /* end of cmUnpkEntityId */
2057 * Fun: cmUnpkElmntId
2059 * Desc: This function unpacks the ElmntId structure
2070 PUBLIC S16 cmUnpkElmntId
2072 ElmntId *elmntId, /* element id */
2073 Buffer *mBuf /* message buffer */
2076 PUBLIC S16 cmUnpkElmntId(elmntId, mBuf)
2077 ElmntId *elmntId; /* element id */
2078 Buffer *mBuf; /* message buffer */
2083 CMCHKUNPK(cmUnpkElmnt, &elmntId->elmnt, mBuf);
2084 CMCHKUNPK(cmUnpkElmntInst1, &elmntId->elmntInst1, mBuf);
2085 CMCHKUNPK(cmUnpkElmntInst2, &elmntId->elmntInst2, mBuf);
2086 CMCHKUNPK(cmUnpkElmntInst3, &elmntId->elmntInst3, mBuf);
2089 } /* end of cmUnpkElmntId */
2094 * Fun: cmUnpkMemoryId
2096 * Desc: This function unpacks the MemoryId structure
2107 PUBLIC S16 cmUnpkMemoryId
2109 MemoryId *memoryId, /* memoryId */
2110 Buffer *mBuf /* message buffer */
2113 PUBLIC S16 cmUnpkMemoryId(memoryId, mBuf)
2114 MemoryId *memoryId; /* memoryId */
2115 Buffer *mBuf; /* message buffer */
2118 TRC2(cmUnpkMemoryId)
2120 CMCHKUNPK(cmUnpkRegion, &memoryId->region, mBuf);
2121 CMCHKUNPK(cmUnpkPool, &memoryId->pool, mBuf);
2124 } /* end of cmUnpkMemoryId */
2129 * Fun: cmUnpkSystemId
2131 * Desc: This function packs the System Id structure
2142 PUBLIC S16 cmUnpkSystemId
2144 SystemId *systemId, /* system id */
2145 Buffer *mBuf /* message buffer */
2148 PUBLIC S16 cmUnpkSystemId(systemId, mBuf)
2149 SystemId *systemId; /* system id */
2150 Buffer *mBuf; /* message buffer */
2153 S16 i; /* loop counter */
2156 TRC2(cmUnpkSystemId)
2158 CMCHKUNPK(SUnpkS16, &systemId->mVer, mBuf);
2159 CMCHKUNPK(SUnpkS16, &systemId->mRev, mBuf);
2160 CMCHKUNPK(SUnpkS16, &systemId->bVer, mBuf);
2161 CMCHKUNPK(SUnpkS16, &systemId->bRev, mBuf);
2163 SFndLenMsg(mBuf, &len);
2165 for (i = 0; i < len; i++)
2167 CMCHKUNPK(cmUnpkTxt, &systemId->ptNmb[i], mBuf);
2171 } /* end of cmUnpkSystemId */
2177 * Fun: cmUnpkProtAddr
2179 * Desc: This function will unpack protocol address.
2181 * Ret: ROK on success
2191 PUBLIC S16 cmUnpkProtAddr
2193 ProtAddr *pAddr, /* protocol address */
2194 Buffer *mBuf /* buffer */
2197 PUBLIC S16 cmUnpkProtAddr(pAddr, mBuf)
2198 ProtAddr *pAddr; /* protocol address table */
2199 Buffer *mBuf; /* buffer */
2204 TRC3(cmUnpkProtAddr)
2206 CMCHKUNPK(SUnpkU16, &(pAddr->protType), mBuf);
2207 CMCHKUNPK(SUnpkU8, &(pAddr->len), mBuf);
2208 CMCHKUNPK(SUnpkU8, &(pAddr->preLen), mBuf);
2210 for (j =0; j < pAddr->len; j++)
2211 CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);
2214 CMCHKUNPK(cmUnpkBool, &(pAddr->autoSysIdPres), mBuf);
2215 CMCHKUNPK(SUnpkU32, &(pAddr->autoSysId), mBuf);
2216 #endif /* CM_ARI2 */
2219 } /* end of cmUnpkProtAddr */
2224 * Fun: cmUnpkProtAddrTbl
2226 * Desc: This function will pack protocol addresses.
2228 * Ret: ROK on success
2238 PUBLIC S16 cmUnpkProtAddrTbl
2240 ProtAddrTbl *protAddr, /* protocol address table */
2241 Buffer *mBuf /* buffer */
2244 PUBLIC S16 cmUnpkProtAddrTbl(protAddr, mBuf)
2245 ProtAddrTbl *protAddr; /* protocol address table */
2246 Buffer *mBuf; /* buffer */
2251 ProtAddr *pAddr; /* Protocol Address */
2253 TRC3(cmUnpkProtAddrTbl)
2255 CMCHKUNPK(SUnpkU8, &protAddr->count, mBuf);
2256 for (i = 0; i < protAddr->count; i++)
2258 pAddr = &(protAddr->addr[i]);
2260 CMCHKUNPK(SUnpkU16, &(pAddr->protType), mBuf);
2261 CMCHKUNPK(SUnpkU8, &(pAddr->len), mBuf);
2262 CMCHKUNPK(SUnpkU8, &(pAddr->preLen), mBuf);
2265 for (j =0; j < pAddr->len; j++)
2266 CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);
2269 CMCHKUNPK(cmUnpkBool, &(pAddr->autoSysIdPres), mBuf);
2270 CMCHKUNPK(SUnpkU32, &(pAddr->autoSysId), mBuf);
2271 #endif /* CM_ARI2 */
2274 } /* end of cmUnpkProtAddrTbl */
2281 * Desc: This function is used to unpack the Addrs structure
2292 PUBLIC S16 cmUnpkAddrs
2294 Addrs *addrs, /* address */
2295 Buffer *mBuf /* message buffer */
2298 PUBLIC S16 cmUnpkAddrs(addrs, mBuf)
2299 Addrs *addrs; /* address */
2300 Buffer *mBuf; /* message buffer */
2303 U8 i; /* loop counter */
2307 CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2309 if (addrs->length > ADRLEN)
2312 for(i = 0; i < addrs->length; i++)
2314 CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2318 } /* end of cmUnpkAddrs */
2322 * Fun: cmUnpkShrtAddrs
2324 * Desc: This function is used to unpack the ShrtAddrs structure
2335 PUBLIC S16 cmUnpkShrtAddrs
2337 ShrtAddrs *addrs, /* address */
2338 Buffer *mBuf /* message buffer */
2341 PUBLIC S16 cmUnpkShrtAddrs(addrs, mBuf)
2342 ShrtAddrs *addrs; /* address */
2343 Buffer *mBuf; /* message buffer */
2346 U8 i; /* loop counter */
2348 TRC2(cmUnpShrtAddrs)
2350 CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2352 if (addrs->length > SHRTADRLEN)
2355 for(i = 0; i < addrs->length; i++)
2357 CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2360 } /* end of cmUnpkShrtAddrs */
2365 * Fun: cmUnpkAddrMask
2367 * Desc: This unpacks address mask.
2378 PUBLIC S16 cmUnpkAddrMask
2380 U8 *mask, /* pointer to address mask */
2381 Buffer *mBuf /* message buffer */
2384 PUBLIC S16 cmUnpkAddrMask(mask, mBuf)
2385 U8 *mask; /* pointer to address mask */
2386 Buffer *mBuf; /* message buffer */
2389 S16 i; /* counter */
2393 /* unpack address mask */
2394 for (i = 0; i< ADRLEN; i++)
2396 CMCHKUNPK(SUnpkU8, &mask[i], mBuf);
2399 } /* end of cmUnpkAddrMask */
2406 * Desc: This function unpacks the BndCfg structure
2417 PUBLIC S16 cmUnpkBndCfg
2419 BndCfg *bndCfg, /* bndCfg */
2420 Buffer *mBuf /* message buffer */
2423 PUBLIC S16 cmUnpkBndCfg(bndCfg, mBuf)
2424 BndCfg *bndCfg; /* bndCfg */
2425 Buffer *mBuf; /* message buffer */
2428 S16 i; /* loop counter */
2432 for (i = 0; bndCfg->usrId[i]; i++);
2433 CMCHKUNPK(cmUnpkTxt, bndCfg->usrId+i, mBuf);
2435 CMCHKUNPK(SUnpkU8, &bndCfg->bufOwnshp, mBuf);
2436 CMCHKUNPK(SUnpkU8, &bndCfg->flcTyp, mBuf);
2437 CMCHKUNPK(SUnpkU8, &bndCfg->wdw, mBuf);
2438 CMCHKUNPK(cmUnpkEnt, &bndCfg->ent, mBuf);
2439 CMCHKUNPK(cmUnpkInst, &bndCfg->inst, mBuf);
2440 CMCHKUNPK(cmUnpkRegion, &bndCfg->region, mBuf);
2441 CMCHKUNPK(cmUnpkPool, &bndCfg->pool, mBuf);
2442 CMCHKUNPK(cmUnpkPrior, &bndCfg->prior, mBuf);
2443 CMCHKUNPK(cmUnpkRoute, &bndCfg->route, mBuf);
2444 CMCHKUNPK(cmUnpkAddrs, &bndCfg->sapAdr, mBuf);
2445 CMCHKUNPK(cmUnpkSelector, &bndCfg->selector, mBuf);
2448 } /* end of cmUnpkBndCfg */
2455 * Desc: pack post structure
2465 PUBLIC S16 cmUnpkPst
2471 PUBLIC S16 cmUnpkPst(pst, mBuf)
2478 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2479 CMCHKUNPK(cmUnpkIntfVer, &pst->intfVer, mBuf);
2481 CMCHKUNPK(cmUnpkSelector, &pst->selector, mBuf);
2482 CMCHKUNPK(cmUnpkRegion, &pst->region, mBuf);
2483 CMCHKUNPK(cmUnpkPool, &pst->pool, mBuf);
2484 CMCHKUNPK(cmUnpkPrior, &pst->prior, mBuf);
2485 CMCHKUNPK(cmUnpkRoute, &pst->route, mBuf);
2486 CMCHKUNPK(cmUnpkProcId, &pst->dstProcId, mBuf);
2487 CMCHKUNPK(cmUnpkEnt, &pst->dstEnt, mBuf);
2488 CMCHKUNPK(cmUnpkInst, &pst->dstInst, mBuf);
2489 CMCHKUNPK(cmUnpkProcId, &pst->srcProcId, mBuf);
2490 CMCHKUNPK(cmUnpkEnt, &pst->srcEnt, mBuf);
2491 CMCHKUNPK(cmUnpkInst, &pst->srcInst, mBuf);
2492 CMCHKUNPK(cmUnpkEvent, &pst->event, mBuf);
2495 } /* end of cmUnpkPst */
2499 * Fun: cmUnpkElmtHdr
2501 * Desc: Unpack element header
2512 PUBLIC S16 cmUnpkElmtHdr
2514 ElmtHdr *m, /* element header */
2515 Buffer *mBuf /* message buffer */
2518 PUBLIC S16 cmUnpkElmtHdr(m, mBuf)
2519 ElmtHdr *m; /* element header */
2520 Buffer *mBuf; /* message buffer */
2526 CMCHKUNPK(cmUnpkBool, &m->pres , mBuf);
2528 #if (LCAMT || ATM_BISUP)
2529 /* Unpack action indicator field */
2532 CMCHKUNPK(SUnpkU8, &m->actnInd, mBuf);
2536 #if (LCAMT || ATM_BISUP)
2537 CMCHKUNPK(SUnpkU16, &m->compInd, mBuf);
2538 #endif /* LCAMT || ATM_BISUP */
2541 } /* end of cmUnpkElmtHdr */
2548 * Desc: This function unpacks a token U8
2559 PUBLIC S16 cmUnpkTknU8
2561 TknU8 *tknU8, /* token U8 */
2562 Buffer *mBuf /* message buffer */
2565 PUBLIC S16 cmUnpkTknU8(tknU8, mBuf)
2566 TknU8 *tknU8; /* token U8 */
2567 Buffer *mBuf; /* message buffer */
2573 CMCHKUNPK(SUnpkU8, &tknU8->pres, mBuf);
2578 CMCHKUNPK(SUnpkU8, &tknU8->val, mBuf);
2582 } /* end of cmUnpkTknU8 */
2589 * Desc: This function unpacks a token S8
2600 PUBLIC S16 cmUnpkTknS8
2602 TknS8 *tknS8, /* token S8 */
2603 Buffer *mBuf /* message buffer */
2606 PUBLIC S16 cmUnpkTknS8(tknS8, mBuf)
2607 TknS8 *tknS8; /* token S8 */
2608 Buffer *mBuf; /* message buffer */
2614 CMCHKUNPK(SUnpkU8, &tknS8->pres, mBuf);
2619 CMCHKUNPK(SUnpkS8, &tknS8->val, mBuf);
2623 } /* end of cmUnpkTknS8 */
2630 * Desc: This function unpacks a token U16
2641 PUBLIC S16 cmUnpkTknU16
2643 TknU16 *tknU16, /* token U16 */
2644 Buffer *mBuf /* message buffer */
2647 PUBLIC S16 cmUnpkTknU16(tknU16, mBuf)
2648 TknU16 *tknU16; /* token U16 */
2649 Buffer *mBuf; /* message buffer */
2655 CMCHKUNPK(SUnpkU8, &tknU16->pres, mBuf);
2660 CMCHKUNPK(SUnpkU16, &tknU16->val, mBuf);
2664 } /* end of cmUnpkTknU16 */
2671 * Desc: This function unpacks a token U32
2682 PUBLIC S16 cmUnpkTknU32
2684 TknU32 *tknU32, /* token U32 */
2685 Buffer *mBuf /* message buffer */
2688 PUBLIC S16 cmUnpkTknU32(tknU32, mBuf)
2689 TknU32 *tknU32; /* token U32 */
2690 Buffer *mBuf; /* message buffer */
2696 CMCHKUNPK(SUnpkU8, &tknU32->pres, mBuf);
2701 CMCHKUNPK(SUnpkU32, &tknU32->val, mBuf);
2705 } /* end of cmUnpkTknU32 */
2711 * Desc: This function unpacks a token string - regular size
2722 PUBLIC S16 cmUnpkTknStr
2724 TknStr *tknStr, /* token string */
2725 Buffer *mBuf /* message buffer */
2728 PUBLIC S16 cmUnpkTknStr(tknStr, mBuf)
2729 TknStr *tknStr; /* token string */
2730 Buffer *mBuf; /* message buffer */
2733 Cntr i; /* counter */
2738 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2743 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2746 for (i = (tknStr->len - 1); i >= 0; i--)
2748 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2755 } /* end of cmUnpkTknStr */
2759 * Fun: cmUnpkTknStrM
2761 * Desc: This function unpacks a token string - medium size
2772 PUBLIC S16 cmUnpkTknStrM
2774 TknStrM *tknStr, /* token string */
2775 Buffer *mBuf /* message buffer */
2778 PUBLIC S16 cmUnpkTknStrM(tknStr, mBuf)
2779 TknStrM *tknStr; /* token string */
2780 Buffer *mBuf; /* message buffer */
2783 Cntr i; /* counter */
2788 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2793 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2796 for (i = (tknStr->len - 1); i >= 0; i--)
2798 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2805 } /* end of cmUnpkTknStrM */
2810 * Fun: cmUnpkTknStrS
2812 * Desc: This function unpacks a token string - small size
2823 PUBLIC S16 cmUnpkTknStrS
2825 TknStrS *tknStr, /* token string */
2826 Buffer *mBuf /* message buffer */
2829 PUBLIC S16 cmUnpkTknStrS(tknStr, mBuf)
2830 TknStrS *tknStr; /* token string */
2831 Buffer *mBuf; /* message buffer */
2834 Cntr i; /* counter */
2839 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2844 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2847 for (i = (tknStr->len - 1); i >= 0; i--)
2849 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2856 } /* end of cmUnpkTknStrS */
2861 * Fun: cmUnpkTknStrE
2863 * Desc: This function unpacks a token string - extended size
2874 PUBLIC S16 cmUnpkTknStrE
2876 TknStrE *tknStr, /* token string */
2877 Buffer *mBuf /* message buffer */
2880 PUBLIC S16 cmUnpkTknStrE(tknStr, mBuf)
2881 TknStrE *tknStr; /* token string */
2882 Buffer *mBuf; /* message buffer */
2885 Cntr i; /* counter */
2890 CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2895 CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2898 for (i = (tknStr->len - 1); i >= 0; i--)
2900 CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2907 } /* end of cmUnpkTknStrE */
2909 #ifndef CMFILE_REORG_1
2914 * Fun: cmUnpkPnNodeId
2916 * Desc: This function unpacks a PnNodeId structure from a buffer
2927 PUBLIC S16 cmUnpkPnNodeId
2929 PnNodeId *dst, /* source PNNI Node Id */
2930 Buffer *mBuf /* message buffer */
2933 PUBLIC S16 cmUnpkPnNodeId (dst, mBuf)
2934 PnNodeId *dst; /* source PNNI Node Id */
2935 Buffer *mBuf; /* message buffer */
2940 TRC3(cmUnpkPnNodeId);
2942 for (i = 0; i < PN_NODEID_LEN; i++)
2944 CMCHKUNPK(SUnpkU8, &dst->id[i], mBuf);
2948 } /* cmUnpkPnNodeId */
2950 #endif /* CMFILE_REORG_1 */
2955 * Fun: cmUnpkTknStr4
2957 * Desc: This function packs a token string of size 4
2968 PUBLIC S16 cmUnpkTknStr4
2970 TknStr4 *tknStr, /* token string */
2971 Buffer *mBuf /* message buffer */
2974 PUBLIC S16 cmUnpkTknStr4(tknStr, mBuf)
2975 TknStr4 *tknStr; /* token string */
2976 Buffer *mBuf; /* message buffer */
2981 CMUNPKTKNSTR(tknStr, mBuf);
2985 } /* end of cmUnpkTknStr4 */
2991 * Fun: cmUnpkTknStr12
2993 * Desc: This function packs a token string of size 4
3004 PUBLIC S16 cmUnpkTknStr12
3006 TknStr12 *tknStr, /* token string */
3007 Buffer *mBuf /* message buffer */
3010 PUBLIC S16 cmUnpkTknStr12(tknStr, mBuf)
3011 TknStr12 *tknStr; /* token string */
3012 Buffer *mBuf; /* message buffer */
3015 TRC2(cmUnpkTknStr12)
3017 CMUNPKTKNSTR(tknStr, mBuf);
3021 } /* end of cmUnpkTknStr12 */
3026 * Fun: cmUnpkTknStr32
3028 * Desc: This function packs a token string of size 4
3039 PUBLIC S16 cmUnpkTknStr32
3041 TknStr32 *tknStr, /* token string */
3042 Buffer *mBuf /* message buffer */
3045 PUBLIC S16 cmUnpkTknStr32(tknStr, mBuf)
3046 TknStr32 *tknStr; /* token string */
3047 Buffer *mBuf; /* message buffer */
3050 TRC2(cmUnpkTknStr32)
3052 CMUNPKTKNSTR(tknStr, mBuf);
3056 } /* end of cmUnpkTknStr32 */
3061 * Fun: cmUnpkTknStr64
3063 * Desc: This function packs a token string of size 4
3074 PUBLIC S16 cmUnpkTknStr64
3076 TknStr64 *tknStr, /* token string */
3077 Buffer *mBuf /* message buffer */
3080 PUBLIC S16 cmUnpkTknStr64(tknStr, mBuf)
3081 TknStr64 *tknStr; /* token string */
3082 Buffer *mBuf; /* message buffer */
3085 TRC2(cmUnpkTknStr64)
3087 CMUNPKTKNSTR(tknStr, mBuf);
3091 } /* end of cmUnpkTknStr64 */
3096 * Fun: cmUnpkTknStr132
3098 * Desc: This function packs a token string of size 4
3109 PUBLIC S16 cmUnpkTknStr132
3111 TknStr132 *tknStr, /* token string */
3112 Buffer *mBuf /* message buffer */
3115 PUBLIC S16 cmUnpkTknStr132(tknStr, mBuf)
3116 TknStr132 *tknStr; /* token string */
3117 Buffer *mBuf; /* message buffer */
3120 TRC2(cmUnpkTknStr132)
3122 CMUNPKTKNSTR(tknStr, mBuf);
3126 } /* end of cmUnpkTknStr132 */
3131 * Fun: cmUnpkTknStr256
3133 * Desc: This function packs a token string of size 4
3144 PUBLIC S16 cmUnpkTknStr256
3146 TknStr256 *tknStr, /* token string */
3147 Buffer *mBuf /* message buffer */
3150 PUBLIC S16 cmUnpkTknStr256(tknStr, mBuf)
3151 TknStr256 *tknStr; /* token string */
3152 Buffer *mBuf; /* message buffer */
3155 TRC2(cmUnpkTknStr256)
3157 CMUNPKTKNSTR(tknStr, mBuf);
3161 } /* end of cmUnpkTknStr256 */
3168 * Desc: This function packs a Object Identifier token
3179 PUBLIC S16 cmUnpkTknOid
3181 TknOid *tknOid, /* Object Identifier token */
3182 Buffer *mBuf /* message buffer */
3185 PUBLIC S16 cmUnpkTknOid(tknOid, mBuf)
3186 TknOid *tknOid; /* Object Identifier token */
3187 Buffer *mBuf; /* message buffer */
3194 /* Unpack the token header */
3195 CMCHKUNPK(SUnpkU8, &tknOid->pres, mBuf);
3197 if (tknOid->pres == TRUE)
3199 /* Unpack the length */
3200 CMCHKUNPK(SUnpkU8, &tknOid->len, mBuf);
3202 /* Pack the value */
3203 for (i = 1; i <= (U16)tknOid->len; i++)
3205 /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
3206 * with compilation flag TKNOID_U16 */
3208 CMCHKUNPK(SUnpkU32, &tknOid->val[tknOid->len - i], mBuf);
3210 CMCHKUNPK(SUnpkU16, &tknOid->val[tknOid->len - i], mBuf);
3211 #endif /* !TKNOID_U16 */
3216 } /* end of cmUnpkTknOid */
3223 * Desc: This function unpacks a token S32
3234 PUBLIC S16 cmUnpkTknS32
3236 TknS32 *tknS32, /* token S32 */
3237 Buffer *mBuf /* message buffer */
3240 PUBLIC S16 cmUnpkTknS32(tknS32, mBuf)
3241 TknS32 *tknS32; /* token S32 */
3242 Buffer *mBuf; /* message buffer */
3248 CMCHKUNPK(SUnpkU8, &tknS32->pres, mBuf);
3253 CMCHKUNPK(SUnpkS32, &tknS32->val, mBuf);
3257 } /* end of cmUnpkTknS32 */
3264 * Desc: This function is used to Unpack Header structure
3275 PUBLIC S16 cmUnpkHeader
3277 Header *header, /* header structure */
3278 Buffer *mBuf /* message buffer */
3281 PUBLIC S16 cmUnpkHeader(header, mBuf)
3282 Header *header; /* header structure */
3283 Buffer *mBuf; /* message buffer */
3288 CMCHKUNPK(SUnpkU16, &header->msgLen, mBuf);
3289 CMCHKUNPK(SUnpkU8, &header->msgType, mBuf);
3290 CMCHKUNPK(SUnpkU8, &header->version, mBuf);
3291 CMCHKUNPK(SUnpkU16, &header->seqNmb, mBuf);
3292 CMCHKUNPK(cmUnpkEntityId, &header->entId, mBuf);
3293 CMCHKUNPK(cmUnpkElmntId, &header->elmId, mBuf);
3295 CMCHKUNPK(cmUnpkTranId, &header->transId, mBuf);
3296 CMCHKUNPK(cmUnpkSelector, &header->response.selector, mBuf);
3297 CMCHKUNPK(cmUnpkPriority, &header->response.prior, mBuf);
3298 CMCHKUNPK(cmUnpkRoute, &header->response.route, mBuf);
3299 CMCHKUNPK(cmUnpkMemoryId, &header->response.mem, mBuf);
3303 } /* end of cmUnpkHeader */
3308 * Fun: cmUnpkCmStatus
3310 * Desc: This function unpacks common management status structure
3321 PUBLIC S16 cmUnpkCmStatus
3323 CmStatus *sta, /* status structure */
3324 Buffer *mBuf /* message buffer */
3327 PUBLIC S16 cmUnpkCmStatus(sta, mBuf)
3328 CmStatus *sta; /* status structure */
3329 Buffer *mBuf; /* message buffer */
3332 TRC2(cmUnpkCmStatus)
3334 CMCHKUNPK(SUnpkU16, &sta->status, mBuf);
3335 CMCHKUNPK(SUnpkU16, &sta->reason, mBuf);
3338 } /* end of cmUnpkCmStatus */
3343 * Fun: cmUnpkCmAlarm
3345 * Desc: This function unpacks common management alarm structure
3356 PUBLIC S16 cmUnpkCmAlarm
3358 CmAlarm *alarm, /* alarm structure */
3359 Buffer *mBuf /* message buffer */
3362 PUBLIC S16 cmUnpkCmAlarm(alarm, mBuf)
3363 CmAlarm *alarm; /* alarm structure */
3364 Buffer *mBuf; /* message buffer */
3369 CMCHKUNPK(cmUnpkDateTime, &alarm->dt, mBuf);
3370 CMCHKUNPK(SUnpkU16, &alarm->category, mBuf);
3371 CMCHKUNPK(SUnpkU16, &alarm->event, mBuf);
3372 CMCHKUNPK(SUnpkU16, &alarm->cause, mBuf);
3375 } /* end of cmUnpkCmAlarm */
3382 * Desc: This function unpacks the stack manager structure
3393 PUBLIC S16 cmUnpkSmCfg
3395 SmCfg *smCfg, /* stack manager */
3396 Buffer *mBuf /* message buffer */
3399 PUBLIC S16 cmUnpkSmCfg(smCfg, mBuf)
3400 SmCfg *smCfg; /* stack manager */
3401 Buffer *mBuf; /* message buffer */
3406 CMCHKUNPK(cmUnpkEnt, &smCfg->ent, mBuf);
3407 CMCHKUNPK(cmUnpkInst, &smCfg->inst, mBuf);
3408 CMCHKUNPK(cmUnpkRegion, &smCfg->region, mBuf);
3409 CMCHKUNPK(cmUnpkPool, &smCfg->pool, mBuf);
3410 CMCHKUNPK(cmUnpkPrior, &smCfg->prior, mBuf);
3411 CMCHKUNPK(cmUnpkRoute, &smCfg->route, mBuf);
3412 CMCHKUNPK(cmUnpkSelector, &smCfg->selector, mBuf);
3415 } /* end of cmUnpkSmCfg */
3422 * Desc: This function unpacks the timer configuration structure
3433 PUBLIC S16 cmUnpkTmrCfg
3435 TmrCfg *tmrCfg, /* timer configuration */
3436 Buffer *mBuf /* message buffer */
3439 PUBLIC S16 cmUnpkTmrCfg(tmrCfg, mBuf)
3440 TmrCfg *tmrCfg; /* timer configuration */
3441 Buffer *mBuf; /* message buffer */
3446 CMCHKUNPK(cmUnpkBool, &tmrCfg->enb, mBuf);
3447 CMCHKUNPK(SUnpkU16, &tmrCfg->val, mBuf);
3450 } /* end of cmUnpkTmrCfg */
3456 * Desc: This function unpacks a token buffer
3467 PUBLIC S16 cmUnpkTknBuf
3469 TknBuf *tknBuf, /* token string */
3470 Buffer **tBuf /* message buffer */
3473 PUBLIC S16 cmUnpkTknBuf(tknBuf, tBuf)
3474 TknBuf *tknBuf; /* token string */
3475 Buffer **tBuf; /* message buffer */
3486 CMCHKUNPK(SUnpkU8, &tknBuf->pres, mBuf);
3490 MsgLen msgLen, buflen;
3491 Region region; /* region */
3492 Pool pool; /* pool */
3494 cmUnpkMsgLen(&msgLen, mBuf);
3495 SFndLenMsg(mBuf, &buflen);
3496 if (buflen > msgLen)
3498 if( SSegMsg(mBuf, msgLen, &tknBuf->val) != ROK )
3505 /* Allocate the buffer for tknbuf->val */
3506 SGetBufRegionPool(mBuf, ®ion, &pool);
3507 SGetMsg(region, pool, &(tknBuf->val));
3510 /* now Swap the two Buffer pointers */
3511 SSwapMsg(mBuf,tknBuf->val);
3518 } /* end of cmUnpkTknBuf */
3520 #ifdef TDS_ROLL_UPGRADE_SUPPORT
3525 * Desc: This function unpacks the interface information
3536 PUBLIC S16 cmUnpkIntf
3538 CmIntf *intf, /* interface info */
3539 Buffer *mBuf /* message buffer */
3542 PUBLIC S16 cmUnpkIntf(intf, mBuf)
3543 CmIntf *intf; /* interface info */
3544 Buffer *mBuf; /* message buffer */
3549 CMCHKUNPK(cmUnpkIntfVer, &intf->intfVer, mBuf);
3550 CMCHKUNPK(cmUnpkIntfId, &intf->intfId, mBuf);
3553 } /* end of cmUnpkIntf */
3554 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
3556 /**********************************************************************
3558 **********************************************************************/