MIH_C_Types.h 143 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/***************************************************************************
                          MIH_C_Types.h  -  description
                             -------------------
    copyright            : (C) 2012 by Eurecom
    email                : davide.brizzolara@eurecom.fr; lionel.gauthier@eurecom.fr, michelle.wetterwald@eurecom.fr
***************************************************************************
Type definition and structure for 802.21 interface
***************************************************************************/
/*! \file MIH_C_Types.h
 * \brief This file defines the 802.21 types or constants defined in Std 802.21-2008 Table F1, F2, F3,
 *         F4, F5, F6, F7, F8, F9, F12, F13, F19, F20, F22, L2. Some tables may be not implemented at all.
 * \author BRIZZOLA Davide, GAUTHIER Lionel, MAUREL Frederic, WETTERWALD Michelle
 * \date 2012
 * \version
 * \note
 * \bug
 * \warning
 */
#ifndef __MIH_C_LINK_TYPES_H__
#define __MIH_C_LINK_TYPES_H__
#include <sys/types.h>
22
#include <linux/types.h>
23
#warning " Hack USER_MODE"
winckel's avatar
winckel committed
24
#undef USER_MODE
25
26
#define USER_MODE

27
28
29
//-----------------------------------------------------------------------------
#include "MIH_C_Link_Constants.h"
#include "MIH_C_bit_buffer.h"
30
#include "UTIL/LOG/log.h"
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
//-----------------------------------------------------------------------------
#define MIH_C_DEBUG_SERIALIZATION 1
#define MIH_C_DEBUG_DESERIALIZATION 1
//-----------------------------------------------------------------------------
#define STR(x)        #x

/** \defgroup MIH_C_INTERFACE 802.21 interface
 *
 */


//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.1 Basic data types
//-----------------------------------------------------------------------------


//----------------------- BITMAP(size) ----------------------------------------
/*! \var typedef u_int8_t                             MIH_C_BITMAP8_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for u_int8_t.
 */
typedef u_int8_t                                                              MIH_C_BITMAP8_T;
/*! \var typedef u_int16_t                             MIH_C_BITMAP16_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for u_int16_t.
 */
typedef u_int16_t                                                             MIH_C_BITMAP16_T;
/*! \struct  MIH_C_BITMAP24_T
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 */
typedef struct MIH_C_BITMAP24 {u_int8_t val[3];}__attribute__((__packed__))   MIH_C_BITMAP24_T;
/*! \var typedef u_int32_t                             MIH_C_BITMAP32_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for u_int32_t.
 */
typedef u_int32_t                                                             MIH_C_BITMAP32_T;
/*! \var typedef u_int64_t                             MIH_C_BITMAP64_T;
 * \brief A type definition for u_int64_t.
 */
typedef u_int64_t                                                             MIH_C_BITMAP64_T;
/*! \struct  MIH_C_BITMAP128_T
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 */
typedef struct MIH_C_BITMAP128 {u_int64_t val[2];}__attribute__((__packed__)) MIH_C_BITMAP128_T;
/*! \struct  MIH_C_BITMAP256_T
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 */
typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MIH_C_BITMAP256_T;

#ifdef MIH_C_F1_BASIC_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_BITMAP6(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP8_T.
     */
    #define TYPEDEF_BITMAP6(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
        extern inline void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
        inline unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            return sprintf(buffP, "0x%02X", *bitmapP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP8_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP8(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP8_T.
     */
    #define TYPEDEF_BITMAP8(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
        extern inline void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            return sprintf(buffP, "0x%02X", *bitmapP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP8_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP16(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP16_T.
     */
    #define TYPEDEF_BITMAP16(DATA_TYPE_NAME)            typedef MIH_C_BITMAP16_T DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
        extern inline void MIH_C_BITMAP16_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            return sprintf(buffP, "0x%04X", *bitmapP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP16_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP16_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP20(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP24_T.
     */
    #define TYPEDEF_BITMAP20(DATA_TYPE_NAME)            typedef MIH_C_BITMAP24_T DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
        extern inline void MIH_C_BITMAP24_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            return sprintf(buffP, "0x%02X%02X%02X", bitmapP->val[0], bitmapP->val[1], bitmapP->val[2]);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP24_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP24_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP32(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP32_T.
     */
    #define TYPEDEF_BITMAP32(DATA_TYPE_NAME)            typedef MIH_C_BITMAP32_T DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
        extern inline void MIH_C_BITMAP32_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            return sprintf(buffP, "0x%08X", *bitmapP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP32_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP32_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP64(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP64_T.
     */
    #define TYPEDEF_BITMAP64(DATA_TYPE_NAME)            typedef MIH_C_BITMAP64_T DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
        extern inline void MIH_C_BITMAP64_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
            unsigned int buffer_index = 0;\
            buffer_index = sprintf(buffP, "0x%08x", (MIH_C_UNSIGNED_INT4_T)(*bitmapP>>32));\
            buffer_index = sprintf(&buffP[buffer_index], "%08x", (MIH_C_UNSIGNED_INT4_T)(*bitmapP));\
            return buffer_index;\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
            MIH_C_BITMAP64_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP64_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP128(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP128_T.
     */
    #define TYPEDEF_BITMAP128(DATA_TYPE_NAME)           typedef MIH_C_BITMAP128_T DATA_TYPE_NAME  ## _T;\
        inline void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
        inline void MIH_C_BITMAP128_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_decode(bbP, bitmapP);};

    /*! \def TYPEDEF_BITMAP256(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP256_T.
     */
    #define TYPEDEF_BITMAP256(DATA_TYPE_NAME)           typedef MIH_C_BITMAP256_T DATA_TYPE_NAME  ## _T;\
        inline void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
        inline void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_encode(bbP, bitmapP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_decode(bbP, bitmapP);};

#else
    #define TYPEDEF_BITMAP6(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP8(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP16(DATA_TYPE_NAME)            typedef MIH_C_BITMAP16_T DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP20(DATA_TYPE_NAME)            typedef MIH_C_BITMAP24_T DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP32(DATA_TYPE_NAME)            typedef MIH_C_BITMAP32_T DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP64(DATA_TYPE_NAME)            typedef MIH_C_BITMAP64_T DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP128(DATA_TYPE_NAME)           typedef MIH_C_BITMAP128_T DATA_TYPE_NAME  ## _T;\
        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);

    #define TYPEDEF_BITMAP256(DATA_TYPE_NAME)           typedef MIH_C_BITMAP256_T DATA_TYPE_NAME  ## _T;\
        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
#endif

#define BITMAP6(VAR_NAME)                                   MIH_C_BITMAP8_T   VAR_NAME;
#define BITMAP8(VAR_NAME)                                   MIH_C_BITMAP8_T   VAR_NAME;
#define BITMAP16(VAR_NAME)                                  MIH_C_BITMAP16_T  VAR_NAME;
#define BITMAP20(VAR_NAME)                                  MIH_C_BITMAP24_T  VAR_NAME;
#define BITMAP24(VAR_NAME)                                  MIH_C_BITMAP24_T  VAR_NAME;
#define BITMAP32(VAR_NAME)                                  MIH_C_BITMAP32_T  VAR_NAME;
#define BITMAP64(VAR_NAME)                                  MIH_C_BITMAP64_T  VAR_NAME;
#define BITMAP128(VAR_NAME)                                 MIH_C_BITMAP128_T VAR_NAME;
#define BITMAP256(VAR_NAME)                                 MIH_C_BITMAP256_T VAR_NAME;

//----------------------- CHOICE(DATATYPE1, DATATYPE2[,...]) ------------------
/*! \var typedef u_int8_t                             MIH_C_CHOICE_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for u_int8_t.
 */
typedef u_int8_t                           MIH_C_CHOICE_T;

//----------------------- INTEGER(size) ---------------------------------------
/*! \var typedef int8_t                             MIH_C_INTEGER1_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for int8_t.
 */
typedef int8_t                             MIH_C_INTEGER1_T;
/*! \var typedef int16_t                             MIH_C_INTEGER2_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for int16_t.
 */
typedef int16_t                            MIH_C_INTEGER2_T;
/*! \var typedef int32_t                             MIH_C_INTEGER4_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for int32_t.
 */
typedef int32_t                            MIH_C_INTEGER4_T;
/*! \var typedef int64_t                             MIH_C_INTEGER8_T;
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A type definition for int64_t.
 */
typedef int64_t                            MIH_C_INTEGER8_T;

#ifdef MIH_C_F1_BASIC_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_INTEGER1(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER1_T.
     */
    #define TYPEDEF_INTEGER1(DATA_TYPE_NAME)            typedef MIH_C_INTEGER1_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_INTEGER1_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
        extern inline void MIH_C_INTEGER1_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%02X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER1_encode(bbP, (MIH_C_INTEGER1_T*)dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER1_decode(bbP, (MIH_C_INTEGER1_T*)dataP);\
        };

    /*! \def TYPEDEF_INTEGER2(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER2_T.
     */
    #define TYPEDEF_INTEGER2(DATA_TYPE_NAME)            typedef MIH_C_INTEGER2_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_INTEGER2_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
        extern inline void MIH_C_INTEGER2_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%04X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER2_encode(bbP, (MIH_C_INTEGER2_T*)dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER2_decode(bbP, (MIH_C_INTEGER2_T*)dataP);\
        };

    /*! \def TYPEDEF_INTEGER4(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER4_T.
     */
    #define TYPEDEF_INTEGER4(DATA_TYPE_NAME)            typedef MIH_C_INTEGER4_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_INTEGER4_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
        extern inline void MIH_C_INTEGER4_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%08X", (MIH_C_INTEGER4_T)*dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER4_encode(bbP, (MIH_C_INTEGER4_T*)dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER4_decode(bbP, (MIH_C_INTEGER4_T*)dataP);\
        };

    /*! \def TYPEDEF_INTEGER8(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER48T.
     */
    #define TYPEDEF_INTEGER8(DATA_TYPE_NAME)            typedef MIH_C_INTEGER8_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_INTEGER8_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
        extern inline void MIH_C_INTEGER8_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            unsigned int buffer_index = 0;\
            buffer_index = sprintf(buffP, "0x%08x", (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));\
            buffer_index = sprintf(&buffP[buffer_index], "%08x", (MIH_C_UNSIGNED_INT4_T)(*dataP));\
            return buffer_index;\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER8_encode(bbP, (MIH_C_INTEGER8_T*)dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_INTEGER8_decode(bbP, (MIH_C_INTEGER8_T*)dataP);\
        };
#else
    #define TYPEDEF_INTEGER1(DATA_TYPE_NAME)            typedef MIH_C_INTEGER1_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_INTEGER2(DATA_TYPE_NAME)            typedef MIH_C_INTEGER2_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_INTEGER4(DATA_TYPE_NAME)            typedef MIH_C_INTEGER4_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_INTEGER8(DATA_TYPE_NAME)            typedef MIH_C_INTEGER8_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif

/*! \def INTEGER1(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_INTEGER1_T.
 */
#define INTEGER1(VAR_NAME)                                  MIH_C_INTEGER1_T   VAR_NAME;
/*! \def INTEGER2(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_INTEGER2_T.
 */
#define INTEGER2(VAR_NAME)                                  MIH_C_INTEGER2_T   VAR_NAME;
/*! \def INTEGER4(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_INTEGER4_T.
 */
#define INTEGER4(VAR_NAME)                                  MIH_C_INTEGER4_T   VAR_NAME;
/*! \def INTEGER8(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_INTEGER8_T.
 */
#define INTEGER8(VAR_NAME)                                  MIH_C_INTEGER8_T   VAR_NAME;


//----------------------- UNSIGNED_INT(size) ----------------------------------
/*! \var typedef int8_t                     MIH_C_UNSIGNED_INT1_T;
 * \brief A type definition for int8_t.
 */
typedef u_int8_t                           MIH_C_UNSIGNED_INT1_T;
/*! \var u_int16_t                          MIH_C_UNSIGNED_INT2_T
 * \brief A type definition for u_int16_t.
 */
typedef u_int16_t                          MIH_C_UNSIGNED_INT2_T;
/*! \var typedef u_int32_t                  MIH_C_UNSIGNED_INT4_T;
 * \brief A type definition for u_int32_t.
 */
typedef u_int32_t                          MIH_C_UNSIGNED_INT4_T;
/*! \var u_int64_t                          MIH_C_UNSIGNED_INT8_T;
 * \brief A type definition for u_int64_t.
 */
typedef u_int64_t                          MIH_C_UNSIGNED_INT8_T;

#ifdef MIH_C_F1_BASIC_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT1_T.
     */
    #define TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT1_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
        extern inline void MIH_C_UNSIGNED_INT1_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%02X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT1_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT1_decode(bbP, dataP);\
        };

    /*! \def TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT2_T.
     */
    #define TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT2_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
        extern inline void MIH_C_UNSIGNED_INT2_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%04X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT2_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT2_decode(bbP, dataP);\
        };

    /*! \def TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT4_T.
     */
    #define TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT4_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
        extern inline void MIH_C_UNSIGNED_INT4_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%08X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT4_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT4_decode(bbP, dataP);\
        };

    /*! \def TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT8_T.
     */
    #define TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT8_T   DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
        extern inline void MIH_C_UNSIGNED_INT8_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
            return sprintf(buffP, "0x%16X", *dataP);\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT8_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_UNSIGNED_INT8_decode(bbP, dataP);\
        };
#else
    #define TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT1_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT2_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT4_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);

    #define TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT8_T   DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif

/*! \def UNSIGNED_INT1(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_UNSIGNED_INT1_T.
 */
#define UNSIGNED_INT1(VAR_NAME)                             MIH_C_UNSIGNED_INT1_T VAR_NAME;
/*! \def UNSIGNED_INT2(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_UNSIGNED_INT2_T.
 */
#define UNSIGNED_INT2(VAR_NAME)                             MIH_C_UNSIGNED_INT2_T VAR_NAME;
/*! \def UNSIGNED_INT4(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_UNSIGNED_INT4_T.
 */
#define UNSIGNED_INT4(VAR_NAME)                             MIH_C_UNSIGNED_INT4_T VAR_NAME;
/*! \def UNSIGNED_INT8(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_UNSIGNED_INT8_T.
 */
#define UNSIGNED_INT8(VAR_NAME)                             MIH_C_UNSIGNED_INT8_T VAR_NAME;

//----------------------- LIST(DATATYPE) --------------------------------------
void      MIH_C_LIST_LENGTH_encode(Bit_Buffer_t *bbP, u_int16_t lengthP);
void      MIH_C_LIST_LENGTH_decode(Bit_Buffer_t *bbP, u_int16_t *lengthP);
u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);

#ifdef MIH_C_F1_BASIC_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_LIST(DATA_TYPE_NAME, MAX_LENGTH)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a LIST of MAX_LENGTH elements of DATA_TYPE_NAME type, and its functions for de/serializing this type.
     */
#define TYPEDEF_LIST(DATA_TYPE_NAME, MAX_LENGTH)    typedef  struct DATA_TYPE_NAME ## _LIST { u_int16_t length; DATA_TYPE_NAME ## _T val[MAX_LENGTH];} DATA_TYPE_NAME ## _LIST_T;\
    extern void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *val);\
    extern void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *val);\
    extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *val, char* bufP);\
    unsigned int DATA_TYPE_NAME ## _LIST2String(DATA_TYPE_NAME ## _LIST_T *listP, char* bufP) {\
        int index = 0;\
        unsigned int buffer_index = 0;\
        while ((index <  listP->length) && (index < MAX_LENGTH)){\
            buffer_index += sprintf(&bufP[buffer_index], "%s (%d) = ", STR(DATA_TYPE_NAME) , index);\
            buffer_index += DATA_TYPE_NAME ## 2String(&listP->val[index], &bufP[buffer_index]);\
            buffer_index += sprintf(&bufP[buffer_index], " ");\
            index = index + 1;\
        }\
        return buffer_index;\
    };\
    inline void DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
        int index = 0;\
        MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
