Last sync 2016.04.01
[deliverable/titan.core.git] / core / String_struct.hh
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Raduly, Csaba
11 * Szabados, Kristof
12 * Szabo, Janos Zoltan – initial implementation
13 *
14 ******************************************************************************/
15 #ifndef STRING_STRUCT_HH
16 #define STRING_STRUCT_HH
17
18 #include "Types.h"
19 #include "Bitstring.hh"
20 #include "Hexstring.hh"
21 #include "Octetstring.hh"
22 #include "Charstring.hh"
23 #include "Universal_charstring.hh"
24 #include "Encdec.hh"
25
26 /** Type of the reference counters in all structures. */
27 typedef unsigned int ref_count_t;
28
29 /** Packed storage of bits, filled from LSB. */
30 struct BITSTRING::bitstring_struct {
31 ref_count_t ref_count;
32 int n_bits;
33 unsigned char bits_ptr[sizeof(int)];
34 };
35
36 /** Each element occupies one byte. Meaning of values:
37 * 0 -> 0, 1 -> 1, 2 -> ?, 3 -> * */
38 struct BITSTRING_template::bitstring_pattern_struct {
39 ref_count_t ref_count;
40 unsigned int n_elements;
41 unsigned char elements_ptr[1];
42 };
43
44 /** Packed storage of hex digits, filled from LSB. */
45 struct HEXSTRING::hexstring_struct {
46 ref_count_t ref_count;
47 int n_nibbles;
48 unsigned char nibbles_ptr[sizeof(int)];
49 };
50
51 /** Each element occupies one byte. Meaning of values:
52 * 0 .. 15 -> 0 .. F, 16 -> ?, 17 -> * */
53 struct HEXSTRING_template::hexstring_pattern_struct {
54 ref_count_t ref_count;
55 unsigned int n_elements;
56 unsigned char elements_ptr[1];
57 };
58
59 struct OCTETSTRING::octetstring_struct {
60 ref_count_t ref_count;
61 int n_octets;
62 unsigned char octets_ptr[sizeof(int)];
63 };
64
65 /** Each element is represented as an unsigned short. Meaning of values:
66 * 0 .. 255 -> 00 .. FF, 256 -> ?, 257 -> * */
67 struct OCTETSTRING_template::octetstring_pattern_struct {
68 ref_count_t ref_count;
69 unsigned int n_elements;
70 unsigned short elements_ptr[1];
71 };
72
73 struct CHARSTRING::charstring_struct {
74 ref_count_t ref_count;
75 int n_chars;
76 char chars_ptr[sizeof(int)];
77 };
78
79 struct UNIVERSAL_CHARSTRING::universal_charstring_struct {
80 ref_count_t ref_count;
81 int n_uchars;
82 universal_char uchars_ptr[1];
83 };
84
85 /* The layout of this structure must match that of charstring_struct */
86 struct TTCN_Buffer::buffer_struct {
87 ref_count_t ref_count;
88 int unused_length_field; /**< placeholder only */
89 unsigned char data_ptr[sizeof(int)];
90 };
91
92 #endif
This page took 0.033766 seconds and 5 git commands to generate.