diff options
Diffstat (limited to 'ostp.d/init')
-rw-r--r-- | ostp.d/init/main.c (renamed from ostp.d/init/otd_init.c) | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/ostp.d/init/otd_init.c b/ostp.d/init/main.c index 4b899b4..08e020e 100644 --- a/ostp.d/init/otd_init.c +++ b/ostp.d/init/main.c @@ -27,11 +27,34 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include <net/listen.h> +#include <libostp/session.h> +#include <libostp/server.h> +#include <string.h> #include <stdio.h> +static int +blah(struct ostp_session *s, const char *buf, size_t len) +{ + printf("Got data!\n"); + return 0; +} + int main(void) { - return net_listen(); + struct ostp_listener l; + struct ostp_session s; + int error; + + listener_init(&l); + l.on_recv = blah; + + if ((error = listener_bind(&s, &l)) < 0) { + return error; + } + if ((error = listener_poll(&s, &l)) < 0) { + return error; + } + + return 0; } |