diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-04-16 17:55:00 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-04-16 17:55:00 +0000 |
commit | ad31f852c3454136bdbfeb7f222cb9c175f13c1c (patch) | |
tree | 67bbd2dbec77205ccfd2c950b8cbeefe65f2c67e /daemon/include/buffer.h | |
parent | 13e6cab49dc2716c3e58eda12eed2fbab24be59b (diff) | |
download | conntrack-tools-ad31f852c3454136bdbfeb7f222cb9c175f13c1c.tar.gz conntrack-tools-ad31f852c3454136bdbfeb7f222cb9c175f13c1c.zip |
initial import of the conntrack daemon to Netfilter SVN
Diffstat (limited to 'daemon/include/buffer.h')
-rw-r--r-- | daemon/include/buffer.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/daemon/include/buffer.h b/daemon/include/buffer.h new file mode 100644 index 0000000..8d72dfb --- /dev/null +++ b/daemon/include/buffer.h @@ -0,0 +1,32 @@ +#ifndef _BUFFER_H_ +#define _BUFFER_H_ + +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <pthread.h> +#include "linux_list.h" + +struct buffer { + pthread_mutex_t lock; + size_t max_size; + size_t cur_size; + struct list_head head; +}; + +struct buffer_node { + struct list_head head; + size_t size; + char data[0]; +}; + +struct buffer *buffer_create(size_t max_size); +void buffer_destroy(struct buffer *b); +int buffer_add(struct buffer *b, const void *data, size_t size); +void buffer_del(struct buffer *b, void *data); +void __buffer_del(struct buffer *b, void *data); +void buffer_iterate(struct buffer *b, + void *data, + int (*iterate)(void *data1, void *data2)); + +#endif |