forked from nmathewson/shim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
headers.h
35 lines (29 loc) · 1.01 KB
/
headers.h
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
#ifndef _HEADERS_H_
#define _HEADERS_H_
#include <sys/queue.h>
/* Use a list of strings to preserve any folding. */
struct val_line {
TAILQ_ENTRY(val_line) next;
size_t len;
char str[0];
};
TAILQ_HEAD(val_line_list, val_line);
struct header {
TAILQ_ENTRY(header) next;
size_t val_len;
struct val_line_list val;
char key[0];
};
TAILQ_HEAD(header_list, header);
struct evbuffer;
void headers_add_key(struct header_list *headers, const char *key, size_t n);
void headers_add_val(struct header_list *headers, const char *val, size_t n);
void headers_add_key_val(struct header_list *headers, const char *key,
const char *val);
void headers_dump(struct header_list *headers, struct evbuffer *buf);
int headers_load(struct header_list *headers, struct evbuffer *buf);
int headers_has_key(struct header_list *headers, const char *key);
char *headers_find(struct header_list *headers, const char *key);
int headers_remove(struct header_list *headers, const char *key);
void headers_clear(struct header_list *headers);
#endif