531
        if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_decode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
532
533
534
535
536
537
538
539
540
        } else {\
            while ((index <  listP->length) && (index < MAX_LENGTH)){\
                DATA_TYPE_NAME ## _decode(bbP, &listP->val[index++]);\
            }\
        }\
    };\
    inline void DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
        int index = 0;\
        if (listP->length > MAX_LENGTH) {\
541
            printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_encode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
        } else {\
            MIH_C_LIST_LENGTH_encode(bbP, listP->length);\
            while (index <  listP->length) {\
                DATA_TYPE_NAME ## _encode(bbP, &listP->val[index++]);\
            }\
        }\
    };

#else
#define TYPEDEF_LIST(DATA_TYPE_NAME, MAX_LENGTH)    typedef  struct DATA_TYPE_NAME ## _LIST { u_int16_t length; DATA_TYPE_NAME ## _T val[MAX_LENGTH];} DATA_TYPE_NAME ## _LIST_T;\
    extern unsigned int DATA_TYPE_NAME ## _LIST2String(DATA_TYPE_NAME ## _LIST_T *listP, char* bufP);\
    extern void         DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP);\
    extern void         DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP);
#endif
#define LIST(DATA_TYPE_NAME, VAR_NAME)              DATA_TYPE_NAME ## _LIST_T VAR_NAME ## _list;



//----------------------- NULL ------------------------------------------------
#define MIH_C_NULL_T     u_int8_t

//----------------------- OCTET(size) -----------------------------------------
#ifdef MIH_C_F1_BASIC_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_OCTET(DATA_TYPE_NAME, MAX_LENGTH)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a LIST of MAX_LENGTH octet elements, and its functions for de/serializing this type.
     */
#define TYPEDEF_OCTET(DATA_TYPE_NAME, LENGTH)       typedef struct DATA_TYPE_NAME {u_int8_t val[LENGTH];} DATA_TYPE_NAME  ## _T;\
    unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP) {\
        int index = 0;\
        unsigned int buffer_index = 0;\
        while ( index <  LENGTH ){\
            buffer_index += sprintf(&bufP[buffer_index], "%02X", dataP->val[index]);\
            index = index + 1;\
        }\
        return buffer_index;\
    };\
    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_readMem(bbP, &dataP->val[0], LENGTH);};\
    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_writeMem(bbP, &dataP->val[0], LENGTH);};
#else
#define TYPEDEF_OCTET(DATA_TYPE_NAME, LENGTH)       typedef struct DATA_TYPE_NAME {u_int8_t val[LENGTH];} DATA_TYPE_NAME  ## _T;\
    extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP);\
    extern void         DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
    extern void         DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif

//----------------------- SEQUENCE(DATATYPE1, DATATYPE2[,...]) : NO MACRO -----

//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.2 General data types
//-----------------------------------------------------------------------------

//----------------------- ENUMERATED ------------------------------------------
TYPEDEF_UNSIGNED_INT1(MIH_C_ENUMERATED)

#ifdef MIH_C_F2_GENERAL_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_ENUMERATED(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as MIH_C_ENUMERATED_T, and its functions for de/serializing this type.
     */
    #define TYPEDEF_ENUMERATED(DATA_TYPE_NAME)          typedef MIH_C_ENUMERATED_T  DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_ENUMERATED_encode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
        extern inline void MIH_C_ENUMERATED_decode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_ENUMERATED_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
#else
    #define TYPEDEF_ENUMERATED(DATA_TYPE_NAME)          typedef MIH_C_ENUMERATED_T  DATA_TYPE_NAME  ## _T;\
        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif

/*! \def ENUMERATED(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_ENUMERATED_T.
 */
#define ENUMERATED(VAR_NAME)                                MIH_C_ENUMERATED_T  VAR_NAME;


//----------------------- BOOLEAN ---------------------------------------------
TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)

#define MIH_C_BOOLEAN_TRUE       (MIH_C_ENUMERATED_T)1
#define MIH_C_BOOLEAN_FALSE      (MIH_C_ENUMERATED_T)0
#ifdef MIH_C_F2_GENERAL_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_BOOLEAN(DATA_TYPE_NAME)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as MIH_C_BOOLEAN_T, and its functions for de/serializing this type.
     */
    #define TYPEDEF_BOOLEAN(DATA_TYPE_NAME)          typedef MIH_C_BOOLEAN_T  DATA_TYPE_NAME  ## _T;\
        extern inline void MIH_C_BOOLEAN_encode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
        extern inline void MIH_C_BOOLEAN_decode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
        unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP) {\
            unsigned int buffer_index = 0;\
            if (*dataP != MIH_C_BOOLEAN_FALSE) {\
                buffer_index += sprintf(&bufP[buffer_index], "TRUE");\
            } else {\
                buffer_index += sprintf(&bufP[buffer_index], "FALSE");\
            }\
            return buffer_index;\
        };\
        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
            MIH_C_BOOLEAN_encode(bbP, dataP);};\
        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
#else
    #define TYPEDEF_BOOLEAN(DATA_TYPE_NAME)          typedef MIH_C_BOOLEAN_T  DATA_TYPE_NAME  ## _T;\
        extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP);\
        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif

/*! \def BOOLEAN(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief A variable declaration of type MIH_C_BOOLEAN_T.
 */
#define BOOLEAN(VAR_NAME)                     MIH_C_BOOLEAN_T  VAR_NAME;


//----------------------- OCTET_STRING ----------------------------------------
#ifdef MIH_C_F2_GENERAL_DATA_TYPES_CODEC_C
    /*! \def TYPEDEF_OCTET_STRING(DATA_TYPE_NAME, MAX_LENGTH)
     * \ingroup MIH_C_F1_BASIC_DATA_TYPES
     * \brief Defines DATA_TYPE_NAME as a LIST of MAX_LENGTH char elements, and its functions for de/serializing this type.
     */
#define TYPEDEF_OCTET_STRING(DATA_TYPE_NAME, MAX_LENGTH)    typedef  struct DATA_TYPE_NAME { u_int16_t length; u_int8_t val[MAX_LENGTH];} DATA_TYPE_NAME ## _T;\
    unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *listP, char* bufP) {\
        memcpy(bufP, listP->val, listP->length);\
        bufP[listP->length] = 0;\
        return listP->length;\
    };\
    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
        MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
674
        if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _decode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
675
676
677
678
679
680
        } else {\
            BitBuffer_readMem(bbP, listP->val, listP->length);\
        }\
    };\
    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
        if (listP->length > MAX_LENGTH) {\
681
            printf("[MIH_C] ERROR DATA_TYPE_NAME ## _encode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
682
683
684
685
686
687
688
        } else {\
            MIH_C_LIST_LENGTH_encode(bbP, listP->length);\
            BitBuffer_writeMem(bbP, listP->val, listP->length);\
        }\
    };\
    inline void DATA_TYPE_NAME ## _set(DATA_TYPE_NAME ## _T *octet_strP, u_int8_t* strP, u_int16_t lengthP) {\
        if (lengthP > MAX_LENGTH) {\
689
            printf("[MIH_C] ERROR DATA_TYPE_NAME ## _set String length out of bounds\n");\
690
691
692
            octet_strP->length = 0;\
        } else {\
            octet_strP->length = lengthP;\
693
694
695
696
697
            if (strP != NULL) {\
                memcpy((char *)octet_strP->val, (char *)strP, lengthP);\
            } else {\
                memset((char *)octet_strP->val, 0, lengthP);\
            }\
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
        }\
    };
#else
#define TYPEDEF_OCTET_STRING(DATA_TYPE_NAME, MAX_LENGTH)    typedef  struct DATA_TYPE_NAME { u_int16_t length; u_int8_t val[MAX_LENGTH];} DATA_TYPE_NAME ## _T;\
    extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *listP, char* bufP);\
    extern void         DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP);\
    extern void         DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP);\
    extern void         DATA_TYPE_NAME ## _set(DATA_TYPE_NAME ## _T *octet_strP, u_int8_t* strP, u_int16_t lengthP);
#endif


//----------------------- PERCENTAGE ------------------------------------------
TYPEDEF_UNSIGNED_INT1(MIH_C_PERCENTAGE);
/*! \var PERCENTAGE(VAR_NAME)
 * \ingroup MIH_C_F1_BASIC_DATA_TYPES
 * \brief Defines VAR_NAME as MIH_C_PERCENTAGE_T.
 */
#define PERCENTAGE(VAR_NAME)                 MIH_C_PERCENTAGE_T  VAR_NAME;

//----------------------- STATUS ----------------------------------------------
TYPEDEF_ENUMERATED(MIH_C_STATUS);
#define MIH_C_STATUS_SUCCESS                 (MIH_C_STATUS_T)0
#define MIH_C_STATUS_UNSPECIFIED_FAILURE     (MIH_C_STATUS_T)1
#define MIH_C_STATUS_REJECTED                (MIH_C_STATUS_T)2
#define MIH_C_STATUS_AUTHORIZATION_FAILURE   (MIH_C_STATUS_T)3
#define MIH_C_STATUS_NETWORK_ERROR           (MIH_C_STATUS_T)4

//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.3 Data types for addresses
//-----------------------------------------------------------------------------
/*! \var MIH_C_UNSIGNED_INT4_T MIH_C_CELL_ID_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief This data type identifies a cell uniquely within 3GPP UTRAN and
* consists of radio network controller (RNC)-ID and C-ID as defined in
* 3GPP TS 25.401.
* Valid Range: 0..268435455.
*/
TYPEDEF_UNSIGNED_INT4(MIH_C_CELL_ID)
//-------------------------------------------
/*!
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief The BSS and cell within the BSS are identified by Cell Identity (CI).
* See 3GPP TS 23.003.
*/
TYPEDEF_OCTET(MIH_C_CI, 2)
//-------------------------------------------
/*!
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief The public land mobile network (PLMN) unique identifier.
*        PLMN_ID consists of Mobile Country Code (MCC) and Mobile Network Code (MNC).
*        This is to represent the access network identifier.
*        Coding of PLMN_ID is defined in 3GPP TS 25.413.
*/
TYPEDEF_OCTET(MIH_C_PLMN_ID, 3)
//-------------------------------------------
/*!
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief Location Area Code (LAC) is a fixed length code (of 2 octets)
* identifying a location area within a public landmobile network (PLMN).
* See 3GPP TS 23.003.
*/
TYPEDEF_OCTET(MIH_C_LAC, 2)
//-------------------------------------------
/*! \struct MIH_C_3GPP_2G_CELL_ID
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent a 3GPP 2G cell identifier.
*/
typedef struct MIH_C_3GPP_2G_CELL_ID {
    MIH_C_PLMN_ID_T        plmn_id;
    MIH_C_LAC_T            lac;
    MIH_C_CI_T             ci;
} MIH_C_3GPP_2G_CELL_ID_T;

