Added code for MAC-PHY interface, DU_APP, F1AP, SCTP and CU stub
[o-du/l2.git] / src / cm / cm_gen.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 \f
20 /********************************************************************20**
21   
22      Name:     common body 6
23   
24      Type:     C source file
25   
26      Desc:     common functions used to pack and unpack primitives and 
27                structures that are:
28
29                - Common to all interfaces e.g. Addrs, etc.
30                  These functions are always compiled.
31
32                All functions pack/unpack assuming that the most significant 
33                bit is towards the head of the buffer.
34
35      File:     cm_gen.c
36   
37 *********************************************************************21*/
38   
39 \f   
40 /* header include files (.h) */
41   
42 #include "envopt.h"        /* environment options */  
43 #include "envdep.h"        /* environment dependent */
44 #include "envind.h"        /* environment independent */
45
46 #include "gen.h"           /* general layer */
47 #include "ssi.h"           /* system services */
48
49 #ifndef CMFILE_REORG_1
50 #include "cm_gen.h"        /* common pack/unpack functions */
51 #endif
52
53 #include "cm_err.h"        /* common error */
54
55 /* header/extern include files (.x) */
56   
57 #include "gen.x"           /* general layer */
58 #include "ssi.x"           /* system services */
59
60 #ifndef CMFILE_REORG_1
61 #include "cm_gen.x"        /* common pack/unpack functions */
62 #endif
63
64 \f  
65 /* local defines */
66   
67 /* local typedefs */
68
69 /* local externs */
70   
71 /* forward references */
72
73 /* functions in other modules */
74
75 /* public variable declarations */
76
77 /* private variable declarations */
78
79 \f
80 /* 
81  * common packing functions 
82  */
83
84 \f
85 /*
86 *
87 *       Fun:   cmPkDateTime
88 *
89 *       Desc:  This function packs the Date Time structure
90 *
91 *       Ret:   ROK      - ok
92 *
93 *       Notes: None.
94 *
95 *       File:  cm_gen.c
96 *
97 */
98   
99 #ifdef ANSI
100 PUBLIC S16 cmPkDateTime
101 (
102 DateTime *dateTime,       /* date and time */
103 Buffer *mBuf              /* message buffer */
104 )
105 #else
106 PUBLIC S16 cmPkDateTime(dateTime, mBuf)
107 DateTime *dateTime;       /* date and time */
108 Buffer *mBuf;             /* message buffer */
109 #endif
110 {
111    TRC2(cmPkDateTime)
112
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);
124
125    RETVALUE(ROK);
126 } /* end of cmPkDateTime */
127
128 \f
129 /*
130 *
131 *       Fun:   cmPkDuration
132 *
133 *       Desc:  This function packs the Duration structure
134 *
135 *       Ret:   ROK      - ok
136 *
137 *       Notes: None.
138 *
139 *       File:  cm_gen.c
140 *
141 */
142   
143 #ifdef ANSI
144 PUBLIC S16 cmPkDuration
145 (
146 Duration *duration,        /* duration */
147 Buffer   *mBuf             /* message buffer */
148 )
149 #else
150 PUBLIC S16 cmPkDuration(duration, mBuf)
151 Duration *duration;        /* duration */
152 Buffer   *mBuf;            /* message buffer */
153 #endif
154 {
155    TRC2(cmPkDuration)
156
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);
162
163    RETVALUE(ROK);
164 } /* end of cmPkDuration */
165
166 /*
167 *
168 *       Fun:   cmPkPtr
169 *
170 *       Desc:  This function packs the pointer
171 *
172 *       Ret:   ROK      - ok
173 *
174 *       Notes: None.
175 *
176 *       File:  cm_gen.c
177 *
178 */
179  
180 #ifdef ANSI
181 PUBLIC S16 cmPkPtr
182 (
183 PTR      ptr,              /* pointer */
184 Buffer   *mBuf             /* message buffer */
185 )
186 #else
187 PUBLIC S16 cmPkPtr(ptr, mBuf)
188 PTR      ptr;              /* pointer */
189 Buffer   *mBuf;            /* message buffer */
190 #endif
191 {
192    Data pkArray[PTRSIZE];   /* array for packing */
193    S16 ret;                 /* return code */
194    U16 tmp;                 /* temporary value */
195
196 #if (defined(ALPHA) || defined(BIT_64))
197    U32 tmp32;
198 #endif
199
200    TRC2(cmPkPtr)
201    
202    ret = ROK;
203    switch (PTRSIZE)
204    {
205       case 2:
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);
212 #endif
213          ret = SAddPreMsgMult(pkArray, (MsgLen) 2, mBuf);
214          break;
215     
216       case 4: 
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);
231 #endif
232          ret = SAddPreMsgMult(pkArray, (MsgLen) 4, mBuf);
233          break;
234
235       case 8:
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);
267 #endif
268          ret = SAddPreMsgMult(pkArray, (MsgLen) 8, mBuf);
269          break;
270 #endif
271       default:
272          /* no support for U64 */
273          ret = RFAILED;
274    }
275
276    RETVALUE(ret);
277 } /* end of cmPkPtr */
278
279 \f
280 /*
281 *
282 *       Fun:   cmPkEntityId
283 *
284 *       Desc:  This function packs the EntityId structure
285 *
286 *       Ret:   ROK      - ok
287 *
288 *       Notes: None.
289 *
290 *       File:  cm_gen.c
291 *
292 */
293   
294 #ifdef ANSI
295 PUBLIC S16 cmPkEntityId
296 (
297 EntityId *entityId,        /* entity id */
298 Buffer   *mBuf             /* message buffer */
299 )
300 #else
301 PUBLIC S16 cmPkEntityId(entityId, mBuf)
302 EntityId *entityId;        /* entity id */
303 Buffer   *mBuf;            /* message buffer */
304 #endif
305 {
306    TRC2(cmPkEntityId)
307
308    CMCHKPK(cmPkInst, entityId->inst, mBuf);
309    CMCHKPK(cmPkEnt, entityId->ent, mBuf);
310
311    RETVALUE(ROK);
312 } /* end of cmPkEntityId */
313
314 \f
315 /*
316 *
317 *       Fun:   cmPkElmntId
318 *
319 *       Desc:  This function packs the ElmntId structure
320 *
321 *       Ret:   ROK      - ok
322 *
323 *       Notes: None.
324 *
325 *       File:  cm_gen.c
326 *
327 */
328   
329 #ifdef ANSI
330 PUBLIC S16 cmPkElmntId
331 (
332 ElmntId *elmntId,         /* element id */
333 Buffer  *mBuf             /* message buffer */
334 )
335 #else
336 PUBLIC S16 cmPkElmntId(elmntId, mBuf)
337 ElmntId *elmntId;         /* element id */
338 Buffer  *mBuf;            /* message buffer */
339 #endif
340 {
341    TRC2(cmPkElmntId)
342
343    CMCHKPK(cmPkElmntInst3, elmntId->elmntInst3, mBuf); 
344    CMCHKPK(cmPkElmntInst2, elmntId->elmntInst2, mBuf); 
345    CMCHKPK(cmPkElmntInst1, elmntId->elmntInst1, mBuf); 
346    CMCHKPK(cmPkElmnt, elmntId->elmnt, mBuf);
347
348    RETVALUE(ROK);
349 } /* end of cmPkElmntId */
350
351 \f
352 /*
353 *
354 *       Fun:   cmPkMemoryId
355 *
356 *       Desc:  This function packs the MemoryId structure
357 *
358 *       Ret:   ROK      - ok
359 *
360 *       Notes: None.
361 *
362 *       File:  cm_gen.c
363 *
364 */
365   
366 #ifdef ANSI
367 PUBLIC S16 cmPkMemoryId
368 (
369 MemoryId *memoryId,        /* memoryId */
370 Buffer   *mBuf             /* message buffer */
371 )
372 #else
373 PUBLIC S16 cmPkMemoryId(memoryId, mBuf)
374 MemoryId *memoryId;        /* memoryId */
375 Buffer   *mBuf;            /* message buffer */
376 #endif
377 {
378    TRC2(cmPkMemoryId)
379
380    CMCHKPK(cmPkPool, memoryId->pool, mBuf); 
381    CMCHKPK(cmPkRegion, memoryId->region, mBuf);
382
383    RETVALUE(ROK);
384 } /* end of cmPkMemoryId */
385
386 \f
387 /*
388 *
389 *       Fun:   cmPkSystemId
390 *
391 *       Desc:  This function packs the System Id structure
392 *
393 *       Ret:   ROK      - ok
394 *
395 *       Notes: None.
396 *
397 *       File:  cm_gen.c
398 *
399 */
400   
401 #ifdef ANSI
402 PUBLIC S16 cmPkSystemId
403 (
404 SystemId *systemId,         /* system id */
405 Buffer   *mBuf              /* message buffer */
406 )
407 #else
408 PUBLIC S16 cmPkSystemId(systemId, mBuf)
409 SystemId *systemId;         /* system id */
410 Buffer   *mBuf;             /* message buffer */
411 #endif
412 {
413    Txt *p;                  /* part number string */
414
415    TRC2(cmPkSystemId)
416
417    for (p = systemId->ptNmb; *p; p++);
418
419    for (; p != systemId->ptNmb; p--)
420    {
421       CMCHKPK(cmPkTxt, *p, mBuf);
422    }
423    CMCHKPK(cmPkTxt, *p, mBuf);
424    
425    CMCHKPK(SPkS16, systemId->bRev, mBuf);
426    CMCHKPK(SPkS16, systemId->bVer, mBuf);
427    CMCHKPK(SPkS16, systemId->mRev, mBuf);
428    CMCHKPK(SPkS16, systemId->mVer, mBuf);
429
430    RETVALUE(ROK);
431 } /* end of cmPkSystemId */
432
433
434
435 /*
436  *
437  *       Fun:   cmPkProtAddr
438  *
439  *       Desc:  This function will pack protocol address.
440  *
441  *       Ret:   ROK on success
442  *              RFAILED on error
443  *
444  *       Notes: None
445  *
446          File:  cm_gen.c
447  *
448  */
449
450 #ifdef ANSI
451 PUBLIC S16 cmPkProtAddr
452 (
453 ProtAddr     *pAddr,     /* protocol address */
454 Buffer       *mBuf       /* buffer */
455 )
456 #else
457 PUBLIC S16 cmPkProtAddr(pAddr, mBuf)
458 ProtAddr     *pAddr;      /* protocol address */
459 Buffer       *mBuf;          /* buffer */
460 #endif
461 {
462    U8              j;                  /* Index */
463
464    TRC3(cmPkProtAddr)
465
466 #ifdef CM_ARI2
467    CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);  
468    CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);  
469 #endif /* CM_ARI2 */
470
471    for (j = pAddr->len; j; j--)
472       CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);  
473
474    CMCHKPK(SPkU8,  pAddr->preLen, mBuf);  
475    CMCHKPK(SPkU8,  pAddr->len, mBuf);  
476    CMCHKPK(SPkU16, pAddr->protType, mBuf);  
477        
478    RETVALUE(ROK);
479
480 } /* end of cmPkProtAddr */
481    
482
483
484 /*
485  *
486  *       Fun:   cmPkProtAddrTbl
487  *
488  *       Desc:  This function will pack protocol addresses.
489  *
490  *       Ret:   ROK on success
491  *              RFAILED on error
492  *
493  *       Notes: None
494  *
495          File:  cm_gen.c
496  *
497  */
498
499 #ifdef ANSI
500 PUBLIC S16 cmPkProtAddrTbl
501 (
502 ProtAddrTbl  *protAddr,      /* protocol address table */
503 Buffer       *mBuf          /* buffer */
504 )
505 #else
506 PUBLIC S16 cmPkProtAddrTbl(protAddr, mBuf)
507 ProtAddrTbl  *protAddr;      /* protocol address table */
508 Buffer       *mBuf;          /* buffer */
509 #endif
510 {
511    U8              i;                  /* index */
512    U8              j;                  /* Index */
513    ProtAddr        *pAddr;             /* protocol Address */
514
515    TRC3(cmPkProtAddrTbl)
516
517    if (protAddr->count > MAX_PROT_ADDRS)
518       RETVALUE(RFAILED);
519
520    for (i = protAddr->count; i; i--)
521    {
522        pAddr = &(protAddr->addr[i - 1]);
523
524 #ifdef CM_ARI2
525        CMCHKPK(SPkU32, pAddr->autoSysId, mBuf);  
526        CMCHKPK(cmPkBool, pAddr->autoSysIdPres, mBuf);  
527 #endif /* CM_ARI2 */
528
529        for (j = pAddr->len; j; j--)
530           CMCHKPK(SPkU8, pAddr->address[j - 1], mBuf);  
531         
532        CMCHKPK(SPkU8, pAddr->preLen, mBuf);  
533        CMCHKPK(SPkU8,  pAddr->len, mBuf);  
534        CMCHKPK(SPkU16,  pAddr->protType, mBuf);  
535        
536    }
537    CMCHKPK(SPkU8, protAddr->count, mBuf);  
538
539    RETVALUE(ROK);
540 } /* end of cmPkProtAddrTbl */
541    
542
543 /*
544 *
545 *       Fun:   cmPkAddrs
546 *
547 *       Desc:  This function packs the address structure for a loosely 
548 *              coupled interface
549 *
550 *       Ret:   ROK      - ok
551 *
552 *       Notes: None.
553 *
554 *       File:  cm_gen.c
555 *
556 */
557   
558 #ifdef ANSI
559 PUBLIC S16 cmPkAddrs
560 (
561 Addrs *addrs,           /* address */
562 Buffer *mBuf            /* message buffer */
563 )
564 #else
565 PUBLIC S16 cmPkAddrs(addrs, mBuf)
566 Addrs *addrs;           /* address */
567 Buffer *mBuf;           /* message buffer */
568 #endif
569 {
570    U8 i;                /* loop counter */
571
572    TRC2(cmPkAddrs)
573
574    if (addrs->length > ADRLEN)
575       RETVALUE(RFAILED);
576
577    for (i = addrs->length; i; i--)
578    {
579       CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
580    }
581
582    CMCHKPK(SPkU8, addrs->length, mBuf);
583
584    RETVALUE(ROK);
585 } /* end of cmPkAddrs */
586
587 \f
588 /*
589 *
590 *       Fun:   cmPkShrtAddrs
591 *
592 *       Desc:  This function packs the short address structure for a loosely 
593 *              coupled interface
594 *
595 *       Ret:   ROK      - ok
596 *
597 *       Notes: None.
598 *
599 *       File:  cm_gen.c
600 *
601 */
602   
603 #ifdef ANSI
604 PUBLIC S16 cmPkShrtAddrs
605 (
606 ShrtAddrs *addrs,          /* address */
607 Buffer    *mBuf            /* message buffer */
608 )
609 #else
610 PUBLIC S16 cmPkShrtAddrs(addrs, mBuf)
611 ShrtAddrs *addrs;          /* address */
612 Buffer    *mBuf;           /* message buffer */
613 #endif 
614 {
615    U8 i;                /* loop counter */
616
617    TRC2(cmPkShrtAddrs)
618
619    if (addrs->length > SHRTADRLEN)
620       RETVALUE(RFAILED);
621
622    for (i = addrs->length; i; i--)
623    {
624       CMCHKPK(SPkU8, addrs->strg[i-1], mBuf);
625    }
626
627    CMCHKPK(SPkU8, addrs->length, mBuf);
628
629    RETVALUE(ROK);
630 } /* end of cmPkShrtAddrs */
631
632 \f
633 /*
634 *
635 *       Fun:   cmPkAddrMask
636 *
637 *       Desc:  This function address mask array.
638 *
639 *       Ret:   ROK      - ok
640 *
641 *       Notes: None
642 *
643 *       File:  cm_gen.c
644 *
645 */
646   
647 #ifdef ANSI
648 PUBLIC S16 cmPkAddrMask
649 (
650 U8 *mask,             /* pointer to address mask array */
651 Buffer  *mBuf         /* message buffer */
652 )
653 #else
654 PUBLIC S16 cmPkAddrMask(mask, mBuf)
655 U8 *mask;             /* pointer to address mask array */
656 Buffer  *mBuf;        /* message buffer */
657 #endif
658 {
659    S16 i;             /* counter */
660
661    TRC2(cmPkAddrMask)
662
663    /* pack address mask */
664    for (i = (ADRLEN - 1); i >= 0; i--)
665    {
666       CMCHKPK(SPkU8, mask[i], mBuf);
667    }
668
669    RETVALUE(ROK);
670 } /* end of cmPkAddrMask */
671
672 \f
673 /*
674 *
675 *       Fun:   cmPkBndCfg
676 *
677 *       Desc:  This function packs the BndCfg structure
678 *
679 *       Ret:   ROK      - ok
680 *
681 *       Notes: None.
682 *
683 *       File:  cm_gen.c
684 *
685 */
686   
687 #ifdef ANSI
688 PUBLIC S16 cmPkBndCfg
689 (
690 BndCfg *bndCfg,         /* bndCfg */
691 Buffer *mBuf            /* message buffer */
692 )
693 #else
694 PUBLIC S16 cmPkBndCfg(bndCfg, mBuf)
695 BndCfg *bndCfg;         /* bndCfg */
696 Buffer *mBuf;           /* message buffer */
697 #endif
698 {
699    Txt *p;              /* temporary */
700
701    TRC2(cmPkBndCfg)
702
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);
714
715    for (p = bndCfg->usrId; *p; p++);
716    for (; p != bndCfg->usrId; p--);
717    CMCHKPK(cmPkTxt, *p, mBuf);
718
719    RETVALUE(ROK);
720 } /* end of cmPkBndCfg */
721
722 \f
723 /*
724 *
725 *       Fun:   cmPkPst
726 *
727 *       Desc:  pack post structure 
728 *
729 *       Ret:   ROK
730 *
731 *       Notes: None.
732 *
733 *       File:  cm_gen.c
734 *
735 */
736 #ifdef ANSI
737 PUBLIC S16 cmPkPst
738 (
739 Pst *pst,
740 Buffer *mBuf
741 )
742 #else
743 PUBLIC S16 cmPkPst(pst, mBuf)
744 Pst *pst;
745 Buffer *mBuf;
746 #endif
747 {
748    TRC2(cmPkPst)
749    
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);
764 #endif
765
766    RETVALUE(ROK);
767 } /* end of cmPkPst */
768
769 /*
770  *
771  *      Fun:    cmPkElmtHdr
772  *
773  *      Desc:   Pack element header
774  *
775  *      Ret:   ROK      - ok
776  *
777  *      Notes:  None
778  *
779         File:   cm_gen.c
780  *
781  */
782   
783 #ifdef ANSI
784 PUBLIC S16 cmPkElmtHdr
785 (
786 ElmtHdr *m,                  /* element header */
787 Buffer  *mBuf                /* message buffer */
788 )
789 #else
790 PUBLIC S16 cmPkElmtHdr(m, mBuf)
791 ElmtHdr *m;                  /* element header */
792 Buffer  *mBuf;               /* message buffer */
793 #endif
794 {
795    TRC2(cmPkElmtHdr)
796  
797 #if (LCAMT || ATM_BISUP)
798       CMCHKPK(SPkU16, m->compInd, mBuf);
799 #endif /* LCAMT || ATM_BISUP */
800
801 #if (LCAMT || ATM_BISUP)
802    /* Pack action indicator field */
803    if (m->pres)
804    {
805      CMCHKPK(SPkU8, m->actnInd, mBuf);
806    }
807 #endif
808
809    /* Present */
810    CMCHKPK(cmPkBool, m->pres, mBuf);
811
812    RETVALUE(ROK);
813 } /* end of cmPkElmtHdr */
814
815 \f
816 /*
817  *
818  *      Fun:   cmPkTknU8
819  *
820  *      Desc:  This function packs a token U8
821  *
822  *      Ret:   ROK      - ok
823  *
824  *      Notes: None
825  *
826         File:  cm_gen.c
827  *
828  */
829   
830 #ifdef ANSI
831 PUBLIC S16 cmPkTknU8
832 (
833 TknU8  *tknU8,              /* token U8 */
834 Buffer *mBuf                /* message buffer */
835 )
836 #else
837 PUBLIC S16 cmPkTknU8(tknU8, mBuf)
838 TknU8  *tknU8;              /* token U8 */
839 Buffer *mBuf;               /* message buffer */
840 #endif
841 {
842    TRC2(cmPkTknU8)
843
844    if (tknU8->pres)
845    {
846       /* Value */
847       CMCHKPK(SPkU8, tknU8->val, mBuf);
848    }
849
850    /* Token Header */
851    CMCHKPK(SPkU8, tknU8->pres, mBuf);
852
853    RETVALUE(ROK);
854 } /* end of cmPkTknU8 */
855
856 \f
857 /*
858  *
859  *      Fun:   cmPkTknS8
860  *
861  *      Desc:  This function packs a token S8
862  *
863  *      Ret:   ROK      - ok
864  *
865  *      Notes: None
866  *
867         File:  cm_gen.c
868  *
869  */
870   
871 #ifdef ANSI
872 PUBLIC S16 cmPkTknS8
873 (
874 TknS8  *tknS8,              /* token S8 */
875 Buffer *mBuf                /* message buffer */
876 )
877 #else
878 PUBLIC S16 cmPkTknS8(tknS8, mBuf)
879 TknS8  *tknS8;              /* token S8 */
880 Buffer *mBuf;               /* message buffer */
881 #endif
882 {
883    TRC2(cmPkTknS8)
884  
885    if (tknS8->pres)
886    {
887       /* Value */
888       CMCHKPK(SPkS8, tknS8->val, mBuf);
889    }
890  
891    /* Token Header */
892    CMCHKPK(SPkU8, tknS8->pres, mBuf);
893  
894    RETVALUE(ROK);
895 } /* end of cmPkTknS8 */
896
897 \f
898 /*
899  *
900  *      Fun:   cmPkTknU16
901  *
902  *      Desc:  This function packs a token U16
903  *
904  *      Ret:   ROK      - ok
905  *
906  *      Notes: None
907  *
908         File:  cm_gen.c
909  *
910  */
911   
912 #ifdef ANSI
913 PUBLIC S16 cmPkTknU16
914 (
915 TknU16 *tknU16,             /* token U16 */
916 Buffer *mBuf                /* message buffer */
917 )
918 #else
919 PUBLIC S16 cmPkTknU16(tknU16, mBuf)
920 TknU16 *tknU16;             /* token U16 */
921 Buffer *mBuf;               /* message buffer */
922 #endif
923 {
924    TRC2(cmPkTknU16)
925
926    if (tknU16->pres)
927    {
928       /* Value */
929       CMCHKPK(SPkU16, tknU16->val, mBuf);
930    }
931
932    /* Token Header */
933    CMCHKPK(SPkU8, tknU16->pres, mBuf);
934
935    RETVALUE(ROK);
936 } /* end of cmPkTknU16 */
937
938 \f
939 /*
940  *
941  *      Fun:   cmPkTknU32
942  *
943  *      Desc:  This function packs a token U32
944  *
945  *      Ret:   ROK      - ok
946  *
947  *      Notes: None
948  *
949         File:  cm_gen.c
950  *
951  */
952   
953 #ifdef ANSI
954 PUBLIC S16 cmPkTknU32
955 (
956 TknU32 *tknU32,             /* token U32 */
957 Buffer *mBuf                /* message buffer */
958 )
959 #else
960 PUBLIC S16 cmPkTknU32(tknU32, mBuf)
961 TknU32 *tknU32;             /* token U32 */
962 Buffer *mBuf;               /* message buffer */
963 #endif
964 {
965    TRC2(cmPkTknU32)
966
967    if (tknU32->pres)
968    {
969       /* Value */
970       CMCHKPK(SPkU32, tknU32->val, mBuf);
971    }
972
973    /* Token Header */
974    CMCHKPK(SPkU8, tknU32->pres, mBuf);
975
976    RETVALUE(ROK);
977 } /* end of cmPkTknU32 */
978
979 \f
980 /*
981  *
982  *      Fun:   cmPkTknStr
983  *
984  *      Desc:  This function packs a token string - regular size
985  *
986  *      Ret:   ROK      - ok
987  *
988  *      Notes: None
989  *
990         File:  cm_gen.c
991  *
992  */
993   
994 #ifdef ANSI
995 PUBLIC S16 cmPkTknStr
996 (
997 TknStr *tknStr,             /* token string */
998 Buffer *mBuf                /* message buffer */
999 )
1000 #else
1001 PUBLIC S16 cmPkTknStr(tknStr, mBuf)
1002 TknStr *tknStr;             /* token string */
1003 Buffer *mBuf;               /* message buffer */
1004 #endif
1005 {
1006    Cntr i;                    /* counter */
1007
1008    TRC2(cmPkTknStr)
1009
1010    if (tknStr->pres)
1011    {
1012       /* Value */
1013       for (i = 0; i < (S16) tknStr->len; i++)
1014       {
1015          CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1016       }
1017
1018       /* Length */
1019       CMCHKPK(SPkU8, tknStr->len, mBuf);
1020    }
1021  
1022    /* Token Header */
1023    CMCHKPK(SPkU8, tknStr->pres, mBuf);
1024
1025    RETVALUE(ROK);
1026 } /* end of cmPkTknStr */
1027
1028 \f
1029 /*
1030  *
1031  *      Fun:   cmPkTknStrM
1032  *
1033  *      Desc:  This function packs a token string - medium size
1034  *
1035  *      Ret:   ROK      - ok
1036  *
1037  *      Notes: None
1038  *
1039         File:  cm_gen.c
1040  *
1041  */
1042   
1043 #ifdef ANSI
1044 PUBLIC S16 cmPkTknStrM
1045 (
1046 TknStrM *tknStr,             /* token string */
1047 Buffer *mBuf                /* message buffer */
1048 )
1049 #else
1050 PUBLIC S16 cmPkTknStrM(tknStr, mBuf)
1051 TknStrM *tknStr;             /* token string */
1052 Buffer *mBuf;               /* message buffer */
1053 #endif
1054 {
1055    Cntr i;                    /* counter */
1056
1057    TRC2(cmPkTknStrM)
1058
1059    if(tknStr->pres)
1060    {
1061       /* Value */
1062       for (i = 0; i < (S16) tknStr->len; i++)
1063       {
1064          CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1065       }
1066
1067       /* Length */
1068       CMCHKPK(SPkU8, tknStr->len, mBuf);
1069    }
1070  
1071    /* Token Header */
1072    CMCHKPK(SPkU8, tknStr->pres, mBuf);
1073
1074    RETVALUE(ROK);
1075 } /* end of cmPkTknStrM */
1076
1077 \f
1078 /*
1079  *
1080  *      Fun:   cmPkTknStrS
1081  *
1082  *      Desc:  This function packs a token string - small size
1083  *
1084  *      Ret:   ROK      - ok
1085  *
1086  *      Notes: None
1087  *
1088         File:  cm_gen.c
1089  *
1090  */
1091   
1092 #ifdef ANSI
1093 PUBLIC S16 cmPkTknStrS
1094 (
1095 TknStrS *tknStr,             /* token string */
1096 Buffer *mBuf                /* message buffer */
1097 )
1098 #else
1099 PUBLIC S16 cmPkTknStrS(tknStr, mBuf)
1100 TknStrS *tknStr;             /* token string */
1101 Buffer *mBuf;               /* message buffer */
1102 #endif
1103 {
1104    Cntr i;                    /* counter */
1105
1106    TRC2(cmPkTknStrS)
1107
1108    if(tknStr->pres)
1109    {
1110       /* Value */
1111       for (i = 0; i < (S16) tknStr->len; i++)
1112       {
1113          CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1114       }
1115
1116       /* Length */
1117       CMCHKPK(SPkU8, tknStr->len, mBuf);
1118    }
1119  
1120    /* Token Header */
1121    CMCHKPK(SPkU8, tknStr->pres, mBuf);
1122
1123    RETVALUE(ROK);
1124 } /* end of cmPkTknStrS */
1125
1126 \f
1127 /*
1128  *
1129  *      Fun:   cmPkTknStrE
1130  *
1131  *      Desc:  This function packs a token string - extended size
1132  *
1133  *      Ret:   ROK      - ok
1134  *
1135  *      Notes: None
1136  *
1137         File:  cm_gen.c
1138  *
1139  */
1140   
1141 #ifdef ANSI
1142 PUBLIC S16 cmPkTknStrE
1143 (
1144 TknStrE *tknStr,             /* token string */
1145 Buffer *mBuf                /* message buffer */
1146 )
1147 #else
1148 PUBLIC S16 cmPkTknStrE(tknStr, mBuf)
1149 TknStrE *tknStr;             /* token string */
1150 Buffer *mBuf;               /* message buffer */
1151 #endif
1152 {
1153    Cntr i;                    /* counter */
1154
1155    TRC2(cmPkTknStrE)
1156
1157    if(tknStr->pres)
1158    {
1159       /* Value */
1160       for (i = 0; i < (S16) tknStr->len; i++)
1161       {
1162          CMCHKPK(SPkU8, tknStr->val[i], mBuf);
1163       }
1164
1165       /* Length */
1166       CMCHKPK(SPkU8, tknStr->len, mBuf);
1167    }
1168  
1169    /* Token Header */
1170    CMCHKPK(SPkU8, tknStr->pres, mBuf);
1171
1172    RETVALUE(ROK);
1173 } /* end of cmPkTknStrE */
1174
1175 #ifndef CMFILE_REORG_1
1176
1177 \f
1178 /*
1179 *
1180 *       Fun:   cmPkPnNodeId
1181 *
1182 *       Desc:  This function packs a PnNodeId structure into a buffer
1183 *
1184 *       Ret:   Void
1185 *
1186 *       Notes: None
1187 *
1188 *       File:  cm_gen.c
1189 *
1190 */
1191   
1192 #ifdef ANSI
1193 PUBLIC S16 cmPkPnNodeId
1194 (
1195 PnNodeId  *src,     /* source PNNI Node Id */
1196 Buffer *mBuf        /* message buffer */
1197 )
1198 #else
1199 PUBLIC S16 cmPkPnNodeId (src, mBuf)
1200 PnNodeId  *src;     /* source PNNI Node Id */
1201 Buffer *mBuf;       /* message buffer */
1202 #endif
1203 {
1204    S16 i;
1205    
1206    TRC3(cmPkPnNodeId);
1207    
1208    for (i = PN_NODEID_LEN - 1; i >= 0; i--)
1209    {
1210       CMCHKPK(SPkU8, src->id[i], mBuf);
1211    }
1212    
1213    RETVALUE(ROK);
1214 } /* cmPkPnNodeId */
1215
1216 #endif /* CMFILE_REORG_1 */
1217
1218 \f
1219 /*
1220  *
1221  *      Fun:   cmPkTknStr4
1222  *
1223  *      Desc:  This function packs a token string of size 4
1224  *
1225  *      Ret:   ROK      - ok
1226  *
1227  *      Notes: None
1228  *
1229         File:  cm_gen.c
1230  *
1231  */
1232   
1233 #ifdef ANSI
1234 PUBLIC S16 cmPkTknStr4
1235 (
1236 TknStr4 *tknStr,             /* token string */
1237 Buffer  *mBuf                /* message buffer */
1238 )
1239 #else
1240 PUBLIC S16 cmPkTknStr4(tknStr, mBuf)
1241 TknStr4 *tknStr;             /* token string */
1242 Buffer  *mBuf;               /* message buffer */
1243 #endif
1244 {
1245    TRC2(cmPkTknStr4)
1246
1247    CMPKTKNSTR(tknStr, mBuf);
1248
1249    RETVALUE(ROK);
1250
1251 } /* end of cmPkTknStr4 */
1252
1253
1254 \f
1255 /*
1256  *
1257  *      Fun:   cmPkTknStr12
1258  *
1259  *      Desc:  This function packs a token string of size 4
1260  *
1261  *      Ret:   ROK      - ok
1262  *
1263  *      Notes: None
1264  *
1265         File:  cm_gen.c
1266  *
1267  */
1268   
1269 #ifdef ANSI
1270 PUBLIC S16 cmPkTknStr12
1271 (
1272 TknStr12 *tknStr,             /* token string */
1273 Buffer   *mBuf                /* message buffer */
1274 )
1275 #else
1276 PUBLIC S16 cmPkTknStr12(tknStr, mBuf)
1277 TknStr12 *tknStr;             /* token string */
1278 Buffer   *mBuf;               /* message buffer */
1279 #endif
1280 {
1281    TRC2(cmPkTknStr12)
1282
1283    CMPKTKNSTR(tknStr, mBuf);
1284
1285    RETVALUE(ROK);
1286
1287 } /* end of cmPkTknStr12 */
1288
1289 \f
1290 /*
1291  *
1292  *      Fun:   cmPkTknStr32
1293  *
1294  *      Desc:  This function packs a token string of size 4
1295  *
1296  *      Ret:   ROK      - ok
1297  *
1298  *      Notes: None
1299  *
1300         File:  cm_gen.c
1301  *
1302  */
1303   
1304 #ifdef ANSI
1305 PUBLIC S16 cmPkTknStr32
1306 (
1307 TknStr32 *tknStr,             /* token string */
1308 Buffer   *mBuf                /* message buffer */
1309 )
1310 #else
1311 PUBLIC S16 cmPkTknStr32(tknStr, mBuf)
1312 TknStr32 *tknStr;             /* token string */
1313 Buffer   *mBuf;               /* message buffer */
1314 #endif
1315 {
1316    TRC2(cmPkTknStr32)
1317
1318    CMPKTKNSTR(tknStr, mBuf);
1319
1320    RETVALUE(ROK);
1321
1322 } /* end of cmPkTknStr32 */
1323
1324 \f
1325 /*
1326  *
1327  *      Fun:   cmPkTknStr64
1328  *
1329  *      Desc:  This function packs a token string of size 4
1330  *
1331  *      Ret:   ROK      - ok
1332  *
1333  *      Notes: None
1334  *
1335         File:  cm_gen.c
1336  *
1337  */
1338   
1339 #ifdef ANSI
1340 PUBLIC S16 cmPkTknStr64
1341 (
1342 TknStr64 *tknStr,             /* token string */
1343 Buffer   *mBuf                /* message buffer */
1344 )
1345 #else
1346 PUBLIC S16 cmPkTknStr64(tknStr, mBuf)
1347 TknStr64 *tknStr;             /* token string */
1348 Buffer   *mBuf;               /* message buffer */
1349 #endif
1350 {
1351    TRC2(cmPkTknStr64)
1352
1353    CMPKTKNSTR(tknStr, mBuf);
1354
1355    RETVALUE(ROK);
1356
1357 } /* end of cmPkTknStr64 */
1358
1359 \f
1360 /*
1361  *
1362  *      Fun:   cmPkTknStr132
1363  *
1364  *      Desc:  This function packs a token string of size 4
1365  *
1366  *      Ret:   ROK      - ok
1367  *
1368  *      Notes: None
1369  *
1370         File:  cm_gen.c
1371  *
1372  */
1373   
1374 #ifdef ANSI
1375 PUBLIC S16 cmPkTknStr132
1376 (
1377 TknStr132 *tknStr,             /* token string */
1378 Buffer   *mBuf                /* message buffer */
1379 )
1380 #else
1381 PUBLIC S16 cmPkTknStr132(tknStr, mBuf)
1382 TknStr132 *tknStr;             /* token string */
1383 Buffer   *mBuf;               /* message buffer */
1384 #endif
1385 {
1386    TRC2(cmPkTknStr132)
1387
1388    CMPKTKNSTR(tknStr, mBuf);
1389
1390    RETVALUE(ROK);
1391
1392 } /* end of cmPkTknStr132 */
1393
1394 \f
1395 /*
1396  *
1397  *      Fun:   cmPkTknStr256
1398  *
1399  *      Desc:  This function packs a token string of size 4
1400  *
1401  *      Ret:   ROK      - ok
1402  *
1403  *      Notes: None
1404  *
1405         File:  cm_gen.c
1406  *
1407  */
1408   
1409 #ifdef ANSI
1410 PUBLIC S16 cmPkTknStr256
1411 (
1412 TknStr256 *tknStr,             /* token string */
1413 Buffer    *mBuf                /* message buffer */
1414 )
1415 #else
1416 PUBLIC S16 cmPkTknStr256(tknStr, mBuf)
1417 TknStr256 *tknStr;             /* token string */
1418 Buffer    *mBuf;               /* message buffer */
1419 #endif
1420 {
1421    TRC2(cmPkTknStr256)
1422
1423    CMPKTKNSTR(tknStr, mBuf);
1424
1425    RETVALUE(ROK);
1426
1427 } /* end of cmPkTknStr256 */
1428
1429 \f
1430 /*
1431  *
1432  *      Fun:   cmPkTknOid
1433  *
1434  *      Desc:  This function packs a Object Identifier token
1435  *
1436  *      Ret:   ROK      - ok
1437  *
1438  *      Notes: None
1439  *
1440         File:  cm_gen.c
1441  *
1442  */
1443   
1444 #ifdef ANSI
1445 PUBLIC S16 cmPkTknOid
1446 (
1447 TknOid   *tknOid,             /* Object Identifier token */
1448 Buffer   *mBuf                /* message buffer */
1449 )
1450 #else
1451 PUBLIC S16 cmPkTknOid(tknOid, mBuf)
1452 TknOid   *tknOid;             /* Object Identifier token */
1453 Buffer   *mBuf;               /* message buffer */
1454 #endif
1455 {
1456    U16    i;
1457
1458    TRC2(cmPkTknOid)
1459  
1460    if (tknOid->pres == TRUE)
1461    {
1462       /* Pack the value */
1463       for (i = 0; i < (U16)tknOid->len; i++)
1464       {
1465          /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
1466           * with compilation flag TKNOID_U16 */
1467 #ifndef TKNOID_U16
1468          CMCHKPK(SPkU32, tknOid->val[i], mBuf);
1469 #else
1470          CMCHKPK(SPkU16, tknOid->val[i], mBuf);
1471 #endif  /* !TKNOID_U16 */
1472       }
1473       /* Pack the length */
1474       CMCHKPK(SPkU8, tknOid->len, mBuf);
1475    }
1476    /* Pack the token header */
1477    CMCHKPK(SPkU8, tknOid->pres, mBuf);
1478
1479    RETVALUE(ROK);
1480 } /* end of cmPkTknOid */
1481
1482 \f
1483 /*
1484 *
1485 *      Fun:   cmPkTknS32
1486 *
1487 *      Desc:  This function packs a token S32
1488 *
1489 *      Ret:   ROK      - ok
1490 *
1491 *      Notes: None
1492 *
1493 *      File:  cm_gen.c
1494 *
1495 */
1496   
1497 #ifdef ANSI
1498 PUBLIC S16 cmPkTknS32
1499 (
1500 TknS32 *tknS32,             /* token S32 */
1501 Buffer *mBuf                /* message buffer */
1502 )
1503 #else
1504 PUBLIC S16 cmPkTknS32(tknS32, mBuf)
1505 TknS32 *tknS32;             /* token S32 */
1506 Buffer *mBuf;               /* message buffer */
1507 #endif
1508 {
1509    TRC2(cmPkTknS32)
1510
1511    if (tknS32->pres)
1512    {
1513       /* Value */
1514       CMCHKPK(SPkS32, tknS32->val, mBuf);
1515    }
1516
1517    /* Token Header */
1518    CMCHKPK(SPkU8, tknS32->pres, mBuf);
1519
1520    RETVALUE(ROK);
1521 } /* end of cmPkTknS32 */
1522
1523 \f
1524 /*
1525 *
1526 *       Fun:   cmPkHeader
1527 *
1528 *       Desc:  This function packs the header structure
1529 *
1530 *       Ret:   ROK      - ok
1531 *
1532 *       Notes: None.
1533 *
1534 *       File:  cm_gen.c
1535 *
1536 */
1537   
1538 #ifdef ANSI
1539 PUBLIC S16 cmPkHeader
1540 (
1541 Header *header,             /* header */
1542 Buffer *mBuf                /* message buffer */
1543 )
1544 #else
1545 PUBLIC S16 cmPkHeader(header, mBuf)
1546 Header *header;             /* header */
1547 Buffer *mBuf;               /* message buffer */
1548 #endif
1549 {
1550    TRC2(cmPkHeader)
1551
1552 #ifdef LMINT3
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);
1558 #endif /* LMINT3 */
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);
1565
1566    RETVALUE(ROK);
1567 } /* end of cmPkHeader */
1568
1569 \f
1570 /*
1571 *
1572 *       Fun:   cmPkCmStatus
1573 *
1574 *       Desc:  This function packs common management status structure
1575 *
1576 *       Ret:   ROK      - ok
1577 *
1578 *       Notes: None.
1579 *
1580 *       File:  cm_gen.c
1581 *
1582 */
1583   
1584 #ifdef ANSI
1585 PUBLIC S16 cmPkCmStatus
1586 (
1587 CmStatus *sta,              /* status structure */
1588 Buffer *mBuf                /* message buffer */
1589 )
1590 #else
1591 PUBLIC S16 cmPkCmStatus(sta, mBuf)
1592 CmStatus *sta;              /* status structure */
1593 Buffer *mBuf;               /* message buffer */
1594 #endif
1595 {
1596    TRC2(cmPkCmStatus)
1597
1598    CMCHKPK(SPkU16, sta->reason, mBuf);
1599    CMCHKPK(SPkU16, sta->status, mBuf);
1600
1601    RETVALUE(ROK);
1602 } /* end of cmPkCmStatus */
1603
1604 \f
1605 /*
1606 *
1607 *       Fun:   cmPkCmAlarm
1608 *
1609 *       Desc:  This function packs common management alarm structure
1610 *
1611 *       Ret:   ROK      - ok
1612 *
1613 *       Notes: None.
1614 *
1615 *       File:  cm_gen.c
1616 *
1617 */
1618   
1619 #ifdef ANSI
1620 PUBLIC S16 cmPkCmAlarm
1621 (
1622 CmAlarm *alarm,            /* alarm structure */
1623 Buffer  *mBuf              /* message buffer */
1624 )
1625 #else
1626 PUBLIC S16 cmPkCmAlarm(alarm, mBuf)
1627 CmAlarm *alarm;             /* alarm structure */
1628 Buffer *mBuf;               /* message buffer */
1629 #endif
1630 {
1631    TRC2(cmPkCmAlarm)
1632
1633    CMCHKPK(SPkU16, alarm->cause, mBuf);
1634    CMCHKPK(SPkU16, alarm->event, mBuf);
1635    CMCHKPK(SPkU16, alarm->category, mBuf);
1636    CMCHKPK(cmPkDateTime, &alarm->dt, mBuf);
1637
1638    RETVALUE(ROK);
1639 } /* end of cmPkCmAlarm */
1640
1641 \f
1642 /*
1643 *
1644 *       Fun:   cmPkSmCfg
1645 *
1646 *       Desc:  This function packs the stack manager structure
1647 *
1648 *       Ret:   ROK      - ok
1649 *
1650 *       Notes: None.
1651 *
1652 *       File:  cm_gen.c
1653 *
1654 */
1655   
1656 #ifdef ANSI
1657 PUBLIC S16 cmPkSmCfg
1658 (
1659 SmCfg *smCfg,           /* stack manager */
1660 Buffer *mBuf            /* message buffer */
1661 )
1662 #else
1663 PUBLIC S16 cmPkSmCfg(smCfg, mBuf)
1664 SmCfg *smCfg;           /* stack manager */
1665 Buffer *mBuf;           /* message buffer */
1666 #endif
1667 {
1668    TRC2(cmPkSmCfg)
1669
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);
1677
1678    RETVALUE(ROK);
1679 } /* end of cmPkSmCfg */
1680
1681 \f
1682 /*
1683 *
1684 *       Fun:   cmPkTmrCfg
1685 *
1686 *       Desc:  This function packs the timer configuration structure
1687 *
1688 *       Ret:   ROK      - ok
1689 *
1690 *       Notes: None.
1691 *
1692 *       File:  cm_gen.c
1693 *
1694 */
1695   
1696 #ifdef ANSI
1697 PUBLIC S16 cmPkTmrCfg
1698 (
1699 TmrCfg *tmrCfg,         /* timer configuration */
1700 Buffer *mBuf            /* message buffer */
1701 )
1702 #else
1703 PUBLIC S16 cmPkTmrCfg(tmrCfg, mBuf)
1704 TmrCfg *tmrCfg;         /* timer configuration */
1705 Buffer *mBuf;           /* message buffer */
1706 #endif
1707 {
1708    TRC2(cmPkTmrCfg)
1709
1710    CMCHKPK(SPkU16, tmrCfg->val, mBuf);
1711    CMCHKPK(cmPkBool, tmrCfg->enb, mBuf);
1712
1713    RETVALUE(ROK);
1714 } /* end of cmPkTmrCfg */
1715
1716 \f
1717 /*
1718  *
1719  *      Fun:   cmPkTknBuf
1720  *
1721  *      Desc:  This function packs a token buffer
1722  *
1723  *      Ret:   ROK      - ok
1724  *
1725  *      Notes: None
1726  *
1727         File:  cm_gen.c
1728  *
1729  */
1730   
1731 #ifdef ANSI
1732 PUBLIC S16 cmPkTknBuf
1733 (
1734 TknBuf *tknBuf,                /* token string */
1735 Buffer    *mBuf                /* message buffer */
1736 )
1737 #else
1738 PUBLIC S16 cmPkTknBuf(tknBuf, mBuf)
1739 TknBuf *tknBuf;                /* token string */
1740 Buffer    *mBuf;               /* message buffer */
1741 #endif
1742 {
1743    TRC2(cmPkTknBuf)
1744
1745    if(tknBuf->pres)
1746    {
1747       MsgLen msgLen;
1748
1749       SFndLenMsg(tknBuf->val, &msgLen);
1750       if( SCatMsg(mBuf, tknBuf->val, M2M1) != ROK )
1751       {
1752          RETVALUE(RFAILED);
1753       }
1754       cmPkMsgLen(msgLen, mBuf);
1755       SPutMsg(tknBuf->val);
1756    }
1757   
1758    /* Token Header */
1759    CMCHKPK(SPkU8, tknBuf->pres, mBuf);
1760
1761    RETVALUE(ROK);
1762 } /* end of cmPkTknBuf */
1763
1764 #ifdef TDS_ROLL_UPGRADE_SUPPORT
1765 /*
1766 *
1767 *       Fun:   cmPkIntf
1768 *
1769 *       Desc:  This function packs the interface information
1770 *
1771 *       Ret:   ROK      - ok
1772 *
1773 *       Notes: None.
1774 *
1775 *       File:  cm_gen.c
1776 *
1777 */
1778   
1779 #ifdef ANSI
1780 PUBLIC S16 cmPkIntf
1781 (
1782 CmIntf *intf,           /* interface info */
1783 Buffer *mBuf            /* message buffer */
1784 )
1785 #else
1786 PUBLIC S16 cmPkIntf(intf, mBuf)
1787 CmIntf *intf;           /* interface info */
1788 Buffer *mBuf;           /* message buffer */
1789 #endif
1790 {
1791    TRC2(cmPkIntf)
1792
1793    CMCHKPK(cmPkIntfId,  intf->intfId,  mBuf); 
1794    CMCHKPK(cmPkIntfVer, intf->intfVer, mBuf); 
1795
1796    RETVALUE(ROK);
1797 } /* end of cmPkIntf */
1798 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
1799
1800 \f
1801 /*
1802  *   common unpacking functions 
1803  */
1804
1805 \f
1806 /*
1807 *
1808 *       Fun:   cmUnpkDateTime
1809 *
1810 *       Desc:  This function is used to Unpack Pack Date Time structure
1811 *
1812 *       Ret:   ROK      - ok
1813 *
1814 *       Notes: None
1815 *
1816 *       File:  cm_gen.c
1817 *
1818 */
1819   
1820 #ifdef ANSI
1821 PUBLIC S16 cmUnpkDateTime
1822 (
1823 DateTime *dateTime,  /* date/time structure */
1824 Buffer *mBuf         /* message buffer */
1825 )
1826 #else
1827 PUBLIC S16 cmUnpkDateTime(dateTime, mBuf)
1828 DateTime *dateTime;  /* date/time structure */
1829 Buffer *mBuf;        /* message buffer */
1830 #endif
1831 {
1832    TRC2(cmUnpDateTime)
1833
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);
1841
1842    /*-- added for micro seconds --*/
1843 #ifdef SS_DATETIME_USEC
1844    CMCHKUNPK(SUnpkU32, &dateTime->usec, mBuf);
1845 #endif /*-- SS_DATETIME_USEC --*/
1846
1847    RETVALUE(ROK);
1848 } /* end of cmUnpkDateTime */
1849
1850 \f
1851 /*
1852 *
1853 *       Fun:   cmUnpkDuration
1854 *
1855 *       Desc:  This function is used to Unpack Pack Duration structure
1856 *
1857 *       Ret:   ROK      - ok
1858 *
1859 *       Notes: None
1860 *
1861 *       File:  cm_gen.c
1862 *
1863 */
1864   
1865 #ifdef ANSI
1866 PUBLIC S16 cmUnpkDuration
1867 (
1868 Duration *duration,  /* duration structure */
1869 Buffer *mBuf         /* message buffer */
1870 )
1871 #else
1872 PUBLIC S16 cmUnpkDuration(duration, mBuf)
1873 Duration *duration;  /* duration structure */
1874 Buffer *mBuf;        /* message buffer */
1875 #endif
1876 {
1877    TRC2(cmUnpDuration)
1878
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);
1884
1885    RETVALUE(ROK);
1886 } /* end of cmUnpkDuration */
1887
1888 /*
1889 *
1890 *       Fun:   cmUnpkPtr
1891 *
1892 *       Desc:  This function is used to Unpack Ptr type
1893 *
1894 *       Ret:   ROK      - ok
1895 *
1896 *       Notes: None
1897 *
1898 *       File:  cm_gen.c
1899 *
1900 */
1901   
1902 #ifdef ANSI
1903 PUBLIC S16 cmUnpkPtr
1904 (
1905 PTR *ptr,  /* duration structure */
1906 Buffer *mBuf    /* message buffer */
1907 )
1908 #else
1909 PUBLIC S16 cmUnpkPtr(ptr, mBuf)
1910 PTR *ptr;  /* duration structure */
1911 Buffer *mBuf;   /* message buffer */
1912 #endif
1913 {
1914    U16 tmp16;               /* temporary value */
1915    U32 tmp32;               /* temporary value */
1916    Data unpkArray[PTRSIZE]; /* unpacking array */
1917    S16 ret;                 /* return code */
1918
1919 #if (defined(ALPHA) || defined(BIT_64))
1920    U64 tmp64;
1921 #endif
1922    
1923    TRC2(cmUnpkPtr)
1924
1925    switch (PTRSIZE)
1926    {
1927       case 2:
1928          ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
1929          if (ret != ROK)
1930             RETVALUE(ret);
1931
1932          tmp16 = 0; 
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]);
1939 #endif
1940          *ptr = tmp16;
1941          break;
1942
1943       case 4:
1944          ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
1945          if (ret != ROK)
1946             RETVALUE(ret);
1947
1948          tmp16 = 0;
1949          tmp32 = 0; 
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);
1964 #endif
1965          *ptr = tmp32;
1966          break;
1967
1968       case 8:
1969 #if(defined(ALPHA) || defined(BIT_64))
1970          ret = SRemPreMsgMult(unpkArray, (MsgLen) 8, mBuf);
1971          if (ret != ROK)
1972             RETVALUE(ret);
1973
1974          tmp16 = 0;
1975          tmp32 = 0; 
1976          tmp64 = 0;
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);
2007 #endif
2008          *ptr = tmp64;
2009          break;
2010 #endif
2011       default:
2012          /* no support for U64 */
2013          ret = RFAILED;
2014    }
2015
2016    RETVALUE(ret);
2017 } /* end of cmUnpkPtr */
2018
2019 \f
2020 /*
2021 *
2022 *       Fun:   cmUnpkEntityId
2023 *
2024 *       Desc:  This function unpacks the EntityId structure
2025 *
2026 *       Ret:   ROK      - ok
2027 *
2028 *       Notes: None.
2029 *
2030 *       File:  cm_gen.c
2031 *
2032 */
2033   
2034 #ifdef ANSI
2035 PUBLIC S16 cmUnpkEntityId
2036 (
2037 EntityId *entityId,        /* entity id */
2038 Buffer   *mBuf             /* message buffer */
2039 )
2040 #else
2041 PUBLIC S16 cmUnpkEntityId(entityId, mBuf)
2042 EntityId *entityId;        /* entity id */
2043 Buffer   *mBuf;            /* message buffer */
2044 #endif
2045 {
2046    TRC2(cmUnpkEntityId)
2047
2048    CMCHKUNPK(cmUnpkEnt, &entityId->ent, mBuf); 
2049    CMCHKUNPK(cmUnpkInst, &entityId->inst, mBuf);
2050
2051    RETVALUE(ROK);
2052 } /* end of cmUnpkEntityId */
2053
2054 \f
2055 /*
2056 *
2057 *       Fun:   cmUnpkElmntId
2058 *
2059 *       Desc:  This function unpacks the ElmntId structure
2060 *
2061 *       Ret:   ROK      - ok
2062 *
2063 *       Notes: None.
2064 *
2065 *       File:  cm_gen.c
2066 *
2067 */
2068   
2069 #ifdef ANSI
2070 PUBLIC S16 cmUnpkElmntId
2071 (
2072 ElmntId *elmntId,         /* element id */
2073 Buffer  *mBuf             /* message buffer */
2074 )
2075 #else
2076 PUBLIC S16 cmUnpkElmntId(elmntId, mBuf)
2077 ElmntId *elmntId;         /* element id */
2078 Buffer  *mBuf;            /* message buffer */
2079 #endif
2080 {
2081    TRC2(cmUnpkElmntId)
2082
2083    CMCHKUNPK(cmUnpkElmnt, &elmntId->elmnt, mBuf); 
2084    CMCHKUNPK(cmUnpkElmntInst1, &elmntId->elmntInst1, mBuf); 
2085    CMCHKUNPK(cmUnpkElmntInst2, &elmntId->elmntInst2, mBuf); 
2086    CMCHKUNPK(cmUnpkElmntInst3, &elmntId->elmntInst3, mBuf);
2087
2088    RETVALUE(ROK);
2089 } /* end of cmUnpkElmntId */
2090
2091 \f
2092 /*
2093 *
2094 *       Fun:   cmUnpkMemoryId
2095 *
2096 *       Desc:  This function unpacks the MemoryId structure
2097 *
2098 *       Ret:   ROK      - ok
2099 *
2100 *       Notes: None.
2101 *
2102 *       File:  cm_gen.c
2103 *
2104 */
2105   
2106 #ifdef ANSI
2107 PUBLIC S16 cmUnpkMemoryId
2108 (
2109 MemoryId *memoryId,        /* memoryId */
2110 Buffer   *mBuf             /* message buffer */
2111 )
2112 #else
2113 PUBLIC S16 cmUnpkMemoryId(memoryId, mBuf)
2114 MemoryId *memoryId;        /* memoryId */
2115 Buffer   *mBuf;            /* message buffer */
2116 #endif
2117 {
2118    TRC2(cmUnpkMemoryId)
2119
2120    CMCHKUNPK(cmUnpkRegion, &memoryId->region,   mBuf); 
2121    CMCHKUNPK(cmUnpkPool, &memoryId->pool, mBuf);
2122
2123    RETVALUE(ROK);
2124 } /* end of cmUnpkMemoryId */
2125
2126 \f
2127 /*
2128 *
2129 *       Fun:   cmUnpkSystemId
2130 *
2131 *       Desc:  This function packs the System Id structure
2132 *
2133 *       Ret:   ROK      - ok
2134 *
2135 *       Notes: None.
2136 *
2137 *       File:  cm_gen.c
2138 *
2139 */
2140   
2141 #ifdef ANSI
2142 PUBLIC S16 cmUnpkSystemId
2143 (
2144 SystemId *systemId,         /* system id */
2145 Buffer   *mBuf              /* message buffer */
2146 )
2147 #else
2148 PUBLIC S16 cmUnpkSystemId(systemId, mBuf)
2149 SystemId *systemId;         /* system id */
2150 Buffer   *mBuf;             /* message buffer */
2151 #endif
2152 {
2153    S16 i;               /* loop counter */
2154    MsgLen len;
2155    
2156    TRC2(cmUnpkSystemId)
2157
2158    CMCHKUNPK(SUnpkS16, &systemId->mVer, mBuf); 
2159    CMCHKUNPK(SUnpkS16, &systemId->mRev, mBuf); 
2160    CMCHKUNPK(SUnpkS16, &systemId->bVer, mBuf); 
2161    CMCHKUNPK(SUnpkS16, &systemId->bRev, mBuf);
2162
2163    SFndLenMsg(mBuf, &len);
2164    
2165    for (i = 0; i < len; i++)
2166    {
2167      CMCHKUNPK(cmUnpkTxt, &systemId->ptNmb[i], mBuf);
2168    }
2169    
2170    RETVALUE(ROK);
2171 } /* end of cmUnpkSystemId */
2172
2173
2174
2175 /*
2176  *
2177  *       Fun:   cmUnpkProtAddr   
2178  *
2179  *       Desc:  This function will unpack protocol address.
2180  *
2181  *       Ret:   ROK on success
2182  *              RFAILED on error
2183  *
2184  *       Notes: None
2185  *
2186          File:  cm_gen.c
2187  *
2188  */
2189
2190 #ifdef ANSI
2191 PUBLIC S16 cmUnpkProtAddr
2192 (
2193 ProtAddr     *pAddr,         /* protocol address */
2194 Buffer       *mBuf           /* buffer */
2195 )
2196 #else
2197 PUBLIC S16 cmUnpkProtAddr(pAddr, mBuf)
2198 ProtAddr     *pAddr;         /* protocol address table */
2199 Buffer       *mBuf;          /* buffer */
2200 #endif
2201 {
2202    U8               j;                  /* Index */
2203
2204    TRC3(cmUnpkProtAddr)
2205
2206    CMCHKUNPK(SUnpkU16,  &(pAddr->protType), mBuf);  
2207    CMCHKUNPK(SUnpkU8,   &(pAddr->len), mBuf);  
2208    CMCHKUNPK(SUnpkU8,   &(pAddr->preLen), mBuf);  
2209
2210    for (j =0; j <  pAddr->len; j++)
2211       CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);  
2212    
2213 #ifdef CM_ARI2
2214    CMCHKUNPK(cmUnpkBool,   &(pAddr->autoSysIdPres), mBuf);  
2215    CMCHKUNPK(SUnpkU32,  &(pAddr->autoSysId), mBuf);  
2216 #endif /* CM_ARI2 */
2217    RETVALUE(ROK);
2218
2219 } /* end of cmUnpkProtAddr */
2220    
2221
2222 /*
2223  *
2224  *       Fun:   cmUnpkProtAddrTbl
2225  *
2226  *       Desc:  This function will pack protocol addresses.
2227  *
2228  *       Ret:   ROK on success
2229  *              RFAILED on error
2230  *
2231  *       Notes: None
2232  *
2233          File:  cm_gen.c
2234  *
2235  */
2236
2237 #ifdef ANSI
2238 PUBLIC S16 cmUnpkProtAddrTbl
2239 (
2240 ProtAddrTbl  *protAddr,      /* protocol address table */
2241 Buffer       *mBuf           /* buffer */
2242 )
2243 #else
2244 PUBLIC S16 cmUnpkProtAddrTbl(protAddr, mBuf)
2245 ProtAddrTbl  *protAddr;      /* protocol address table */
2246 Buffer       *mBuf;          /* buffer */
2247 #endif
2248 {
2249    U8               i;                  /* index */
2250    U8               j;                  /* Index */
2251    ProtAddr         *pAddr;             /* Protocol Address */
2252
2253    TRC3(cmUnpkProtAddrTbl)
2254
2255    CMCHKUNPK(SUnpkU8, &protAddr->count, mBuf);  
2256    for (i = 0;  i < protAddr->count; i++)
2257    {
2258        pAddr = &(protAddr->addr[i]);
2259
2260        CMCHKUNPK(SUnpkU16,  &(pAddr->protType), mBuf);  
2261        CMCHKUNPK(SUnpkU8,  &(pAddr->len), mBuf);  
2262        CMCHKUNPK(SUnpkU8, &(pAddr->preLen), mBuf);  
2263
2264         
2265        for (j =0; j <  pAddr->len; j++)
2266           CMCHKUNPK(SUnpkU8, &pAddr->address[j], mBuf);  
2267
2268 #ifdef CM_ARI2
2269        CMCHKUNPK(cmUnpkBool,   &(pAddr->autoSysIdPres), mBuf);
2270        CMCHKUNPK(SUnpkU32,  &(pAddr->autoSysId), mBuf);
2271 #endif /* CM_ARI2 */
2272    }
2273    RETVALUE(ROK);
2274 } /* end of cmUnpkProtAddrTbl */
2275    
2276
2277 /*
2278 *
2279 *       Fun:   cmUnpkAddrs
2280 *
2281 *       Desc:  This function is used to unpack the Addrs structure
2282 *
2283 *       Ret:   ROK - ok
2284 *
2285 *       Notes: None
2286 *
2287 *       File:  cm_gen.c
2288 *
2289 */
2290   
2291 #ifdef ANSI
2292 PUBLIC S16 cmUnpkAddrs
2293 (
2294 Addrs *addrs,     /* address */
2295 Buffer *mBuf      /* message buffer */
2296 )
2297 #else
2298 PUBLIC S16 cmUnpkAddrs(addrs, mBuf)
2299 Addrs *addrs;     /* address */
2300 Buffer *mBuf;     /* message buffer */
2301 #endif
2302 {
2303    U8 i;          /* loop counter */
2304
2305    TRC2(cmUnpAddrs)
2306
2307    CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2308
2309    if (addrs->length > ADRLEN)
2310       RETVALUE(RFAILED);
2311    
2312    for(i = 0; i < addrs->length; i++)
2313    {
2314       CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2315    }
2316
2317    RETVALUE(ROK);
2318 } /* end of cmUnpkAddrs */
2319
2320 /*
2321 *
2322 *       Fun:   cmUnpkShrtAddrs
2323 *
2324 *       Desc:  This function is used to unpack the ShrtAddrs structure
2325 *
2326 *       Ret:   ROK - ok
2327 *
2328 *       Notes: None
2329 *
2330 *       File:  cm_gen.c
2331 *
2332 */
2333   
2334 #ifdef ANSI
2335 PUBLIC S16 cmUnpkShrtAddrs
2336 (
2337 ShrtAddrs *addrs,    /* address */
2338 Buffer    *mBuf      /* message buffer */
2339 )
2340 #else
2341 PUBLIC S16 cmUnpkShrtAddrs(addrs, mBuf)
2342 ShrtAddrs *addrs;    /* address */
2343 Buffer    *mBuf;     /* message buffer */
2344 #endif
2345 {
2346    U8 i;          /* loop counter */
2347
2348    TRC2(cmUnpShrtAddrs)
2349
2350    CMCHKUNPK(SUnpkU8, &addrs->length, mBuf);
2351
2352    if (addrs->length > SHRTADRLEN)
2353       RETVALUE(RFAILED);
2354    
2355    for(i = 0; i < addrs->length; i++)
2356    {
2357       CMCHKUNPK(SUnpkU8, &addrs->strg[i], mBuf);
2358    }
2359    RETVALUE(ROK);
2360 } /* end of cmUnpkShrtAddrs */
2361
2362 \f
2363 /*
2364 *
2365 *       Fun:   cmUnpkAddrMask
2366 *
2367 *       Desc:  This unpacks address mask.
2368 *
2369 *       Ret:   ROK      - ok
2370 *
2371 *       Notes: None
2372 *
2373 *       File:  cm_gen.c
2374 *
2375 */
2376   
2377 #ifdef ANSI
2378 PUBLIC S16 cmUnpkAddrMask
2379 (
2380 U8 *mask,             /* pointer to address mask */
2381 Buffer  *mBuf         /* message buffer */
2382 )
2383 #else
2384 PUBLIC S16 cmUnpkAddrMask(mask, mBuf)
2385 U8 *mask;             /* pointer to address mask */
2386 Buffer  *mBuf;        /* message buffer */
2387 #endif
2388 {
2389    S16 i;             /* counter */
2390
2391    TRC2(cmUnpAddrMask)
2392
2393    /* unpack address mask */
2394    for (i = 0; i< ADRLEN; i++) 
2395    {
2396       CMCHKUNPK(SUnpkU8, &mask[i], mBuf);
2397    }
2398    RETVALUE(ROK);
2399 } /* end of cmUnpkAddrMask */
2400
2401 \f
2402 /*
2403 *
2404 *       Fun:   cmUnpkBndCfg
2405 *
2406 *       Desc:  This function unpacks the BndCfg structure
2407 *
2408 *       Ret:   ROK      - ok
2409 *
2410 *       Notes: None.
2411 *
2412 *       File:  cm_gen.c
2413 *
2414 */
2415   
2416 #ifdef ANSI
2417 PUBLIC S16 cmUnpkBndCfg
2418 (
2419 BndCfg *bndCfg,         /* bndCfg */
2420 Buffer *mBuf            /* message buffer */
2421 )
2422 #else
2423 PUBLIC S16 cmUnpkBndCfg(bndCfg, mBuf)
2424 BndCfg *bndCfg;         /* bndCfg */
2425 Buffer *mBuf;           /* message buffer */
2426 #endif
2427 {
2428    S16 i;               /* loop counter */
2429
2430    TRC2(cmUnpBndCfg)
2431
2432    for (i = 0; bndCfg->usrId[i]; i++);
2433    CMCHKUNPK(cmUnpkTxt, bndCfg->usrId+i, mBuf);
2434
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);
2446
2447    RETVALUE(ROK);
2448 } /* end of cmUnpkBndCfg */
2449
2450 \f
2451 /*
2452 *
2453 *       Fun:   cmUnpkPst
2454 *
2455 *       Desc:  pack post structure 
2456 *
2457 *       Ret:   ROK
2458 *
2459 *       Notes: None.
2460 *
2461 *       File:  cm_gen.c
2462 *
2463 */
2464 #ifdef ANSI
2465 PUBLIC S16 cmUnpkPst
2466 (
2467 Pst *pst,
2468 Buffer *mBuf
2469 )
2470 #else
2471 PUBLIC S16 cmUnpkPst(pst, mBuf)
2472 Pst *pst;
2473 Buffer *mBuf;
2474 #endif
2475 {
2476    TRC2(cmUnpkPst)
2477
2478 #ifdef TDS_ROLL_UPGRADE_SUPPORT
2479    CMCHKUNPK(cmUnpkIntfVer, &pst->intfVer, mBuf);
2480 #endif
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);
2493
2494    RETVALUE(ROK);
2495 } /* end of cmUnpkPst */
2496
2497 /*
2498 *
2499 *       Fun:    cmUnpkElmtHdr
2500 *
2501 *       Desc:   Unpack element header
2502 *
2503 *       Ret:   ROK      - ok
2504 *
2505 *       Notes:  None
2506 *
2507 *       File:   cm_gen.c
2508 *
2509 */
2510   
2511 #ifdef ANSI
2512 PUBLIC S16 cmUnpkElmtHdr
2513 (
2514 ElmtHdr *m,                  /* element header */
2515 Buffer  *mBuf                /* message buffer */
2516 )
2517 #else
2518 PUBLIC S16 cmUnpkElmtHdr(m, mBuf)
2519 ElmtHdr *m;                  /* element header */
2520 Buffer  *mBuf;               /* message buffer */
2521 #endif
2522 {
2523    TRC2(cmUnpElmtHdr)
2524  
2525    /* Present */
2526    CMCHKUNPK(cmUnpkBool, &m->pres , mBuf);
2527
2528 #if (LCAMT || ATM_BISUP)
2529    /* Unpack action indicator field */
2530    if (m->pres)
2531    {
2532       CMCHKUNPK(SUnpkU8, &m->actnInd, mBuf);
2533    }
2534 #endif
2535
2536 #if (LCAMT || ATM_BISUP)
2537       CMCHKUNPK(SUnpkU16, &m->compInd, mBuf);
2538 #endif /* LCAMT || ATM_BISUP */
2539
2540    RETVALUE(ROK);
2541 } /* end of cmUnpkElmtHdr */
2542
2543 \f
2544 /*
2545 *
2546 *       Fun:   cmUnpkTknU8
2547 *
2548 *       Desc:  This function unpacks a token U8
2549 *
2550 *       Ret:   ROK      - ok
2551 *
2552 *       Notes: None
2553 *
2554 *       File:  cm_gen.c
2555 *
2556 */
2557   
2558 #ifdef ANSI
2559 PUBLIC S16 cmUnpkTknU8
2560 (
2561 TknU8 *tknU8,               /* token U8 */
2562 Buffer *mBuf                /* message buffer */
2563 )
2564 #else
2565 PUBLIC S16 cmUnpkTknU8(tknU8, mBuf)
2566 TknU8 *tknU8;               /* token U8 */
2567 Buffer *mBuf;               /* message buffer */
2568 #endif
2569 {
2570    TRC2(cmUnpTknU8)
2571
2572    /* Token Header */
2573    CMCHKUNPK(SUnpkU8, &tknU8->pres, mBuf);
2574
2575    if (tknU8->pres)
2576    {
2577       /* Value */
2578       CMCHKUNPK(SUnpkU8, &tknU8->val, mBuf);
2579    }
2580
2581    RETVALUE(ROK);
2582 } /* end of cmUnpkTknU8 */
2583
2584 \f
2585 /*
2586 *
2587 *       Fun:   cmUnpkTknS8
2588 *
2589 *       Desc:  This function unpacks a token S8
2590 *
2591 *       Ret:   ROK      - ok
2592 *
2593 *       Notes: None
2594 *
2595 *       File:  cm_gen.c
2596 *
2597 */
2598   
2599 #ifdef ANSI
2600 PUBLIC S16 cmUnpkTknS8
2601 (
2602 TknS8 *tknS8,               /* token S8 */
2603 Buffer *mBuf                /* message buffer */
2604 )
2605 #else
2606 PUBLIC S16 cmUnpkTknS8(tknS8, mBuf)
2607 TknS8 *tknS8;               /* token S8 */
2608 Buffer *mBuf;               /* message buffer */
2609 #endif
2610 {
2611    TRC2(cmUnpTknS8)
2612  
2613    /* Token Header */
2614    CMCHKUNPK(SUnpkU8, &tknS8->pres, mBuf);
2615  
2616    if (tknS8->pres)
2617    {
2618       /* Value */
2619       CMCHKUNPK(SUnpkS8, &tknS8->val, mBuf);
2620    }
2621  
2622    RETVALUE(ROK);
2623 } /* end of cmUnpkTknS8 */
2624
2625 \f
2626 /*
2627 *
2628 *       Fun:   cmUnpkTknU16
2629 *
2630 *       Desc:  This function unpacks a token U16
2631 *
2632 *       Ret:   ROK      - ok
2633 *
2634 *       Notes: None
2635 *
2636 *       File:  cm_gen.c
2637 *
2638 */
2639   
2640 #ifdef ANSI
2641 PUBLIC S16 cmUnpkTknU16
2642 (
2643 TknU16 *tknU16,             /* token U16 */
2644 Buffer *mBuf                /* message buffer */
2645 )
2646 #else
2647 PUBLIC S16 cmUnpkTknU16(tknU16, mBuf)
2648 TknU16 *tknU16;             /* token U16 */
2649 Buffer *mBuf;               /* message buffer */
2650 #endif
2651 {
2652    TRC2(cmUnpTknU16)
2653
2654    /* Token Header */
2655    CMCHKUNPK(SUnpkU8, &tknU16->pres, mBuf);
2656
2657    if (tknU16->pres)
2658    {
2659       /* Value */
2660       CMCHKUNPK(SUnpkU16, &tknU16->val, mBuf);
2661    }
2662
2663    RETVALUE(ROK);
2664 } /* end of cmUnpkTknU16 */
2665
2666 \f
2667 /*
2668 *
2669 *       Fun:   cmUnpkTknU32
2670 *
2671 *       Desc:  This function unpacks a token U32
2672 *
2673 *       Ret:   ROK      - ok
2674 *
2675 *       Notes: None
2676 *
2677 *       File:  cm_gen.c
2678 *
2679 */
2680   
2681 #ifdef ANSI
2682 PUBLIC S16 cmUnpkTknU32
2683 (
2684 TknU32 *tknU32,             /* token U32 */
2685 Buffer *mBuf                /* message buffer */
2686 )
2687 #else
2688 PUBLIC S16 cmUnpkTknU32(tknU32, mBuf)
2689 TknU32 *tknU32;             /* token U32 */
2690 Buffer *mBuf;               /* message buffer */
2691 #endif
2692 {
2693    TRC2(cmUnpTknU32)
2694
2695    /* Token Header */
2696    CMCHKUNPK(SUnpkU8, &tknU32->pres, mBuf);
2697
2698    if (tknU32->pres)
2699    {
2700       /* Value */
2701       CMCHKUNPK(SUnpkU32, &tknU32->val, mBuf);
2702    }
2703
2704    RETVALUE(ROK);
2705 } /* end of cmUnpkTknU32 */
2706
2707 /*
2708 *
2709 *       Fun:   cmUnpkTknStr
2710 *
2711 *       Desc:  This function unpacks a token string - regular size
2712 *
2713 *       Ret:   ROK      - ok
2714 *
2715 *       Notes: None
2716 *
2717 *       File:  cm_gen.c
2718 *
2719 */
2720   
2721 #ifdef ANSI
2722 PUBLIC S16 cmUnpkTknStr
2723 (
2724 TknStr *tknStr,             /* token string */
2725 Buffer *mBuf                /* message buffer */
2726 )
2727 #else
2728 PUBLIC S16 cmUnpkTknStr(tknStr, mBuf)
2729 TknStr *tknStr;             /* token string */
2730 Buffer *mBuf;               /* message buffer */
2731 #endif
2732 {
2733    Cntr i;                     /* counter */
2734
2735    TRC2(cmUnpTknStr)
2736
2737    /* Token Header */
2738    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2739
2740    if (tknStr->pres)
2741    {
2742       /* Length */
2743       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2744
2745       /* Value */
2746       for (i = (tknStr->len - 1); i >= 0; i--)
2747       {
2748          CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2749       }
2750    }
2751    else
2752       tknStr->len = 0;
2753
2754    RETVALUE(ROK);
2755 } /* end of cmUnpkTknStr */
2756
2757 /*
2758 *
2759 *       Fun:   cmUnpkTknStrM
2760 *
2761 *       Desc:  This function unpacks a token string - medium size
2762 *
2763 *       Ret:   ROK      - ok
2764 *
2765 *       Notes: None
2766 *
2767 *       File:  cm_gen.c
2768 *
2769 */
2770   
2771 #ifdef ANSI
2772 PUBLIC S16 cmUnpkTknStrM
2773 (
2774 TknStrM *tknStr,             /* token string */
2775 Buffer *mBuf                /* message buffer */
2776 )
2777 #else
2778 PUBLIC S16 cmUnpkTknStrM(tknStr, mBuf)
2779 TknStrM *tknStr;             /* token string */
2780 Buffer *mBuf;               /* message buffer */
2781 #endif
2782 {
2783    Cntr i;                     /* counter */
2784
2785    TRC2(cmUnpTknStrM)
2786
2787    /* Token Header */
2788    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2789
2790    if (tknStr->pres)
2791    {
2792       /* Length */
2793       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2794
2795       /* Value */
2796       for (i = (tknStr->len - 1); i >= 0; i--)
2797       {
2798          CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2799       }
2800    }
2801    else
2802       tknStr->len = 0;
2803
2804    RETVALUE(ROK);
2805 } /* end of cmUnpkTknStrM */
2806
2807 \f
2808 /*
2809 *
2810 *       Fun:   cmUnpkTknStrS
2811 *
2812 *       Desc:  This function unpacks a token string - small size
2813 *
2814 *       Ret:   ROK      - ok
2815 *
2816 *       Notes: None
2817 *
2818 *       File:  cm_gen.c
2819 *
2820 */
2821   
2822 #ifdef ANSI
2823 PUBLIC S16 cmUnpkTknStrS
2824 (
2825 TknStrS *tknStr,             /* token string */
2826 Buffer *mBuf                /* message buffer */
2827 )
2828 #else
2829 PUBLIC S16 cmUnpkTknStrS(tknStr, mBuf)
2830 TknStrS *tknStr;             /* token string */
2831 Buffer *mBuf;               /* message buffer */
2832 #endif
2833 {
2834    Cntr i;                     /* counter */
2835
2836    TRC2(cmUnpTknStrS)
2837
2838    /* Token Header */
2839    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2840
2841    if (tknStr->pres)
2842    {
2843       /* Length */
2844       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2845
2846       /* Value */
2847       for (i = (tknStr->len - 1); i >= 0; i--)
2848       {
2849          CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2850       }
2851    }
2852    else
2853       tknStr->len = 0;
2854
2855    RETVALUE(ROK);
2856 } /* end of cmUnpkTknStrS */
2857
2858 \f
2859 /*
2860 *
2861 *       Fun:   cmUnpkTknStrE
2862 *
2863 *       Desc:  This function unpacks a token string - extended size
2864 *
2865 *       Ret:   ROK      - ok
2866 *
2867 *       Notes: None
2868 *
2869 *       File:  cm_gen.c
2870 *
2871 */
2872   
2873 #ifdef ANSI
2874 PUBLIC S16 cmUnpkTknStrE
2875 (
2876 TknStrE *tknStr,             /* token string */
2877 Buffer *mBuf                /* message buffer */
2878 )
2879 #else
2880 PUBLIC S16 cmUnpkTknStrE(tknStr, mBuf)
2881 TknStrE *tknStr;             /* token string */
2882 Buffer *mBuf;               /* message buffer */
2883 #endif
2884 {
2885    Cntr i;                     /* counter */
2886
2887    TRC2(cmUnpTknStrE)
2888
2889    /* Token Header */
2890    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
2891
2892    if (tknStr->pres)
2893    {
2894       /* Length */
2895       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
2896
2897       /* Value */
2898       for (i = (tknStr->len - 1); i >= 0; i--)
2899       {
2900          CMCHKUNPK(SUnpkU8, &tknStr->val[i], mBuf);
2901       }
2902    }
2903    else
2904       tknStr->len = 0;
2905
2906    RETVALUE(ROK);
2907 } /* end of cmUnpkTknStrE */
2908
2909 #ifndef CMFILE_REORG_1
2910
2911 \f
2912 /*
2913 *
2914 *       Fun:   cmUnpkPnNodeId
2915 *
2916 *       Desc:  This function unpacks a PnNodeId structure from a buffer
2917 *
2918 *       Ret:   Void
2919 *
2920 *       Notes: None
2921 *
2922 *       File:  cm_gen.c
2923 *
2924 */
2925   
2926 #ifdef ANSI
2927 PUBLIC S16 cmUnpkPnNodeId
2928 (
2929 PnNodeId  *dst,     /* source PNNI Node Id */
2930 Buffer *mBuf        /* message buffer */
2931 )
2932 #else
2933 PUBLIC S16 cmUnpkPnNodeId (dst, mBuf)
2934 PnNodeId  *dst;     /* source PNNI Node Id */
2935 Buffer *mBuf;       /* message buffer */
2936 #endif
2937 {
2938    S16 i;
2939    
2940    TRC3(cmUnpkPnNodeId);
2941    
2942    for (i = 0; i < PN_NODEID_LEN; i++)
2943    {
2944       CMCHKUNPK(SUnpkU8, &dst->id[i], mBuf);
2945    }
2946    
2947    RETVALUE(ROK);
2948 } /* cmUnpkPnNodeId */
2949
2950 #endif /* CMFILE_REORG_1 */
2951
2952 \f
2953 /*
2954  *
2955  *      Fun:   cmUnpkTknStr4
2956  *
2957  *      Desc:  This function packs a token string of size 4
2958  *
2959  *      Ret:   ROK      - ok
2960  *
2961  *      Notes: None
2962  *
2963         File:  cm_gen.c
2964  *
2965  */
2966   
2967 #ifdef ANSI
2968 PUBLIC S16 cmUnpkTknStr4
2969 (
2970 TknStr4 *tknStr,             /* token string */
2971 Buffer  *mBuf                /* message buffer */
2972 )
2973 #else
2974 PUBLIC S16 cmUnpkTknStr4(tknStr, mBuf)
2975 TknStr4 *tknStr;             /* token string */
2976 Buffer  *mBuf;               /* message buffer */
2977 #endif
2978 {
2979    TRC2(cmUnpkTknStr4)
2980
2981    CMUNPKTKNSTR(tknStr, mBuf);
2982
2983    RETVALUE(ROK);
2984
2985 } /* end of cmUnpkTknStr4 */
2986
2987
2988 \f
2989 /*
2990  *
2991  *      Fun:   cmUnpkTknStr12
2992  *
2993  *      Desc:  This function packs a token string of size 4
2994  *
2995  *      Ret:   ROK      - ok
2996  *
2997  *      Notes: None
2998  *
2999         File:  cm_gen.c
3000  *
3001  */
3002   
3003 #ifdef ANSI
3004 PUBLIC S16 cmUnpkTknStr12
3005 (
3006 TknStr12 *tknStr,             /* token string */
3007 Buffer   *mBuf                /* message buffer */
3008 )
3009 #else
3010 PUBLIC S16 cmUnpkTknStr12(tknStr, mBuf)
3011 TknStr12 *tknStr;             /* token string */
3012 Buffer   *mBuf;               /* message buffer */
3013 #endif
3014 {
3015    TRC2(cmUnpkTknStr12)
3016
3017    CMUNPKTKNSTR(tknStr, mBuf);
3018
3019    RETVALUE(ROK);
3020
3021 } /* end of cmUnpkTknStr12 */
3022
3023 \f
3024 /*
3025  *
3026  *      Fun:   cmUnpkTknStr32
3027  *
3028  *      Desc:  This function packs a token string of size 4
3029  *
3030  *      Ret:   ROK      - ok
3031  *
3032  *      Notes: None
3033  *
3034         File:  cm_gen.c
3035  *
3036  */
3037   
3038 #ifdef ANSI
3039 PUBLIC S16 cmUnpkTknStr32
3040 (
3041 TknStr32 *tknStr,             /* token string */
3042 Buffer   *mBuf                /* message buffer */
3043 )
3044 #else
3045 PUBLIC S16 cmUnpkTknStr32(tknStr, mBuf)
3046 TknStr32 *tknStr;             /* token string */
3047 Buffer   *mBuf;               /* message buffer */
3048 #endif
3049 {
3050    TRC2(cmUnpkTknStr32)
3051
3052    CMUNPKTKNSTR(tknStr, mBuf);
3053
3054    RETVALUE(ROK);
3055
3056 } /* end of cmUnpkTknStr32 */
3057
3058 \f
3059 /*
3060  *
3061  *      Fun:   cmUnpkTknStr64
3062  *
3063  *      Desc:  This function packs a token string of size 4
3064  *
3065  *      Ret:   ROK      - ok
3066  *
3067  *      Notes: None
3068  *
3069         File:  cm_gen.c
3070  *
3071  */
3072   
3073 #ifdef ANSI
3074 PUBLIC S16 cmUnpkTknStr64
3075 (
3076 TknStr64 *tknStr,             /* token string */
3077 Buffer   *mBuf                /* message buffer */
3078 )
3079 #else
3080 PUBLIC S16 cmUnpkTknStr64(tknStr, mBuf)
3081 TknStr64 *tknStr;             /* token string */
3082 Buffer   *mBuf;               /* message buffer */
3083 #endif
3084 {
3085    TRC2(cmUnpkTknStr64)
3086
3087    CMUNPKTKNSTR(tknStr, mBuf);
3088
3089    RETVALUE(ROK);
3090
3091 } /* end of cmUnpkTknStr64 */
3092
3093 \f
3094 /*
3095  *
3096  *      Fun:   cmUnpkTknStr132
3097  *
3098  *      Desc:  This function packs a token string of size 4
3099  *
3100  *      Ret:   ROK      - ok
3101  *
3102  *      Notes: None
3103  *
3104         File:  cm_gen.c
3105  *
3106  */
3107   
3108 #ifdef ANSI
3109 PUBLIC S16 cmUnpkTknStr132
3110 (
3111 TknStr132 *tknStr,             /* token string */
3112 Buffer   *mBuf                /* message buffer */
3113 )
3114 #else
3115 PUBLIC S16 cmUnpkTknStr132(tknStr, mBuf)
3116 TknStr132 *tknStr;             /* token string */
3117 Buffer   *mBuf;               /* message buffer */
3118 #endif
3119 {
3120    TRC2(cmUnpkTknStr132)
3121
3122    CMUNPKTKNSTR(tknStr, mBuf);
3123
3124    RETVALUE(ROK);
3125
3126 } /* end of cmUnpkTknStr132 */
3127
3128 \f
3129 /*
3130  *
3131  *      Fun:   cmUnpkTknStr256
3132  *
3133  *      Desc:  This function packs a token string of size 4
3134  *
3135  *      Ret:   ROK      - ok
3136  *
3137  *      Notes: None
3138  *
3139         File:  cm_gen.c
3140  *
3141  */
3142   
3143 #ifdef ANSI
3144 PUBLIC S16 cmUnpkTknStr256
3145 (
3146 TknStr256 *tknStr,             /* token string */
3147 Buffer    *mBuf                /* message buffer */
3148 )
3149 #else
3150 PUBLIC S16 cmUnpkTknStr256(tknStr, mBuf)
3151 TknStr256 *tknStr;             /* token string */
3152 Buffer    *mBuf;               /* message buffer */
3153 #endif
3154 {
3155    TRC2(cmUnpkTknStr256)
3156
3157    CMUNPKTKNSTR(tknStr, mBuf);
3158
3159    RETVALUE(ROK);
3160
3161 } /* end of cmUnpkTknStr256 */
3162
3163 \f
3164 /*
3165  *
3166  *      Fun:   cmUnpkTknOid
3167  *
3168  *      Desc:  This function packs a Object Identifier token
3169  *
3170  *      Ret:   ROK      - ok
3171  *
3172  *      Notes: None
3173  *
3174         File:  cm_gen.c
3175  *
3176  */
3177   
3178 #ifdef ANSI
3179 PUBLIC S16 cmUnpkTknOid
3180 (
3181 TknOid   *tknOid,             /* Object Identifier token */
3182 Buffer   *mBuf                /* message buffer */
3183 )
3184 #else
3185 PUBLIC S16 cmUnpkTknOid(tknOid, mBuf)
3186 TknOid   *tknOid;             /* Object Identifier token */
3187 Buffer   *mBuf;               /* message buffer */
3188 #endif
3189 {
3190    U16    i;
3191
3192    TRC2(cmUnpkTknOid)
3193  
3194    /* Unpack the token header */
3195    CMCHKUNPK(SUnpkU8, &tknOid->pres, mBuf);
3196
3197    if (tknOid->pres == TRUE)
3198    {
3199       /* Unpack the length */
3200       CMCHKUNPK(SUnpkU8, &tknOid->len, mBuf);
3201
3202       /* Pack the value */
3203       for (i = 1; i <= (U16)tknOid->len; i++)
3204       {
3205          /* cm_gen_c_001.main_33: changes for TknOid value from U16 to U32
3206           * with compilation flag TKNOID_U16 */
3207 #ifndef TKNOID_U16
3208          CMCHKUNPK(SUnpkU32, &tknOid->val[tknOid->len - i], mBuf);
3209 #else
3210          CMCHKUNPK(SUnpkU16, &tknOid->val[tknOid->len - i], mBuf);
3211 #endif /* !TKNOID_U16 */
3212       }
3213    }
3214
3215    RETVALUE(ROK);
3216 } /* end of cmUnpkTknOid */
3217
3218 \f
3219 /*
3220 *
3221 *       Fun:   cmUnpkTknS32
3222 *
3223 *       Desc:  This function unpacks a token S32
3224 *
3225 *       Ret:   ROK      - ok
3226 *
3227 *       Notes: None
3228 *
3229 *       File:  cm_gen.c
3230 *
3231 */
3232   
3233 #ifdef ANSI
3234 PUBLIC S16 cmUnpkTknS32
3235 (
3236 TknS32 *tknS32,             /* token S32 */
3237 Buffer *mBuf                /* message buffer */
3238 )
3239 #else
3240 PUBLIC S16 cmUnpkTknS32(tknS32, mBuf)
3241 TknS32 *tknS32;             /* token S32 */
3242 Buffer *mBuf;               /* message buffer */
3243 #endif
3244 {
3245    TRC2(cmUnpTknS32)
3246
3247    /* Token Header */
3248    CMCHKUNPK(SUnpkU8, &tknS32->pres, mBuf);
3249
3250    if (tknS32->pres)
3251    {
3252       /* Value */
3253       CMCHKUNPK(SUnpkS32, &tknS32->val, mBuf);
3254    }
3255
3256    RETVALUE(ROK);
3257 } /* end of cmUnpkTknS32 */
3258
3259 \f
3260 /*
3261 *
3262 *       Fun:   cmUnpkHeader
3263 *
3264 *       Desc:  This function is used to Unpack Header structure
3265 *
3266 *       Ret:   ROK      - ok
3267 *
3268 *       Notes: None.
3269 *
3270 *       File:  cm_gen.c
3271 *
3272 */
3273   
3274 #ifdef ANSI
3275 PUBLIC S16 cmUnpkHeader
3276 (
3277 Header *header,   /* header structure */
3278 Buffer *mBuf      /* message buffer */
3279 )
3280 #else
3281 PUBLIC S16 cmUnpkHeader(header, mBuf)
3282 Header *header;   /* header structure */
3283 Buffer *mBuf;     /* message buffer */
3284 #endif
3285 {
3286    TRC2(cmUnpHeader)
3287
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);
3294 #ifdef LMINT3
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);
3300 #endif /* LMINT3 */
3301
3302    RETVALUE(ROK);
3303 } /* end of cmUnpkHeader */
3304
3305 \f
3306 /*
3307 *
3308 *       Fun:   cmUnpkCmStatus
3309 *
3310 *       Desc:  This function unpacks common management status structure
3311 *
3312 *       Ret:   ROK      - ok
3313 *
3314 *       Notes: None.
3315 *
3316 *       File:  cm_gen.c
3317 *
3318 */
3319   
3320 #ifdef ANSI
3321 PUBLIC S16 cmUnpkCmStatus
3322 (
3323 CmStatus *sta,              /* status structure */
3324 Buffer *mBuf                /* message buffer */
3325 )
3326 #else
3327 PUBLIC S16 cmUnpkCmStatus(sta, mBuf)
3328 CmStatus *sta;              /* status structure */
3329 Buffer *mBuf;               /* message buffer */
3330 #endif
3331 {
3332    TRC2(cmUnpkCmStatus)
3333
3334    CMCHKUNPK(SUnpkU16, &sta->status, mBuf);
3335    CMCHKUNPK(SUnpkU16, &sta->reason, mBuf);
3336
3337    RETVALUE(ROK);
3338 } /* end of cmUnpkCmStatus */
3339
3340 \f
3341 /*
3342 *
3343 *       Fun:   cmUnpkCmAlarm
3344 *
3345 *       Desc:  This function unpacks common management alarm structure
3346 *
3347 *       Ret:   ROK      - ok
3348 *
3349 *       Notes: None.
3350 *
3351 *       File:  cm_gen.c
3352 *
3353 */
3354   
3355 #ifdef ANSI
3356 PUBLIC S16 cmUnpkCmAlarm
3357 (
3358 CmAlarm *alarm,             /* alarm structure */
3359 Buffer *mBuf                /* message buffer */
3360 )
3361 #else
3362 PUBLIC S16 cmUnpkCmAlarm(alarm, mBuf)
3363 CmAlarm *alarm;             /* alarm structure */
3364 Buffer *mBuf;               /* message buffer */
3365 #endif
3366 {
3367    TRC2(cmUnpkCmAlarm)
3368
3369    CMCHKUNPK(cmUnpkDateTime, &alarm->dt, mBuf);
3370    CMCHKUNPK(SUnpkU16, &alarm->category, mBuf);
3371    CMCHKUNPK(SUnpkU16, &alarm->event, mBuf);
3372    CMCHKUNPK(SUnpkU16, &alarm->cause, mBuf);
3373
3374    RETVALUE(ROK);
3375 } /* end of cmUnpkCmAlarm */
3376
3377 \f
3378 /*
3379 *
3380 *       Fun:   cmUnpkSmCfg
3381 *
3382 *       Desc:  This function unpacks the stack manager structure
3383 *
3384 *       Ret:   ROK      - ok
3385 *
3386 *       Notes: None.
3387 *
3388 *       File:  cm_gen.c
3389 *
3390 */
3391   
3392 #ifdef ANSI
3393 PUBLIC S16 cmUnpkSmCfg
3394 (
3395 SmCfg *smCfg,           /* stack manager */
3396 Buffer *mBuf            /* message buffer */
3397 )
3398 #else
3399 PUBLIC S16 cmUnpkSmCfg(smCfg, mBuf)
3400 SmCfg *smCfg;           /* stack manager */
3401 Buffer *mBuf;           /* message buffer */
3402 #endif
3403 {
3404    TRC2(cmUnpSmCfg)
3405
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);
3413
3414    RETVALUE(ROK);
3415 } /* end of cmUnpkSmCfg */
3416
3417 \f
3418 /*
3419 *
3420 *       Fun:   cmUnpkTmrCfg
3421 *
3422 *       Desc:  This function unpacks the timer configuration structure
3423 *
3424 *       Ret:   ROK      - ok
3425 *
3426 *       Notes: None.
3427 *
3428 *       File:  cm_gen.c
3429 *
3430 */
3431   
3432 #ifdef ANSI
3433 PUBLIC S16 cmUnpkTmrCfg
3434 (
3435 TmrCfg *tmrCfg,         /* timer configuration */
3436 Buffer *mBuf            /* message buffer */
3437 )
3438 #else
3439 PUBLIC S16 cmUnpkTmrCfg(tmrCfg, mBuf)
3440 TmrCfg *tmrCfg;         /* timer configuration */
3441 Buffer *mBuf;           /* message buffer */
3442 #endif
3443 {
3444    TRC2(cmUnpTmrCfg)
3445
3446    CMCHKUNPK(cmUnpkBool, &tmrCfg->enb, mBuf); 
3447    CMCHKUNPK(SUnpkU16, &tmrCfg->val, mBuf);
3448
3449    RETVALUE(ROK);
3450 } /* end of cmUnpkTmrCfg */
3451
3452 /*
3453  *
3454  *      Fun:   cmUnpkTknBuf
3455  *
3456  *      Desc:  This function unpacks a token buffer
3457  *
3458  *      Ret:   ROK      - ok
3459  *
3460  *      Notes: None
3461  *
3462         File:  cm_gen.c
3463  *
3464  */
3465
3466 #ifdef ANSI
3467 PUBLIC S16 cmUnpkTknBuf
3468 (
3469 TknBuf *tknBuf,                /* token string */
3470 Buffer    **tBuf                /* message buffer */
3471 )
3472 #else
3473 PUBLIC S16 cmUnpkTknBuf(tknBuf, tBuf)
3474 TknBuf *tknBuf;                /* token string */
3475 Buffer    **tBuf;               /* message buffer */
3476 #endif
3477 {
3478    Buffer *mBuf;
3479
3480
3481    TRC2(cmUnpkTknBuf)
3482
3483    mBuf = *tBuf;
3484   
3485    /* Token Header */
3486    CMCHKUNPK(SUnpkU8, &tknBuf->pres, mBuf);
3487
3488    if(tknBuf->pres)
3489    {
3490       MsgLen msgLen, buflen;
3491       Region region;                 /* region */
3492       Pool   pool;                   /* pool */
3493
3494       cmUnpkMsgLen(&msgLen, mBuf);
3495       SFndLenMsg(mBuf, &buflen);
3496       if (buflen > msgLen)
3497       {
3498          if( SSegMsg(mBuf, msgLen, &tknBuf->val) != ROK )
3499          {
3500             RETVALUE(RFAILED);
3501          }
3502       }
3503       else
3504       {
3505           /* Allocate the buffer for tknbuf->val */
3506           SGetBufRegionPool(mBuf, &region, &pool);
3507           SGetMsg(region, pool, &(tknBuf->val));
3508       }
3509       
3510      /* now Swap the two Buffer pointers */
3511       SSwapMsg(mBuf,tknBuf->val);
3512       
3513    }
3514
3515    *tBuf = mBuf;
3516
3517    RETVALUE(ROK);
3518 } /* end of cmUnpkTknBuf */
3519
3520 #ifdef TDS_ROLL_UPGRADE_SUPPORT
3521 /*
3522 *
3523 *       Fun:   cmUnpkIntf
3524 *
3525 *       Desc:  This function unpacks the interface information
3526 *
3527 *       Ret:   ROK      - ok
3528 *
3529 *       Notes: None.
3530 *
3531 *       File:  cm_gen.c
3532 *
3533 */
3534   
3535 #ifdef ANSI
3536 PUBLIC S16 cmUnpkIntf
3537 (
3538 CmIntf *intf,           /* interface info */
3539 Buffer *mBuf            /* message buffer */
3540 )
3541 #else
3542 PUBLIC S16 cmUnpkIntf(intf, mBuf)
3543 CmIntf *intf;           /* interface info */
3544 Buffer *mBuf;           /* message buffer */
3545 #endif
3546 {
3547    TRC2(cmUnpkIntf)
3548
3549    CMCHKUNPK(cmUnpkIntfVer, &intf->intfVer, mBuf); 
3550    CMCHKUNPK(cmUnpkIntfId,  &intf->intfId,  mBuf); 
3551
3552    RETVALUE(ROK);
3553 } /* end of cmUnpkIntf */
3554 #endif /* TDS_ROLL_UPGRADE_SUPPORT */
3555
3556 /**********************************************************************
3557          End of file
3558 **********************************************************************/