diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-10 16:44:49 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-11 11:59:14 +0000 |
commit | 2fbed5b4c55ca92edbd436d4d0fa0a35506855c3 (patch) | |
tree | f9cee9b3eb13d47789ec0340a59ae105dce0a07a /toxcore/network.h | |
parent | c84daff5413c45fb9e87fa5dbb7ae228564cfd2f (diff) |
Move Networking_Core struct into the .c file.
To make it an abstract type everywhere except in network.c.
Diffstat (limited to 'toxcore/network.h')
-rw-r--r-- | toxcore/network.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/toxcore/network.h b/toxcore/network.h index 41d1307a..943030e5 100644 --- a/toxcore/network.h +++ b/toxcore/network.h | |||
@@ -303,20 +303,10 @@ int addr_resolve_or_parse_ip(const char *address, IP *to, IP *extra); | |||
303 | typedef int (*packet_handler_callback)(void *object, IP_Port ip_port, const uint8_t *data, uint16_t len, | 303 | typedef int (*packet_handler_callback)(void *object, IP_Port ip_port, const uint8_t *data, uint16_t len, |
304 | void *userdata); | 304 | void *userdata); |
305 | 305 | ||
306 | typedef struct { | 306 | typedef struct Networking_Core Networking_Core; |
307 | packet_handler_callback function; | ||
308 | void *object; | ||
309 | } Packet_Handles; | ||
310 | |||
311 | typedef struct { | ||
312 | Logger *log; | ||
313 | Packet_Handles packethandlers[256]; | ||
314 | 307 | ||
315 | Family family; | 308 | Family net_family(const Networking_Core *net); |
316 | uint16_t port; | 309 | uint16_t net_port(const Networking_Core *net); |
317 | /* Our UDP socket. */ | ||
318 | Socket sock; | ||
319 | } Networking_Core; | ||
320 | 310 | ||
321 | /* Run this before creating sockets. | 311 | /* Run this before creating sockets. |
322 | * | 312 | * |
@@ -415,6 +405,7 @@ int bind_to_port(Socket sock, int family, uint16_t port); | |||
415 | */ | 405 | */ |
416 | Networking_Core *new_networking(Logger *log, IP ip, uint16_t port); | 406 | Networking_Core *new_networking(Logger *log, IP ip, uint16_t port); |
417 | Networking_Core *new_networking_ex(Logger *log, IP ip, uint16_t port_from, uint16_t port_to, unsigned int *error); | 407 | Networking_Core *new_networking_ex(Logger *log, IP ip, uint16_t port_from, uint16_t port_to, unsigned int *error); |
408 | Networking_Core *new_networking_no_udp(Logger *log); | ||
418 | 409 | ||
419 | /* Function to cleanup networking stuff (doesn't do much right now). */ | 410 | /* Function to cleanup networking stuff (doesn't do much right now). */ |
420 | void kill_networking(Networking_Core *net); | 411 | void kill_networking(Networking_Core *net); |