Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

parse.h File Reference

Go to the source code of this file.

Defines

#define LDNS_PARSE_SKIP_SPACE   "\f\n\r\v"
#define LDNS_PARSE_NORMAL   " \f\n\r\t\v"
#define LDNS_PARSE_NO_NL   " \t"
#define LDNS_MAX_LINELEN   4096
#define LDNS_MAX_KEYWORDLEN   32

Typedefs

typedef enum ldns_enum_directive ldns_directive

Enumerations

enum  ldns_enum_directive { LDNS_DIR_TTL, LDNS_DIR_ORIGIN, LDNS_DIR_INCLUDE }
 different type of directives in zone files We now deal with $TTL, $ORIGIN and $INCLUDE. More...

Functions

ssize_t ldns_fget_token (FILE *f, char *token, const char *delim, size_t limit)
 returns a token/char from the stream F.
ssize_t ldns_fget_token_l (FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
 returns a token/char from the stream F.
ssize_t ldns_fget_keyword_data (FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit)
ssize_t ldns_fget_keyword_data_l (FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr)
ssize_t ldns_bget_token (ldns_buffer *b, char *token, const char *delim, size_t limit)
 returns a token/char from the buffer b.
ssize_t ldns_bget_keyword_data (ldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del)
char * ldns_str_remove_comment (char *str)
 removes comments from a string.
int ldns_bgetc (ldns_buffer *buffer)
 returns the next character from a buffer.
void ldns_bskipcs (ldns_buffer *buffer, const char *s)
 skips all of the characters in the given string in the buffer, moving the position to the first character that is not in *s.
void ldns_fskipcs (FILE *fp, const char *s)
 skips all of the characters in the given string in the fp, moving the position to the first character that is not in *s.
void ldns_fskipcs_l (FILE *fp, const char *s, int *line_nr)
 skips all of the characters in the given string in the fp, moving the position to the first character that is not in *s.


Define Documentation

#define LDNS_MAX_KEYWORDLEN   32
 

Definition at line 20 of file parse.h.

#define LDNS_MAX_LINELEN   4096
 

Definition at line 19 of file parse.h.

#define LDNS_PARSE_NO_NL   " \t"
 

Definition at line 18 of file parse.h.

#define LDNS_PARSE_NORMAL   " \f\n\r\t\v"
 

Definition at line 17 of file parse.h.

#define LDNS_PARSE_SKIP_SPACE   "\f\n\r\v"
 

Definition at line 16 of file parse.h.


Typedef Documentation

typedef enum ldns_enum_directive ldns_directive
 

Definition at line 33 of file parse.h.


Enumeration Type Documentation

enum ldns_enum_directive
 

different type of directives in zone files We now deal with $TTL, $ORIGIN and $INCLUDE.

The latter is not implemented in ldns (yet)

Enumerator:
LDNS_DIR_TTL 
LDNS_DIR_ORIGIN 
LDNS_DIR_INCLUDE 

Definition at line 27 of file parse.h.


Function Documentation

ssize_t ldns_bget_keyword_data ldns_buffer b,
const char *  keyword,
const char *  k_del,
char *  data,
const char *  d_del
 

ssize_t ldns_bget_token ldns_buffer b,
char *  token,
const char *  delim,
size_t  limit
 

returns a token/char from the buffer b.

This function deals with ( and ) in the buffer, and ignores when it finds them.

Parameters:
[in] *b the buffer to read from
[out] *token the token is put here
[in] *delim chars at which the parsing should stop
[in] *limit how much to read. If 0 use builtin maximum
Returns:
0 on error of EOF of b otherwise return the length of what is read

int ldns_bgetc ldns_buffer buffer  ) 
 

returns the next character from a buffer.

Advances the position pointer with 1. When end of buffer is reached returns EOF. This is the buffer's equivalent for getc().

Parameters:
[in] *buffer buffer to read from
Returns:
EOF on failure otherwise return the character

void ldns_bskipcs ldns_buffer buffer,
const char *  s
 

skips all of the characters in the given string in the buffer, moving the position to the first character that is not in *s.

Parameters:
[in] *buffer buffer to use
[in] *s characters to skip
Returns:
void

ssize_t ldns_fget_keyword_data FILE *  f,
const char *  keyword,
const char *  k_del,
char *  data,
const char *  d_del,
size_t  data_limit
 

ssize_t ldns_fget_keyword_data_l FILE *  f,
const char *  keyword,
const char *  k_del,
char *  data,
const char *  d_del,
size_t  data_limit,
int *  line_nr
 

ssize_t ldns_fget_token FILE *  f,
char *  token,
const char *  delim,
size_t  limit
 

returns a token/char from the stream F.

This function deals with ( and ) in the stream, and ignores when it finds them.

Parameters:
[in] *f the file to read from
[out] *token the token is put here
[in] *delim chars at which the parsing should stop
[in] *limit how much to read. If 0 use builtin maximum
Returns:
0 on error of EOF of F otherwise return the length of what is read

ssize_t ldns_fget_token_l FILE *  f,
char *  token,
const char *  delim,
size_t  limit,
int *  line_nr
 

returns a token/char from the stream F.

This function deals with ( and ) in the stream, and ignores when it finds them.

Parameters:
[in] *f the file to read from
[out] *token the token is put here
[in] *delim chars at which the parsing should stop
[in] *limit how much to read. If 0 use builtin maximum
[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
Returns:
0 on error of EOF of F otherwise return the length of what is read

void ldns_fskipcs FILE *  fp,
const char *  s
 

skips all of the characters in the given string in the fp, moving the position to the first character that is not in *s.

Parameters:
[in] *fp file to use
[in] *s characters to skip
Returns:
void

void ldns_fskipcs_l FILE *  fp,
const char *  s,
int *  line_nr
 

skips all of the characters in the given string in the fp, moving the position to the first character that is not in *s.

Parameters:
[in] *fp file to use
[in] *s characters to skip
[in] line_nr pointer to an integer containing the current line number (for debugging purposes)
Returns:
void

char* ldns_str_remove_comment char *  str  ) 
 

removes comments from a string.

A comment = ';'. Goes on with this until a newline (
) is reached. The comments are replaces with spaces.

Parameters:
[in] str the string to remove the comments from. String must be writeable
Returns:
the new string


Generated on Tue Jan 24 02:22:27 2006 for ldns by  doxygen 1.4.4