1df278fc2SJan Lentfer /*
2df278fc2SJan Lentfer * util.h
3df278fc2SJan Lentfer *
4df278fc2SJan Lentfer * helper function header file
5df278fc2SJan Lentfer *
6df278fc2SJan Lentfer * a Net::DNS like library for C
7df278fc2SJan Lentfer *
8df278fc2SJan Lentfer * (c) NLnet Labs, 2004
9df278fc2SJan Lentfer *
10df278fc2SJan Lentfer * See the file LICENSE for the license
11df278fc2SJan Lentfer */
12df278fc2SJan Lentfer
13df278fc2SJan Lentfer #ifndef _UTIL_H
14df278fc2SJan Lentfer #define _UTIL_H
15df278fc2SJan Lentfer
16df278fc2SJan Lentfer #include <inttypes.h>
17fcd4e566SJan Lentfer #include <sys/types.h>
18fcd4e566SJan Lentfer #include <unistd.h>
19df278fc2SJan Lentfer #include <ldns/common.h>
20df278fc2SJan Lentfer #include <time.h>
21df278fc2SJan Lentfer #include <stdio.h>
22df278fc2SJan Lentfer
23fcd4e566SJan Lentfer #ifdef __cplusplus
24fcd4e566SJan Lentfer extern "C" {
25fcd4e566SJan Lentfer #endif
26fcd4e566SJan Lentfer
27df278fc2SJan Lentfer #define dprintf(X,Y) fprintf(stderr, (X), (Y))
28df278fc2SJan Lentfer /* #define dprintf(X, Y) */
29df278fc2SJan Lentfer
30*c1ccac55SAntonio Huete Jimenez #define LDNS_VERSION "1.8.3"
31*c1ccac55SAntonio Huete Jimenez #define LDNS_REVISION ((1<<16)|(8<<8)|(3))
32df278fc2SJan Lentfer
33df278fc2SJan Lentfer /**
34df278fc2SJan Lentfer * splint static inline workaround
35df278fc2SJan Lentfer */
36df278fc2SJan Lentfer #ifdef S_SPLINT_S
37df278fc2SJan Lentfer # define INLINE
38df278fc2SJan Lentfer #else
39df278fc2SJan Lentfer # ifdef SWIG
40df278fc2SJan Lentfer # define INLINE static
41df278fc2SJan Lentfer # else
42df278fc2SJan Lentfer # define INLINE static inline
43df278fc2SJan Lentfer # endif
44df278fc2SJan Lentfer #endif
45df278fc2SJan Lentfer
46df278fc2SJan Lentfer /**
47df278fc2SJan Lentfer * Memory management macros
48df278fc2SJan Lentfer */
49df278fc2SJan Lentfer #define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1)
50df278fc2SJan Lentfer
51df278fc2SJan Lentfer #define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type)))
52df278fc2SJan Lentfer
53de9b0015SJan Lentfer #define LDNS_CALLOC(type, count) ((type *) calloc((count), sizeof(type)))
54de9b0015SJan Lentfer
55df278fc2SJan Lentfer #define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1)
56df278fc2SJan Lentfer
57df278fc2SJan Lentfer #define LDNS_XREALLOC(ptr, type, count) \
58df278fc2SJan Lentfer ((type *) realloc((ptr), (count) * sizeof(type)))
59df278fc2SJan Lentfer
60df278fc2SJan Lentfer #define LDNS_FREE(ptr) \
61df278fc2SJan Lentfer do { free((ptr)); (ptr) = NULL; } while (0)
62df278fc2SJan Lentfer
63df278fc2SJan Lentfer #define LDNS_DEP printf("DEPRECATED FUNCTION!\n");
64df278fc2SJan Lentfer
65df278fc2SJan Lentfer /*
66df278fc2SJan Lentfer * Copy data allowing for unaligned accesses in network byte order
67df278fc2SJan Lentfer * (big endian).
68df278fc2SJan Lentfer */
69df278fc2SJan Lentfer INLINE uint16_t
ldns_read_uint16(const void * src)70df278fc2SJan Lentfer ldns_read_uint16(const void *src)
71df278fc2SJan Lentfer {
72df278fc2SJan Lentfer #ifdef ALLOW_UNALIGNED_ACCESSES
7326c5a308Szrj return ntohs(*(const uint16_t *) src);
74df278fc2SJan Lentfer #else
7526c5a308Szrj const uint8_t *p = (const uint8_t *) src;
76df278fc2SJan Lentfer return ((uint16_t) p[0] << 8) | (uint16_t) p[1];
77df278fc2SJan Lentfer #endif
78df278fc2SJan Lentfer }
79df278fc2SJan Lentfer
80df278fc2SJan Lentfer INLINE uint32_t
ldns_read_uint32(const void * src)81df278fc2SJan Lentfer ldns_read_uint32(const void *src)
82df278fc2SJan Lentfer {
83df278fc2SJan Lentfer #ifdef ALLOW_UNALIGNED_ACCESSES
8426c5a308Szrj return ntohl(*(const uint32_t *) src);
85df278fc2SJan Lentfer #else
8626c5a308Szrj const uint8_t *p = (const uint8_t *) src;
87df278fc2SJan Lentfer return ( ((uint32_t) p[0] << 24)
88df278fc2SJan Lentfer | ((uint32_t) p[1] << 16)
89df278fc2SJan Lentfer | ((uint32_t) p[2] << 8)
90df278fc2SJan Lentfer | (uint32_t) p[3]);
91df278fc2SJan Lentfer #endif
92df278fc2SJan Lentfer }
93df278fc2SJan Lentfer
94df278fc2SJan Lentfer /*
95df278fc2SJan Lentfer * Copy data allowing for unaligned accesses in network byte order
96df278fc2SJan Lentfer * (big endian).
97df278fc2SJan Lentfer */
98df278fc2SJan Lentfer INLINE void
ldns_write_uint16(void * dst,uint16_t data)99df278fc2SJan Lentfer ldns_write_uint16(void *dst, uint16_t data)
100df278fc2SJan Lentfer {
101df278fc2SJan Lentfer #ifdef ALLOW_UNALIGNED_ACCESSES
102df278fc2SJan Lentfer * (uint16_t *) dst = htons(data);
103df278fc2SJan Lentfer #else
104df278fc2SJan Lentfer uint8_t *p = (uint8_t *) dst;
105df278fc2SJan Lentfer p[0] = (uint8_t) ((data >> 8) & 0xff);
106df278fc2SJan Lentfer p[1] = (uint8_t) (data & 0xff);
107df278fc2SJan Lentfer #endif
108df278fc2SJan Lentfer }
109df278fc2SJan Lentfer
110df278fc2SJan Lentfer INLINE void
ldns_write_uint32(void * dst,uint32_t data)111df278fc2SJan Lentfer ldns_write_uint32(void *dst, uint32_t data)
112df278fc2SJan Lentfer {
113df278fc2SJan Lentfer #ifdef ALLOW_UNALIGNED_ACCESSES
114df278fc2SJan Lentfer * (uint32_t *) dst = htonl(data);
115df278fc2SJan Lentfer #else
116df278fc2SJan Lentfer uint8_t *p = (uint8_t *) dst;
117df278fc2SJan Lentfer p[0] = (uint8_t) ((data >> 24) & 0xff);
118df278fc2SJan Lentfer p[1] = (uint8_t) ((data >> 16) & 0xff);
119df278fc2SJan Lentfer p[2] = (uint8_t) ((data >> 8) & 0xff);
120df278fc2SJan Lentfer p[3] = (uint8_t) (data & 0xff);
121df278fc2SJan Lentfer #endif
122df278fc2SJan Lentfer }
123df278fc2SJan Lentfer
124df278fc2SJan Lentfer /* warning. */
125df278fc2SJan Lentfer INLINE void
ldns_write_uint64_as_uint48(void * dst,uint64_t data)126df278fc2SJan Lentfer ldns_write_uint64_as_uint48(void *dst, uint64_t data)
127df278fc2SJan Lentfer {
128df278fc2SJan Lentfer uint8_t *p = (uint8_t *) dst;
129df278fc2SJan Lentfer p[0] = (uint8_t) ((data >> 40) & 0xff);
130df278fc2SJan Lentfer p[1] = (uint8_t) ((data >> 32) & 0xff);
131df278fc2SJan Lentfer p[2] = (uint8_t) ((data >> 24) & 0xff);
132df278fc2SJan Lentfer p[3] = (uint8_t) ((data >> 16) & 0xff);
133df278fc2SJan Lentfer p[4] = (uint8_t) ((data >> 8) & 0xff);
134df278fc2SJan Lentfer p[5] = (uint8_t) (data & 0xff);
135df278fc2SJan Lentfer }
136df278fc2SJan Lentfer
137df278fc2SJan Lentfer
138df278fc2SJan Lentfer /**
139df278fc2SJan Lentfer * Structure to do a Schwartzian-like transformation, for instance when
140df278fc2SJan Lentfer * sorting. If you need a transformation on the objects that are sorted,
141df278fc2SJan Lentfer * you can sue this to store the transformed values, so you do not
142df278fc2SJan Lentfer * need to do the transformation again for each comparison
143df278fc2SJan Lentfer */
144df278fc2SJan Lentfer struct ldns_schwartzian_compare_struct {
145df278fc2SJan Lentfer void *original_object;
146df278fc2SJan Lentfer void *transformed_object;
147df278fc2SJan Lentfer };
148df278fc2SJan Lentfer
149df278fc2SJan Lentfer /** A general purpose lookup table
150df278fc2SJan Lentfer *
151df278fc2SJan Lentfer * Lookup tables are arrays of (id, name) pairs,
152df278fc2SJan Lentfer * So you can for instance lookup the RCODE 3, which is "NXDOMAIN",
153df278fc2SJan Lentfer * and vice versa. The lookup tables themselves are defined wherever needed,
154df278fc2SJan Lentfer * for instance in \ref host2str.c
155df278fc2SJan Lentfer */
156df278fc2SJan Lentfer struct ldns_struct_lookup_table {
157df278fc2SJan Lentfer int id;
158df278fc2SJan Lentfer const char *name;
159df278fc2SJan Lentfer };
160df278fc2SJan Lentfer typedef struct ldns_struct_lookup_table ldns_lookup_table;
161df278fc2SJan Lentfer
162df278fc2SJan Lentfer /**
163df278fc2SJan Lentfer * Looks up the table entry by name, returns NULL if not found.
164df278fc2SJan Lentfer * \param[in] table the lookup table to search in
165df278fc2SJan Lentfer * \param[in] name what to search for
166df278fc2SJan Lentfer * \return the item found
167df278fc2SJan Lentfer */
168df278fc2SJan Lentfer ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[],
169df278fc2SJan Lentfer const char *name);
170df278fc2SJan Lentfer
171df278fc2SJan Lentfer /**
172df278fc2SJan Lentfer * Looks up the table entry by id, returns NULL if not found.
173df278fc2SJan Lentfer * \param[in] table the lookup table to search in
174df278fc2SJan Lentfer * \param[in] id what to search for
175df278fc2SJan Lentfer * \return the item found
176df278fc2SJan Lentfer */
177df278fc2SJan Lentfer ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id);
178df278fc2SJan Lentfer
179df278fc2SJan Lentfer /**
180df278fc2SJan Lentfer * Returns the value of the specified bit
181df278fc2SJan Lentfer * The bits are counted from left to right, so bit #0 is the
182df278fc2SJan Lentfer * left most bit.
183df278fc2SJan Lentfer * \param[in] bits array holding the bits
184df278fc2SJan Lentfer * \param[in] index to the wanted bit
185df278fc2SJan Lentfer * \return
186df278fc2SJan Lentfer */
187df278fc2SJan Lentfer int ldns_get_bit(uint8_t bits[], size_t index);
188df278fc2SJan Lentfer
189df278fc2SJan Lentfer
190df278fc2SJan Lentfer /**
191df278fc2SJan Lentfer * Returns the value of the specified bit
192df278fc2SJan Lentfer * The bits are counted from right to left, so bit #0 is the
193df278fc2SJan Lentfer * right most bit.
194df278fc2SJan Lentfer * \param[in] bits array holding the bits
195df278fc2SJan Lentfer * \param[in] index to the wanted bit
196df278fc2SJan Lentfer * \return 1 or 0 depending no the bit state
197df278fc2SJan Lentfer */
198df278fc2SJan Lentfer int ldns_get_bit_r(uint8_t bits[], size_t index);
199df278fc2SJan Lentfer
200df278fc2SJan Lentfer /**
201df278fc2SJan Lentfer * sets the specified bit in the specified byte to
202df278fc2SJan Lentfer * 1 if value is true, 0 if false
203df278fc2SJan Lentfer * The bits are counted from right to left, so bit #0 is the
204df278fc2SJan Lentfer * right most bit.
205df278fc2SJan Lentfer * \param[in] byte the bit to set the bit in
206df278fc2SJan Lentfer * \param[in] bit_nr the bit to set (0 <= n <= 7)
207df278fc2SJan Lentfer * \param[in] value whether to set the bit to 1 or 0
208df278fc2SJan Lentfer * \return 1 or 0 depending no the bit state
209df278fc2SJan Lentfer */
210df278fc2SJan Lentfer void ldns_set_bit(uint8_t *byte, int bit_nr, bool value);
211df278fc2SJan Lentfer
212df278fc2SJan Lentfer /**
213df278fc2SJan Lentfer * Returns the value of a to the power of b
214df278fc2SJan Lentfer * (or 1 of b < 1)
215df278fc2SJan Lentfer */
216df278fc2SJan Lentfer /*@unused@*/
217df278fc2SJan Lentfer INLINE long
ldns_power(long a,long b)218df278fc2SJan Lentfer ldns_power(long a, long b) {
219df278fc2SJan Lentfer long result = 1;
220df278fc2SJan Lentfer while (b > 0) {
221df278fc2SJan Lentfer if (b & 1) {
222df278fc2SJan Lentfer result *= a;
223df278fc2SJan Lentfer if (b == 1) {
224df278fc2SJan Lentfer return result;
225df278fc2SJan Lentfer }
226df278fc2SJan Lentfer }
227df278fc2SJan Lentfer a *= a;
228df278fc2SJan Lentfer b /= 2;
229df278fc2SJan Lentfer }
230df278fc2SJan Lentfer return result;
231df278fc2SJan Lentfer }
232df278fc2SJan Lentfer
233df278fc2SJan Lentfer /**
234df278fc2SJan Lentfer * Returns the int value of the given (hex) digit
235df278fc2SJan Lentfer * \param[in] ch the hex char to convert
236df278fc2SJan Lentfer * \return the converted decimal value
237df278fc2SJan Lentfer */
238df278fc2SJan Lentfer int ldns_hexdigit_to_int(char ch);
239df278fc2SJan Lentfer
240df278fc2SJan Lentfer /**
241df278fc2SJan Lentfer * Returns the char (hex) representation of the given int
242df278fc2SJan Lentfer * \param[in] ch the int to convert
243df278fc2SJan Lentfer * \return the converted hex char
244df278fc2SJan Lentfer */
245df278fc2SJan Lentfer char ldns_int_to_hexdigit(int ch);
246df278fc2SJan Lentfer
247df278fc2SJan Lentfer /**
248df278fc2SJan Lentfer * Converts a hex string to binary data
249df278fc2SJan Lentfer *
250df278fc2SJan Lentfer * \param[out] data The binary result is placed here.
251df278fc2SJan Lentfer * At least strlen(str)/2 bytes should be allocated
252df278fc2SJan Lentfer * \param[in] str The hex string to convert.
253df278fc2SJan Lentfer * This string should not contain spaces
254df278fc2SJan Lentfer * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number
255df278fc2SJan Lentfer */
256df278fc2SJan Lentfer int
257df278fc2SJan Lentfer ldns_hexstring_to_data(uint8_t *data, const char *str);
258df278fc2SJan Lentfer
259df278fc2SJan Lentfer /**
260df278fc2SJan Lentfer * Show the internal library version
261df278fc2SJan Lentfer * \return a string with the version in it
262df278fc2SJan Lentfer */
263df278fc2SJan Lentfer const char * ldns_version(void);
264df278fc2SJan Lentfer
265df278fc2SJan Lentfer /**
266df278fc2SJan Lentfer * Convert TM to seconds since epoch (midnight, January 1st, 1970).
267df278fc2SJan Lentfer * Like timegm(3), which is not always available.
268df278fc2SJan Lentfer * \param[in] tm a struct tm* with the date
269df278fc2SJan Lentfer * \return the seconds since epoch
270df278fc2SJan Lentfer */
271675702c9SJohn Marino time_t ldns_mktime_from_utc(const struct tm *tm);
272675702c9SJohn Marino
273df278fc2SJan Lentfer time_t mktime_from_utc(const struct tm *tm);
274df278fc2SJan Lentfer
275df278fc2SJan Lentfer /**
276de9b0015SJan Lentfer * The function interprets time as the number of seconds since epoch
277*c1ccac55SAntonio Huete Jimenez * with respect to now using serial arithmetics (rfc1982).
278de9b0015SJan Lentfer * That number of seconds is then converted to broken-out time information.
27926c5a308Szrj * This is especially useful when converting the inception and expiration
280de9b0015SJan Lentfer * fields of RRSIG records.
281de9b0015SJan Lentfer *
282de9b0015SJan Lentfer * \param[in] time number of seconds since epoch (midnight, January 1st, 1970)
283*c1ccac55SAntonio Huete Jimenez * to be interpreted as a serial arithmetics number relative to now.
284de9b0015SJan Lentfer * \param[in] now number of seconds since epoch (midnight, January 1st, 1970)
285de9b0015SJan Lentfer * to which the time value is compared to determine the final value.
286de9b0015SJan Lentfer * \param[out] result the struct with the broken-out time information
287de9b0015SJan Lentfer * \return result on success or NULL on error
288de9b0015SJan Lentfer */
289*c1ccac55SAntonio Huete Jimenez struct tm * ldns_serial_arithmetics_gmtime_r(int32_t time, time_t now, struct tm *result);
290*c1ccac55SAntonio Huete Jimenez
291*c1ccac55SAntonio Huete Jimenez /* previously used wrong spelling */
292*c1ccac55SAntonio Huete Jimenez #define ldns_serial_arithmitics_gmtime_r ldns_serial_arithmetics_gmtime_r
293de9b0015SJan Lentfer
294de9b0015SJan Lentfer /**
295df278fc2SJan Lentfer * Seed the random function.
296df278fc2SJan Lentfer * If the file descriptor is specified, the random generator is seeded with
297df278fc2SJan Lentfer * data from that file. If not, /dev/urandom is used.
298df278fc2SJan Lentfer *
299df278fc2SJan Lentfer * applications should call this if they need entropy data within ldns
300df278fc2SJan Lentfer * If openSSL is available, it is automatically seeded from /dev/urandom
301df278fc2SJan Lentfer * or /dev/random.
302df278fc2SJan Lentfer *
303df278fc2SJan Lentfer * If you need more entropy, or have no openssl available, this function
304df278fc2SJan Lentfer * MUST be called at the start of the program
305df278fc2SJan Lentfer *
306df278fc2SJan Lentfer * If openssl *is* available, this function just adds more entropy
307df278fc2SJan Lentfer *
308df278fc2SJan Lentfer * \param[in] fd a file providing entropy data for the seed
309df278fc2SJan Lentfer * \param[in] size the number of bytes to use as entropy data. If this is 0,
310df278fc2SJan Lentfer * only the minimal amount is taken (usually 4 bytes)
311df278fc2SJan Lentfer * \return 0 if seeding succeeds, 1 if it fails
312df278fc2SJan Lentfer */
313df278fc2SJan Lentfer int ldns_init_random(FILE *fd, unsigned int size);
314df278fc2SJan Lentfer
315fcd4e566SJan Lentfer /**
316fcd4e566SJan Lentfer * Get random number.
317fcd4e566SJan Lentfer * \return random number.
318fcd4e566SJan Lentfer *
319fcd4e566SJan Lentfer */
320fcd4e566SJan Lentfer uint16_t ldns_get_random(void);
321df278fc2SJan Lentfer
322df278fc2SJan Lentfer /**
323df278fc2SJan Lentfer * Encode data as BubbleBabble
324df278fc2SJan Lentfer *
325df278fc2SJan Lentfer * \param[in] data a pointer to data to be encoded
326df278fc2SJan Lentfer * \param[in] len size the number of bytes of data
327df278fc2SJan Lentfer * \return a string of BubbleBabble
328df278fc2SJan Lentfer */
329df278fc2SJan Lentfer char *ldns_bubblebabble(uint8_t *data, size_t len);
330df278fc2SJan Lentfer
33126c5a308Szrj
ldns_time(time_t * t)33226c5a308Szrj INLINE time_t ldns_time(time_t *t) { return time(t); }
33326c5a308Szrj
33426c5a308Szrj
335df278fc2SJan Lentfer /**
336df278fc2SJan Lentfer * calculates the size needed to store the result of b32_ntop
337df278fc2SJan Lentfer */
338df278fc2SJan Lentfer /*@unused@*/
ldns_b32_ntop_calculate_size(size_t src_data_length)33926c5a308Szrj INLINE size_t ldns_b32_ntop_calculate_size(size_t src_data_length)
340df278fc2SJan Lentfer {
34126c5a308Szrj return src_data_length == 0 ? 0 : ((src_data_length - 1) / 5 + 1) * 8;
342df278fc2SJan Lentfer }
34326c5a308Szrj
ldns_b32_ntop_calculate_size_no_padding(size_t src_data_length)34426c5a308Szrj INLINE size_t ldns_b32_ntop_calculate_size_no_padding(size_t src_data_length)
34526c5a308Szrj {
34626c5a308Szrj return ((src_data_length + 3) * 8 / 5) - 4;
34726c5a308Szrj }
34826c5a308Szrj
34926c5a308Szrj int ldns_b32_ntop(const uint8_t* src_data, size_t src_data_length,
35026c5a308Szrj char* target_text_buffer, size_t target_text_buffer_size);
35126c5a308Szrj
35226c5a308Szrj int ldns_b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
35326c5a308Szrj char* target_text_buffer, size_t target_text_buffer_size);
35426c5a308Szrj
35526c5a308Szrj #if ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP
35626c5a308Szrj
35726c5a308Szrj int b32_ntop(const uint8_t* src_data, size_t src_data_length,
35826c5a308Szrj char* target_text_buffer, size_t target_text_buffer_size);
35926c5a308Szrj
36026c5a308Szrj int b32_ntop_extended_hex(const uint8_t* src_data, size_t src_data_length,
36126c5a308Szrj char* target_text_buffer, size_t target_text_buffer_size);
36226c5a308Szrj
36326c5a308Szrj #endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_NTOP */
36426c5a308Szrj
36526c5a308Szrj
366df278fc2SJan Lentfer /**
367df278fc2SJan Lentfer * calculates the size needed to store the result of b32_pton
368df278fc2SJan Lentfer */
369df278fc2SJan Lentfer /*@unused@*/
ldns_b32_pton_calculate_size(size_t src_text_length)37026c5a308Szrj INLINE size_t ldns_b32_pton_calculate_size(size_t src_text_length)
371df278fc2SJan Lentfer {
37226c5a308Szrj return src_text_length * 5 / 8;
373df278fc2SJan Lentfer }
374df278fc2SJan Lentfer
37526c5a308Szrj int ldns_b32_pton(const char* src_text, size_t src_text_length,
37626c5a308Szrj uint8_t* target_data_buffer, size_t target_data_buffer_size);
37726c5a308Szrj
37826c5a308Szrj int ldns_b32_pton_extended_hex(const char* src_text, size_t src_text_length,
37926c5a308Szrj uint8_t* target_data_buffer, size_t target_data_buffer_size);
38026c5a308Szrj
38126c5a308Szrj #if ! LDNS_BUILD_CONFIG_HAVE_B32_PTON
38226c5a308Szrj
38326c5a308Szrj int b32_pton(const char* src_text, size_t src_text_length,
38426c5a308Szrj uint8_t* target_data_buffer, size_t target_data_buffer_size);
38526c5a308Szrj
38626c5a308Szrj int b32_pton_extended_hex(const char* src_text, size_t src_text_length,
38726c5a308Szrj uint8_t* target_data_buffer, size_t target_data_buffer_size);
38826c5a308Szrj
38926c5a308Szrj #endif /* ! LDNS_BUILD_CONFIG_HAVE_B32_PTON */
39026c5a308Szrj
391675702c9SJohn Marino
392fcd4e566SJan Lentfer #ifdef __cplusplus
393fcd4e566SJan Lentfer }
394fcd4e566SJan Lentfer #endif
395fcd4e566SJan Lentfer
396df278fc2SJan Lentfer #endif /* !_UTIL_H */
397