//-------------------------------------------
/*! \struct  MIH_C_3GPP_3G_CELL_ID
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent a 3GPP 3G cell identifier.
*/
typedef struct MIH_C_3GPP_3G_CELL_ID {
    MIH_C_PLMN_ID_T        plmn_id;
    MIH_C_CELL_ID_T        cell_id;
} MIH_C_3GPP_3G_CELL_ID_T;
//-------------------------------------------
/*! \struct  MIH_C_3GPP_ADDR
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent a 3GPP transport address.
*/
TYPEDEF_OCTET_STRING(MIH_C_3GPP_ADDR, MIH_C_3GPP_ADDR_LENGTH)
//-------------------------------------------
/*! \struct  MIH_C_3GPP2_ADDR
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent a 3GPP2 transport address.
*/
TYPEDEF_OCTET_STRING(MIH_C_3GPP2_ADDR, MIH_C_3GPP2_ADDR_LENGTH)
//-------------------------------------------
/*! \var MIH_C_IANA_ADDR_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief Is the address family type of a transport address.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_IANA_ADDR)
//-------------------------------------------
/*! \struct MIH_C_TRANSPORT_ADDR_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A type to represent a transport address. The
* UNSIGNED_INT(2) is the address type defined in
* http://www.iana.org/assignments/address-family-numbers.
*/
TYPEDEF_OCTET_STRING(MIH_C_TRANSPORT_ADDR_VALUE, 128)
//-------------------------------------------
#ifdef MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC_C
#define TYPEDEF_TRANSPORT_ADDR(DATA_TYPE_NAME)  typedef struct DATA_TYPE_NAME {\
                                                                MIH_C_IANA_ADDR_T              address_family;\
                                                                MIH_C_TRANSPORT_ADDR_VALUE_T   address;\
                                                            } DATA_TYPE_NAME ## _T;\
    unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP) {\
        unsigned int buffer_index = 0;\
        buffer_index += sprintf(&bufP[buffer_index], "IANA = ");\
        buffer_index += MIH_C_IANA_ADDR2String(&dataP->address_family, &bufP[buffer_index]);\
        buffer_index += sprintf(&bufP[buffer_index], "TRANSPORT_ADDR = ");\
        buffer_index += MIH_C_TRANSPORT_ADDR_VALUE2String(&dataP->address, &bufP[buffer_index]);\
        return buffer_index;\
    };\
    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
        MIH_C_IANA_ADDR_decode(bbP, &dataP->address_family);\
        MIH_C_TRANSPORT_ADDR_VALUE_decode(bbP, &dataP->address);\
    };\
    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
        MIH_C_IANA_ADDR_encode(bbP, &dataP->address_family);\
        MIH_C_TRANSPORT_ADDR_VALUE_encode(bbP, &dataP->address);\
    };
#else
#define TYPEDEF_TRANSPORT_ADDR(DATA_TYPE_NAME)  typedef struct DATA_TYPE_NAME {\
                                                                MIH_C_IANA_ADDR_T              address_family;\
                                                                MIH_C_TRANSPORT_ADDR_VALUE_T   address;\
                                                            } DATA_TYPE_NAME ## _T;\
    extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP);\
    extern void         DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
    extern void         DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
#endif
//-------------------------------------------
/*! \struct  MIH_C_IP_ADDR_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief Represents an IP address. The Address Type is either 1 (IPv4) or 2 (IPv6).
*/
//typedef MIH_C_TRANSPORT_ADDR_T   MIH_C_IP_ADDR_T;
TYPEDEF_TRANSPORT_ADDR(MIH_C_IP_ADDR)
//-------------------------------------------
/*! \struct  MIH_C_MAC_ADDR_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief Represents a MAC address. The Address Type contains the one used for a specific link layer.
*/
//typedef MIH_C_TRANSPORT_ADDR_T   MIH_C_MAC_ADDR_T;
TYPEDEF_TRANSPORT_ADDR(MIH_C_MAC_ADDR)
//-------------------------------------------
/*! \struct  MIH_C_OTHER_L2_ADDR_T
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent a link-layer address other than the address already defined.
* For example, SSID.
*/
TYPEDEF_OCTET_STRING(MIH_C_OTHER_L2_ADDR, MIH_C_OTHER_L2_ADDR_LENGTH)
//-------------------------------------------

typedef enum  {
                  MIH_C_CHOICE_MAC_ADDR = 0,
                  MIH_C_CHOICE_3GPP_3G_CELL_ID,
                  MIH_C_CHOICE_3GPP_2G_CELL_ID,
                  MIH_C_CHOICE_3GPP_ADDR,
                  MIH_C_CHOICE_3GPP2_ADDR,
                  MIH_C_CHOICE_OTHER_L2_ADDR
              } MIH_C_LINK_ADDR_CHOICE_ENUM_T;
//-------------------------------------------
/*! \struct MIH_C_LINK_ADDR
* \ingroup MIH_C_F3_DATA_TYPES_FOR_ADDRESS_CODEC
* \brief A data type to represent an address of any link layer.
*/
typedef struct MIH_C_LINK_ADDR {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_MAC_ADDR_T         mac_addr;
        MIH_C_3GPP_3G_CELL_ID_T  _3gpp_3g_cell_id;
        MIH_C_3GPP_2G_CELL_ID_T  _3gpp_2g_cell_id;
        MIH_C_3GPP_ADDR_T        _3gpp_addr;
        MIH_C_3GPP2_ADDR_T       _3gpp2_addr;
        MIH_C_OTHER_L2_ADDR_T    other_l2_addr;
    } _union;
} MIH_C_LINK_ADDR_T;




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.4 Data types for links (MAINLY because of precedence definition)
//-----------------------------------------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents percentage of battery charge remaining.

