Make sure we add headers in our tarballs
[shim.git] / util.h
blob3be96f690774893efe4c3883b74a789a840a682e
1 #ifndef _UTIL_H_
2 #define _UTIL_H_
4 #include <sys/queue.h>
5 #include <event2/util.h>
7 void *mem_calloc(size_t nmemb, size_t size);
8 void *mem_malloc(size_t size);
9 char *mem_strdup(const char *str);
10 char *mem_strdup_n(const char *str, size_t n);
11 void mem_free(void *buf);
13 struct token {
14 TAILQ_ENTRY(token) next;
15 char *token;
17 TAILQ_HEAD(token_list, token) token;
19 size_t tokenize(const char *buf, const char *sep, int lim,
20 struct token_list *tokens);
21 void token_list_clear(struct token_list *tokens);
23 ev_int64_t get_int(const char *buf, int base);
25 struct url {
26 char *scheme;
27 char *host;
28 int port;
29 char *path;
31 struct url *url_connect_tokenize(const char *str);
32 struct url *url_tokenize(const char *str);
33 void url_free(struct url *url);
35 struct sockaddr;
37 const char *format_addr(const struct sockaddr *addr);
38 const char *socket_error_string(evutil_socket_t s);
40 #endif