Added code for MAC-PHY interface, DU_APP, F1AP, SCTP and CU stub
[o-du/l2.git] / src / cm / cm_tkns.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 \f
19 /********************************************************************20**
20   
21      Name:     general layer
22   
23      Type:     C file
24   
25      Desc:     Packing/Unpacking for structures, defined in cm_tkns.x
26    
27      File:     cm_tkns.c
28   
29 *********************************************************************21*/
30 \f
31 /* header include files (.h) */
32
33 #include "envopt.h"        /* environment options */
34 #include "envdep.h"        /* environment dependent */
35 #include "envind.h"        /* environment independent */
36
37 #include "gen.h"           /* general layer */
38 #include "ssi.h"           /* system services */
39 #include "cm_mblk.h"
40 #include "cm_tkns.h"       /* common tokens */
41
42 /* header/extern include files (.x) */
43
44 #include "gen.x"           /* general layer */
45 #include "ssi.x"           /* system services */
46 #include "cm_mblk.x"
47 #include "cm_tkns.x"       /* common tokens */
48
49 \f  
50
51 /*
52  *      PACKING FUNCTIONS
53  */
54
55 \f
56 /*
57  *
58  *      Fun:   cmPkTknS16
59  *
60  *      Desc:  This function unpacks a token S16
61  *
62  *      Ret:   ROK      - ok
63  *
64  *      Notes: None
65  *
66         File:  cm_tkns.c
67  *
68  */
69 #ifdef ANSI
70 PUBLIC S16 cmPkTknS16
71 (
72 TknS16 *tknS16,             /* token S16 */
73 Buffer *mBuf                /* message buffer */
74 )
75 #else
76 PUBLIC S16 cmPkTknS16(tknS16, mBuf)
77 TknS16 *tknS16;             /* token S16 */
78 Buffer *mBuf;               /* message buffer */
79 #endif
80 {
81    TRC2(cmPkTknS16)
82
83    if (tknS16->pres)
84    {
85       /* Value */
86       CMCHKPK(SPkS16, tknS16->val, mBuf);
87    }
88
89    /* Token Header */
90    CMCHKPK(SPkU8, tknS16->pres, mBuf);
91
92    RETVALUE(ROK);
93 } /* end of cmPkTknS16 */
94   
95 \f
96 /*
97  *
98  *      Fun:   cmPkTknBStr32
99  *
100  *      Desc:  This function packs a token bit string of size 32
101  *
102  *      Ret:   ROK      - ok
103  *
104  *      Notes: None
105  *
106         File:  cm_tkns.c
107  *
108  */
109   
110 #ifdef ANSI
111 PUBLIC S16 cmPkTknBStr32
112 (
113 TknBStr32 *tknStr,             /* token string */
114 Buffer    *mBuf                /* message buffer */
115 )
116 #else
117 PUBLIC S16 cmPkTknBStr32(tknStr, mBuf)
118 TknBStr32 *tknStr;             /* token string */
119 Buffer    *mBuf;               /* message buffer */
120 #endif
121 {
122    TRC2(cmPkTknBStr32)
123
124    CMPKTKNBSTR(tknStr, mBuf);
125
126    RETVALUE(ROK);
127
128 } /* end of cmPkTknBStr32 */
129
130 /*
131  *
132  *      Fun:   cmPkTknStr8
133  *
134  *      Desc:  This function packs a token string of size 8
135  *
136  *      Ret:   ROK      - ok
137  *
138  *      Notes: None
139  *
140         File:  cm_tkns.c
141  *
142  */
143   
144 #ifdef ANSI
145 PUBLIC S16 cmPkTknStr8
146 (
147 TknStr8 *tknStr,             /* token string */
148 Buffer  *mBuf                /* message buffer */
149 )
150 #else
151 PUBLIC S16 cmPkTknStr8(tknStr, mBuf)
152 TknStr8 *tknStr;             /* token string */
153 Buffer  *mBuf;               /* message buffer */
154 #endif
155 {
156    TRC2(cmPkTknStr8)
157
158    CMPKTKNSTR(tknStr, mBuf);
159
160    RETVALUE(ROK);
161
162 } /* end of cmPkTknStr8 */
163
164 \f
165 /*
166  *
167  *      Fun:   cmPkTknStr16
168  *
169  *      Desc:  This function packs a token string of size 16
170  *
171  *      Ret:   ROK      - ok
172  *
173  *      Notes: None
174  *
175         File:  cm_tkns.c
176  *
177  */
178   
179 #ifdef ANSI
180 PUBLIC S16 cmPkTknStr16
181 (
182 TknStr16 *tknStr,             /* token string */
183 Buffer   *mBuf                /* message buffer */
184 )
185 #else
186 PUBLIC S16 cmPkTknStr16(tknStr, mBuf)
187 TknStr16 *tknStr;             /* token string */
188 Buffer   *mBuf;               /* message buffer */
189 #endif
190 {
191    TRC2(cmPkTknStr16)
192
193    CMPKTKNSTR(tknStr, mBuf);
194
195    RETVALUE(ROK);
196
197 } /* end of cmPkTknStr16 */
198
199 \f
200 /*
201  *
202  *      Fun:   cmPkTknStrOSXL
203  *
204  *      Desc:  This function packs a Long Octet string
205  *
206  *      Ret:   ROK      - ok
207  *
208  *      Notes: None
209  *
210         File:  cm_tkns.c
211  *
212  */
213   
214 #ifdef ANSI
215 PUBLIC S16 cmPkTknStrOSXL
216 (
217 TknStrOSXL *tknStr,             /* token string */
218 Buffer     *mBuf                /* message buffer */
219 )
220 #else
221 PUBLIC S16 cmPkTknStrOSXL(tknStr, mBuf)
222 TknStrOSXL *tknStr;             /* token string */
223 Buffer     *mBuf;               /* message buffer */
224 #endif
225 {
226    U16 ndx;
227
228    TRC2(cmPkTknStrOSXL)
229
230    if(tknStr->pres)
231    {
232       /* Value */
233       for (ndx = 0; ndx < tknStr->len; ndx++)
234       {
235          CMCHKPK(SPkU8, tknStr->val[ndx], mBuf);
236       }
237       /* Length */
238       CMCHKPK(SPkU16, tknStr->len, mBuf);
239    }
240    /* Token Header */
241    CMCHKPK(SPkU8, tknStr->pres, mBuf);
242
243    RETVALUE(ROK);
244
245 } /* end of cmPkTknStrOSXL */
246
247
248 \f
249 /*
250  *
251  *      Fun:   cmPkTknStrBSXL
252  *
253  *      Desc:  This function packs a Long bit string
254  *
255  *      Ret:   ROK      - ok
256  *
257  *      Notes: None
258  *
259         File:  cm_tkns.c
260  *
261  */
262   
263 #ifdef ANSI
264 PUBLIC S16 cmPkTknStrBSXL
265 (
266 TknStrBSXL *tknStr,             /* token string */
267 Buffer     *mBuf              /* message buffer */
268 )
269 #else
270 PUBLIC S16 cmPkTknStrBSXL(tknStr, mBuf)
271 TknStrBSXL *tknStr;             /* token string */
272 Buffer     *mBuf;               /* message buffer */
273 #endif
274 {
275    U16 ndx;
276    U16 len;
277
278    TRC2(cmPkTknStrBSXL)
279
280    if(tknStr->pres)
281    {
282       if (tknStr->len % 8)
283          len = (tknStr->len/8) + 1;
284       else
285          len = (tknStr->len/8);
286    
287       /* Value */
288       for (ndx = 0; ndx < len; ndx++)
289       {
290          CMCHKPK(SPkU8, tknStr->val[ndx], mBuf);
291       }
292       /* Length */
293       CMCHKPK(SPkU16, tknStr->len, mBuf);
294    }
295    /* Token Header */
296    CMCHKPK(SPkU8, tknStr->pres, mBuf);
297
298    RETVALUE(ROK);
299
300 } /* end of cmPkTknStrBSXL */
301
302 \f  
303 /*
304  *
305  *      Fun:   cmPkTknStrBMP4
306  *
307  *      Desc:  This function packs a BMP token string of size 4
308  *
309  *      Ret:   ROK      - ok
310  *
311  *      Notes: None
312  *
313         File:  cm_tkns.c
314  *
315  */
316   
317 #ifdef ANSI
318 PUBLIC S16 cmPkTknStrBMP4
319 (
320 TknStrBMP4 *tknStr,             /* token string */
321 Buffer     *mBuf                /* message buffer */
322 )
323 #else
324 PUBLIC S16 cmPkTknStrBMP4(tknStr, mBuf)
325 TknStrBMP4 *tknStr;             /* token string */
326 Buffer     *mBuf;               /* message buffer */
327 #endif
328 {
329    U8 ndx;
330
331    TRC2(cmPkTknStrBMP4)
332
333    if(tknStr->pres)
334    {
335       /* Value */
336       for (ndx = 0; ndx < tknStr->len; ndx++)
337       {
338          CMCHKPK(SPkU16, tknStr->val[ndx], mBuf);
339       }
340
341       /* Length */
342       CMCHKPK(SPkU8, tknStr->len, mBuf);
343    }
344
345    /* Token Header */
346    CMCHKPK(SPkU8, tknStr->pres, mBuf);
347
348    RETVALUE(ROK);
349 } /* end of cmPkTknStrBMP4 */
350
351 \f
352 /*
353  *
354  *      Fun:   cmPkTknStrBMPXL
355  *
356  *      Desc:  This function packs a Long BMP Octet string
357  *
358  *      Ret:   ROK      - ok
359  *
360  *      Notes: None
361  *
362         File:  cm_tkns.c
363  *
364  */
365   
366 #ifdef ANSI
367 PUBLIC S16 cmPkTknStrBMPXL
368 (
369 TknStrBMPXL *tknStr,             /* token string */
370 Buffer     *mBuf                /* message buffer */
371 )
372 #else
373 PUBLIC S16 cmPkTknStrBMPXL(tknStr, mBuf)
374 TknStrBMPXL *tknStr;             /* token string */
375 Buffer      *mBuf;               /* message buffer */
376 #endif
377 {
378    U16 ndx;
379
380    TRC2(cmPkTknStrBMPXL)
381
382    if(tknStr->pres)
383    {
384       /* Value */
385       for (ndx = 0; ndx < tknStr->len; ndx++)
386       {
387          CMCHKPK(SPkU16, tknStr->val[ndx], mBuf);
388       }
389       /* Length */
390       CMCHKPK(SPkU16, tknStr->len, mBuf);
391    }
392    /* Token Header */
393    CMCHKPK(SPkU8, tknStr->pres, mBuf);
394
395    RETVALUE(ROK);
396 } /* end of cmPkTknStrBMPXL */
397
398 \f  
399 /*
400  *
401  *      Fun:   cmPkTknStrUNI4
402  *
403  *      Desc:  This function packs a UNI token string of size 4
404  *
405  *      Ret:   ROK      - ok
406  *
407  *      Notes: None
408  *
409         File:  cm_tkns.c
410  *
411  */
412   
413 #ifdef ANSI
414 PUBLIC S16 cmPkTknStrUNI4
415 (
416 TknStrUNI4 *tknStr,             /* token string */
417 Buffer     *mBuf                /* message buffer */
418 )
419 #else
420 PUBLIC S16 cmPkTknStrUNI4(tknStr, mBuf)
421 TknStrUNI4 *tknStr;             /* token string */
422 Buffer     *mBuf;               /* message buffer */
423 #endif
424 {
425    U8 ndx;
426
427    TRC2(cmPkTknStrUNI4)
428
429    if(tknStr->pres)
430    {
431       /* Value */
432       for (ndx = 0; ndx < tknStr->len; ndx++)
433       {
434          CMCHKPK(SPkU32, tknStr->val[ndx], mBuf);
435       }
436
437       /* Length */
438       CMCHKPK(SPkU8, tknStr->len, mBuf);
439    }
440
441    /* Token Header */
442    CMCHKPK(SPkU8, tknStr->pres, mBuf);
443
444    RETVALUE(ROK);
445 } /* end of cmPkTknStrUNI4 */
446
447 \f
448 /*
449  *
450  *      Fun:   cmPkTknStrUNIXL
451  *
452  *      Desc:  This function packs a Long UNI Octet string
453  *
454  *      Ret:   ROK      - ok
455  *
456  *      Notes: None
457  *
458         File:  cm_tkns.c
459  *
460  */
461   
462 #ifdef ANSI
463 PUBLIC S16 cmPkTknStrUNIXL
464 (
465 TknStrUNIXL *tknStr,             /* token string */
466 Buffer     *mBuf                /* message buffer */
467 )
468 #else
469 PUBLIC S16 cmPkTknStrUNIXL(tknStr, mBuf)
470 TknStrUNIXL *tknStr;             /* token string */
471 Buffer      *mBuf;               /* message buffer */
472 #endif
473 {
474    U16 ndx;
475
476    TRC2(cmPkTknStrUNIXL)
477
478    if(tknStr->pres)
479    {
480       /* Value */
481       for (ndx = 0; ndx < tknStr->len; ndx++)
482       {
483          CMCHKPK(SPkU32, tknStr->val[ndx], mBuf);
484       }
485       /* Length */
486       CMCHKPK(SPkU16, tknStr->len, mBuf);
487    }
488    /* Token Header */
489    CMCHKPK(SPkU8, tknStr->pres, mBuf);
490
491    RETVALUE(ROK);
492 } /* end of cmPkTknStrUNIXL */
493 \f
494 /*
495  *      UNPACKING FUNCTIONS
496  */
497
498 \f
499 /*
500  *
501  *      Fun:   cmUnpkTknS16
502  *
503  *      Desc:  This function unpacks a token S16
504  *
505  *      Ret:   ROK      - ok
506  *
507  *      Notes: None
508  *
509         File:  cm_tkns.c
510  *
511  */
512 #ifdef ANSI
513 PUBLIC S16 cmUnpkTknS16
514 (
515 TknS16 *tknS16,             /* token S16 */
516 Buffer *mBuf                /* message buffer */
517 )
518 #else
519 PUBLIC S16 cmUnpkTknS16(tknS16, mBuf)
520 TknS16 *tknS16;             /* token S16 */
521 Buffer *mBuf;               /* message buffer */
522 #endif
523 {
524    TRC2(cmUnpkTknS16)
525
526    /* Token Header */
527    CMCHKUNPK(SUnpkU8, &tknS16->pres, mBuf);
528
529    if (tknS16->pres)
530    {
531       /* Value */
532       CMCHKUNPK(SUnpkS16, &tknS16->val, mBuf);
533    }
534
535    RETVALUE(ROK);
536 } /* end of cmUnpkTknS16 */
537   
538 \f
539 /*
540  *
541  *      Fun:   cmUnpkTknBStr32
542  *
543  *      Desc:  This function packs a token bit string of size 32
544  *
545  *      Ret:   ROK      - ok
546  *
547  *      Notes: None
548  *
549         File:  cm_tkns.c
550  *
551  */
552   
553 #ifdef ANSI
554 PUBLIC S16 cmUnpkTknBStr32
555 (
556 TknBStr32 *tknStr,             /* token string */
557 Buffer    *mBuf                /* message buffer */
558 )
559 #else
560 PUBLIC S16 cmUnpkTknBStr32(tknStr, mBuf)
561 TknBStr32 *tknStr;             /* token string */
562 Buffer    *mBuf;               /* message buffer */
563 #endif
564 {
565    TRC2(cmUnpkTknBStr32)
566
567    CMUNPKTKNBSTR(tknStr, mBuf);
568
569    RETVALUE(ROK);
570
571 } /* end of cmUnpkTknBStr32 */
572
573 \f
574 /*
575  *
576  *      Fun:   cmUnpkTknStr8
577  *
578  *      Desc:  This function packs a token string of size 8
579  *
580  *      Ret:   ROK      - ok
581  *
582  *      Notes: None
583  *
584         File:  cm_tkns.c
585  *
586  */
587   
588 #ifdef ANSI
589 PUBLIC S16 cmUnpkTknStr8
590 (
591 TknStr8 *tknStr,             /* token string */
592 Buffer  *mBuf                /* message buffer */
593 )
594 #else
595 PUBLIC S16 cmUnpkTknStr8(tknStr, mBuf)
596 TknStr8 *tknStr;             /* token string */
597 Buffer  *mBuf;               /* message buffer */
598 #endif
599 {
600    TRC2(cmUnpkTknStr8)
601
602    CMUNPKTKNSTR(tknStr, mBuf);
603
604    RETVALUE(ROK);
605
606 } /* end of cmUnpkTknStr8 */
607
608 \f
609 /*
610  *
611  *      Fun:   cmUnpkTknStr16
612  *
613  *      Desc:  This function packs a token string of size 16
614  *
615  *      Ret:   ROK      - ok
616  *
617  *      Notes: None
618  *
619         File:  cm_tkns.c
620  *
621  */
622   
623 #ifdef ANSI
624 PUBLIC S16 cmUnpkTknStr16
625 (
626 TknStr16 *tknStr,             /* token string */
627 Buffer   *mBuf                /* message buffer */
628 )
629 #else
630 PUBLIC S16 cmUnpkTknStr16(tknStr, mBuf)
631 TknStr16 *tknStr;             /* token string */
632 Buffer   *mBuf;               /* message buffer */
633 #endif
634 {
635    TRC2(cmUnpkTknStr16)
636
637    CMUNPKTKNSTR(tknStr, mBuf);
638
639    RETVALUE(ROK);
640
641 } /* end of cmUnpkTknStr16 */
642
643 \f
644 /*
645  *
646  *      Fun:   cmUnpkTknStrOSXL
647  *
648  *      Desc:  This function packs a long octet token string
649  *
650  *      Ret:   ROK      - ok
651  *
652  *      Notes: None
653  *
654         File:  cm_tkns.c
655  *
656  */
657   
658 #ifdef ANSI
659 PUBLIC S16 cmUnpkTknStrOSXL
660 (
661 TknStrOSXL *tknStr,             /* token string */
662 Buffer     *mBuf,               /* message buffer */
663 Ptr         ptr                 /* pointer to memory control block */
664 )
665 #else
666 PUBLIC S16 cmUnpkTknStrOSXL(tknStr, mBuf, ptr)
667 TknStrOSXL *tknStr;             /* token string */
668 Buffer     *mBuf;               /* message buffer */
669 Ptr         ptr;                /* pointer to control memory block */
670 #endif
671 {
672    U16 ndx;
673
674    TRC2(cmUnpkTknStrOSXL)
675
676    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
677
678    if(tknStr->pres)
679    {
680       /* Length */
681       CMCHKUNPK(SUnpkU16, &tknStr->len, mBuf);
682
683       if( cmGetMem(ptr, tknStr->len, (Ptr *)&tknStr->val) != ROK)
684       {
685          RETVALUE(RFAILED);
686       }
687       /* Value */
688       for (ndx = 1; ndx <= tknStr->len; ndx++)
689       {
690          CMCHKUNPK(SUnpkU8, &tknStr->val[tknStr->len - ndx], mBuf);
691       }
692    }
693
694    RETVALUE(ROK);
695
696 } /* end of cmUnpkTknStrOSXL */
697
698
699 \f
700 /*
701  *
702  *      Fun:   cmUnpkTknStrBSXL
703  *
704  *      Desc:  This function packs a long bit token string
705  *
706  *      Ret:   ROK      - ok
707  *
708  *      Notes: None
709  *
710         File:  cm_tkns.c
711  *
712  */
713   
714 #ifdef ANSI
715 PUBLIC S16 cmUnpkTknStrBSXL
716 (
717 TknStrBSXL *tknStr,             /* token string */
718 Ptr         ptr,                /* pointer to memory control block */
719 Buffer     *mBuf                /* message buffer */
720 )
721 #else
722 PUBLIC S16 cmUnpkTknStrBSXL(tknStr, ptr, mBuf)
723 TknStrBSXL *tknStr;             /* token string */
724 Ptr         ptr;                /* pointer to control memory block */
725 Buffer     *mBuf;               /* message buffer */
726 #endif
727 {
728    U16 ndx;
729    U16 len;
730
731    TRC2(cmUnpkTknStrBSXL)
732
733    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
734
735    if(tknStr->pres)
736    {
737       /* Length */
738       CMCHKUNPK(SUnpkU16, &tknStr->len, mBuf);
739
740       if (tknStr->len % 8)
741          len = (tknStr->len/8) + 1;
742       else
743          len = (tknStr->len/8);
744          
745       if( cmGetMem(ptr, len, (Ptr *)&tknStr->val) != ROK)
746       {
747          RETVALUE(RFAILED);
748       }
749       /* Value */
750       for (ndx = 1; ndx <= len; ndx++)
751       {
752          CMCHKUNPK(SUnpkU8, &tknStr->val[len - ndx], mBuf);
753       }
754    }
755
756    RETVALUE(ROK);
757
758 } /* end of cmUnpkTknStrBSXL */
759
760 \f  
761 /*
762  *
763  *      Fun:   cmUnpkTknStrBMP4
764  *
765  *      Desc:  This function unpacks a BMP token string of size 4
766  *
767  *      Ret:   ROK      - ok
768  *
769  *      Notes: None
770  *
771         File:  cm_tkns.c
772  *
773  */
774   
775 #ifdef ANSI
776 PUBLIC S16 cmUnpkTknStrBMP4
777 (
778 TknStrBMP4 *tknStr,             /* token string */
779 Buffer     *mBuf                /* message buffer */
780 )
781 #else
782 PUBLIC S16 cmUnpkTknStrBMP4(tknStr, mBuf)
783 TknStrBMP4 *tknStr;             /* token string */
784 Buffer     *mBuf;               /* message buffer */
785 #endif
786 {
787    U8 ndx;
788
789    TRC2(cmUnpkTknStrBMP4)
790
791    /* Token Header */
792    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
793
794    if(tknStr->pres)
795    {
796       /* Length */
797       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
798
799       /* Value */
800       for (ndx = 1; ndx <= tknStr->len; ndx++)
801       {
802          CMCHKUNPK(SUnpkU16, &tknStr->val[tknStr->len - ndx], mBuf);
803       }
804    }
805
806    RETVALUE(ROK);
807 } /* end of cmUnpkTknStrBMP4 */
808
809 \f
810 /*
811  *
812  *      Fun:   cmUnpkTknStrBMPXL
813  *
814  *      Desc:  This function packs a long octet token string
815  *
816  *      Ret:   ROK      - ok
817  *
818  *      Notes: None
819  *
820         File:  cm_tkns.c
821  *
822  */
823   
824 #ifdef ANSI
825 PUBLIC S16 cmUnpkTknStrBMPXL
826 (
827 TknStrBMPXL *tknStr,             /* token string */
828 Buffer      *mBuf,               /* message buffer */
829 Ptr          ptr                 /* pointer to memory control block */
830 )
831 #else
832 PUBLIC S16 cmUnpkTknStrBMPXL(tknStr, mBuf, ptr)
833 TknStrBMPXL *tknStr;             /* token string */
834 Buffer      *mBuf;               /* message buffer */
835 Ptr          ptr;                /* pointer to control memory block */
836 #endif
837 {
838    U16 ndx;
839
840    TRC2(cmUnpkTknStrBMPXL)
841
842    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
843
844    if(tknStr->pres)
845    {
846       /* Length */
847       CMCHKUNPK(SUnpkU16, &tknStr->len, mBuf);
848
849       /* Each BMP Character is 2 octet long */
850       if( cmGetMem(ptr, 2*(tknStr->len), (Ptr *)&tknStr->val) != ROK)
851       {
852          RETVALUE(RFAILED);
853       }
854       /* Value */
855       for (ndx = 1; ndx <= tknStr->len; ndx++)
856       {
857          CMCHKUNPK(SUnpkU16, &tknStr->val[tknStr->len - ndx], mBuf);
858       }
859    }
860
861    RETVALUE(ROK);
862
863 } /* end of cmUnpkTknStrBMPXL */
864
865 \f  
866 /*
867  *
868  *      Fun:   cmUnpkTknStrUNI4
869  *
870  *      Desc:  This function unpacks a UNI token string of size 4
871  *
872  *      Ret:   ROK      - ok
873  *
874  *      Notes: None
875  *
876         File:  cm_tkns.c
877  *
878  */
879   
880 #ifdef ANSI
881 PUBLIC S16 cmUnpkTknStrUNI4
882 (
883 TknStrUNI4 *tknStr,             /* token string */
884 Buffer     *mBuf                /* message buffer */
885 )
886 #else
887 PUBLIC S16 cmUnpkTknStrUNI4(tknStr, mBuf)
888 TknStrUNI4 *tknStr;             /* token string */
889 Buffer     *mBuf;               /* message buffer */
890 #endif
891 {
892    U8 ndx;
893
894    TRC2(cmUnpkTknStrUNI4)
895
896    /* Token Header */
897    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
898
899    if(tknStr->pres)
900    {
901       /* Length */
902       CMCHKUNPK(SUnpkU8, &tknStr->len, mBuf);
903
904       /* Value */
905       for (ndx = 1; ndx <= tknStr->len; ndx++)
906       {
907          CMCHKUNPK(SUnpkU32, &tknStr->val[tknStr->len - ndx], mBuf);
908       }
909    }
910
911    RETVALUE(ROK);
912 } /* end of cmUnpkTknStrUNI4 */
913
914 \f
915 /*
916  *
917  *      Fun:   cmUnpkTknStrUNIXL
918  *
919  *      Desc:  This function packs a long octet token string
920  *
921  *      Ret:   ROK      - ok
922  *
923  *      Notes: None
924  *
925         File:  cm_tkns.c
926  *
927  */
928   
929 #ifdef ANSI
930 PUBLIC S16 cmUnpkTknStrUNIXL
931 (
932 TknStrUNIXL *tknStr,             /* token string */
933 Buffer      *mBuf,               /* message buffer */
934 Ptr          ptr                 /* pointer to memory control block */
935 )
936 #else
937 PUBLIC S16 cmUnpkTknStrUNIXL(tknStr, mBuf, ptr)
938 TknStrUNIXL *tknStr;             /* token string */
939 Buffer      *mBuf;               /* message buffer */
940 Ptr          ptr;                /* pointer to control memory block */
941 #endif
942 {
943    U16 ndx;
944
945    TRC2(cmUnpkTknStrUNIXL)
946
947    CMCHKUNPK(SUnpkU8, &tknStr->pres, mBuf);
948
949    if(tknStr->pres)
950    {
951       /* Length */
952       CMCHKUNPK(SUnpkU16, &tknStr->len, mBuf);
953
954       /* Each UNI Character is 4 octets long */
955       if( cmGetMem(ptr, 4*tknStr->len, (Ptr *)&tknStr->val) != ROK)
956       {
957          RETVALUE(RFAILED);
958       }
959       /* Value */
960       for (ndx = 1; ndx <= tknStr->len; ndx++)
961       {
962          CMCHKUNPK(SUnpkU32, &tknStr->val[tknStr->len - ndx], mBuf);
963       }
964    }
965
966    RETVALUE(ROK);
967
968 } /* end of cmUnpkTknStrUNIXL */
969
970 /**********************************************************************
971          End of file
972 **********************************************************************/