*/
TYPEDEF_INTEGER1(MIH_C_BATT_LEVEL)
//-------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Channel identifier as defined in the specific link technology (e.g., standards
*        development organization (SDO)).
*        Valid Range: 0..65535
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_CHANNEL_ID)
//-------------------------------------------
#define MIH_C_CONFIG_STATUS_SUCCESS MIH_C_BOOLEAN_TRUE
#define MIH_C_CONFIG_STATUS_ERROR   MIH_C_BOOLEAN_FALSE
/*! \var  MIH_C_CONFIG_STATUS_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The status of link parameter configuration.
*        TRUE: Success
*        FALSE: Error
*/
TYPEDEF_BOOLEAN(MIH_C_CONFIG_STATUS)
//-------------------------------------------
/*! \var  MIH_C_DEVICE_INFO_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A non-NULL terminated string whose length shall not exceed 253 octets, representing
*        information on manufacturer, model number, revision number of the software/firmware
*        and serial number in displayable text.
*/
TYPEDEF_OCTET_STRING(MIH_C_DEVICE_INFO, 253)
//-------------------------------------------
#define MIH_C_BIT_DEVICE_INFO   MIH_C_BIT_0_VALUE
#define MIH_C_BIT_BATT_LEVEL    MIH_C_BIT_1_VALUE
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A list of device status request.
*        Bitmap Values:
*        Bit 0: DEVICE_INFO
*        Bit 1: BATT_LEVEL
*        Bit 2–15: (Reserved)
*/
TYPEDEF_BITMAP16(MIH_C_DEV_STATES_REQ)
//-------------------------------------------
/*! \struct  MIH_C_DEV_STATE_RSP_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents a device status.
*/
typedef struct MIH_C_DEV_STATE_RSP {
    MIH_C_CHOICE_T          choice;
    union  {
        MIH_C_DEVICE_INFO_T      device_info;
        MIH_C_BATT_LEVEL_T       batt_level;
    } _union;
} MIH_C_DEV_STATE_RSP_T;
//-------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Time (in ms) to elapse before an action needs to be taken. A value of 0 indicates
*        that the action will be taken immediately. Time elapsed will be calculated from the
*        instance the command arrives until the time when the execution of the action is carried out.
*        Valid Range: 0..65535
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_LINK_AC_EX_TIME)
//-------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Link action result.
*        0: Success
*        1: Failure
*        2: Refused
*        3: Incapable
*/
TYPEDEF_ENUMERATED(MIH_C_LINK_AC_RESULT)
#define MIH_C_LINK_AC_RESULT_SUCCESS   (MIH_C_LINK_AC_RESULT_T)0
#define MIH_C_LINK_AC_RESULT_FAILURE   (MIH_C_LINK_AC_RESULT_T)1
#define MIH_C_LINK_AC_RESULT_REFUSED   (MIH_C_LINK_AC_RESULT_T)2
#define MIH_C_LINK_AC_RESULT_INCAPABLE (MIH_C_LINK_AC_RESULT_T)3
//-------------------------------------------
#define MIH_C_BIT_LINK_AC_ATTR_LINK_SCAN          MIH_C_BIT_0_VALUE
#define MIH_C_BIT_LINK_AC_ATTR_LINK_RES_RETAIN    MIH_C_BIT_1_VALUE
#define MIH_C_BIT_LINK_AC_ATTR_DATA_FWD_REQ       MIH_C_BIT_2_VALUE
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Link action attribute that can be executed along with a valid link action.
*        Detail description of each attribute is in Table F.6.
*        Bitmap Values:
*        Bit 0: LINK_SCAN
*        Bit 1: LINK_RES_RETAIN
*        Bit 2: DATA_FWD_REQ
*        Bit 3–7: (Reserved)
*/
TYPEDEF_BITMAP8(MIH_C_LINK_AC_ATTR)
//-------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief An action for a link. The meaning of each link action is defined in Table F.5.
*        0: NONE
*        1: LINK_DISCONNECT
*        2: LINK_LOW_POWER
*        3: LINK_POWER_DOWN
*        4: LINK_POWER_UP
*        5–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_AC_TYPE)
#define MIH_C_LINK_AC_TYPE_NONE                      (MIH_C_LINK_AC_TYPE_T)0
#define MIH_C_LINK_AC_TYPE_LINK_DISCONNECT           (MIH_C_LINK_AC_TYPE_T)1
#define MIH_C_LINK_AC_TYPE_LINK_LOW_POWER            (MIH_C_LINK_AC_TYPE_T)2
#define MIH_C_LINK_AC_TYPE_LINK_POWER_DOWN           (MIH_C_LINK_AC_TYPE_T)3
#define MIH_C_LINK_AC_TYPE_LINK_POWER_UP             (MIH_C_LINK_AC_TYPE_T)4
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
#define MIH_C_LINK_AC_TYPE_LINK_FLOW_ATTR            (MIH_C_LINK_AC_TYPE_T)5
#define MIH_C_LINK_AC_TYPE_LINK_ACTIVATE_RESOURCES   (MIH_C_LINK_AC_TYPE_T)6
#define MIH_C_LINK_AC_TYPE_LINK_DEACTIVATE_RESOURCES (MIH_C_LINK_AC_TYPE_T)7
#endif
//-------------------------------------------
/*!
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents the link type.a
*        Number assignments:
*        0: Reserved
*        1: Wireless - GSM
*        2: Wireless - GPRS
*        3: Wireless - EDGE
*        15: Ethernet
*        18: Wireless - Other
*        19: Wireless - IEEE 802.11
*        22: Wireless - CDMA2000
*        23: Wireless - UMTS
*        24: Wireless - cdma2000-HRPD
*        25: Wireless - LTE (MEDIEVAL)
*        27: Wireless - IEEE 802.16
*        28: Wireless - IEEE 802.20
*        29: Wireless - IEEE 802.22
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_TYPE)
#define MIH_C_WIRELESS_GSM            (MIH_C_LINK_TYPE_T)1
#define MIH_C_WIRELESS_GPRS           (MIH_C_LINK_TYPE_T)2
#define MIH_C_WIRELESS_EDGE           (MIH_C_LINK_TYPE_T)3
#define MIH_C_ETHERNET                (MIH_C_LINK_TYPE_T)15
#define MIH_C_WIRELESS_OTHER          (MIH_C_LINK_TYPE_T)18
#define MIH_C_WIRELESS_IEEE802_11     (MIH_C_LINK_TYPE_T)19
#define MIH_C_WIRELESS_CDMA_2000      (MIH_C_LINK_TYPE_T)22
//#define MIH_C_WIRELESS_UMTS           (MIH_C_LINK_TYPE_T)23
// Temp - MW modified to test LTE for MEDIEVAL
#define MIH_C_WIRELESS_UMTS           (MIH_C_LINK_TYPE_T)25
#define MIH_C_WIRELESS_CDMA_2000_HRPD (MIH_C_LINK_TYPE_T)24
#define MIH_C_WIRELESS_LTE            (MIH_C_LINK_TYPE_T)25
#define MIH_C_WIRELESS_IEEE802_16     (MIH_C_LINK_TYPE_T)27
#define MIH_C_WIRELESS_IEEE802_20     (MIH_C_LINK_TYPE_T)28
#define MIH_C_WIRELESS_IEEE802_22     (MIH_C_LINK_TYPE_T)29
//-------------------------------------------
/*! \struct  MIH_C_LINK_ID_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The identifier of a link that is not associated with the peer node.
*        The LINK_ADDR contains the address of this link.
*/
typedef struct MIH_C_LINK_ID {
    MIH_C_LINK_TYPE_T           link_type;
    MIH_C_LINK_ADDR_T           link_addr;
} MIH_C_LINK_ID_T;
//-------------------------------------------
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
/*! \var MIH_C_PORT_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief 2 octets defining the port used by the transport protocol
*/
TYPEDEF_OCTET(MIH_C_PORT, 2)
//-------------------------------------------
/*! \struct MIH_C_IP_TUPLE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief Tuple consisting on an IP address and the port
*/
typedef struct MIH_C_IP_TUPLE {
    MIH_C_IP_ADDR_T              ip_addr;
    MIH_C_PORT_T                 port;
} MIH_C_IP_TUPLE_T;
//-------------------------------------------
/*! \var MIH_C_PROTO_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief The transport protocol used:
*    0: TCP
*    1: UDP
*/
TYPEDEF_ENUMERATED(MIH_C_PROTO)
#define MIH_C_PROTO_TCP   (MIH_C_PROTO_T)0
#define MIH_C_PROTO_UDP   (MIH_C_PROTO_T)1
//-------------------------------------------
/*! \struct MIH_C_FLOW_ID_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief Five tuple, consisting on the source and destination address
* and ports plus the transport protocol used.
*/
/*typedef struct MIH_C_FLOW_ID {
    MIH_C_IP_TUPLE_T              source_addr;
    MIH_C_IP_TUPLE_T              dest_addr;
    MIH_C_PROTO_T                 transport_protocol;
} MIH_C_FLOW_ID_T;*/
TYPEDEF_UNSIGNED_INT4(MIH_C_FLOW_ID)
//-------------------------------------------
/*! \struct MIH_C_MARK_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief 6 Bits (IPv4) or 20 Bits (IPv6) mask to be applied to the DSCP
* or Flow Label field of IPv4/v6 header.
*/
typedef struct MIH_C_MARK {
    MIH_C_CHOICE_T          choice;
    union  {
        BITMAP6(dscp_mask);
        BITMAP20(flow_label_mask);
    } _union;
} MIH_C_MARK_T;
//-------------------------------------------
/*! \var MIH_C_MAX_DELAY_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief Maximum delay supported by the flow in ms.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_MAX_DELAY)
//-------------------------------------------
/*! \var MIH_C_BITRATE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief A type to represent the maximum data rate in kb/s.
*  Valid Range: 0 –– 2^32 – 1

*/
TYPEDEF_UNSIGNED_INT4(MIH_C_BITRATE)
//-------------------------------------------
/*! \var MIH_C_JITTER_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief A type to represent the packet transfer delay jitter in ms.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_JITTER)
//-------------------------------------------
/*! \var MIH_C_PKT_LOSS_RATE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief A type to represent the packet loss rate. The loss rate is equal
* to the integer part of the result of multiplying --100 times the
* log10 of the ratio between the number of packets lost and the
* total number of packets transmitted.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_PKT_LOSS_RATE)
//-------------------------------------------
/*! \var MIH_C_COS_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief COS Class to be used for queuing.
*  To be filled for LTE and WLAN
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_COS)
//-------------------------------------------
/*! \var MIH_C_DROP_ELIGIBILITY_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief 0 means the frames are not eligible to discarding.
* 1 means frames are eligible for discarding.
*/
TYPEDEF_BOOLEAN(MIH_C_DROP_ELIGIBILITY)
//-------------------------------------------
/*! \var MIH_C_MULTICAST_ENABLE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief Identifies if a flow is multicast.
*  0: is not multicast
*  1: is multicast
*/
TYPEDEF_BOOLEAN(MIH_C_MULTICAST_ENABLE)
//-------------------------------------------
/*! \var MIH_C_JUMBO_ENABLE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief Identifies if JUMBO must be activated
*  0: Deactivate Jumbo
*  1: Activate Jumbo
*/
TYPEDEF_BOOLEAN(MIH_C_JUMBO_ENABLE)
#endif
//-------------------------------------------
/*! \var MIH_C_LINK_DATA_RATE_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent the maximum data rate in kb/s.
*        Valid Range: 0 – 232–1
*/
TYPEDEF_UNSIGNED_INT4(MIH_C_LINK_DATA_RATE)
//-------------------------------------------
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
/*! \struct MIH_C_QOS_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief The choice of delay and bitrate corresponds to a new flow being
*  signalled through the MIH_SAP, the COS parameter is used after being processed by the WP3 AQM.
*/
typedef struct MIH_C_QOS {
    MIH_C_CHOICE_T          choice;
    union  {
        struct {
            MIH_C_MAX_DELAY_T      max_delay;
            MIH_C_BITRATE_T        bitrate;
            MIH_C_JITTER_T         jitter;
            MIH_C_PKT_LOSS_RATE_T  pkt_loss;
        }                          mark_qos;
        MIH_C_COS_T                cos;
    } _union;
} MIH_C_QOS_T;
//-------------------------------------------
/*! \struct MIH_C_RESOURCE_DESC_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief The choice of RESOURCE_DESC is used when the LINK_ACTIVATE_RESOURCES
* or DEACTIVATE action is selected in order to identify and
* configure the flow subject to action
*/
typedef struct MIH_C_RESOURCE_DESC {
    MIH_C_LINK_ID_T         link_id;
    MIH_C_FLOW_ID_T         flow_id;
    MIH_C_CHOICE_T          choice_link_data_rate;
    union  {
1202
        MIH_C_NULL_T             null_attr;
1203
1204
1205
1206
        MIH_C_LINK_DATA_RATE_T   link_data_rate;
    } _union_link_data_rate;
    MIH_C_CHOICE_T          choice_qos;
    union  {
1207
        MIH_C_NULL_T             null_attr;
1208
1209
1210
1211
        MIH_C_QOS_T          qos;
    } _union_qos;
    MIH_C_CHOICE_T          choice_jumbo_enable;
    union  {
1212
        MIH_C_NULL_T             null_attr;
1213
1214
1215
1216
        MIH_C_JUMBO_ENABLE_T     jumbo_enable;
    } _union_jumbo_enable;
    MIH_C_CHOICE_T          choice_multicast_enable;
    union  {
1217
        MIH_C_NULL_T             null_attr;
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
        MIH_C_MULTICAST_ENABLE_T multicast_enable;
    } _union_multicast_enable;
} MIH_C_RESOURCE_DESC_T;
//-------------------------------------------
/*! \struct MIH_C_FLOW_ATTRIBUTE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief The choice of FLOW_ATTRIBUTE is used when the FLOW_ATTR action is
* selected in order to provide the mark and multicast configuration
* to be set up for the flow.
*/
typedef struct MIH_C_FLOW_ATTRIBUTE {
    MIH_C_FLOW_ID_T         flow_id;
    MIH_C_CHOICE_T          choice_multicast_enable;
    union  {
1232
        MIH_C_NULL_T             null_attr;
1233
1234
1235
1236
        MIH_C_MULTICAST_ENABLE_T multicast_enable;
    } _union_multicast_enable;
    MIH_C_CHOICE_T          choice_mark_qos;
    union  {
1237
        MIH_C_NULL_T             null_attr;
1238
1239
1240
1241
1242
1243
1244
        struct {
            MIH_C_MARK_T         mark;
            MIH_C_QOS_T          qos;
        }                        mark_qos;
    } _union_mark_qos;
    MIH_C_CHOICE_T                      choice_mark_drop_eligibility;
    union  {
1245
        MIH_C_NULL_T                    null_attr;
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
        struct {
            MIH_C_MARK_T                mark;
            MIH_C_DROP_ELIGIBILITY_T    drop_eligibility;
        }                               mark_drop_eligibility;
    } _union_mark_drop_eligibility;

} MIH_C_FLOW_ATTRIBUTE_T;
//-------------------------------------------
/*! \struct MIH_C_LINK_AC_PARAM_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief The choice of FLOW_ATTRIBUTE is used when the FLOW_ATTR action is selected
*  in order to provide the mark and multicast configuration to be set up for the flow.
*  The choice of RESOURCE_DESC is used when LINK_ACTIVATE_RESOURCES or
*  LINK_DEACTIVATE_RESOURCES actions are used.
*/
typedef struct MIH_C_LINK_AC_PARAM {
    MIH_C_CHOICE_T          choice;
    union  {
1264
        MIH_C_NULL_T             null_attr;
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
        MIH_C_FLOW_ATTRIBUTE_T   flow_attribute;
        MIH_C_RESOURCE_DESC_T    resource_desc;
    } _union;
} MIH_C_LINK_AC_PARAM_T;
#endif
//-------------------------------------------
/*! \struct  MIH_C_LINK_ACTION_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Link action.
*/
typedef struct MIH_C_LINK_ACTION {
    MIH_C_LINK_AC_TYPE_T           link_ac_type;
    MIH_C_LINK_AC_ATTR_T           link_ac_attr;
#ifdef MIH_C_MEDIEVAL_EXTENSIONS
    MIH_C_LINK_AC_PARAM_T          link_ac_param; /*!<  \brief extension of MEDIEVAL PROJECT  */
#endif
} MIH_C_LINK_ACTION_T;
//-------------------------------------------
/*! \struct MIH_C_LINK_ACTION_REQ_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A set of handover action request parameters. The choice of LINK_ADDR is to
*        provide PoA address information when the LINK_ACTION contains the attribute for  DATA_FWD_REQ.
*/
typedef struct MIH_C_LINK_ACTION_REQ {
    MIH_C_LINK_ID_T              link_id;
    MIH_C_CHOICE_T               choice;
    union  {
1292
        MIH_C_NULL_T             null_attr;
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
        MIH_C_LINK_ADDR_T        link_addr;
    } _union;

    MIH_C_LINK_ACTION_T          link_action;
    MIH_C_LINK_AC_EX_TIME_T      link_action_ex_time;
} MIH_C_LINK_ACTION_REQ_T;
//-------------------------------------------
/*! \struct  MIH_C_SIG_STRENGTH_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents the signal strength in dBm unit or its relative value in an arbitrary percentage scale.
*/
typedef struct MIH_C_SIG_STRENGTH {
    MIH_C_CHOICE_T               choice;
    union  {
        INTEGER1(dbm)
        PERCENTAGE(percentage)
    } _union;
} MIH_C_SIG_STRENGTH_T;
#define MIH_C_SIG_STRENGTH_CHOICE_DBM        (MIH_C_CHOICE_T)0
#define MIH_C_SIG_STRENGTH_CHOICE_PERCENTAGE (MIH_C_CHOICE_T)1
//-------------------------------------------
/*! \var  MIH_C_NETWORK_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent a network identifier.
*        A non-NULL terminated string whose length shall not exceed 253 octets.
*/
TYPEDEF_OCTET_STRING(MIH_C_NETWORK_ID, 253)
//-------------------------------------------
/*! \struct  MIH_C_LINK_SCAN_RSP_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents a scan response. The LINK_ADDR contains the PoA link address.
*        The PoA belongs to the NETWORK_ID with the given SIG_STRENGTH.
*/
typedef struct MIH_C_LINK_SCAN_RSP {
    MIH_C_LINK_ADDR_T            link_addr;
    MIH_C_NETWORK_ID_T           network_id;
    MIH_C_SIG_STRENGTH_T         sig_strength;
} MIH_C_LINK_SCAN_RSP_T;
//-------------------------------------------
/*! \var MIH_C_LINK_SCAN_RSP_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_SCAN_RSP, MIH_C_LINK_SCAN_RSP_LENGTH)
//-------------------------------------------
/*! \struct  MIH_C_LINK_ACTION_RSP_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A set of link action returned results.
*/
typedef struct MIH_C_LINK_ACTION_RSP {
    MIH_C_LINK_ID_T              link_id;
    MIH_C_LINK_AC_RESULT_T       link_ac_result;
    MIH_C_CHOICE_T               choice;
    union  {
1346
        MIH_C_NULL_T             null_attr;
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
        LIST(MIH_C_LINK_SCAN_RSP, link_scan_rsp)
    } _union;
} MIH_C_LINK_ACTION_RSP_T;
//-------------------------------------------
#define MIH_C_BIT_LINK_EVENT_SUBSCRIBE      MIH_C_BIT_1_VALUE
#define MIH_C_BIT_LINK_EVENT_UNSUBSCRIBE    MIH_C_BIT_2_VALUE
#define MIH_C_BIT_LINK_GET_PARAMETERS       MIH_C_BIT_3_VALUE
#define MIH_C_BIT_LINK_CONFIGURE_THRESHOLDS MIH_C_BIT_4_VALUE
#define MIH_C_BIT_LINK_ACTION               MIH_C_BIT_5_VALUE
/*! \var MIH_C_LINK_CMD_LIST_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A list of link commands.
*        Bitmap Values:
*        Bit 0: Reserved
*        Bit 1: Link_Event_Subscribe
*        Bit 2: Link_Event_Unsubscribe
*        Bit 3: Link_Get_Parameters
*        Bit 4: Link_Configure_Thresholds
*        Bit 5: Link_Action
*        Bit 6-31: (Reserved)
*/
TYPEDEF_BITMAP32(MIH_C_LINK_CMD_LIST)
//-------------------------------------------
/*! \var MIH_C_TH_ACTION_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief
*        0: Set normal threshold
*        1: Set one-shot threshold
*        2: Cancel threshold
*/
TYPEDEF_ENUMERATED(MIH_C_TH_ACTION)
#define MIH_C_SET_NORMAL_THRESHOLD      (MIH_C_TH_ACTION_T)0
#define MIH_C_SET_ONE_SHOT_THRESHOLD    (MIH_C_TH_ACTION_T)1
#define MIH_C_CANCEL_THRESHOLD          (MIH_C_TH_ACTION_T)2
//-------------------------------------------
/*! \var MIH_C_THRESHOLD_VAL_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Threshold value. The format of the media-dependent value is defined in the
*        respective media specification standard and the equivalent number of bits (i.e.,
*        first bits) of this data type is used. In case that there are remaining unused bits
*        in the data type, these are marked as all-zeros (‘0’).
*        Valid Range: 0..65535
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_THRESHOLD_VAL)

//-------------------------------------------
/*! \var MIH_C_THRESHOLD_XDIR_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The direction the threshold is to be crossed.
*        0: ABOVE_THRESHOLD
*        1: BELOW_THRESHOLD
*        2–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_THRESHOLD_XDIR)
#define MIH_C_ABOVE_THRESHOLD           (MIH_C_THRESHOLD_XDIR_T)0
#define MIH_C_BELOW_THRESHOLD           (MIH_C_THRESHOLD_XDIR_T)1
//-------------------------------------------
/*! \struct  MIH_C_THRESHOLD_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A link threshold. The threshold is considered crossed when the value of the
*        link parameter passes the threshold in the specified direction.
*/
typedef struct MIH_C_THRESHOLD {
    MIH_C_THRESHOLD_VAL_T        threshold_val;
    MIH_C_THRESHOLD_XDIR_T       threshold_xdir;
} MIH_C_THRESHOLD_T;
//-------------------------------------------
/*! \var MIH_C_TIMER_INTERVAL_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief This timer value (ms) is used to set the interval between periodic reports.
*        Valid Range: 0..65535
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_TIMER_INTERVAL)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_GEN_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a generic link parameter that is applicable to any link type.
*        0: Data Rate—the parameter value is represented as a DATA_RATE.
*        1: Signal Strength—the parameter value is represented as a SIG_STRENGTH.
*        2: Signal over interference plus noise ratio (SINR)—the parameter value is
*           represented as an UNSIGNED_INT(2).
*        3:Throughput (the number of bits successfully received divided by the time it
*          took to transmit them over the medium)—the parameter value is represented as
*          an UNSIGNED_INT(2).
*        4: Packet Error Rate (representing the ratio between the number of frames received
*           in error and the total number of frames transmitted in a link population of interest)
*           the parameter value is represented as a PERCENTAGE.
*        5–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_GEN)
#define MIH_C_LINK_PARAM_GEN_DATA_RATE         (MIH_C_LINK_PARAM_GEN_T)0
#define MIH_C_LINK_PARAM_GEN_SIGNAL_STRENGTH   (MIH_C_LINK_PARAM_GEN_T)1
#define MIH_C_LINK_PARAM_GEN_SINR              (MIH_C_LINK_PARAM_GEN_T)2
#define MIH_C_LINK_PARAM_GEN_THROUGHPUT        (MIH_C_LINK_PARAM_GEN_T)3
#define MIH_C_LINK_PARAM_GEN_PACKET_ERROR_RATE (MIH_C_LINK_PARAM_GEN_T)4
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_QOS_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent QOS_LIST parameters.
*        0: Maximum number of differentiable classes of service supported.
*        1: Minimum packet transfer delay for all CoS, the minimum delay over a class
*           population of interest.
*        2: Average packet transfer delay for all CoS, the arithmetic mean of the delay
*           over a class population of interest. (See B.3.4)
*        3: Maximum packet transfer delay for all CoS, the maximum delay over a class
*           population of interest.
*        4: Packet transfer delay jitter for all CoS, the standard deviation of the delay
*           over a class population of interest. (See B.3.5.)
*        5: Packet loss rate for all CoS, the ratio between the number of frames that are
*           transmitted but not received and the total number of frames transmitted over
*           a class population of interest. (See B.3.2.)
*        6–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_QOS)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_GG_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for GSM and GPRS. See 3GPP TS 25.008.
*        0: RxQual
*        1: RsLev
*        2: Mean BEP
*        3: StDev BEP
*        4-255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_GG)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_EDGE_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for EDGE.
*        0-255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_EDGE)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_ETH_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for Ethernet.
*        0-255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_ETH)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_802_11_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for IEEE 802.11.
*        0: RSSI of the beacon channel, as defined in IEEE Std 802.11-2007.
*           (This is applicable only for an MN.)
*        1: No QoS resource available. The corresponding LINK_PARAM_VAL is BOOLEAN set to TRUE when
*           no QoS resources available. (This applicable when the traffic stream to be transmitted
*           is on an access category configured for mandatory admission control and the request for
*           bandwidth was denied by the available APs in the access network).
*        2: Multicast packet loss rate.
*        3–255: (Reserved)
*        Medieval extensions:
*           3: System Load. Percentage of usage load present at the system.
*           4:Number registered users.
*           5:Number active users.
*           6:Congestion window of users. Ordered list of the CW used by the clients, ordered according to
*             highest value of MAC address.
*           7:Transmission rate of users. Ordered list of the transmission rate used by the clients, ordered
*             according to highest value of MAC address.
*           8-255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_802_11)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_C2K_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for CDMA2000.
*        0: PILOT_STRENGTH
*        1–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_C2K)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_FDD_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for UMTS. See 3GPP TS 25.215.
*        0: CPICH RSCP
*        1: PCCPCH RSCP
*        2: UTRA carrier RSSI
*        3: GSM carrier RSSI
*        4: CPICH Ec/No
*        5: Transport channel BLER
*        6: user equipment (UE) transmitted power
*        7–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_FDD)
#define MIH_C_LINK_PARAM_FDD_CPICH_RSCP              (MIH_C_LINK_PARAM_FDD_T)0
#define MIH_C_LINK_PARAM_FDD_PCCPCH_RSCP             (MIH_C_LINK_PARAM_FDD_T)1
#define MIH_C_LINK_PARAM_FDD_UTRA_CARRIER_RSSI       (MIH_C_LINK_PARAM_FDD_T)2
#define MIH_C_LINK_PARAM_FDD_GSM_CARRIER_RSSI        (MIH_C_LINK_PARAM_FDD_T)3
#define MIH_C_LINK_PARAM_FDD_CPICH_EC_NO             (MIH_C_LINK_PARAM_FDD_T)4
#define MIH_C_LINK_PARAM_FDD_TRANSPORT_CHANNEL_BLER  (MIH_C_LINK_PARAM_FDD_T)5
#define MIH_C_LINK_PARAM_FDD_UE_TRANMITTED_POWER     (MIH_C_LINK_PARAM_FDD_T)6
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_HRPD_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for CDMA2000 HRPD.
*        0: PILOT_STRENGTH
*        1–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_HRPD)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_802_16_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for IEEE 802.16.
*        0–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_802_16)
//-------------------------------------------
/*! \var MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for IEEE 802.20.
*        0–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_802_20)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_802_22_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A type to represent a link parameter for IEEE 802.22.
*        0–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_802_22)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_LTE_T
* \ingroup MIH_C_MEDIEVAL_EXTENSIONS
* \brief A type to represent a link parameter for LTE.
*
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_PARAM_LTE)
#define MIH_C_LINK_PARAM_LTE_UE_RSRP                              0
#define MIH_C_LINK_PARAM_LTE_UE_RSRQ                              1
#define MIH_C_LINK_PARAM_LTE_UE_CQI                               2
#define MIH_C_LINK_PARAM_LTE_AVAILABLE_BW                         3
#define MIH_C_LINK_PARAM_LTE_PACKET_DELAY                         4
#define MIH_C_LINK_PARAM_LTE_PACKET_LOSS_RATE                     5
#define MIH_C_LINK_PARAM_LTE_L2_BUFFER_STATUS                     6
#define MIH_C_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES             7
#define MIH_C_LINK_PARAM_LTE_EMBMS_CAPABILITY                     8
#define MIH_C_LINK_PARAM_LTE_JUMBO_FEASIBILITY                    9
#define MIH_C_LINK_PARAM_LTE_JUMBO_SETUP_STATUS                   10
#define MIH_C_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW  11

//-------------------------------------------
/*! \struct  MIH_C_LINK_PARAM_TYPE_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Measurable link parameter for which thresholds are being set.
*/
#define MIH_C_LINK_PARAM_TYPE_CHOICE_GEN    (MIH_C_CHOICE_T)0
#define MIH_C_LINK_PARAM_TYPE_CHOICE_QOS    (MIH_C_CHOICE_T)1
#define MIH_C_LINK_PARAM_TYPE_CHOICE_GG     (MIH_C_CHOICE_T)2
#define MIH_C_LINK_PARAM_TYPE_CHOICE_EDGE   (MIH_C_CHOICE_T)3
#define MIH_C_LINK_PARAM_TYPE_CHOICE_ETH    (MIH_C_CHOICE_T)4
#define MIH_C_LINK_PARAM_TYPE_CHOICE_802_11 (MIH_C_CHOICE_T)5
#define MIH_C_LINK_PARAM_TYPE_CHOICE_C2K    (MIH_C_CHOICE_T)6
#define MIH_C_LINK_PARAM_TYPE_CHOICE_FDD    (MIH_C_CHOICE_T)7
#define MIH_C_LINK_PARAM_TYPE_CHOICE_HRPD   (MIH_C_CHOICE_T)8
#define MIH_C_LINK_PARAM_TYPE_CHOICE_802_16 (MIH_C_CHOICE_T)9
#define MIH_C_LINK_PARAM_TYPE_CHOICE_802_20 (MIH_C_CHOICE_T)10
#define MIH_C_LINK_PARAM_TYPE_CHOICE_802_22 (MIH_C_CHOICE_T)11
#define MIH_C_LINK_PARAM_TYPE_CHOICE_LTE    (MIH_C_CHOICE_T)12

