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