| 1 | /* |
| 2 | * lttng-events-write.h |
| 3 | * |
| 4 | * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; only |
| 9 | * version 2.1 of the License. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #undef ctf_integer |
| 22 | #define ctf_integer(_type, _item, _src) \ |
| 23 | _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, 0, 0) |
| 24 | |
| 25 | #undef ctf_integer_bitfield |
| 26 | #define ctf_integer_bitfield(_type, _item, _src) \ |
| 27 | _ctf_integer_ext(_type, _item, _src, __LITTLE_ENDIAN, 10, 0, 0) |
| 28 | |
| 29 | #undef ctf_integer_hex |
| 30 | #define ctf_integer_hex(_type, _item, _src) \ |
| 31 | _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 16, 0, 0) |
| 32 | |
| 33 | #undef ctf_integer_oct |
| 34 | #define ctf_integer_oct(_type, _item, _src) \ |
| 35 | _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 8, 0, 0) |
| 36 | |
| 37 | #undef ctf_integer_network |
| 38 | #define ctf_integer_network(_type, _item, _src) \ |
| 39 | _ctf_integer_ext(_type, _item, _src, __BIG_ENDIAN, 10, 0, 0) |
| 40 | |
| 41 | #undef ctf_integer_network_hex |
| 42 | #define ctf_integer_network_hex(_type, _item, _src) \ |
| 43 | _ctf_integer_ext(_type, _item, _src, __BIG_ENDIAN, 16, 0, 0) |
| 44 | |
| 45 | #undef ctf_array |
| 46 | #define ctf_array(_type, _item, _src, _length) \ |
| 47 | _ctf_array_encoded(_type, _item, _src, \ |
| 48 | _length, none, __BYTE_ORDER, 10, 0, 0) |
| 49 | |
| 50 | #undef ctf_array_hex |
| 51 | #define ctf_array_hex(_type, _item, _src, _length) \ |
| 52 | _ctf_array_encoded(_type, _item, _src, \ |
| 53 | _length, none, __BYTE_ORDER, 16, 0, 0) |
| 54 | |
| 55 | #undef ctf_array_network |
| 56 | #define ctf_array_network(_type, _item, _src, _length) \ |
| 57 | _ctf_array_encoded(_type, _item, _src, \ |
| 58 | _length, none, __BIG_ENDIAN, 10, 0, 0) |
| 59 | |
| 60 | #undef ctf_array_network_hex |
| 61 | #define ctf_array_network_hex(_type, _item, _src, _length) \ |
| 62 | _ctf_array_encoded(_type, _item, _src, \ |
| 63 | _length, none, __BIG_ENDIAN, 16, 0, 0) |
| 64 | |
| 65 | #undef ctf_array_text |
| 66 | #define ctf_array_text(_type, _item, _src, _length) \ |
| 67 | _ctf_array_encoded(_type, _item, _src, \ |
| 68 | _length, UTF8, __BYTE_ORDER, 10, 0, 0) |
| 69 | |
| 70 | #undef ctf_array_bitfield |
| 71 | #define ctf_array_bitfield(_type, _item, _src, _length) \ |
| 72 | _ctf_array_bitfield(_type, _item, _src, _length, 0, 0) |
| 73 | |
| 74 | #undef ctf_sequence |
| 75 | #define ctf_sequence(_type, _item, _src, _length_type, _src_length) \ |
| 76 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 77 | _length_type, _src_length, none, __BYTE_ORDER, 10, 0, 0) |
| 78 | |
| 79 | #undef ctf_sequence_hex |
| 80 | #define ctf_sequence_hex(_type, _item, _src, _length_type, _src_length) \ |
| 81 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 82 | _length_type, _src_length, none, __BYTE_ORDER, 16, 0, 0) |
| 83 | |
| 84 | #undef ctf_sequence_network |
| 85 | #define ctf_sequence_network(_type, _item, _src, _length_type, _src_length) \ |
| 86 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 87 | _length_type, _src_length, none, __BIG_ENDIAN, 10, 0, 0) |
| 88 | |
| 89 | #undef ctf_sequence_network_hex |
| 90 | #define ctf_sequence_network_hex(_type, _item, _src, _length_type, _src_length) \ |
| 91 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 92 | _length_type, _src_length, none, __BIG_ENDIAN, 16, 0, 0) |
| 93 | |
| 94 | #undef ctf_sequence_text |
| 95 | #define ctf_sequence_text(_type, _item, _src, _length_type, _src_length) \ |
| 96 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 97 | _length_type, _src_length, UTF8, __BYTE_ORDER, 10, 0, 0) |
| 98 | |
| 99 | #undef ctf_sequence_bitfield |
| 100 | #define ctf_sequence_bitfield(_type, _item, _src, _length_type, _src_length) \ |
| 101 | _ctf_sequence_bitfield(_type, _item, _src, \ |
| 102 | _length_type, _src_length, 0, 0) |
| 103 | |
| 104 | #undef ctf_string |
| 105 | #define ctf_string(_item, _src) \ |
| 106 | _ctf_string(_item, _src, 0, 0) |
| 107 | |
| 108 | #undef ctf_enum |
| 109 | #define ctf_enum(_name, _type, _item, _src) \ |
| 110 | _ctf_enum(_name, _type, _item, _src, 0, 0) |
| 111 | |
| 112 | /* user src */ |
| 113 | #undef ctf_user_integer |
| 114 | #define ctf_user_integer(_type, _item, _src) \ |
| 115 | _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, 1, 0) |
| 116 | |
| 117 | #undef ctf_user_integer_hex |
| 118 | #define ctf_user_integer_hex(_type, _item, _src) \ |
| 119 | _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 16, 1, 0) |
| 120 | |
| 121 | #undef ctf_user_integer_network |
| 122 | #define ctf_user_integer_network(_type, _item, _src) \ |
| 123 | _ctf_integer_ext(_type, _item, _src, __BIG_ENDIAN, 10, 1, 0) |
| 124 | |
| 125 | #undef ctf_user_integer_network_hex |
| 126 | #define ctf_user_integer_network_hex(_type, _item, _src) \ |
| 127 | _ctf_integer_ext(_type, _item, _src, __BIG_ENDIAN, 16, 1, 0) |
| 128 | |
| 129 | #undef ctf_user_array |
| 130 | #define ctf_user_array(_type, _item, _src, _length) \ |
| 131 | _ctf_array_encoded(_type, _item, _src, \ |
| 132 | _length, none, __BYTE_ORDER, 10, 1, 0) |
| 133 | |
| 134 | #undef ctf_user_array_hex |
| 135 | #define ctf_user_array_hex(_type, _item, _src, _length) \ |
| 136 | _ctf_array_encoded(_type, _item, _src, \ |
| 137 | _length, none, __BYTE_ORDER, 16, 1, 0) |
| 138 | |
| 139 | #undef ctf_user_array_network |
| 140 | #define ctf_user_array_network(_type, _item, _src, _length) \ |
| 141 | _ctf_array_encoded(_type, _item, _src, \ |
| 142 | _length, none, __BIG_ENDIAN, 10, 1, 0) |
| 143 | |
| 144 | #undef ctf_user_array_network_hex |
| 145 | #define ctf_user_array_network_hex(_type, _item, _src, _length) \ |
| 146 | _ctf_array_encoded(_type, _item, _src, \ |
| 147 | _length, none, __BIG_ENDIAN, 16, 1, 0) |
| 148 | |
| 149 | #undef ctf_user_array_text |
| 150 | #define ctf_user_array_text(_type, _item, _src, _length) \ |
| 151 | _ctf_array_encoded(_type, _item, _src, \ |
| 152 | _length, UTF8, __BYTE_ORDER, 10, 1, 0) |
| 153 | |
| 154 | #undef ctf_user_array_bitfield |
| 155 | #define ctf_user_array_bitfield(_type, _item, _src, _length) \ |
| 156 | _ctf_array_bitfield(_type, _item, _src, _length, 1, 0) |
| 157 | |
| 158 | #undef ctf_user_sequence |
| 159 | #define ctf_user_sequence(_type, _item, _src, _length_type, _src_length) \ |
| 160 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 161 | _length_type, _src_length, none, __BYTE_ORDER, 10, 1, 0) |
| 162 | |
| 163 | #undef ctf_user_sequence_hex |
| 164 | #define ctf_user_sequence_hex(_type, _item, _src, _length_type, _src_length) \ |
| 165 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 166 | _length_type, _src_length, none, __BYTE_ORDER, 16, 1, 0) |
| 167 | |
| 168 | #undef ctf_user_sequence_network |
| 169 | #define ctf_user_sequence_network(_type, _item, _src, _length_type, _src_length) \ |
| 170 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 171 | _length_type, _src_length, none, __BIG_ENDIAN, 10, 1, 0) |
| 172 | |
| 173 | #undef ctf_user_sequence_network_hex |
| 174 | #define ctf_user_sequence_network_hex(_type, _item, _src, _length_type, _src_length) \ |
| 175 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 176 | _length_type, _src_length, none, __BIG_ENDIAN, 16, 1, 0) |
| 177 | |
| 178 | #undef ctf_user_sequence_text |
| 179 | #define ctf_user_sequence_text(_type, _item, _src, _length_type, _src_length) \ |
| 180 | _ctf_sequence_encoded(_type, _item, _src, \ |
| 181 | _length_type, _src_length, UTF8, __BYTE_ORDER, 10, 1, 0) |
| 182 | |
| 183 | #undef ctf_user_sequence_bitfield |
| 184 | #define ctf_user_sequence_bitfield(_type, _item, _src, _length_type, _src_length) \ |
| 185 | _ctf_sequence_bitfield(_type, _item, _src, \ |
| 186 | _length_type, _src_length, 1, 0) |
| 187 | |
| 188 | #undef ctf_user_string |
| 189 | #define ctf_user_string(_item, _src) \ |
| 190 | _ctf_string(_item, _src, 1, 0) |
| 191 | |
| 192 | #undef ctf_user_enum |
| 193 | #define ctf_user_enum(_name, _type, _item, _src) \ |
| 194 | _ctf_enum(_name, _type, _item, _src, 1, 0) |
| 195 | |
| 196 | /* types */ |
| 197 | #undef ctf_integer_type |
| 198 | #define ctf_integer_type(_type, _src) \ |
| 199 | ctf_integer(_type, unused, _src) |
| 200 | |
| 201 | #undef ctf_integer_bitfield_type |
| 202 | #define ctf_integer_bitfield_type(_type, _src) \ |
| 203 | ctf_integer_bitfield(_type, unused, _src) |
| 204 | |
| 205 | #undef ctf_integer_hex_type |
| 206 | #define ctf_integer_hex_type(_type, _src) \ |
| 207 | ctf_integer_hex(_type, unused, _src) |
| 208 | |
| 209 | #undef ctf_integer_oct_type |
| 210 | #define ctf_integer_oct_type(_type, _item, _src) \ |
| 211 | ctf_integer_oct(_type, unused, _src) |
| 212 | |
| 213 | #undef ctf_integer_network_type |
| 214 | #define ctf_integer_network_type(_type, _src) \ |
| 215 | ctf_integer_network(_type, unused, _src) |
| 216 | |
| 217 | #undef ctf_integer_network_hex_type |
| 218 | #define ctf_integer_network_hex_type(_type, _src) \ |
| 219 | ctf_integer_network_hex(_type, unused, _src) |
| 220 | |
| 221 | #undef ctf_array_type |
| 222 | #define ctf_array_type(_type, _src, _length) \ |
| 223 | ctf_array(_type, unused, _src, _length) |
| 224 | |
| 225 | #undef ctf_array_hex_type |
| 226 | #define ctf_array_hex_type(_type, _src, _length) \ |
| 227 | ctf_array_hex(_type, unused, _src, _length) |
| 228 | |
| 229 | #undef ctf_array_network_type |
| 230 | #define ctf_array_network_type(_type, _src, _length) \ |
| 231 | ctf_array_network(_type, unused, _src, _length) |
| 232 | |
| 233 | #undef ctf_array_network_hex_type |
| 234 | #define ctf_array_network_hex_type(_type, _src, _length) \ |
| 235 | ctf_array_network_hex(_type, unused, _src, _length) |
| 236 | |
| 237 | #undef ctf_array_text_type |
| 238 | #define ctf_array_text_type(_type, _src, _length) \ |
| 239 | ctf_array_text(_type, unused, _src, _length) |
| 240 | |
| 241 | #undef ctf_array_bitfield_type |
| 242 | #define ctf_array_bitfield_type(_type, _src, _length) \ |
| 243 | ctf_array_bitfield(_type, unused, _src, _length) |
| 244 | |
| 245 | #undef ctf_sequence_type |
| 246 | #define ctf_sequence_type(_type, _src, _length_type, _src_length) \ |
| 247 | ctf_sequence(_type, unused, _src, _length_type, _src_length) |
| 248 | |
| 249 | #undef ctf_sequence_hex_type |
| 250 | #define ctf_sequence_hex_type(_type, _src, _length_type, _src_length) \ |
| 251 | ctf_sequence_hex(_type, unused, _src, _length_type, _src_length) |
| 252 | |
| 253 | #undef ctf_sequence_network_type |
| 254 | #define ctf_sequence_network_type(_type, _src, _length_type, _src_length) \ |
| 255 | ctf_sequence_network(_type, unused, _src, _length_type, _src_length) |
| 256 | |
| 257 | #undef ctf_sequence_network_hex_type |
| 258 | #define ctf_sequence_network_hex_type(_type, _src, _length_type, _src_length) \ |
| 259 | ctf_sequence_network_hex(_type, unused, _src, _length_type, _src_length) |
| 260 | |
| 261 | #undef ctf_sequence_text_type |
| 262 | #define ctf_sequence_text_type(_type, _src, _length_type, _src_length) \ |
| 263 | ctf_sequence_text(_type, unused, _src, _length_type, _src_length) |
| 264 | |
| 265 | #undef ctf_sequence_bitfield_type |
| 266 | #define ctf_sequence_bitfield_type(_type, _src, _length_type, _src_length) \ |
| 267 | ctf_sequence_bitfield(_type, unused, _src, _length_type, _src_length) |
| 268 | |
| 269 | #undef ctf_string_type |
| 270 | #define ctf_string_type(_src) \ |
| 271 | ctf_string(unused, _src) |
| 272 | |
| 273 | #undef ctf_enum_type |
| 274 | #define ctf_enum_type(_name, _type, _src) \ |
| 275 | ctf_enum(_name, _type, unused, _src) |
| 276 | |
| 277 | /* user src types */ |
| 278 | #undef ctf_user_integer_type |
| 279 | #define ctf_user_integer_type(_type, _src) \ |
| 280 | ctf_user_integer(_type, unused, _src) |
| 281 | |
| 282 | #undef ctf_user_integer_hex_type |
| 283 | #define ctf_user_integer_hex_type(_type, _src) \ |
| 284 | ctf_user_integer_hex(_type, unused, _src) |
| 285 | |
| 286 | #undef ctf_user_integer_oct_type |
| 287 | #define ctf_user_integer_oct_type(_type, _item, _src) \ |
| 288 | ctf_user_integer_oct(_type, unused, _src) |
| 289 | |
| 290 | #undef ctf_user_integer_network_type |
| 291 | #define ctf_user_integer_network_type(_type, _src) \ |
| 292 | ctf_user_integer_network(_type, unused, _src) |
| 293 | |
| 294 | #undef ctf_user_integer_network_hex_type |
| 295 | #define ctf_user_integer_network_hex_type(_type, _src) \ |
| 296 | ctf_user_integer_network_hex(_type, unused, _src) |
| 297 | |
| 298 | #undef ctf_user_array_type |
| 299 | #define ctf_user_array_type(_type, _src, _length) \ |
| 300 | ctf_user_array(_type, unused, _src, _length) |
| 301 | |
| 302 | #undef ctf_user_array_hex_type |
| 303 | #define ctf_user_array_hex_type(_type, _src, _length) \ |
| 304 | ctf_user_array_hex(_type, unused, _src, _length) |
| 305 | |
| 306 | #undef ctf_user_array_network_type |
| 307 | #define ctf_user_array_network_type(_type, _src, _length) \ |
| 308 | ctf_user_array_network(_type, unused, _src, _length) |
| 309 | |
| 310 | #undef ctf_user_array_network_hex_type |
| 311 | #define ctf_user_array_network_hex_type(_type, _src, _length) \ |
| 312 | ctf_user_array_network_hex(_type, unused, _src, _length) |
| 313 | |
| 314 | #undef ctf_user_array_text_type |
| 315 | #define ctf_user_array_text_type(_type, _src, _length) \ |
| 316 | ctf_user_array_text(_type, unused, _src, _length) |
| 317 | |
| 318 | #undef ctf_user_array_bitfield_type |
| 319 | #define ctf_user_array_bitfield_type(_type, _src, _length) \ |
| 320 | ctf_user_array_bitfield(_type, unused, _src, _length) |
| 321 | |
| 322 | #undef ctf_user_sequence_type |
| 323 | #define ctf_user_sequence_type(_type, _src, _length_type, _src_length) \ |
| 324 | ctf_user_sequence(_type, unused, _src, _length_type, _src_length) |
| 325 | |
| 326 | #undef ctf_user_sequence_hex_type |
| 327 | #define ctf_user_sequence_hex_type(_type, _src, _length_type, _src_length) \ |
| 328 | ctf_user_sequence_hex(_type, unused, _src, _length_type, _src_length) |
| 329 | |
| 330 | #undef ctf_user_sequence_network_type |
| 331 | #define ctf_user_sequence_network_type(_type, _src, _length_type, _src_length) \ |
| 332 | ctf_user_sequence_network(_type, unused, _src, _length_type, _src_length) |
| 333 | |
| 334 | #undef ctf_user_sequence_network_hex_type |
| 335 | #define ctf_user_sequence_network_hex_type(_type, _src, _length_type, _src_length) \ |
| 336 | ctf_user_sequence_network_hex(_type, unused, _src, _length_type, _src_length) |
| 337 | |
| 338 | #undef ctf_user_sequence_text_type |
| 339 | #define ctf_user_sequence_text_type(_type, _src, _length_type, _src_length) \ |
| 340 | ctf_user_sequence_text(_type, unused, _src, _length_type, _src_length) |
| 341 | |
| 342 | #undef ctf_user_sequence_bitfield_type |
| 343 | #define ctf_user_sequence_bitfield_type(_type, _src, _length_type, _src_length) \ |
| 344 | ctf_user_sequence_bitfield(_type, unused, _src, _length_type, _src_length) |
| 345 | |
| 346 | #undef ctf_user_string_type |
| 347 | #define ctf_user_string_type(_src) \ |
| 348 | ctf_user_string(unused, _src) |
| 349 | |
| 350 | #undef ctf_user_enum_type |
| 351 | #define ctf_user_enum_type(_name, _type, _src) \ |
| 352 | ctf_user_enum(_name, _type, unused, _src) |