typedef struct MIH_C_LINK_PARAM_TYPE {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_LINK_PARAM_GEN_T      link_param_gen;
        MIH_C_LINK_PARAM_QOS_T      link_param_qos;
        MIH_C_LINK_PARAM_GG_T       link_param_gg;
        MIH_C_LINK_PARAM_EDGE_T     link_param_edge;
        MIH_C_LINK_PARAM_ETH_T      link_param_eth;
        MIH_C_LINK_PARAM_802_11_T   link_param_802_11;
        MIH_C_LINK_PARAM_C2K_T      link_param_c2k;
        MIH_C_LINK_PARAM_FDD_T      link_param_fdd;
        MIH_C_LINK_PARAM_HRPD_T     link_param_hrpd;
        MIH_C_LINK_PARAM_802_16_T   link_param_802_16;
        MIH_C_LINK_PARAM_802_20_T   link_param_802_20;
        MIH_C_LINK_PARAM_802_22_T   link_param_802_22;
        MIH_C_LINK_PARAM_LTE_T      link_param_lte;
    } _union;
} MIH_C_LINK_PARAM_TYPE_T;
//-------------------------------------------
/*! \var MIH_C_THRESHOLD_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_THRESHOLD, MIH_C_THRESHOLD_LIST_LENGTH)
/*! \struct  MIH_C_LINK_CFG_PARAM_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A link configuration parameter.
*        TH_ACTION indicates what action to apply to the listed thresholds.
*        When “Cancel threshold” is selected and no thresholds are specified, then all
*        currently configured thresholds for the given LINK_PARAM_TYPE are cancelled.
*        When “Cancel threshold” is selected and thresholds are specified only those
*        configured thresholds for the given LINK_PARAM_TYPE and whose threshold value
*        match what was specified are cancelled.
*        With “Set one-shot threshold” the listed thresholds are first set and then each of
*        the threshold is cancelled as soon as it is crossed for the first time.
*/
typedef struct MIH_C_LINK_CFG_PARAM {
    MIH_C_LINK_PARAM_TYPE_T      link_param_type;
    MIH_C_CHOICE_T               choice;
    union  {
1645
        MIH_C_NULL_T             null_attr;
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
        MIH_C_TIMER_INTERVAL_T   timer_interval;
        LIST(MIH_C_LINK_SCAN_RSP, link_scan_rsp)
    } _union;
    MIH_C_TH_ACTION_T             th_action;
    LIST(MIH_C_THRESHOLD, threshold)
} MIH_C_LINK_CFG_PARAM_T;
//-------------------------------------------
/*! \struct  MIH_C_LINK_CFG_STATUS_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The status of link parameter configuration for each threshold specified in the THRESHOLD.
*/
typedef struct MIH_C_LINK_CFG_STATUS {
    MIH_C_LINK_PARAM_TYPE_T      link_param_type;
    MIH_C_THRESHOLD_T            threshold;
    MIH_C_CONFIG_STATUS_T        config_status;
} MIH_C_LINK_CFG_STATUS_T;
//-------------------------------------------
#define MIH_C_BIT_NUMBER_OF_CLASSES_OF_SERVICE_SUPPORTED    MIH_C_BIT_0_VALUE
#define MIH_C_BIT_NUMBER_OF_QUEUES_SUPPORTED                MIH_C_BIT_1_VALUE
/*! \var MIH_C_LINK_DESC_REQ_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A set of link descriptors.
*        Bitmap Values:
*        Bit 0: Number of Classes of Service Supported
*        Bit 1: Number of Queues Supported
*        Bits 2–15: (Reserved)
*/
TYPEDEF_BITMAP16(MIH_C_LINK_DESC_REQ)
//-------------------------------------------
/*! \var MIH_C_NUM_COS_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The maximum number of differentiable classes of service supported.
*        Valid Range: 0..255
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_NUM_COS)
//-------------------------------------------
/*! \var MIH_C_NUM_QUEUE_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The number of transmit queues supported.
*        Valid Range: 0..255
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_NUM_QUEUE)
//-------------------------------------------
/*! \struct  MIH_C_LINK_DESC_RSP_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Descriptors of a link.
*/
typedef struct MIH_C_LINK_DESC_RSP {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_NUM_COS_T          num_cos;
        MIH_C_NUM_QUEUE_T        num_queue;
    } _union;
} MIH_C_LINK_DESC_RSP_T;
//-------------------------------------------
/*! \var MIH_C_LINK_DN_REASON_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents the reason of a link down event.
*        See Table F.7 for the enumeration values.
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_DN_REASON)
//-------------------------------------------
#define MIH_C_BIT_LINK_DETECTED            MIH_C_BIT_0_VALUE
#define MIH_C_BIT_LINK_UP                  MIH_C_BIT_1_VALUE
#define MIH_C_BIT_LINK_DOWN                MIH_C_BIT_2_VALUE
#define MIH_C_BIT_LINK_PARAMETERS_REPORT   MIH_C_BIT_3_VALUE
#define MIH_C_BIT_LINK_GOING_DOWN          MIH_C_BIT_4_VALUE
#define MIH_C_BIT_LINK_HANDOVER_IMMINENT   MIH_C_BIT_5_VALUE
#define MIH_C_BIT_LINK_HANDOVER_COMPLETE   MIH_C_BIT_6_VALUE
#define MIH_C_BIT_LINK_PDU_TRANSMIT_STATUS MIH_C_BIT_7_VALUE
/*! \var MIH_C_LINK_EVENT_LIST_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A list of link events. The specified event is selected if the corresponding bit is set to 1.
*        Bitmap values:
*        Bit 0: Link_Detected
*        Bit 1: Link_Up
*        Bit 2: Link_Down
*        Bit 3: Link_Parameters_Report
*        Bit 4: Link_Going_Down
*        Bit 5: Link_Handover_Imminent
*        Bit 6: Link_Handover_Complete
*        Bit 7: Link_PDU_Transmit_Status
*        Bit 8–31: (Reserved)
*/
TYPEDEF_BITMAP32(MIH_C_LINK_EVENT_LIST)
//-------------------------------------------
/*! \var MIH_C_LINK_GD_REASON_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents the reason of a link going down. See Table F.8 for the enumeration values.
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_LINK_GD_REASON)
//-------------------------------------------
#define MIH_C_BIT_EVENT_SERVICE_SUPPORTED        MIH_C_BIT_1_VALUE
#define MIH_C_BIT_COMMAND_SERVICE_SUPPORTED      MIH_C_BIT_2_VALUE
#define MIH_C_BIT_INFORMATION_SERVICE_SUPPORTED  MIH_C_BIT_3_VALUE
/*! \var MIH_C_LINK_MIHCAP_FLAG_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents if MIH capability is supported or not. If the bit is set, it indicates
*        that the capability is supported.
*        Bitmap values:
*        Bit 1: event service (ES) supported
*        Bit 2: command service (CS) supported
*        Bit 3: information service (IS) supported
*        Bit 0, 4–7: (Reserved)
*/
TYPEDEF_BITMAP8(MIH_C_LINK_MIHCAP_FLAG)
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_VAL_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The current value of the parameter. The format of the media-dependent value is defined in
*        the respective media specification standard and the equivalent number of bits (i.e., first
*        bits) of this data type is used. In case that there are remaining unused bits in the data
*        type, these are marked as all-zeros (‘0’).
*        Valid Range: 0..65535
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_LINK_PARAM_VAL)





