summaryrefslogtreecommitdiff
path: root/core/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/network.h')
-rw-r--r--core/network.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/network.h b/core/network.h
index 47d9fff2..87f45978 100644
--- a/core/network.h
+++ b/core/network.h
@@ -99,18 +99,18 @@ typedef struct {
99/* Function to receive data, ip and port of sender is put into ip_port 99/* Function to receive data, ip and port of sender is put into ip_port
100 the packet data into data 100 the packet data into data
101 the packet length into length. */ 101 the packet length into length. */
102typedef int (*packet_handler_callback)(void * object, IP_Port ip_port, uint8_t *data, uint32_t len); 102typedef int (*packet_handler_callback)(void *object, IP_Port ip_port, uint8_t *data, uint32_t len);
103 103
104typedef struct { 104typedef struct {
105 packet_handler_callback function; 105 packet_handler_callback function;
106 void * object; 106 void *object;
107}Packet_Handles; 107} Packet_Handles;
108 108
109typedef struct { 109typedef struct {
110 Packet_Handles packethandlers[256]; 110 Packet_Handles packethandlers[256];
111 /* our UDP socket */ 111 /* our UDP socket */
112 int sock; 112 int sock;
113}Networking_Core; 113} Networking_Core;
114 114
115/* returns current time in milleseconds since the epoch. */ 115/* returns current time in milleseconds since the epoch. */
116uint64_t current_time(void); 116uint64_t current_time(void);
@@ -125,10 +125,10 @@ uint32_t random_int(void);
125int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length); 125int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length);
126 126
127/* Function to call when packet beginning with byte is received */ 127/* Function to call when packet beginning with byte is received */
128void networking_registerhandler(Networking_Core * net, uint8_t byte, packet_handler_callback cb, void * object); 128void networking_registerhandler(Networking_Core *net, uint8_t byte, packet_handler_callback cb, void *object);
129 129
130/* call this several times a second */ 130/* call this several times a second */
131void networking_poll(Networking_Core * net); 131void networking_poll(Networking_Core *net);
132 132
133/* initialize networking 133/* initialize networking
134 bind to ip and port 134 bind to ip and port
@@ -136,10 +136,10 @@ void networking_poll(Networking_Core * net);
136 port is in host byte order (this means don't worry about it) 136 port is in host byte order (this means don't worry about it)
137 returns 0 if no problems 137 returns 0 if no problems
138 returns -1 if there were problems */ 138 returns -1 if there were problems */
139Networking_Core * new_networking(IP ip, uint16_t port); 139Networking_Core *new_networking(IP ip, uint16_t port);
140 140
141/* function to cleanup networking stuff(doesn't do much right now) */ 141/* function to cleanup networking stuff(doesn't do much right now) */
142void kill_networking(Networking_Core * net); 142void kill_networking(Networking_Core *net);
143 143
144/* 144/*
145 resolve_addr(): 145 resolve_addr():