Revision 61a07891
som/net_helper-ml.c | ||
---|---|---|
4 | 4 |
* This is free software; see GPL.txt |
5 | 5 |
* |
6 | 6 |
*/ |
7 |
#include <netinet/in.h> |
|
8 |
#include <sys/uio.h> |
|
9 |
#include "util/udpSocket.h" |
|
10 |
#include <sys/socket.h> |
|
11 | 7 |
|
12 | 8 |
#include <event2/event.h> |
13 | 9 |
#include <arpa/inet.h> |
... | ... | |
267 | 263 |
} |
268 | 264 |
|
269 | 265 |
|
270 |
struct nodeID *net_helper_init(const char *IPaddr, int port,unsigned char msgtypes[], int msgtypes_len) {
|
|
266 |
struct nodeID *net_helper_init(const char *IPaddr, int port) { |
|
271 | 267 |
|
272 | 268 |
struct timeval tout = {1, 0}; |
273 | 269 |
base = event_base_new(); |
... | ... | |
294 | 290 |
|
295 | 291 |
register_Error_connection_cb(&connError_cb); |
296 | 292 |
register_Recv_connection_cb(&receive_conn_cb); |
297 |
for (i=0;i<msgtypes_len;i++) { |
|
298 |
register_Recv_data_cb(&recv_data_cb,msgtypes[i]); |
|
299 |
} |
|
300 | 293 |
init_messaging_layer(1,tout,port,IPaddr,0,NULL,&init_myNodeID_cb,base); |
301 | 294 |
while (me->connID<-1) { |
302 | 295 |
// event_base_once(base,-1, EV_TIMEOUT, &t_out_cb, NULL, &tout); |
... | ... | |
309 | 302 |
} |
310 | 303 |
|
311 | 304 |
|
305 |
void bind_msg_types (unsigned char msgtypes[], int msgtypes_len) { |
|
306 |
int i; |
|
307 |
for (i=0;i<msgtypes_len;i++) { |
|
308 |
register_Recv_data_cb(&recv_data_cb,msgtypes[i]); |
|
309 |
} |
|
310 |
} |
|
311 |
|
|
312 |
|
|
312 | 313 |
/** |
313 | 314 |
* Called by the application to send data to a remote peer |
314 | 315 |
* @param from |
Also available in: Unified diff