//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.9 Data types for QOS (MAINLY because of precedence definition)
//-----------------------------------------------------------------------------
//-------------------------------------------
/*! \var MIH_C_COS_ID_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief Defines MIH_C_COS_ID_T as a MIH_C_UNSIGNED_INT1_T.
*        Valid Range: 0–255
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_COS_ID)
//-------------------------------------------
/*! \struct  MIH_C_MIN_PK_TX_DELAY_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A type to represent the minimum packet transfer delay in ms for the specific CoS specified by the COS_ID.
*/
typedef struct MIH_C_MIN_PK_TX_DELAY {
    MIH_C_COS_ID_T               cos_id;
    UNSIGNED_INT2(value)
} MIH_C_MIN_PK_TX_DELAY_T;
//-------------------------------------------
/*! \struct  MIH_C_AVG_PK_TX_DELAY_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A type to represent the average packet transfer delay in ms for the specific CoS specified by the COS_ID.
*/
typedef struct MIH_C_AVG_PK_TX_DELAY {
    MIH_C_COS_ID_T               cos_id;
    UNSIGNED_INT2(value)
} MIH_C_AVG_PK_TX_DELAY_T;
//-------------------------------------------
/*! \struct  MIH_C_MAX_PK_TX_DELAY_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A type to represent the maximum packet transfer delay in ms for the specific CoS specified by the COS_ID.
*/
typedef struct MIH_C_MAX_PK_TX_DELAY {
    MIH_C_COS_ID_T               cos_id;
    UNSIGNED_INT2(value)
} MIH_C_MAX_PK_TX_DELAY_T;
//-------------------------------------------
/*! \struct  MIH_C_PK_DELAY_JITTER_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A type to represent the packet transfer delay jitter in ms for the specific CoS specified by the COS_ID.
*/
typedef struct MIH_C_PK_DELAY_JITTER {
    MIH_C_COS_ID_T               cos_id;
    UNSIGNED_INT2(value)
} MIH_C_PK_DELAY_JITTER_T;
//-------------------------------------------
/*! \struct  MIH_C_PK_LOSS_RATE_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A type to represent the packet loss rate for the specific CoS specified by the COS_ID. The loss rate is
*        equal to the integer part of the result of multiplying –100 times the log10 of the ratio between the num-
*        ber of packets lost and the total number of packets transmitted in the class population of interest.
*/
typedef struct MIH_C_PK_LOSS_RATE {
    MIH_C_COS_ID_T               cos_id;
    UNSIGNED_INT2(value)
} MIH_C_PK_LOSS_RATE_T;
//-------------------------------------------
/*! \var MIH_C_MIN_PK_TX_DELAY_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_MIN_PK_TX_DELAY, MIH_C_QOS_LIST_LENGTH)
/*! \var MIH_C_AVG_PK_TX_DELAY_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_AVG_PK_TX_DELAY, MIH_C_QOS_LIST_LENGTH)
/*! \var MIH_C_MAX_PK_TX_DELAY_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_MAX_PK_TX_DELAY, MIH_C_QOS_LIST_LENGTH)
/*! \var MIH_C_PK_DELAY_JITTER_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_PK_DELAY_JITTER, MIH_C_QOS_LIST_LENGTH)
/*! \var MIH_C_PK_LOSS_RATE_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_PK_LOSS_RATE,    MIH_C_QOS_LIST_LENGTH)

//-------------------------------------------
/*! \var MIH_C_NUM_COS_TYPES_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_NUM_COS_TYPES)

/*! \struct  MIH_C_QOS_PARAM_VAL_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A choice of Class of Service (CoS) parameters.
*/
typedef struct MIH_C_QOS_PARAM_VAL {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_NUM_COS_TYPES_T    num_qos_types;
        LIST(MIH_C_MIN_PK_TX_DELAY, min_pk_tx_delay)
        LIST(MIH_C_AVG_PK_TX_DELAY, avg_pk_tx_delay)
        LIST(MIH_C_MAX_PK_TX_DELAY, max_pk_tx_delay)
        LIST(MIH_C_PK_DELAY_JITTER, pk_delay_jitter)
        LIST(MIH_C_PK_LOSS_RATE,    pk_loss_rate)
    } _union;
} MIH_C_QOS_PARAM_VAL_T;
#define MIH_C_QOS_PARAM_VAL_CHOICE_NUM_QOS_TYPES    (MIH_C_CHOICE_T)0
#define MIH_C_QOS_PARAM_VAL_CHOICE_MIN_PK_TX_DELAY  (MIH_C_CHOICE_T)1
#define MIH_C_QOS_PARAM_VAL_CHOICE_AVG_PK_TX_DELAY  (MIH_C_CHOICE_T)2
#define MIH_C_QOS_PARAM_VAL_CHOICE_MAX_PK_TX_DELAY  (MIH_C_CHOICE_T)3
#define MIH_C_QOS_PARAM_VAL_CHOICE_PK_DELAY_JITTER  (MIH_C_CHOICE_T)4
#define MIH_C_QOS_PARAM_VAL_CHOICE_PK_LOSS_RATE     (MIH_C_CHOICE_T)5

//-------------------------------------------
/*! \struct  MIH_C_QOS_LIST_T
* \ingroup MIH_C_F9_DATA_TYPES_FOR_QOS
* \brief A list of Class of Service (CoS) parameters.
*/
typedef struct MIH_C_QOS_LIST {
    MIH_C_NUM_COS_TYPES_T              num_qos_types;
    LIST(MIH_C_MIN_PK_TX_DELAY, min_pk_tx_delay)
    LIST(MIH_C_AVG_PK_TX_DELAY, avg_pk_tx_delay)
    LIST(MIH_C_MAX_PK_TX_DELAY, max_pk_tx_delay)
    LIST(MIH_C_PK_DELAY_JITTER, pk_delay_jitter)
    LIST(MIH_C_PK_LOSS_RATE,    pk_loss_rate)
} MIH_C_QOS_LIST_T;



//-------------------------------------------
/*! \struct  MIH_C_LINK_PARAM_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents a link parameter type and value pair.
*/
typedef struct MIH_C_LINK_PARAM {
    MIH_C_LINK_PARAM_TYPE_T      link_param_type;
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_LINK_PARAM_VAL_T   link_param_val;
        MIH_C_QOS_PARAM_VAL_T    qos_param_val;
    } _union;
} MIH_C_LINK_PARAM_T;
#define MIH_C_LINK_PARAM_CHOICE_LINK_PARAM_VAL (MIH_C_CHOICE_T)0
#define MIH_C_LINK_PARAM_CHOICE_QOS_PARAM_VAL  (MIH_C_CHOICE_T)1
//-------------------------------------------
/*! \struct  MIH_C_LINK_PARAM_RPT_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents a link parameter report.
*        Includes an option of the THRESHOLD that was crossed.
*        If no THRESHOLD is included, then this is a periodic report.
*/
typedef struct MIH_C_LINK_PARAM_RPT {
    MIH_C_LINK_PARAM_T           link_param;
    MIH_C_CHOICE_T               choice;
    union  {
1917
        MIH_C_NULL_T             null_attr;
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
        MIH_C_THRESHOLD_T        threshold;
    } _union;
} MIH_C_LINK_PARAM_RPT_T;
#define MIH_C_LINK_PARAM_RPT_CHOICE_NULL      0
#define MIH_C_LINK_PARAM_RPT_CHOICE_THRESHOLD 1
//-------------------------------------------
/*! \var MIH_C_LINK_ADDR_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_ADDR, MIH_C_LINK_ADDR_LIST_LENGTH)
/*! \struct  MIH_C_LINK_POA_LIST_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A list of PoAs for a particular link. The LIST(LINK_ADDR) is a list of PoA
*        link addresses and is sorted from most preferred first to least preferred last.
*/
typedef struct MIH_C_LINK_POA_LIST {
    MIH_C_LINK_ID_T              link_id;
    LIST(MIH_C_LINK_ADDR, link_addr)
} MIH_C_LINK_POA_LIST_T;
//-------------------------------------------
#define MIH_C_LINK_RES_STATUS_AVAILABLE          MIH_C_MIH_C_BOOLEAN_TRUE
#define MIH_C_LINK_RES_STATUS_NOT_AVAILABLE      MIH_C_BOOLEAN_FALSE
/*! \var MIH_C_LINK_RES_STATUS_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Indicates if a resource is available or not.
*        TRUE: Available
*        FALSE: Not available.
*/
TYPEDEF_BOOLEAN(MIH_C_LINK_RES_STATUS)
//-------------------------------------------
#define MIH_C_BIT_LINK_STATES_REQ_OP_MODE            MIH_C_BIT_0_VALUE
#define MIH_C_BIT_LINK_STATES_REQ_CHANNEL_ID         MIH_C_BIT_1_VALUE
/*! \var MIH_C_LINK_STATES_REQ_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Link states to be requested.
* Bit 0: OP_MODE
* Bit 1: CHANNEL_ID
* Bit 2–15: (Reserved)
*/
TYPEDEF_BITMAP16(MIH_C_LINK_STATES_REQ)
//-------------------------------------------
#define MIH_C_OPMODE_NORMAL_MODE                 0
#define MIH_C_OPMODE_POWER_SAVING_MODE           1
#define MIH_C_OPMODE_POWERED_DOWN                2
/*! \var MIH_C_OPMODE_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The link power mode.
*        0: Normal Mode
*        1: Power Saving Mode
*        2: Powered Down
*        3–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_OPMODE)
//-------------------------------------------
/*! \struct  MIH_C_LINK_STATES_RSP_T
* \brief The operation mode or the channel ID of the link.
*/
typedef struct MIH_C_LINK_STATES_RSP {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_OPMODE_T           op_mode;
        MIH_C_CHANNEL_ID_T       channel_id;
    } _union;
} MIH_C_LINK_STATES_RSP_T;
//-------------------------------------------
/*! \var MIH_C_LINK_PARAM_TYPE_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_PARAM_TYPE, MIH_C_LINK_STATUS_REQ_LIST_LENGTH)
/*! \struct MIH_C_LINK_STATUS_REQ_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief Represents the possible information to request from a link.
*/
typedef struct MIH_C_LINK_STATUS_REQ {
    MIH_C_LINK_STATES_REQ_T      link_states_req;
    LIST(MIH_C_LINK_PARAM_TYPE, link_param_type)
    MIH_C_LINK_DESC_RSP_T        link_desc_rsp;
} MIH_C_LINK_STATUS_REQ_T;
//-------------------------------------------
/*! \var MIH_C_LINK_STATES_RSP_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_STATES_RSP, MIH_C_LINK_STATUS_REQ_LIST_LENGTH)
/*! \var MIH_C_LINK_PARAM_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_PARAM, MIH_C_LINK_STATUS_REQ_LIST_LENGTH)
/*! \var MIH_C_LINK_DESC_RSP_LIST_T
* \brief
*/
TYPEDEF_LIST(MIH_C_LINK_DESC_RSP, MIH_C_LINK_STATUS_REQ_LIST_LENGTH)
/*! \struct  MIH_C_LINK_STATUS_RSP_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief A set of link status parameter values correspond to the LINK_STATUS_REQ.
*/
typedef struct MIH_C_LINK_STATUS_RSP {
    LIST(MIH_C_LINK_STATES_RSP,  link_states_rsp)
    LIST(MIH_C_LINK_PARAM,       link_param)
    LIST(MIH_C_LINK_DESC_RSP,    link_desc_rsp)
} MIH_C_LINK_STATUS_RSP_T;
//-------------------------------------------
/*! \struct  MIH_C_LINK_TUPLE_ID_T
* \ingroup MIH_C_F4_DATA_TYPES_FOR_LINKS_CODEC
* \brief The identifier of a link that is associated with a PoA. The LINK_ID contains the MN LINK_ADDR.
*        The optional LINK_ADDR contains a link address of PoA.
*/
typedef struct MIH_C_LINK_TUPLE_ID {
    MIH_C_LINK_ID_T              link_id;
    MIH_C_CHOICE_T               choice;
    union  {
2028
        MIH_C_NULL_T             null_attr;
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
        MIH_C_LINK_ADDR_T        link_addr;
    } _union;
} MIH_C_LINK_TUPLE_ID_T;
#define MIH_C_LINK_TUPLE_ID_CHOICE_NULL      0
#define MIH_C_LINK_TUPLE_ID_CHOICE_LINK_ADDR 1
//-------------------------------------------




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.5 Link actions
//-----------------------------------------------------------------------------
#define MIH_C_LINK_ACTION_LINK_NONE                             0
#define MIH_C_LINK_ACTION_LINK_LINK_DISCONNECT                  1  /* Disconnect the link connection directly.*/
#define MIH_C_LINK_ACTION_LINK_LOW_POWER                        2  /* Cause the link to adjust its battery power level to be low power consumption. */
#define MIH_C_LINK_ACTION_LINK_POWER_DOWN                       3  /* Cause the link to power down and turn off the radio.*/
#define MIH_C_LINK_ACTION_LINK_POWER_UP                         4  /* Cause the link to power up and establish L2 connectivity. For UMTS link type, power up lower layers and establish PDP context. */




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.6 Link action attibutes
//-----------------------------------------------------------------------------
#define MIH_C_LINK_ACTION_ATTRIBUTE_DATA_FWD_REQ                0 /* This indication requires   the buffered data at the old serving PoA entity to be forwarded
                                                                   * to the new target PoA entity in order to avoid data loss. This action can be taken imme-
                                                                   * diately after the old serving PoS receives MIH_N2N_HO_Commit response message from the new
                                                                   * target PoS, or the old serving PoS receives MIH_Net_HO_Commit response message from the MN.
                                                                   * This is not valid on UMTS link type.*/
