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