Initial commit
[o-du/l2.git] / src / cm / cm_tkns.x
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 /********************************************************************20**
20   
21      Name:     general layer
22   
23      Type:     C include file
24   
25      Desc:     Token Structures, required by two or more layers
26    
27      File:     cm_tkns.x
28   
29 *********************************************************************21*/
30
31 #ifndef __CMTKNSX
32 #define __CMTKNSX
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 \f
39 /* typedefs */
40
41 /* Token Present */
42 typedef TknU8 TknPres;
43 /* Do not remove TknBool definition. If cm_gprs.x is used then include this
44  * file before cm_gprs.x */
45 typedef TknU8 TknBool;
46
47 typedef struct tknS16        
48 {
49    U8   pres;                     /* present flag */
50    U8   spare1;                   /* for alignment */
51    S16  val;                      /* value */
52 #ifdef ALIGN_64BIT
53    U32  spare2;                   /* for 64 bit alignment */
54 #endif
55 } TknS16;
56
57 /* Token TknStr8 */
58 typedef struct tknStr8            /* token string */
59 {
60    U8   pres;                     /* present flag */
61    U8   len;                      /* length */
62    U16  spare1;                   /* for alignment */
63 #ifdef ALIGN_64BIT
64    U32  spare2;                   /* for 64 bit alignment */
65 #endif
66    U8   val[8];                  /* string value - 4 byte alligned */
67 } TknStr8;
68
69 /* Token TknStr16 */
70 typedef struct tknStr16            /* token string */
71 {
72    U8   pres;                     /* present flag */
73    U8   len;                      /* length */
74    U16  spare1;                   /* for alignment */
75 #ifdef ALIGN_64BIT
76    U32  spare2;                   /* for 64 bit alignment */
77 #endif
78    U8   val[16];                  /* string value - 4 byte alligned */
79 } TknStr16;
80
81 typedef struct tknStrOSXL
82 {
83    U8   pres;                    /* present flag */
84    U8   spare1;                  /* spare */
85    U16   len;                    /* length */
86 #ifdef ALIGN_64BIT
87    U32  spare2;                  /* for 64 bit alignment */
88 #endif
89    U8   *val;                    /* string value - 4 byte alligned */
90 } TknStrOSXL;
91
92 /* Token TknBStr32 : length field indicates number of Bits present */
93 typedef TknStr4 TknBStr32;
94
95 /* Token TknStrBSXL : Len field indicates number of bits present */
96 typedef TknStrOSXL TknStrBSXL;
97
98
99 /*****************************************************
100  Token structure for BMP Character Strings
101 ******************************************************/
102
103 /* Token TknStrBMP4 */
104 typedef struct tknStrBMP4         /* token string */
105 {
106    U8   pres;                     /* present flag */
107    U8   len;                      /* length */
108    U16  spare1;                   /* for alignment */
109 #ifdef ALIGN_64BIT
110    U32  spare2;                   /* for 64 bit alignment */
111 #endif
112    U16   val[4];                  /* string value - 4 byte alligned */
113 } TknStrBMP4;
114
115 /* Token TknStrBMPXL */
116 typedef struct tknStrBMPXL
117 {
118    U8   pres;                    /* present flag */
119    U8   spare1;                  /* spare */
120    U16   len;                    /* length */
121 #ifdef ALIGN_64BIT
122    U32  spare2;                  /* for 64 bit alignment */
123 #endif
124    U16   *val;                   /* string value - 4 byte alligned */
125 } TknStrBMPXL;
126
127
128 /*****************************************************
129  Token structure for UNIVERSAL Character Strings
130 ******************************************************/
131
132 /* Token TknStrUNI4 */
133 typedef struct tknStrUNI4         /* token string */
134 {
135    U8   pres;                     /* present flag */
136    U8   len;                      /* length */
137    U16  spare1;                   /* for alignment */
138 #ifdef ALIGN_64BIT
139    U32  spare2;                   /* for 64 bit alignment */
140 #endif
141    U32   val[4];                  /* string value - 4 byte alligned */
142 } TknStrUNI4;
143
144 typedef struct tknStrUNIXL       /* Universal String */
145 {
146    U8   pres;                    /* present flag */
147    U8   spare1;                  /* spare */
148    U16  len;                     /* length */
149 #ifdef ALIGN_64BIT
150    U32  spare2;                  /* for 64 bit alignment */
151 #endif
152    U32  *val;                    /* string value- 4 byte alligned */ 
153 } TknStrUNIXL;
154
155 /* common packing functions */
156 EXTERN S16 cmPkTknPres      ARGS((TknPres      *tknPres,       Buffer *mBuf));
157 EXTERN S16 cmPkTknS16       ARGS((TknS16       *tknS16,        Buffer *mBuf));
158 EXTERN S16 cmPkTknBStr32    ARGS((TknBStr32    *tknbStr32,     Buffer *mBuf));
159 EXTERN S16 cmPkTknStr8      ARGS((TknStr8      *tknStr8,       Buffer *mBuf));
160 EXTERN S16 cmPkTknStr16     ARGS((TknStr16     *tknStr16,      Buffer *mBuf));
161 EXTERN S16 cmPkTknStrOSXL   ARGS((TknStrOSXL   *tknStrOSXL,    Buffer *mBuf));
162 EXTERN S16 cmPkTknStrBSXL   ARGS((TknStrBSXL   *tknStrBSXL,    Buffer *mBuf));
163 EXTERN S16 cmPkTknStrBMP4   ARGS((TknStrBMP4   *tknStrBMP4,    Buffer *mBuf));
164 EXTERN S16 cmPkTknStrBMPXL  ARGS((TknStrBMPXL  *tknStrBMPXL,   Buffer *mBuf));
165 EXTERN S16 cmPkTknStrUNI4   ARGS((TknStrUNI4   *tknStrUNI4,    Buffer *mBuf));
166 EXTERN S16 cmPkTknStrUNIXL  ARGS((TknStrUNIXL  *tknStrUNIXL,   Buffer *mBuf));
167
168
169 \f
170 /* common unpacking functions */
171 EXTERN S16 cmUnpkTknPres      ARGS((TknPres      *tknPres,       Buffer *mBuf));
172 EXTERN S16 cmUnpkTknS16       ARGS((TknS16       *tknS16,        Buffer *mBuf));
173 EXTERN S16 cmUnpkTknBStr32    ARGS((TknBStr32    *tknBStr32,     Buffer *mBuf));
174 EXTERN S16 cmUnpkTknStr8      ARGS((TknStr8      *tknStr8,       Buffer *mBuf));
175 EXTERN S16 cmUnpkTknStr16     ARGS((TknStr16     *tknStr16,      Buffer *mBuf));
176 EXTERN S16 cmUnpkTknStrOSXL   ARGS((TknStrOSXL   *tknStrOSXL,    Buffer *mBuf,
177                                        Ptr ptr));
178 EXTERN S16 cmUnpkTknStrBSXL   ARGS((TknStrBSXL   *tknStrBSXL,    Ptr ptr, 
179                                        Buffer *mBuf));
180 EXTERN S16 cmUnpkTknStrBMP4   ARGS((TknStrBMP4   *tknStrBMP4,    Buffer *mBuf));
181 EXTERN S16 cmUnpkTknStrBMPXL  ARGS((TknStrBMPXL  *tknStrBMPXL,   Buffer *mBuf,
182                                        Ptr ptr));
183 EXTERN S16 cmUnpkTknStrUNI4   ARGS((TknStrUNI4   *tknStrUNI4,    Buffer *mBuf));
184 EXTERN S16 cmUnpkTknStrUNIXL  ARGS((TknStrUNIXL  *tknStrUNIXL,   Buffer *mBuf,
185                                        Ptr ptr));
186
187
188 #ifdef __cplusplus
189 }
190 #endif /* __cplusplus */
191 #endif /* __CMTKNSX */
192
193 \f  
194 /********************************************************************30**
195   
196          End of file
197 **********************************************************************/