#define MIH_C_LINK_ACTION_ATTRIBUTE_LINK_RES_RETAIN             1 /* The link will be disconnected but the resource for the link connection still remains so
                                                                   * reestablishing the link connection later can be more efficient.*/
#define MIH_C_LINK_ACTION_ATTRIBUTE_LINK_SCAN                   2 /* Cause the link to perform a scan.*/




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.7 Link down reason code
//-----------------------------------------------------------------------------
#define MIH_C_LINK_DOWN_REASON_EXPLICIT_DISCONNECT              0 /* The link is down because of explicit disconnect procedures initiated either by MN or network.*/
#define MIH_C_LINK_DOWN_REASON_PACKET_TIMEOUT                   1 /* The link is down because no acknowledgements were received for transmitted packets within the
                                                                   * specified time limit.*/
#define MIH_C_LINK_DOWN_REASON_NO_RESOURCE                      2 /* The link is down because there were no resources to maintain the connection.*/
#define MIH_C_LINK_DOWN_REASON_NO_BROADCAST                     3 /* The link is down because broadcast messages (such as beacons in IEEE 802.11 management frames)
                                                                   * could not be received by MN. */
#define MIH_C_LINK_DOWN_REASON_AUTHENTICATION_FAILURE           4 /* Authentication failure.*/
#define MIH_C_LINK_DOWN_REASON_BILLING_FAILURE                  5 /* Billing failure.*/




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.8 Link going down reason code
//-----------------------------------------------------------------------------
#define MIH_C_LINK_GOING_DOWN_REASON_EXPLICIT_DISCONNECT        0 /* The link is going to be down because explicit disconnect procedures will be
                                                                   * initiated either by MN or network. For example, when a BS has decided to
                                                                   * shutdown for administrative reasons or an operator of the terminal has
                                                                   * decided to execute a handover manually, a Link_Going_Down trigger is sent
                                                                   * to the MIHF.
                                                                   */
#define MIH_C_LINK_GOING_DOWN_REASON_LINK_PARAMETER_DEGRADING   1 /* The link is going to be down because broadcast messages (such as beacons in
                                                                   * IEEE 802.11 management frames) could not be received by MN.
                                                                   */
#define MIH_C_LINK_GOING_DOWN_REASON_LOW_POWER                  2 /* The link is going to be down because the power level of the terminal is low
                                                                   * and the current link will not be maintained in such a low power level. Mobile
                                                                   * terminals usually have limited battery supply, and when the battery level of
                                                                   * the terminal is low, a terminal can choose a link that has lower power con-
                                                                   * sumption for handover according to the received Link_Going_Down triggers
                                                                   * with this reason code. This will lengthen the usable time for the terminal.
                                                                   */
#define MIH_C_LINK_GOING_DOWN_REASON_NO_RESOURCE                3 /* The link is going to be down because there will be no resources to maintain
                                                                   * the current connection. For example, a BS that has too many users can send
                                                                   * Link_Going_Down indications to terminals when the links with them can not
                                                                   * be kept because of insufficient resources. Another example is that users with
                                                                   * higher priority can preempt the ones with lower priority when no more
                                                                   * resources can be allocated in 3GPP, and this can also cause a
                                                                   * Link_Going_Down indication with this reason code.
                                                                   */


//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.10 Not implemented
//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.11 Not implemented
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.12 Data types for IP configuration
//-----------------------------------------------------------------------------
#define MIH_C_BIT_IP_CFG_MTHDS_IPV4_STATIC_CONFIGURATION             MIH_C_BIT_0_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_IPV4_DYNAMIC_CONFIGURATION            MIH_C_BIT_1_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_MOBILE_IPV4_WITH_FA_COA               MIH_C_BIT_2_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_MOBILE_IPV4_WITHOUT_FA                MIH_C_BIT_3_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_IPV6_STATELESS_ADDRESS_CONFIGURATION  MIH_C_BIT_11_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_IPV6_STATEFULL_ADDRESS_CONFIGURATION  MIH_C_BIT_12_VALUE
#define MIH_C_BIT_IP_CFG_MTHDS_IPV6_MANUAL_ADDRESS_CONFIGURATION     MIH_C_BIT_13_VALUE
/*! \var MIH_C_IP_CFG_MTHDS_T
* \brief A set of IP configuration methods.
*         Bit 0: IPv4 static configuration
*         Bit 1: IPv4 dynamic configuration (DHCPv4)
*         Bit 2: Mobile IPv4 with foreign agent (FA) care-of address (CoA) (FA-CoA)
*         Bit 3: Mobile IPv4 without FA (Co-located CoA)
*         Bits 4–10: reserved for IPv4 address configurations
*         Bit 11: IPv6 stateless address configuration
*         Bit 12: IPv6 stateful address configuration (DHCPv6)
*         Bit 13: IPv6 manual configuration
*         Bits 14–31: (Reserved)
*/
TYPEDEF_BITMAP32(MIH_C_IP_CFG_MTHDS)
//-------------------------------------------
#define MIH_C_BIT_IP_MOB_MGMT_MOBILE_IPV4                             MIH_C_BIT_0_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_MOBILE_IPV4_REGIONAL_REGISTRATION       MIH_C_BIT_1_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_MOBILE_IPV6                             MIH_C_BIT_2_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_HIERARCHICAL_MOBILE_IPV6                MIH_C_BIT_3_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_LOW_LATENCY_HANDOFFS                    MIH_C_BIT_4_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_MOBILE_IPV6_FAST_HANDOVERS              MIH_C_BIT_5_VALUE
#define MIH_C_BIT_IP_MOB_MGMT_IKEV2_MOBILITY_AND_MULTIHOMING_PROTOCOL MIH_C_BIT_6_VALUE
/*! \var MIH_C_IP_MOB_MGMT_T
* \brief Indicates the supported mobility management protocols.
*         Bit 0: Mobile IPv4 (IETF RFC 3344)
*         Bit 1: Mobile IPv4 Regional Registration (IETF RFC 4857)
*         Bit 2: Mobile IPv6 (IETF RFC 3775)
*         Bit 3: Hierarchical Mobile IPv6 (IETF RFC 4140)
*         Bit 4: Low Latency Handoffs (IETF RFC 4881)
*         Bit 5: Mobile IPv6 Fast Handovers (IETF RFC 5268)
*         Bit 6: IKEv2 Mobility and Multihoming Protocol (IETF RFC 4555)
*         Bit 7–15: (Reserved)
*/
TYPEDEF_BITMAP16(MIH_C_IP_MOB_MGMT)
//-------------------------------------------
/*! \var MIH_C_IP_PREFIX_LEN_T
* \brief The length of an IP subnet prefix.
*         Valid Range:
*         0..32 for IPv4 subnet.
*         0..64, 65..127 for IPv6 subnet. (IETF RFC 4291 [B25])
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_IP_PREFIX_LEN)
//-------------------------------------------
/*! \var MIH_C_IP_RENEWAL_FLAG_T
* \brief Indicates whether MN’s IP address needs to be changed or not.
*         TRUE: Change required.
*         FALSE: Change not required.
*/
TYPEDEF_BOOLEAN(MIH_C_IP_RENEWAL_FLAG)
//-------------------------------------------
/*! \struct  MIH_C_IP_SUBNET_INFO_T
* \brief Represent an IP subnet. The IP_PREFIX_LEN contains the bit
*         length of the prefix of the subnet to which the IP_ADDR
*         belongs.
*/
typedef struct MIH_C_IP_SUBNET_INFO {
    MIH_C_IP_PREFIX_LEN_T              ip_prefix_len;
    MIH_C_IP_ADDR_T                    ip_addr;
} MIH_C_IP_SUBNET_INFO_T;




//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.13 Data types for information elements
//-----------------------------------------------------------------------------
/*! \var  MIH_C_NET_AUX_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent an auxiliary access network
*        identifier. This is HESSID if network type is
*        IEEE 802.11.
*/
TYPEDEF_OCTET_STRING(MIH_C_NET_AUX_ID, 253)

// already defined in other section TYPEDEF_OCTET_STRING(MIH_C_NETWORK_ID, 253)
/*! \var MIH_C_BAND_CLASS_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief CDMA band class.
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_BAND_CLASS)
/*! \var MIH_C_BANDWIDTH_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Channel bandwidth in kb/s.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_BANDWIDTH)
/*! \var MIH_C_BASE_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Base station identifier.
*/
TYPEDEF_UNSIGNED_INT2(MIH_C_BASE_ID)
/*! \var MIH_C_DOWN_BP_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A List of FEC Code Type for Downlink burst.
*        Refer to 11.4.1 in IEEE 802.16Rev2/D5.0.
*/
TYPEDEF_BITMAP256(MIH_C_DOWN_BP)
/*! \var  MIH_C_TYPE_EXT_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A generic type extension contained indicating a flexible length and format field. The content is to be
*        defined and filled by the appropriate SDO or service provider consortium, etc.
*        The value is a non-NULL terminated string whose length shall not exceed 253 octets.
*/
TYPEDEF_OCTET_STRING(MIH_C_TYPE_EXT, 253)
/*! \var MIH_C_UP_BP_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A List of FEC Code Type for Uplink burst.
*        Refer to 11.3.1 in IEEE 802.16Rev2/D5.0
*/
TYPEDEF_BITMAP256(MIH_C_UP_BP)
//-------------------------------------------
/*! \struct  MIH_C_BURST_PROF_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Burst profile.
*/
typedef struct MIH_C_BURST_PROF {
    MIH_C_DOWN_BP_T              down_bp;
    MIH_C_UP_BP_T                up_bp;
} MIH_C_BURST_PROF_T;
//-------------------------------------------
/*! \struct  MIH_C_CH_RANGE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type that contains two numbers. The first unsigned
*        integer is the low range. The second unsigned integer
*        is the high range. Both values are in kHz.
*        The first unsigned integer value should always be less
*        than or equal to the second unsigned integer.
*/
typedef struct MIH_C_CH_RANGE {
    UNSIGNED_INT4(low_range);
    UNSIGNED_INT4(high_range);
} MIH_C_CH_RANGE_T;
//-------------------------------------------
#define MIH_C_COST_UNIT_SECOND    0
#define MIH_C_COST_UNIT_MINUTE    1
#define MIH_C_COST_UNIT_HOURS     2
#define MIH_C_COST_UNIT_DAY       3
#define MIH_C_COST_UNIT_WEEK      4
#define MIH_C_COST_UNIT_MONTH     5
#define MIH_C_COST_UNIT_YEAR      6
#define MIH_C_COST_UNIT_FREE      7
#define MIH_C_COST_UNIT_FLAT_RATE 8
/*! \var MIH_C_COST_UNIT_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent the unit of a cost.
*        0: second
*        1: minute
*        2: hours
*        3: day
*        4: week
*        5: month
*        6: year
*        7: free
*        8: flat rate
*        9–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_COST_UNIT)
//-------------------------------------------
/*! \struct  MIH_C_COST_VALUE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent the value of a cost.
*        The first 4-octet contains the integer part of the cost.
*        The last 2-octet contains the fraction part where it rep-
*        resents a 3-digit fraction.
*        Therefore, the value range of the fraction part is
*        [0,999].
*        For example, for a value of ““0.5””, the integer part is
*             zero and the fraction part is 500.
*/
typedef struct MIH_C_COST_VALUE {
    UNSIGNED_INT4(cost_integer_part);
    UNSIGNED_INT2(cost_fraction_part);
} MIH_C_COST_VALUE_T;
//-------------------------------------------
/*! \var  MIH_C_COST_CURR_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent the currency of a cost.
*        A three-letter currency code (e.g., “USD”) specified
*        by ISO 4217.
*/
TYPEDEF_OCTET_STRING(MIH_C_COST_CURR, 3)
//-------------------------------------------
/*! \struct  MIH_C_COST_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent a cost.
*/
typedef struct MIH_C_COST {
    MIH_C_COST_UNIT_T              cost_unit;
    MIH_C_COST_VALUE_T             cost_value;
    MIH_C_COST_CURR_T              cost_curr;
} MIH_C_COST_T;
//-------------------------------------------
/*! \var MIH_C_CNTRY_CODE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Country code, represented as two letter ISO 3166-1 country code in capital ASCII letters.
*/
TYPEDEF_OCTET(MIH_C_CNTRY_CODE, 2)
//-------------------------------------------
/*! \var MIH_C_DATA_RATE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief
*/
TYPEDEF_UNSIGNED_INT4(MIH_C_DATA_RATE)
//-------------------------------------------
/*! \var MIH_C_DU_CTR_FREQ_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Downlink/Uplink center frequency in kHz.
*/
TYPEDEF_INTEGER8(MIH_C_DU_CTR_FREQ)
//-------------------------------------------
/*! \var MIH_C_EIRP_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief BS’s effective isotropic radiated power level. Signed in units of 1 dBm.
*/
TYPEDEF_INTEGER4(MIH_C_EIRP)
//-------------------------------------------
/*! \struct  MIH_C_GAP_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief This gap is an integer number of physical slot durations and starts on a
*        physical slot boundary. Used on TDD systems only.
*        The UNSIGNED_INT(2) is used for the TTG - transmit/receive transition gap.
*        The UNSIGNED_INT(1) is used for the RTG - receive/transmit transition gap.
*/
typedef struct MIH_C_GAP
 {
    UNSIGNED_INT2(ttg);
    UNSIGNED_INT1(rtg);
} MIH_C_GAP_T;
//-------------------------------------------
/*! \var MIH_C_HO_CODE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief HANDOVER_RANGING_CODE.
*        Refer to 11.3.1 in IEEE 802.16Rev2/D5.0.
*/
TYPEDEF_INTEGER1(MIH_C_HO_CODE)
//-------------------------------------------
/*! \var MIH_C_INIT_CODE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief INITIAL_RANGING_CODE.
*        Refer to 11.3.1 in IEEE 802.16Rev2/D5.0.
*/
TYPEDEF_INTEGER1(MIH_C_INIT_CODE)
//-------------------------------------------
/*! \struct  MIH_C_CDMA_CODES_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A set of CDMA ranging codes.
*/
typedef struct MIH_C_CDMA_CODES {
    MIH_C_INIT_CODE_T            init_code;
    MIH_C_HO_CODE_T              ho_code;
} MIH_C_CDMA_CODES_T;
//-------------------------------------------
/*! \struct  MIH_C_DCD_UCD_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent the downlink channel descriptor and the uplink channel descriptor.
*/
typedef struct MIH_C_DCD_UCD {
    MIH_C_BASE_ID_T          base_id;
    MIH_C_BANDWIDTH_T        bandwidth;
    MIH_C_DU_CTR_FREQ_T      du_ctr_freq;
    MIH_C_EIRP_T             eirp;
    MIH_C_GAP_T              gap;
    MIH_C_BURST_PROF_T       burst_prof;
    MIH_C_CDMA_CODES_T       cdma_codes;
} MIH_C_DCD_UCD_T;
//-------------------------------------------
/*! \var  MIH_C_FQDN_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief The fully qualified domain name of a host as described in IETF RFC 2181.
*/
TYPEDEF_OCTET_STRING(MIH_C_FQDN, 253)
//-------------------------------------------
// TBD FREQ_BANDS
/*! \var MIH_C_FREQ_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Identifier of the carrier frequency. Valid Range: 0..65535
*/
TYPEDEF_INTEGER2(MIH_C_FREQ_ID)
//-------------------------------------------
/*! \var MIH_C_FQ_CODE_NUM_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief UMTS scrambling code, cdma2000 Walsh code.
*        Valid Range: 0..65535
*/
TYPEDEF_INTEGER2(MIH_C_FQ_CODE_NUM)
//-------------------------------------------
/*! \var  MIH_C_IP4_ADDR_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief An IPv4 address as described in IETF RFC 791
*/
TYPEDEF_OCTET(MIH_C_IP4_ADDR, 4)
/*! \var  MIH_C_IP6_ADDR_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief An IPv6 address as described in IETF RFC 4291
*/
TYPEDEF_OCTET(MIH_C_IP6_ADDR, 16)

