summaryrefslogtreecommitdiff
path: root/include/tipc.h
diff options
context:
space:
mode:
authorQuentin Aebischer <quentin.aebischer@usherbrooke.ca>2012-02-13 15:47:10 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2012-02-14 00:08:15 +0100
commit5f75e067a0883a7e4128fefb46b74b71b0928d27 (patch)
treef00b2d321347a8d2c4d9c653757191e97a796baf /include/tipc.h
parent167eb3e2028561ab2cc0f2b7b6ff9d24c56514f6 (diff)
downloadconntrack-tools-tipc.tar.gz
conntrackd: basic TIPC supporttipc
Basic implementation of a TIPC channel for the conntrackd daemon (successfully tested in NOTRACK and FTFW modes). TIPC is a protocol that allows applications in a cluster-based environment to communicate quickly and reliably with other applications in the cluster. It allows both unicast and multicast, reliable/unreliable and datagram/stream oriented communications. One of its main feature's of interest here is to provide sockets that communicates in a connectionless, yet reliable manner that guarantees delivery of every message sent over the network. This can be useful in the context of high-available, cluster-based firewalls where states propagation has to be both fast and reliable. So far, the results are encouraging, though more tests have to performed on different setups to enhance the implementation and track any bugs. An example config file can be found in the doc/sync/ directory of the conntrack-tools, along with a README file providing basic installation instructions. Signed-off-by: Quentin Aebischer <quentin.aebischer@usherbrooke.ca>
Diffstat (limited to 'include/tipc.h')
-rw-r--r--include/tipc.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/include/tipc.h b/include/tipc.h
new file mode 100644
index 0000000..840eae0
--- /dev/null
+++ b/include/tipc.h
@@ -0,0 +1,59 @@
+#ifndef _TIPC_H_
+#define _TIPC_H_
+
+#include <stdint.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <linux/tipc.h>
+
+/* TODO: no buffer tuning supported. */
+
+struct tipc_conf {
+ int ipproto;
+ int msgImportance;
+ struct {
+ uint32_t type;
+ uint32_t instance;
+ } client;
+ struct {
+ uint32_t type;
+ uint32_t instance;
+ } server;
+};
+
+struct tipc_stats {
+#ifdef CTD_TIPC_DEBUG
+ uint64_t returned_messages; /* used for debug purposes */
+#endif
+ uint64_t bytes;
+ uint64_t messages;
+ uint64_t error;
+};
+
+struct tipc_sock {
+ int fd;
+ struct sockaddr_tipc addr;
+ socklen_t sockaddr_len;
+ struct tipc_stats stats;
+};
+
+struct tipc_sock *tipc_server_create(struct tipc_conf *conf);
+void tipc_server_destroy(struct tipc_sock *m);
+
+struct tipc_sock *tipc_client_create(struct tipc_conf *conf);
+void tipc_client_destroy(struct tipc_sock *m);
+
+ssize_t tipc_send(struct tipc_sock *m, const void *data, int size);
+ssize_t tipc_recv(struct tipc_sock *m, void *data, int size);
+
+int tipc_get_fd(struct tipc_sock *m);
+int tipc_isset(struct tipc_sock *m, fd_set *readfds);
+
+int tipc_snprintf_stats(char *buf, size_t buflen, char *ifname,
+ struct tipc_stats *s, struct tipc_stats *r);
+
+int tipc_snprintf_stats2(char *buf, size_t buflen, const char *ifname,
+ const char *status, int active,
+ struct tipc_stats *s, struct tipc_stats *r);
+
+#endif