aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/libglouglou.h
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-11-28 01:22:41 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2012-11-28 01:22:41 +0100
commit3cff3744d055ae7dab86944465d269db1ba375c7 (patch)
tree663180aa387d596b265d94bf966eb304dcda9bb8 /libglouglou/libglouglou.h
parentadd skeleton from ARCHITECTURE.txt (diff)
downloadglouglou-3cff3744d055ae7dab86944465d269db1ba375c7.tar.xz
glouglou-3cff3744d055ae7dab86944465d269db1ba375c7.zip
coded gg_server_start()
Diffstat (limited to 'libglouglou/libglouglou.h')
-rw-r--r--libglouglou/libglouglou.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/libglouglou/libglouglou.h b/libglouglou/libglouglou.h
index 4906bab..c8f1536 100644
--- a/libglouglou/libglouglou.h
+++ b/libglouglou/libglouglou.h
@@ -1,7 +1,15 @@
#define PACKET_VERSION 1
#define DNSNAME_MAX 20
-struct packet {
+struct gg_server {
+ struct event *ev;
+ int sock;
+};
+
+struct gg_client {
+};
+
+struct gg_packet {
u_int8_t ver;
u_int8_t type;
/* XXX nicer way for _SIZE ... ? */
@@ -48,16 +56,18 @@ struct packet {
#define name_fqdn pdat.name.fqdn
};
-struct gg_server *gg_server_start(char *ip, int port,
- int (*handle_conn)(struct gg_server *s, int client_id, struct sockaddr_in *addr),
- int (*handle_packet)(struct gg_server *s, struct gg_packet *p));
-int gg_server_send(struct gg_server *s, int client_id,
- struct gg_packet *p);
-void gg_server_stop(struct gg_server *s);
+struct gg_server *gg_server_start(struct event_base *, char *, int,
+ int (*handle_conn)(struct gg_server *, int, struct sockaddr_in *),
+ int (*handle_packet)(struct gg_server *, struct gg_packet *));
+int gg_server_send(struct gg_server *, int, struct gg_packet *);
+void gg_server_stop(struct gg_server *);
+
+struct gg_client *gg_client_connect(char *, int,
+ int (*handle_conn)(struct gg_client *, int),
+ int (*handle_packet)(struct gg_client *, struct gg_packet *));
+int gg_client_send(struct gg_client *, struct gg_packet *);
+void gg_client_disconnect(struct gg_client *);
-struct gg_client *gg_client_connect(char *ip, int port,
- int (*handle_conn)(struct gg_client *c, int status),
- int (*handle_packet)(struct gg_client *c,
- struct gg_packet *p));
-int gg_client_send(struct gg_client *c, struct gg_packet *p);
-void gg_client_disconnect(struct gg_client *c);
+void *xmalloc(size_t);
+void *xcalloc(size_t, size_t);
+void fd_nonblock(int);