File indexing completed on 2025-01-18 10:02:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #ifndef NETTLE_SEXP_H_INCLUDED
0034 #define NETTLE_SEXP_H_INCLUDED
0035
0036 #include <stdarg.h>
0037 #include "nettle-types.h"
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043
0044 #define sexp_iterator_first nettle_sexp_iterator_first
0045 #define sexp_transport_iterator_first nettle_sexp_transport_iterator_first
0046 #define sexp_iterator_next nettle_sexp_iterator_next
0047 #define sexp_iterator_enter_list nettle_sexp_iterator_enter_list
0048 #define sexp_iterator_exit_list nettle_sexp_iterator_exit_list
0049 #define sexp_iterator_subexpr nettle_sexp_iterator_subexpr
0050 #define sexp_iterator_get_uint32 nettle_sexp_iterator_get_uint32
0051 #define sexp_iterator_check_type nettle_sexp_iterator_check_type
0052 #define sexp_iterator_check_types nettle_sexp_iterator_check_types
0053 #define sexp_iterator_assoc nettle_sexp_iterator_assoc
0054 #define sexp_format nettle_sexp_format
0055 #define sexp_vformat nettle_sexp_vformat
0056 #define sexp_transport_format nettle_sexp_transport_format
0057 #define sexp_transport_vformat nettle_sexp_transport_vformat
0058 #define sexp_token_chars nettle_sexp_token_chars
0059
0060 enum sexp_type
0061 { SEXP_ATOM, SEXP_LIST, SEXP_END };
0062
0063 struct sexp_iterator
0064 {
0065 size_t length;
0066 const uint8_t *buffer;
0067
0068
0069 size_t start;
0070
0071
0072 size_t pos;
0073 unsigned level;
0074
0075 enum sexp_type type;
0076
0077 size_t display_length;
0078 const uint8_t *display;
0079
0080 size_t atom_length;
0081 const uint8_t *atom;
0082 };
0083
0084
0085
0086
0087
0088 int
0089 sexp_iterator_first(struct sexp_iterator *iterator,
0090 size_t length, const uint8_t *input);
0091
0092
0093 int
0094 sexp_transport_iterator_first(struct sexp_iterator *iterator,
0095 size_t length, uint8_t *input);
0096
0097 int
0098 sexp_iterator_next(struct sexp_iterator *iterator);
0099
0100
0101 int
0102 sexp_iterator_enter_list(struct sexp_iterator *iterator);
0103
0104
0105 int
0106 sexp_iterator_exit_list(struct sexp_iterator *iterator);
0107
0108 #if 0
0109
0110
0111 int
0112 sexp_iterator_exit_lists(struct sexp_iterator *iterator,
0113 unsigned level);
0114 #endif
0115
0116
0117
0118 const uint8_t *
0119 sexp_iterator_subexpr(struct sexp_iterator *iterator,
0120 size_t *length);
0121
0122 int
0123 sexp_iterator_get_uint32(struct sexp_iterator *iterator,
0124 uint32_t *x);
0125
0126
0127
0128
0129
0130
0131 int
0132 sexp_iterator_check_type(struct sexp_iterator *iterator,
0133 const char *type);
0134
0135 const char *
0136 sexp_iterator_check_types(struct sexp_iterator *iterator,
0137 unsigned ntypes,
0138 const char * const *types);
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149 int
0150 sexp_iterator_assoc(struct sexp_iterator *iterator,
0151 unsigned nkeys,
0152 const char * const *keys,
0153 struct sexp_iterator *values);
0154
0155
0156
0157
0158
0159
0160 struct nettle_buffer;
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193 size_t
0194 sexp_format(struct nettle_buffer *buffer,
0195 const char *format, ...);
0196
0197 size_t
0198 sexp_vformat(struct nettle_buffer *buffer,
0199 const char *format, va_list args);
0200
0201 size_t
0202 sexp_transport_format(struct nettle_buffer *buffer,
0203 const char *format, ...);
0204
0205 size_t
0206 sexp_transport_vformat(struct nettle_buffer *buffer,
0207 const char *format, va_list args);
0208
0209 #ifdef __cplusplus
0210 }
0211 #endif
0212
0213 #endif