Tor  0.4.7.0-alpha-dev
Macros | Functions
kvline.h File Reference

Header for kvline.c. More...

Go to the source code of this file.

Macros

#define KV_QUOTED   (1u<<0)
 
#define KV_OMIT_KEYS   (1u<<1)
 
#define KV_OMIT_VALS   (1u<<2)
 
#define KV_QUOTED_QSTRING   (1u<<3)
 
#define KV_RAW   (1u<<4)
 

Functions

struct config_line_tkvline_parse (const char *line, unsigned flags)
 
char * kvline_encode (const struct config_line_t *line, unsigned flags)
 

Detailed Description

Header for kvline.c.

Definition in file kvline.h.

Function Documentation

◆ kvline_parse()

struct config_line_t* kvline_parse ( const char *  line,
unsigned  flags 
)

Decode a line containing a series of space-separated 'Key=Value' pairs, using the provided flags to decode it. Return a newly allocated list of pairs on success, or NULL on failure.

If KV_QUOTED is set in flags, then (double-)quoted values are allowed and handled as C strings. Otherwise, such values are not allowed.

If KV_OMIT_KEYS is set in flags, then values without keys are allowed. Otherwise, such values are not allowed.

If KV_OMIT_VALS is set in flags, then keys without values are allowed. Otherwise, such keys are not allowed. Mutually exclusive with KV_OMIT_KEYS.

If KV_QUOTED_QSTRING is set in flags, then double-quoted values are allowed and handled as QuotedStrings per qstring.c. Do not add new users of this flag.

KV_RAW is not supported.

Definition at line 199 of file kvline.c.