/*! \var MIH_C_DHCP_SERV_T
* \ingroup MIH_C_F22_DATA_TYPE_FOR_HANDOVER_OPERATION
* \brief IP address of candidate DHCP Server. It is only
* included when dynamic address configuration is supported.
*/
typedef MIH_C_IP_ADDR_T MIH_C_DHCP_SERV_T;
/*! \var MIH_C_FN_AGNT_T
* \ingroup MIH_C_F22_DATA_TYPE_FOR_HANDOVER_OPERATION
* \brief IP address of candidate Foreign Agent. It is only included when Mobile IPv4 is supported.
*/
typedef MIH_C_IP_ADDR_T MIH_C_FN_AGNT_T;
/*! \var MIH_C_ACC_RTR_T
* \ingroup MIH_C_F22_DATA_TYPE_FOR_HANDOVER_OPERATION
* \brief IP address of candidate Access Router. It is only
* included when IPv6 Stateless configuration is supported.
*/
typedef MIH_C_IP_ADDR_T MIH_C_ACC_RTR_T;
//-------------------------------------------
/*! \struct  MIH_C_IP_CONFIG_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief IP Configuration Methods supported by the access network.
*/
typedef struct MIH_C_IP_CONFIG
 {
    MIH_C_IP_CFG_MTHDS_T         ip_cfg_mthds;
    MIH_C_CHOICE_T               choice_dhcp_serv;
    union  {
2449
        MIH_C_NULL_T             null_attr;
2450
2451
2452
2453
        MIH_C_DHCP_SERV_T        dhcp_serv;
    } _union_dhcp_serv;
    MIH_C_CHOICE_T               choice_fn_agnt;
    union  {
2454
        MIH_C_NULL_T             null_attr;
2455
2456
2457
2458
        MIH_C_FN_AGNT_T          fn_agnt;
    } _union_fn_agnt;
    MIH_C_CHOICE_T               choice_acc_rtr;
    union  {
2459
        MIH_C_NULL_T             null_attr;
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
        MIH_C_ACC_RTR_T          acc_rtr;
    } _union_acc_rtr;
} MIH_C_IP_CONFIG_T;
//-------------------------------------------
#define MIH_C_BIT_NET_CAPS_SECURITY                MIH_C_BIT_0_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS0              MIH_C_BIT_1_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS1              MIH_C_BIT_2_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS2              MIH_C_BIT_3_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS3              MIH_C_BIT_4_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS4              MIH_C_BIT_5_VALUE
#define MIH_C_BIT_NET_CAPS_QOS_CLASS5              MIH_C_BIT_6_VALUE
#define MIH_C_BIT_NET_CAPS_INTERNET_ACCESS         MIH_C_BIT_7_VALUE
#define MIH_C_BIT_NET_CAPS_EMERGENCY_SERVICES      MIH_C_BIT_8_VALUE
#define MIH_C_BIT_NET_CAPS_MIH_CAPABILITY          MIH_C_BIT_9_VALUE
/*! \var MIH_C_NET_CAPS_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief These bits provide high level capabilities supported on a network.
*        Bitmap Values:
*        Bit 0: Security – Indicates that some level of security is supported when set.
*        Bit 1: QoS Class 0 – Indicates that QoS for class 0 is supported when set.
*        Bit 2: QoS Class 1 – Indicates that QoS for class 1 is supported when set.
*        Bit 3: QoS Class 2 – Indicates that QoS for class 2 is supported when set; Otherwise, no QoS for class 2 support is available.
*        Bit 4: QoS Class 3 – Indicates that QoS for class 3 is supported when set; Otherwise, no QoS for class 3 support is available.
*        Bit 5: QoS Class 4 – Indicates that QoS for class 4 is supported when set; Otherwise, no QoS for class 4 support is available.
*        Bit 6: QoS Class 5 – Indicates that QoS for class 5 is supported when set; Otherwise, no QoS for class 5 support is available.
*        Bit 7: Internet Access – Indicates that Internet access is supported when set; Otherwise, no Internet access support is available.
*        Bit 8: Emergency Services – Indicates that some level of emergency services is supported when set; Otherwise, no emergency service support is available.
*        Bit 9: MIH Capability – Indicates that MIH is supported when set; Otherwise, no MIH support is available.
*        Bit 10–31: (Reserved)
*/
TYPEDEF_BITMAP32(MIH_C_NET_CAPS)
//-------------------------------------------
/*! \var MIH_C_SUBTYPE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A network subtype. See Table F.14.
*/
TYPEDEF_BITMAP64(MIH_C_SUBTYPE)
//-------------------------------------------

//-------------------------------------------
/*! \struct  MIH_C_NETWORK_TYPE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent a network type and its subtype.
*        See Table F.14 for details.
*/
typedef struct MIH_C_NETWORK_TYPE
 {
    MIH_C_CHOICE_T               choice_link_type;
    union  {
2509
        MIH_C_NULL_T             null_attr;
2510
2511
2512
2513
        MIH_C_LINK_TYPE_T        link_type;
    } _union_link_type;
    MIH_C_CHOICE_T               choice_subtype;
    union  {
2514
        MIH_C_NULL_T             null_attr;
2515
2516
2517
2518
        MIH_C_SUBTYPE_T          subtype;
    } _union_subtype;
    MIH_C_CHOICE_T               choice_type_ext;
    union  {
2519
        MIH_C_NULL_T             null_attr;
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
        MIH_C_TYPE_EXT_T         type_ext;
    } _union_type_ext;
} MIH_C_NETWORK_TYPE_T;
//-------------------------------------------
/*! \var  MIH_C_OP_NAME_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent an operator name. The value
*        uniquely identifies the operator name within the scope
*        of the OP_NAMESPACE.
*        The value is a non NULL terminated string whose
*        length shall not exceed 253 octets.
*/
TYPEDEF_OCTET_STRING(MIH_C_OP_NAME, 253)
//-------------------------------------------
/*! \var MIH_C_OP_NAMESPACE_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent a type of operator name.
*        0: GSM/UMTS
*        1: CDMA
*        2: REALM (as defined in [B28]).
*        3: ITU-T/TSB
*        4: General
*        5–255: (Reserved)
*/
TYPEDEF_UNSIGNED_INT1(MIH_C_OP_NAMESPACE)
//-------------------------------------------
/*! \struct  MIH_C_OPERATOR_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent an operator identifier.
*/
typedef struct MIH_C_OPERATOR_ID {
    MIH_C_OP_NAME_T               opname;
    MIH_C_OP_NAMESPACE_T          opnamespace;
} MIH_C_OPERATOR_ID_T;
//-------------------------------------------
/*! \struct  MIH_C_SIB_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A type to represent UMTS system information block (SIB).
*/
typedef struct MIH_C_SIB {
    MIH_C_CELL_ID_T               cell_id;
    MIH_C_FQ_CODE_NUM_T           fq_code_num;
} MIH_C_SIB_T;
//-------------------------------------------
/*! \var MIH_C_PILOT_PN_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief Pilot PN sequence offset index.
*/
TYPEDEF_INTEGER2(MIH_C_PILOT_PN)
//-------------------------------------------
/*! \struct  MIH_C_SYS_PARAMS_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief CDMA2000 system parameters.
*/
typedef struct MIH_C_SYS_PARAMS {
    MIH_C_BASE_ID_T               base_id;
    MIH_C_PILOT_PN_T              pilot_pn;
    MIH_C_FREQ_ID_T               freq_id;
    MIH_C_BAND_CLASS_T            band_class;
} MIH_C_SYS_PARAMS_T;
//-------------------------------------------
/*! \struct  MIH_C_MIH_C_PARAMETERS_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A data type to represent system information depending on the network type.
*        DCD_UCD: IEEE 802.16
*        SIB: UMTS
*        SYS_PARAMS: cdma2000
*/
typedef struct MIH_C_PARAMETERS {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_DCD_UCD_T          dcd_ucd;
        MIH_C_SIB_T              sib;
        MIH_C_SYS_PARAMS_T       sys_params;
    } _union;
} MIH_C_MIH_C_PARAMETERS_T;
//-------------------------------------------
/*! \struct  MIH_C_PROXY_ADDR_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief L3 address of a proxy server.
*/
typedef struct MIH_C_PROXY_ADDR {
    MIH_C_CHOICE_T               choice;
    union  {
        MIH_C_IP4_ADDR_T         ip4_addr;
        MIH_C_IP6_ADDR_T         ip6_addr;
        MIH_C_FQDN_T             fqdn;
    } _union;
} MIH_C_PROXY_ADDR_T;
//-------------------------------------------
// TBD REGU_DOMAIN
// TBD ROAMING_PTNS
/*! \var  MIH_C_SP_ID_T
* \ingroup MIH_C_F13_DATA_TYPES_FOR_INFORMATION_ELEMENTS
* \brief A service provider identifier.
*        A non-NULL terminated string whose length shall not exceed 253 octets.
*/
TYPEDEF_OCTET_STRING(MIH_C_SP_ID, 253)
// TBD SUPPORTED_LCP
// TBD SYSTEM_INFO





//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.19 Data type for MIHF identification
//-----------------------------------------------------------------------------
/** \defgroup MIH_C_F19_DATA_TYPE_FOR_MIHF_IDENTIFICATION Data types for MIHF identification
 * \ingroup MIH_C_INTERFACE
 *
 *  @{
 */
/*! \var  MIH_C_MIHF_ID_T
* \brief The MIHF Identifier: MIHF_ID is a network access identifier (NAI).
*        NAI shall be unique as per IETF RFC 4282. If L3 communication is
*        used and MIHF entity resides in the network node, then MIHF_ID is
*        the fully qualified domain name or NAI-encoded IP address
*        (IP4_ADDR or IP6_ADDR) of the entity that hosts the MIH Services.
*        If L2 communication is used then MIHF_ID is the NAI-encoded link-
*        layer address (LINK_ADDR) of the entity that hosts the MIH ser-
*        vices. In an NAI-encoded IP address or link-layer address, each octet
*        of binary-encoded IP4_ADDR, IP6_ADDR and LINK_ADDR data is
*        encoded in the username part of the NAI as “\” followed by the octet
*        value. A multicast MIHF identifier is defined as an MIHF ID of zero
*        length. When an MIH protocol message with multicast MIHF ID is
*        transmitted over the L2 data plane, a group MAC address (01-80-C2-
*        00-00-0E) shall be used (see IEEE P802.1aj/D2.2). The maximum
*        length is 253 octets.
*/
TYPEDEF_OCTET_STRING(MIH_C_MIHF_ID, 253)
/** @}*/


//-----------------------------------------------------------------------------
// STD 802.21-2008 Table F.20—Data type for MIH capabilities
//-----------------------------------------------------------------------------
/** \defgroup MIH_C_F19_DATA_TYPE_FOR_MIHF_CAPABILITIES Data type for MIH capabilities
 * \ingroup MIH_C_INTERFACE
 *
 *  @{
 */
/*! \struct  MIH_C_LINK_DET_CFG_T
* \brief A data type for configuring link detected event trigger.
*/
typedef struct MIH_C_LINK_DET_CFG  {
    MIH_C_CHOICE_T                choice_network_id;
    union  {
2668
        MIH_C_NULL_T              null_attr;
2669
2670
2671
2672
        MIH_C_NETWORK_ID_T        network_id;
    } _union_network_id;
    MIH_C_CHOICE_T                choice_sig_strength;
    union  {
2673
        MIH_C_NULL_T              null_attr;
2674
2675
2676
2677
        MIH_C_SIG_STRENGTH_T      sig_strength;
    } _union_sig_strength;
    MIH_C_CHOICE_T                choice_link_data_rate;
    union  {
2678
        MIH_C_NULL_T              null_attr;
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821