blob: bdb6935580d83d0213d13cde32fe9e47d178df5f (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "protocol-native.h"
struct protocol_native {
struct socket_server*server;
struct idxset *connection;
};
struct stream_info {
guint32_t tag;
union {
struct output_stream *output_stream;
struct input_stream *input_stream;
}
};
struct connection {
struct client *client;
struct serializer *serializer;
};
static void on_connection(struct socket_server *server, struct iochannel *io, void *userdata) {
struct protocol_native *p = userdata;
assert(server && io && p && p->server == server);
}
struct protocol_native* protocol_native(struct socket_server *server) {
struct protocol_native *p;
assert(server);
p = malloc(sizeof(struct protocol_native));
assert(p);
p->server = server;
socket_server_set_callback(p->server, callback, p);
return p;
}
void protocol_native_free(struct protocol_native *p) {
assert(p);
socket_server_free(p->server);
free(p);
}
|