summaryrefslogtreecommitdiff
path: root/core/Lossless_UDP.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/Lossless_UDP.h')
-rw-r--r--core/Lossless_UDP.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h
index 6d0ee6a2..176e86ce 100644
--- a/core/Lossless_UDP.h
+++ b/core/Lossless_UDP.h
@@ -118,14 +118,14 @@ typedef struct {
118} Connection; 118} Connection;
119 119
120typedef struct { 120typedef struct {
121Networking_Core *net; 121 Networking_Core *net;
122Connection *connections; 122 Connection *connections;
123 123
124uint32_t connections_length; /* Length of connections array */ 124 uint32_t connections_length; /* Length of connections array */
125uint32_t connections_number; /* Number of connections in connections array */ 125 uint32_t connections_number; /* Number of connections in connections array */
126 126
127/* table of random numbers used in handshake_id. */ 127 /* table of random numbers used in handshake_id. */
128uint32_t randtable[6][256]; 128 uint32_t randtable[6][256];
129 129
130} Lossless_UDP; 130} Lossless_UDP;
131 131
@@ -135,66 +135,66 @@ uint32_t randtable[6][256];
135 * Return -1 if it could not initialize the connection. 135 * Return -1 if it could not initialize the connection.
136 * Return number if there already was an existing connection to that ip_port. 136 * Return number if there already was an existing connection to that ip_port.
137 */ 137 */
138int new_connection(Lossless_UDP * ludp, IP_Port ip_port); 138int new_connection(Lossless_UDP *ludp, IP_Port ip_port);
139 139
140/* 140/*
141 * Get connection id from IP_Port. 141 * Get connection id from IP_Port.
142 * Return -1 if there are no connections like we are looking for. 142 * Return -1 if there are no connections like we are looking for.
143 * Return id if it found it . 143 * Return id if it found it .
144 */ 144 */
145int getconnection_id(Lossless_UDP * ludp, IP_Port ip_port); 145int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port);
146 146
147/* 147/*
148 * Returns an int corresponding to the next connection in our imcoming connection list 148 * Returns an int corresponding to the next connection in our imcoming connection list
149 * Return -1 if there are no new incoming connections in the list. 149 * Return -1 if there are no new incoming connections in the list.
150 */ 150 */
151int incoming_connection(Lossless_UDP * ludp); 151int incoming_connection(Lossless_UDP *ludp);
152 152
153/* 153/*
154 * Return -1 if it could not kill the connection. 154 * Return -1 if it could not kill the connection.
155 * Return 0 if killed successfully 155 * Return 0 if killed successfully
156 */ 156 */
157int kill_connection(Lossless_UDP * ludp, int connection_id); 157int kill_connection(Lossless_UDP *ludp, int connection_id);
158 158
159/* 159/*
160 * Kill connection in seconds seconds. 160 * Kill connection in seconds seconds.
161 * Return -1 if it can not kill the connection. 161 * Return -1 if it can not kill the connection.
162 * Return 0 if it will kill it 162 * Return 0 if it will kill it
163 */ 163 */
164int kill_connection_in(Lossless_UDP * ludp, int connection_id, uint32_t seconds); 164int kill_connection_in(Lossless_UDP *ludp, int connection_id, uint32_t seconds);
165 165
166/* 166/*
167 * Returns the ip_port of the corresponding connection. 167 * Returns the ip_port of the corresponding connection.
168 * Return 0 if there is no such connection. 168 * Return 0 if there is no such connection.
169 */ 169 */
170IP_Port connection_ip(Lossless_UDP * ludp, int connection_id); 170IP_Port connection_ip(Lossless_UDP *ludp, int connection_id);
171 171
172/* 172/*
173 * Returns the id of the next packet in the queue 173 * Returns the id of the next packet in the queue
174 * Return -1 if no packet in queue 174 * Return -1 if no packet in queue
175 */ 175 */
176char id_packet(Lossless_UDP * ludp, int connection_id); 176char id_packet(Lossless_UDP *ludp, int connection_id);
177 177
178/* 178/*
179 * Return 0 if there is no received data in the buffer. 179 * Return 0 if there is no received data in the buffer.
180 * Return length of received packet if successful 180 * Return length of received packet if successful
181 */ 181 */
182int read_packet(Lossless_UDP * ludp, int connection_id, uint8_t *data); 182int read_packet(Lossless_UDP *ludp, int connection_id, uint8_t *data);
183 183
184/* 184/*
185 * Return 0 if data could not be put in packet queue 185 * Return 0 if data could not be put in packet queue
186 * Return 1 if data was put into the queue 186 * Return 1 if data was put into the queue
187 */ 187 */
188int write_packet(Lossless_UDP * ludp, int connection_id, uint8_t *data, uint32_t length); 188int write_packet(Lossless_UDP *ludp, int connection_id, uint8_t *data, uint32_t length);
189 189
190/* Returns the number of packets in the queue waiting to be successfully sent. */ 190/* Returns the number of packets in the queue waiting to be successfully sent. */
191uint32_t sendqueue(Lossless_UDP * ludp, int connection_id); 191uint32_t sendqueue(Lossless_UDP *ludp, int connection_id);
192 192
193/* 193/*
194 * returns the number of packets in the queue waiting to be successfully 194 * returns the number of packets in the queue waiting to be successfully
195 * read with read_packet(...) 195 * read with read_packet(...)
196 */ 196 */
197uint32_t recvqueue(Lossless_UDP * ludp, int connection_id); 197uint32_t recvqueue(Lossless_UDP *ludp, int connection_id);
198 198
199/* Check if connection is connected: 199/* Check if connection is connected:
200 * Return 0 no. 200 * Return 0 no.
@@ -203,17 +203,17 @@ uint32_t recvqueue(Lossless_UDP * ludp, int connection_id);
203 * Return 3 if fully connected. 203 * Return 3 if fully connected.
204 * Return 4 if timed out and wating to be killed. 204 * Return 4 if timed out and wating to be killed.
205 */ 205 */
206int is_connected(Lossless_UDP * ludp, int connection_id); 206int is_connected(Lossless_UDP *ludp, int connection_id);
207 207
208/* Call this function a couple times per second It's the main loop. */ 208/* Call this function a couple times per second It's the main loop. */
209void do_lossless_udp(Lossless_UDP * ludp); 209void do_lossless_udp(Lossless_UDP *ludp);
210 210
211/* 211/*
212 * This function sets up LosslessUDP packet handling. 212 * This function sets up LosslessUDP packet handling.
213 */ 213 */
214Lossless_UDP * new_lossless_udp(Networking_Core * net); 214Lossless_UDP *new_lossless_udp(Networking_Core *net);
215 215
216void kill_lossless_udp(Lossless_UDP * ludp); 216void kill_lossless_udp(Lossless_UDP *ludp);
217 217
218#ifdef __cplusplus 218#ifdef __cplusplus
219} 219}