summaryrefslogtreecommitdiffstats
path: root/src/trans.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans.h')
-rw-r--r--src/trans.h46
1 files changed, 43 insertions, 3 deletions
diff --git a/src/trans.h b/src/trans.h
index e7c38bc..8916208 100644
--- a/src/trans.h
+++ b/src/trans.h
@@ -3,6 +3,7 @@
#define TRANS_H
#include <sys/ioctl.h>
+#include <stdlib.h>
struct trans_handle;
struct trans_msg;
@@ -40,14 +41,53 @@ struct trans_msg {
};
};
-int trans_init(struct trans_handle *h, trans_cb_t cb);
+/* public interface enum for tsnif_init function */
+enum {
+ TSNIF_TRANS_NL = 0x1,
+ TSNIF_TRANS_UDP_CLIENT = 0x2,
+ TSNIF_TRANS_UDP_SERVER = 0x4,
+ TSNIF_TRANS_TCP_CLIENT = 0x8,
+ TSNIF_TRANS_TCP_SERVER = 0x10,
+};
+
+typedef int (*init_t)(struct trans_handle *h, trans_cb_t cb);
+typedef int (*close_t)(struct trans_handle *h);
+typedef int (*process_t)(struct trans_handle *h);
+typedef int (*send_t)(struct trans_handle *h, struct trans_msg *msg);
+typedef int (*group_t)(struct trans_handle *h, int group);
+typedef int (*fd_t)(struct trans_handle *h);
+
+struct trans_layer {
+ init_t init;
+ close_t close;
+ process_t process;
+ send_t send;
+ group_t group;
+ fd_t fd;
+};
+
+int trans_init(struct trans_handle *h, trans_cb_t cb, int flags);
int trans_close(struct trans_handle *h);
int trans_process(struct trans_handle *h);
int trans_send(struct trans_handle *h, struct trans_msg *msg);
int trans_group(struct trans_handle *h, int group);
int trans_fd(struct trans_handle *h);
-/* TODO make CONFIG option and ifdef this place */
-#include "trans-libnl.h"
+struct trans_handle {
+ int flags;
+
+ trans_cb_t cb;
+ trans_cb_t cb_local;
+
+ /* nl */
+ struct nl_handle *sock;
+ int family;
+
+ /* udp */
+ int udp_socket;
+
+ /* tcp */
+ int tcp_socket;
+};
#endif /* !TRANS_H */