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.h74
1 files changed, 37 insertions, 37 deletions
diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h
index ad8c545c..8a71bd68 100644
--- a/core/Lossless_UDP.h
+++ b/core/Lossless_UDP.h
@@ -28,82 +28,82 @@
28#include "network.h" 28#include "network.h"
29 29
30 30
31//maximum length of the data in the data packets 31/* maximum length of the data in the data packets */
32#define MAX_DATA_SIZE 1024 32#define MAX_DATA_SIZE 1024
33 33
34 34
35 35
36//Functions 36/* Functions */
37 37
38//initialize a new connection to ip_port 38/* initialize a new connection to ip_port
39//returns an integer corresponding to the connection id. 39 returns an integer corresponding to the connection id.
40//return -1 if it could not initialize the connection. 40 return -1 if it could not initialize the connection.
41//if there already was an existing connection to that ip_port return its number. 41 if there already was an existing connection to that ip_port return its number. */
42int new_connection(IP_Port ip_port); 42int new_connection(IP_Port ip_port);
43 43
44//get connection id from IP_Port 44/* get connection id from IP_Port
45//return -1 if there are no connections like we are looking for 45 return -1 if there are no connections like we are looking for
46//return id if it found it 46 return id if it found it */
47int getconnection_id(IP_Port ip_port); 47int getconnection_id(IP_Port ip_port);
48 48
49//returns an integer corresponding to the next connection in our imcoming connection list 49/* returns an integer corresponding to the next connection in our imcoming connection list
50//return -1 if there are no new incoming connections in the list. 50 return -1 if there are no new incoming connections in the list. */
51int incoming_connection(); 51int incoming_connection();
52 52
53 53
54//return -1 if it could not kill the connection. 54/* return -1 if it could not kill the connection.
55//return 0 if killed successfully 55 return 0 if killed successfully */
56int kill_connection(int connection_id); 56int kill_connection(int connection_id);
57 57
58//kill connection in seconds seconds. 58/* kill connection in seconds seconds.
59//return -1 if it can not kill the connection. 59 return -1 if it can not kill the connection.
60//return 0 if it will kill it 60 return 0 if it will kill it */
61int kill_connection_in(int connection_id, uint32_t seconds); 61int kill_connection_in(int connection_id, uint32_t seconds);
62 62
63//returns the ip_port of the corresponding connection. 63/* returns the ip_port of the corresponding connection.
64//return 0 if there is no such connection. 64 return 0 if there is no such connection. */
65IP_Port connection_ip(int connection_id); 65IP_Port connection_ip(int connection_id);
66 66
67//returns the id of the next packet in the queue 67/* returns the id of the next packet in the queue
68//return -1 if no packet in queue 68 return -1 if no packet in queue */
69char id_packet(int connection_id); 69char id_packet(int connection_id);
70 70
71//return 0 if there is no received data in the buffer. 71/* return 0 if there is no received data in the buffer.
72//return length of received packet if successful 72 return length of received packet if successful */
73int read_packet(int connection_id, uint8_t * data); 73int read_packet(int connection_id, uint8_t * data);
74 74
75 75
76//return 0 if data could not be put in packet queue 76/* return 0 if data could not be put in packet queue
77//return 1 if data was put into the queue 77 return 1 if data was put into the queue */
78int write_packet(int connection_id, uint8_t * data, uint32_t length); 78int write_packet(int connection_id, uint8_t * data, uint32_t length);
79 79
80 80
81 81
82//returns the number of packets in the queue waiting to be successfully sent. 82/* returns the number of packets in the queue waiting to be successfully sent. */
83uint32_t sendqueue(int connection_id); 83uint32_t sendqueue(int connection_id);
84 84
85 85
86//returns the number of packets in the queue waiting to be successfully read with read_packet(...) 86/* returns the number of packets in the queue waiting to be successfully read with read_packet(...) */
87uint32_t recvqueue(int connection_id); 87uint32_t recvqueue(int connection_id);
88 88
89 89
90//check if connection is connected 90/* check if connection is connected
91//return 0 no. 91 return 0 no.
92//return 1 if attempting handshake 92 return 1 if attempting handshake
93//return 2 if handshake is done 93 return 2 if handshake is done
94//return 3 if fully connected 94 return 3 if fully connected
95//return 4 if timed out and wating to be killed 95 return 4 if timed out and wating to be killed */
96int is_connected(int connection_id); 96int is_connected(int connection_id);
97 97
98 98
99//Call this function a couple times per second 99/* Call this function a couple times per second
100//It's the main loop. 100 It's the main loop. */
101void doLossless_UDP(); 101void doLossless_UDP();
102 102
103 103
104//if we receive a Lossless_UDP packet we call this function so it can be handled. 104/* if we receive a Lossless_UDP packet we call this function so it can be handled.
105//Return 0 if packet is handled correctly. 105 return 0 if packet is handled correctly.
106//return 1 if it didn't handle the packet or if the packet was shit. 106 return 1 if it didn't handle the packet or if the packet was shit. */
107int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); 107int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source);
108 108
109#endif 109#endif