Skip to content
This repository
tree: 823e21aa12
Fetching contributors…

Cannot retrieve contributors at this time

file 57 lines (51 sloc) 2.009 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/*
* Part of DNS zone file validator `validns`.
*
* Copyright 2011, Anton Berezin <tobez@tobez.org>
* Modified BSD license.
* (See LICENSE file in the distribution.)
*
*/
#ifndef _TEXTPARSE_H_
#define _TEXTPARSE_H_

struct binary_data {
int length;
char *data;
};

struct binary_data compose_binary_data(const char *fmt, int tmp, ...);
/*
* Format:
* 1 - byte
* 2 - 16-bit, will convert to network byte order
* 4 - 32-bit, will convert to network byte order
* d - another binary structure, will incorporate its data
* b - another binary structure, will incorporate its data,
* and prepend the length as a byte (fatal error on overflow)
* B - another binary structure, will incorporate its data,
* and prepend the length as a 16-bit word in NBO,
* fatal error on overflow
* tmp : allocate temp storage if true, permanent if false
*
*/

int empty_line_or_comment(char *s);
char *skip_white_space(char *s);
char *extract_name(char **input, char *what);
char *extract_label(char **input, char *what, void *is_temporary);
long long extract_integer(char **input, char *what);
long extract_timevalue(char **input, char *what);
long long extract_timestamp(char **input, char *what);
int extract_ipv4(char **input, char *what, struct in_addr *addr);
int extract_ipv6(char **input, char *what, struct in6_addr *addr);
int extract_double(char **input, char *what, double *val, int skip_m);
struct binary_data extract_base32hex_binary_data(char **input, char *what);
struct binary_data extract_base64_binary_data(char **input, char *what);
struct binary_data extract_text(char **input, char *what);

#define EXTRACT_DONT_EAT_WHITESPACE 0
#define EXTRACT_EAT_WHITESPACE 1
struct binary_data extract_hex_binary_data(char **input, char *what, int eat_whitespace);
struct binary_data bad_binary_data(void);

/* for NSEC/NSEC3 sets */
struct binary_data new_set(void);
void add_bit_to_set(struct binary_data *set, int bit);
struct binary_data compressed_set(struct binary_data *set);

#endif
Something went wrong with that request. Please try again.