diff options
Diffstat (limited to 'core/Lossless_UDP.h')
-rw-r--r-- | core/Lossless_UDP.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h index 8bdeb43e..18224088 100644 --- a/core/Lossless_UDP.h +++ b/core/Lossless_UDP.h | |||
@@ -41,6 +41,10 @@ | |||
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. |
42 | int new_connection(IP_Port ip_port); | 42 | int new_connection(IP_Port ip_port); |
43 | 43 | ||
44 | //get connection id from IP_Port | ||
45 | //return -1 if there are no connections like we are looking for | ||
46 | //return id if it found it | ||
47 | int getconnection_id(IP_Port ip_port); | ||
44 | 48 | ||
45 | //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 |
46 | //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. |
@@ -51,20 +55,28 @@ int incoming_connection(); | |||
51 | //return 0 if killed successfully | 55 | //return 0 if killed successfully |
52 | int kill_connection(int connection_id); | 56 | int kill_connection(int connection_id); |
53 | 57 | ||
58 | //kill connection in seconds seconds. | ||
59 | //return -1 if it can not kill the connection. | ||
60 | //return 0 if it will kill it | ||
61 | int kill_connection_in(int connection_id, uint32_t seconds); | ||
54 | 62 | ||
55 | //returns the ip_port of the corresponding connection. | 63 | //returns the ip_port of the corresponding connection. |
56 | //return 0 if there is no such connection. | 64 | //return 0 if there is no such connection. |
57 | IP_Port connection_ip(int connection_id); | 65 | IP_Port connection_ip(int connection_id); |
58 | 66 | ||
67 | //returns the id of the next packet in the queue | ||
68 | //return -1 if no packet in queue | ||
69 | char id_packet(int connection_id); | ||
59 | 70 | ||
60 | //return 0 if there is no received data in the buffer. | 71 | //return 0 if there is no received data in the buffer. |
61 | //return length of recieved packet if successful | 72 | //return length of recieved packet if successful |
62 | int read_packet(int connection_id, char * data); | 73 | int read_packet(int connection_id, uint8_t * data); |
63 | 74 | ||
64 | 75 | ||
65 | //return 0 if data could not be put in packet queue | 76 | //return 0 if data could not be put in packet queue |
66 | //return 1 if data was put into the queue | 77 | //return 1 if data was put into the queue |
67 | int write_packet(int connection_id, char * data, uint32_t length); | 78 | int write_packet(int connection_id, uint8_t * data, uint32_t length); |
79 | |||
68 | 80 | ||
69 | 81 | ||
70 | //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. |
@@ -80,6 +92,7 @@ uint32_t recvqueue(int connection_id); | |||
80 | //return 1 if attempting handshake | 92 | //return 1 if attempting handshake |
81 | //return 2 if handshake is done | 93 | //return 2 if handshake is done |
82 | //return 3 if fully connected | 94 | //return 3 if fully connected |
95 | //return 4 if timed out and wating to be killed | ||
83 | int is_connected(int connection_id); | 96 | int is_connected(int connection_id); |
84 | 97 | ||
85 | 98 | ||
@@ -91,6 +104,6 @@ void doLossless_UDP(); | |||
91 | //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. |
92 | //Return 0 if packet is handled correctly. | 105 | //Return 0 if packet is handled correctly. |
93 | //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. |
94 | int LosslessUDP_handlepacket(char * packet, uint32_t length, IP_Port source); | 107 | int LosslessUDP_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); |
95 | 108 | ||
96 | #endif | 109 | #endif |