2004-06-08 23:54:24 +00:00
|
|
|
#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);
|
|
|
|
|
|
2004-06-19 18:41:24 +00:00
|
|
|
#ifdef USE_TCP_SOCKETS
|
2004-06-08 23:54:24 +00:00
|
|
|
if (!(s = socket_server_new_ipv4(c->mainloop, INADDR_LOOPBACK, 4712)))
|
|
|
|
|
return -1;
|
2004-06-19 18:41:24 +00:00
|
|
|
#else
|
|
|
|
|
if (!(s = socket_server_new_unix(c->mainloop, "/tmp/polypsimple")))
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
2004-06-08 23:54:24 +00:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|