actf 0.0.1
An acute CTF reader
Loading...
Searching...
No Matches
/home/adwe/code/actf/types.h
Go to the documentation of this file.
1/*
2 * This file is a part of ACTF.
3 *
4 * Copyright (C) 2024 Adam Wendelin <adwe live se>
5 *
6 * ACTF is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * ACTF is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14 * Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with ACTF. If not, see
18 * <https://www.gnu.org/licenses/>.
19 */
20
25#ifndef ACTF_TYPES_H
26#define ACTF_TYPES_H
27
28#include <stdint.h>
29
30
31/* Return codes. */
32#define ACTF_OK 0
33#define ACTF_ERROR -1
34#define ACTF_INTERNAL -2
35#define ACTF_OOM -3
36#define ACTF_NOT_FOUND -4
37#define ACTF_JSON_PARSE_ERROR -5
38#define ACTF_JSON_ERROR -6
39#define ACTF_JSON_WRONG_TYPE -7
40#define ACTF_JSON_NOT_GTEZ -8
41#define ACTF_JSON_NOT_GTZ -9
42#define ACTF_INVALID_ALIGNMENT -10
43#define ACTF_INVALID_BYTE_ORDER -11
44#define ACTF_INVALID_BIT_ORDER -12
45#define ACTF_INVALID_RANGE -13
46#define ACTF_INVALID_RANGE_SET -14
47#define ACTF_INVALID_UUID -15
48#define ACTF_INVALID_FLD_LOC -16
49#define ACTF_INVALID_FLD_CLS -17
50#define ACTF_INVALID_FLAGS -18
51#define ACTF_INVALID_ROLE -19
52#define ACTF_INVALID_BASE -20
53#define ACTF_UNSUPPORTED_LENGTH -21
54#define ACTF_INVALID_ENCODING -22
55#define ACTF_INVALID_ENVIRONMENT -23
56#define ACTF_INVALID_VARIANT -24
57#define ACTF_CC_GTE_FREQ_ERROR -25
58#define ACTF_NO_SUCH_ALIAS -26
59#define ACTF_MISSING_PROPERTY -27
60#define ACTF_UNSUPPORTED_EXTENSION -28
61#define ACTF_NO_SUCH_ORIGIN -29
62#define ACTF_NO_DEFAULT_CLOCK -30
63#define ACTF_INVALID_UUID_ROLE -31
64#define ACTF_INVALID_MAGIC_ROLE -32
65#define ACTF_NOT_A_STRUCT -33
66#define ACTF_DUPLICATE_ERROR -34
67#define ACTF_NO_SUCH_ID -35
68#define ACTF_UNSUPPORTED_VERSION -36
69#define ACTF_NO_PREAMBLE -37
70#define ACTF_WRONG_FLD_TYPE -38
71#define ACTF_MISSING_FLD_LOC -39
72#define ACTF_NOT_ENOUGH_BITS -40
73#define ACTF_MID_BYTE_ENDIAN_SWAP -41
74#define ACTF_INVALID_STR_LEN -42
75#define ACTF_MAGIC_MISMATCH -43
76#define ACTF_UUID_MISMATCH -44
77#define ACTF_NO_SELECTOR_FLD -45
78#define ACTF_INVALID_CONTENT_LEN -46
79#define ACTF_INVALID_METADATA_PKT -47
80#define ACTF_LUA_WRONG_RET_TYPE -48
81#define ACTF_LUA_RUN_ERROR -49
82
88const char *actf_errstr(int rc);
89
91typedef struct actf_fld actf_fld;
94
97 ACTF_LIL_ENDIAN,
98 ACTF_BIG_ENDIAN,
99};
100
103 ACTF_FIRST_TO_LAST,
104 ACTF_LAST_TO_FIRST,
105};
106
109 ACTF_ENCODING_UTF8,
110 ACTF_ENCODING_UTF16BE,
111 ACTF_ENCODING_UTF16LE,
112 ACTF_ENCODING_UTF32BE,
113 ACTF_ENCODING_UTF32LE,
114 ACTF_N_ENCODINGS,
115};
116
119 ACTF_BASE_BINARY = 2,
120 ACTF_BASE_OCTAL = 8,
121 ACTF_BASE_DECIMAL = 10,
122 ACTF_BASE_HEXADECIMAL = 16,
123};
124
126#define ACTF_UUID_N_BYTES 16
127
129struct actf_uuid {
132};
133
136typedef struct actf_it {
138 void *data;
140
141#endif /* ACTF_TYPES_H */
An iterator.
Definition types.h:136
void * data
Opaque pointer.
Definition types.h:138
A UUID.
Definition types.h:129
uint8_t d[ACTF_UUID_N_BYTES]
UUID data.
Definition types.h:131
const char * actf_errstr(int rc)
Convert a return code into an error string.
struct actf_fld actf_fld
A field.
Definition types.h:91
struct actf_fld_cls actf_fld_cls
A field class.
Definition types.h:93
actf_bit_order
Bit orders.
Definition types.h:102
actf_byte_order
Byte orders.
Definition types.h:96
#define ACTF_UUID_N_BYTES
Number of bytes in a UUID.
Definition types.h:126
actf_base
Bases.
Definition types.h:118
actf_encoding
Character encodings.
Definition types.h:108