4 * @brief Type definitions for parser and generator,
5 * also payload types are defined here.
7 * Header is parsed like a payload and gets its one payload_id
8 * from PRIVATE USE space. Also the substructures
9 * of specific payload types get their own payload_id
10 * from PRIVATE_USE space. See RFC for mor informations.
15 * Copyright (C) 2005 Jan Hutter, Martin Willi
16 * Hochschule fuer Technik Rapperswil
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
33 #include "../definitions.h"
37 * @brief All different kinds of encoding types.
39 * Each field of an IKEv2-Message (in header or payload)
40 * which has to be parsed or generated differently has its own
43 typedef enum encoding_type_e encoding_type_t
;
47 * Representing a 4 Bit unsigned int value
50 * When generating it must be changed from host to network order.
51 * The value is read from the associated data struct.
52 * The current write position is moved 4 bit forward afterwards.
54 * When parsing it must be changed from network to host order.
55 * The value is written to the associated data struct.
56 * The current read pointer is moved 4 bit forward afterwards.
60 * Representing a 8 Bit unsigned int value
63 * When generating it must be changed from host to network order.
64 * The value is read from the associated data struct.
65 * The current write position is moved 8 bit forward afterwards.
67 * When parsing it must be changed from network to host order.
68 * The value is written to the associated data struct.
69 * The current read pointer is moved 8 bit forward afterwards.
73 * Representing a 16 Bit unsigned int value
76 * When generating it must be changed from host to network order.
77 * The value is read from the associated data struct.
78 * The current write position is moved 16 bit forward afterwards.
80 * When parsing it must be changed from network to host order.
81 * The value is written to the associated data struct.
82 * The current read pointer is moved 16 bit forward afterwards.
86 * Representing a 32 Bit unsigned int value
88 * When generating it must be changed from host to network order.
89 * The value is read from the associated data struct.
90 * The current write position is moved 32 bit forward afterwards.
92 * When parsing it must be changed from network to host order.
93 * The value is written to the associated data struct.
94 * The current read pointer is moved 32 bit forward afterwards.
99 * Representing a 64 Bit unsigned int value
101 * When generating it must be changed from host to network order.
102 * The value is read from the associated data struct.
103 * The current write position is moved 64 bit forward afterwards.
105 * When parsing it must be changed from network to host order.
106 * The value is written to the associated data struct.
107 * The current read pointer is moved 64 bit forward afterwards.
111 * @brief represents a RESERVED_BIT used in FLAG-Bytes
113 * When generating, the next bit is set to zero and the current write
114 * position is moved one bit forward.
115 * No value is read from the associated data struct.
116 * The current write position is moved 1 bit forward afterwards.
118 * When parsing, the current read pointer is moved one bit forward.
119 * No value is written to the associated data struct.
120 * The current read pointer is moved 1 bit forward afterwards.
124 * @brief represents a RESERVED_BYTE
126 * When generating, the next byte is set to zero and the current write
127 * position is moved one byte forward.
128 * No value is read from the associated data struct.
129 * The current write position is moved 1 byte forward afterwards.
131 * When parsing, the current read pointer is moved one byte forward.
132 * No value is written to the associated data struct.
133 * The current read pointer is moved 1 byte forward afterwards.
137 * Representing a 1 Bit flag.
139 * When generation, the next bit is set to 1 if the associated value
140 * in the data struct is TRUE, 0 otherwise. The current write position
141 * is moved 1 bit forward afterwards.
143 * When parsing, the next bit is read and stored in the associated data
144 * struct. 0 means FALSE, 1 means TRUE, The current read pointer
145 * is moved 1 bit forward afterwards
149 * Representating a length field
151 * When generating it must be changed from host to network order.
152 * The value is read from the associated data struct.
153 * The current write position is moved 32 bit forward afterwards.
155 * When parsing it must be changed from network to host order.
156 * The value is written to the associated data struct.
157 * The current read pointer is moved 32 bit forward afterwards.
161 * Representating a spi size field
163 * When generating it must be changed from host to network order.
164 * The value is read from the associated data struct.
165 * The current write position is moved 32 bit forward afterwards.
167 * When parsing it must be changed from network to host order.
168 * The value is written to the associated data struct.
169 * The current read pointer is moved 32 bit forward afterwards.
175 * An encoding rule is a mapping of a specific encoding type to
176 * a location in the data struct where the current field is stored to
179 * For examples see directory encodings/.
181 * This rules are used by parser and generator.
183 typedef struct encoding_rule_s encoding_rule_t
;
185 struct encoding_rule_s
{
189 encoding_type_t type
;
191 * Offset in the data struct
193 * When parsing, data are written to this offset of the
196 * When generating, data are read from this offset in the
206 #endif /*ENCODINGS_H_*/