summaryrefslogtreecommitdiff
path: root/lib/examples
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2010-09-29 15:52:39 +0200
committerLinus Nordberg <linus@nordu.net>2010-09-29 15:52:39 +0200
commitb10a02e5f3a7dd184ada869015e438e63bca52bf (patch)
tree70c74d012d2a89c1a1efefa5afc0787de0b84368 /lib/examples
parente2633633030e62994ca41ff62006e3e40517c73a (diff)
WIP -- connecting and sending a packet using libevent.
Diffstat (limited to 'lib/examples')
-rw-r--r--lib/examples/Makefile2
-rw-r--r--lib/examples/client.c12
2 files changed, 3 insertions, 11 deletions
diff --git a/lib/examples/Makefile b/lib/examples/Makefile
index a9876da..f9f2ee1 100644
--- a/lib/examples/Makefile
+++ b/lib/examples/Makefile
@@ -6,7 +6,7 @@ blocking.o: blocking.c blocking.h ../libradsec-base.h ../libradsec.h
$(CC) $(CFLAGS) -c -I .. $^
client: client.c ../libradsec.a ../libradsec.h ../libradsec-impl.h
- $(CC) $(CFLAGS) -o $@ $< -L /usr/lib/freeradius -lfreeradius-radius -L .. -lradsec -L /usr/local/lib -levent
+ $(CC) $(CFLAGS) -o $@ $< -L /usr/lib/freeradius -lfreeradius-radius -L .. -lradsec -L /usr/local/lib -levent_core
clean:
-rm *.o client
diff --git a/lib/examples/client.c b/lib/examples/client.c
index a6b7999..2304e49 100644
--- a/lib/examples/client.c
+++ b/lib/examples/client.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+#include <event2/event.h>
#include "../libradsec.h"
#include "../debug.h"
@@ -18,14 +19,13 @@ rsx_client (const char *srvname, int srvport)
struct rs_connection *conn;
struct rs_peer *server;
struct rs_packet *req;
- //struct rs_packet *resp;
if (rs_context_create (&h, "/usr/share/freeradius/dictionary"))
return NULL;
if (rs_conn_create (h, &conn))
return rs_conn_err_pop (conn);
- if (rs_conn_add_server (conn, &server, RS_CONN_TYPE_UDP, srvname, srvport))
+ if (rs_conn_add_server (conn, &server, RS_CONN_TYPE_TCP, srvname, srvport))
return rs_conn_err_pop (conn);
rs_server_set_timeout (server, 10);
rs_server_set_tries (server, 3);
@@ -38,14 +38,6 @@ rsx_client (const char *srvname, int srvport)
return rs_conn_err_pop (conn);
req = NULL;
-#if 0
- printf ("waiting for response\n");
- if (rs_packet_recv (conn, &resp))
- return rs_conn_err_pop (conn);
- printf ("got response\n");
- rs_dump_packet (resp);
-#endif
-
rs_conn_destroy (conn);
rs_context_destroy (h);
return 0;