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
12 * Szabo, Janos Zoltan – initial implementation
14 ******************************************************************************/
15 #ifndef STRING_STRUCT_HH
16 #define STRING_STRUCT_HH
19 #include "Bitstring.hh"
20 #include "Hexstring.hh"
21 #include "Octetstring.hh"
22 #include "Charstring.hh"
23 #include "Universal_charstring.hh"
25 #include "CharCoding.hh"
27 /** Type of the reference counters in all structures. */
28 typedef unsigned int ref_count_t;
30 /** Packed storage of bits, filled from LSB. */
31 struct BITSTRING::bitstring_struct {
32 ref_count_t ref_count;
34 unsigned char bits_ptr[sizeof(int)];
37 /** Each element occupies one byte. Meaning of values:
38 * 0 -> 0, 1 -> 1, 2 -> ?, 3 -> * */
39 struct BITSTRING_template::bitstring_pattern_struct {
40 ref_count_t ref_count;
41 unsigned int n_elements;
42 unsigned char elements_ptr[1];
45 /** Packed storage of hex digits, filled from LSB. */
46 struct HEXSTRING::hexstring_struct {
47 ref_count_t ref_count;
49 unsigned char nibbles_ptr[sizeof(int)];
52 /** Each element occupies one byte. Meaning of values:
53 * 0 .. 15 -> 0 .. F, 16 -> ?, 17 -> * */
54 struct HEXSTRING_template::hexstring_pattern_struct {
55 ref_count_t ref_count;
56 unsigned int n_elements;
57 unsigned char elements_ptr[1];
60 struct OCTETSTRING::octetstring_struct {
61 ref_count_t ref_count;
63 unsigned char octets_ptr[sizeof(int)];
66 /** Each element is represented as an unsigned short. Meaning of values:
67 * 0 .. 255 -> 00 .. FF, 256 -> ?, 257 -> * */
68 struct OCTETSTRING_template::octetstring_pattern_struct {
69 ref_count_t ref_count;
70 unsigned int n_elements;
71 unsigned short elements_ptr[1];
74 struct CHARSTRING::charstring_struct {
75 ref_count_t ref_count;
77 char chars_ptr[sizeof(int)];
80 struct UNIVERSAL_CHARSTRING::universal_charstring_struct {
81 ref_count_t ref_count;
83 universal_char uchars_ptr[1];
86 /* The layout of this structure must match that of charstring_struct */
87 struct TTCN_Buffer::buffer_struct {
88 ref_count_t ref_count;
89 int unused_length_field; /**< placeholder only */
90 unsigned char data_ptr[sizeof(int)];
93 /** Structure for storing a decoded content matching mechanism
94 * (for bitstrings, hexstrings, octetstrings and charstrings) */
95 struct decmatch_struct {
96 ref_count_t ref_count;
97 Dec_Match_Interface* instance;
100 /** Structure for storing a decoded content matching mechanism for universal
101 * charstrings (also contains the character coding method) */
102 struct unichar_decmatch_struct {
103 ref_count_t ref_count;
104 Dec_Match_Interface* instance;
105 CharCoding::CharCodingType coding;