summaryrefslogtreecommitdiffstats
path: root/src/module-simple-protocol-tcp.c
blob: e71d71420c426c307ee11d963766e4a668267396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <assert.h>
#include <arpa/inet.h>

#include "module.h"
#include "socket-server.h"
#include "protocol-simple.h"

int module_init(struct core *c, struct module*m) {
    struct socket_server *s;
    assert(c && m);

    if (!(s = socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, 4712)))
        return -1;

    m->userdata = protocol_simple_new(c, s, PROTOCOL_SIMPLE_PLAYBACK);
    assert(m->userdata);
    return 0;
}

void module_done(struct core *c, struct module*m) {
    assert(c && m);

    protocol_simple_free(m->userdata);
}