summaryrefslogtreecommitdiff
path: root/include/channel.h
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-03-12 21:09:27 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-03-12 21:09:27 +0100
commit656d5ad7c69a5a7d356c6251743890f1eec0bb71 (patch)
tree46c7fe13a32382c556a51d258fab5b7bebe9cd77 /include/channel.h
parent56b484e3acc7205f0ebd71eec6905253eeace132 (diff)
downloadconntrack-tools-656d5ad7c69a5a7d356c6251743890f1eec0bb71.tar.gz
conntrack-tools-656d5ad7c69a5a7d356c6251743890f1eec0bb71.zip
sync-mode: add abstract layer to make daemon independent of multicast
This patch reworks conntrackd to make it independent of the protocol used to propagate state-changes. This patch adds the channel layer abstraction, this layer allows you to add support for different protocols like unicast UDP or TIPC. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/channel.h')
-rw-r--r--include/channel.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/include/channel.h b/include/channel.h
new file mode 100644
index 0000000..ac1a93c
--- /dev/null
+++ b/include/channel.h
@@ -0,0 +1,95 @@
+#ifndef _CHANNEL_H_
+#define _CHANNEL_H_
+
+#include "mcast.h"
+
+struct channel;
+struct nethdr;
+
+enum {
+ CHANNEL_MCAST,
+ CHANNEL_MAX,
+};
+
+struct mcast_channel {
+ struct mcast_sock *client;
+ struct mcast_sock *server;
+};
+
+#define CHANNEL_F_DEFAULT (1 << 0)
+#define CHANNEL_F_BUFFERED (1 << 1)
+#define CHANNEL_F_MAX (1 << 2)
+
+union channel_type_conf {
+ struct mcast_conf mcast;
+};
+
+struct channel_conf {
+ int channel_type;
+ char channel_ifname[IFNAMSIZ];
+ unsigned int channel_flags;
+ union channel_type_conf u;
+};
+
+struct nlif_handle;
+
+struct channel_ops {
+ void * (*open)(void *conf);
+ void (*close)(void *channel);
+ int (*send)(void *channel, const void *data, int len);
+ int (*recv)(void *channel, char *buf, int len);
+ int (*get_fd)(void *channel);
+ void (*stats)(struct channel *c, int fd);
+ void (*stats_extended)(struct channel *c, int active,
+ struct nlif_handle *h, int fd);
+};
+
+struct channel_buffer;
+
+struct channel {
+ int channel_type;
+ int channel_ifindex;
+ int channel_ifmtu;
+ unsigned int channel_flags;
+ struct channel_buffer *buffer;
+ struct channel_ops *ops;
+ void *data;
+};
+
+void channel_init(void);
+struct channel *channel_open(struct channel_conf *conf);
+void channel_close(struct channel *c);
+
+int channel_send(struct channel *c, const struct nethdr *net);
+int channel_send_flush(struct channel *c);
+int channel_recv(struct channel *c, char *buf, int size);
+
+int channel_get_fd(struct channel *c);
+void channel_stats(struct channel *c, int fd);
+void channel_stats_extended(struct channel *c, int active,
+ struct nlif_handle *h, int fd);
+
+#define MULTICHANNEL_MAX 4
+
+struct multichannel {
+ int channel_num;
+ struct channel *channel[MULTICHANNEL_MAX];
+ struct channel *current;
+};
+
+struct multichannel *multichannel_open(struct channel_conf *conf, int len);
+void multichannel_close(struct multichannel *m);
+
+int multichannel_send(struct multichannel *c, const struct nethdr *net);
+int multichannel_send_flush(struct multichannel *c);
+int multichannel_recv(struct multichannel *c, char *buf, int size);
+
+void multichannel_stats(struct multichannel *m, int fd);
+void multichannel_stats_extended(struct multichannel *m,
+ struct nlif_handle *h, int fd);
+
+int multichannel_get_ifindex(struct multichannel *m, int i);
+int multichannel_get_current_ifindex(struct multichannel *m);
+void multichannel_set_current_channel(struct multichannel *m, int i);
+
+#endif /* _CHANNEL_H_ */