00001 #ifndef NET_HELPER_H
00002 #define NET_HELPER_H
00003
00017 struct nodeID;
00018
00025 struct nodeID *nodeid_dup(struct nodeID *s);
00026
00034 int nodeid_equal(const struct nodeID *s1, const struct nodeID *s2);
00035
00043 struct nodeID *create_node(const char *IPaddr, int port);
00044
00050 void nodeid_free(struct nodeID *s);
00051
00059 struct nodeID *net_helper_init(const char *IPaddr, int port);
00060
00066 void bind_msg_type (uint8_t msgtype);
00067
00077 int send_to_peer(const struct nodeID *from, struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size);
00078
00088 int recv_from_peer(const struct nodeID *local, struct nodeID **remote, uint8_t *buffer_ptr, int buffer_size);
00089
00090
00099 int wait4data(const struct nodeID *n, struct timeval *tout, fd_set *user_fds);
00100
00107 const char *node_addr(const struct nodeID *s);
00108
00116 struct nodeID *nodeid_undump(const uint8_t *b, int *len);
00117
00125 int nodeid_dump(uint8_t *b, const struct nodeID *s);
00126
00127 #endif