aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-07-21 21:37:03 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2012-07-21 21:37:03 +0200
commit83ddce2dcad62b7104585fd0d545aac897248329 (patch)
treea470c5c66a4f13b36f1259684f478b231623e117 /libglouglou
parenttodo++ (diff)
downloadglouglou-83ddce2dcad62b7104585fd0d545aac897248329.tar.xz
glouglou-83ddce2dcad62b7104585fd0d545aac897248329.zip
add libglouglou, for now only containing libglouglou.h, containing the
packet structure used to communicate between client and server
Diffstat (limited to 'libglouglou')
-rw-r--r--libglouglou/Makefile13
-rw-r--r--libglouglou/libglouglou.h50
2 files changed, 63 insertions, 0 deletions
diff --git a/libglouglou/Makefile b/libglouglou/Makefile
new file mode 100644
index 0000000..f1aa0ba
--- /dev/null
+++ b/libglouglou/Makefile
@@ -0,0 +1,13 @@
+PREFIX=/usr/local
+INCLUDEDIR=$(PREFIX)/include
+LIBNAME=libglouglou
+
+all:
+ @echo "$(LIBNAME) can only be installed, do"
+ @echo "sudo make install"
+
+install:
+ @echo "installation of $(LIBNAME)"
+ mkdir -p $(INCLUDEDIR)
+ install -m 0644 $(LIBNAME).h $(INCLUDEDIR)
+
diff --git a/libglouglou/libglouglou.h b/libglouglou/libglouglou.h
new file mode 100644
index 0000000..62d601c
--- /dev/null
+++ b/libglouglou/libglouglou.h
@@ -0,0 +1,50 @@
+#define PACKET_VERSION 1
+#define DNSNAME_MAX 20
+
+struct packet {
+ u_int8_t ver;
+ u_int8_t type;
+/* XXX nicer way for _SIZE ... ? */
+#define PACKET_NEWCONN 0
+#define PACKET_NEWCONN_SIZE (2 + sizeof((struct packet *)0)->pdat.newconn)
+#define PACKET_DELCONN 1
+#define PACKET_DELCONN_SIZE (2 + sizeof((struct packet *)0)->pdat.delconn)
+#define PACKET_DATA 2
+#define PACKET_DATA_SIZE (2 + sizeof((struct packet *)0)->pdat.data)
+#define PACKET_NAME 3
+#define PACKET_NAME_SIZE ((2 + sizeof((struct packet *)0)->pdat.name) - DNSNAME_MAX)
+
+ union {
+ struct newconn {
+ u_int16_t id;
+ u_int32_t src;
+ u_int32_t dst;
+ u_int8_t proto;
+ u_int8_t size;
+ } newconn;
+ struct delconn {
+ u_int16_t id;
+ } delconn;
+ struct data {
+ u_int16_t connid;
+ u_int8_t size;
+ } data;
+ struct name {
+ u_int32_t addr;
+ u_int8_t len;
+ u_char fqdn[DNSNAME_MAX];
+ } name;
+ } pdat;
+#define newconn_id pdat.newconn.id
+#define newconn_src pdat.newconn.src
+#define newconn_dst pdat.newconn.dst
+#define newconn_proto pdat.newconn.proto
+#define newconn_size pdat.newconn.size
+#define delconn_id pdat.delconn.id
+#define data_connid pdat.data.connid
+#define data_size pdat.data.size
+#define name_addr pdat.name.addr
+#define name_len pdat.name.len
+#define name_fqdn pdat.name.fqdn
+};
+