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