diff options
Diffstat (limited to 'core/Lossless_UDP.h')
-rw-r--r-- | core/Lossless_UDP.h | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h index 0f5bb119..a9f1bb15 100644 --- a/core/Lossless_UDP.h +++ b/core/Lossless_UDP.h | |||
@@ -1,26 +1,25 @@ | |||
1 | /* Lossless_UDP.h | 1 | /* Lossless_UDP.h |
2 | * | 2 | * |
3 | * An implementation of the Lossless_UDP protocol as seen in docs/Lossless_UDP.txt | 3 | * An implementation of the Lossless_UDP protocol as seen in docs/Lossless_UDP.txt |
4 | * | 4 | * |
5 | 5 | * Copyright (C) 2013 Tox project All Rights Reserved. | |
6 | Copyright (C) 2013 Tox project All Rights Reserved. | 6 | * |
7 | 7 | * This file is part of Tox. | |
8 | This file is part of Tox. | 8 | * |
9 | 9 | * Tox is free software: you can redistribute it and/or modify | |
10 | Tox is free software: you can redistribute it and/or modify | 10 | * it under the terms of the GNU General Public License as published by |
11 | it under the terms of the GNU General Public License as published by | 11 | * the Free Software Foundation, either version 3 of the License, or |
12 | the Free Software Foundation, either version 3 of the License, or | 12 | * (at your option) any later version. |
13 | (at your option) any later version. | 13 | * |
14 | 14 | * Tox is distributed in the hope that it will be useful, | |
15 | Tox is distributed in the hope that it will be useful, | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 | * GNU General Public License for more details. |
18 | GNU General Public License for more details. | 18 | * |
19 | 19 | * You should have received a copy of the GNU General Public License | |
20 | You should have received a copy of the GNU General Public License | 20 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. |
21 | along with Tox. If not, see <http://www.gnu.org/licenses/>. | 21 | * |
22 | 22 | */ | |
23 | */ | ||
24 | 23 | ||
25 | #ifndef LOSSLESS_UDP_H | 24 | #ifndef LOSSLESS_UDP_H |
26 | #define LOSSLESS_UDP_H | 25 | #define LOSSLESS_UDP_H |
@@ -34,8 +33,6 @@ extern "C" { | |||
34 | /* maximum length of the data in the data packets */ | 33 | /* maximum length of the data in the data packets */ |
35 | #define MAX_DATA_SIZE 1024 | 34 | #define MAX_DATA_SIZE 1024 |
36 | 35 | ||
37 | |||
38 | |||
39 | /* Functions */ | 36 | /* Functions */ |
40 | 37 | ||
41 | /* initialize a new connection to ip_port | 38 | /* initialize a new connection to ip_port |
@@ -53,7 +50,6 @@ int getconnection_id(IP_Port ip_port); | |||
53 | 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. */ |
54 | int incoming_connection(); | 51 | int incoming_connection(); |
55 | 52 | ||
56 | |||
57 | /* return -1 if it could not kill the connection. | 53 | /* return -1 if it could not kill the connection. |
58 | return 0 if killed successfully */ | 54 | return 0 if killed successfully */ |
59 | int kill_connection(int connection_id); | 55 | int kill_connection(int connection_id); |
@@ -75,21 +71,16 @@ char id_packet(int connection_id); | |||
75 | return length of received packet if successful */ | 71 | return length of received packet if successful */ |
76 | int read_packet(int connection_id, uint8_t * data); | 72 | int read_packet(int connection_id, uint8_t * data); |
77 | 73 | ||
78 | |||
79 | /* return 0 if data could not be put in packet queue | 74 | /* return 0 if data could not be put in packet queue |
80 | return 1 if data was put into the queue */ | 75 | return 1 if data was put into the queue */ |
81 | int write_packet(int connection_id, uint8_t * data, uint32_t length); | 76 | int write_packet(int connection_id, uint8_t * data, uint32_t length); |
82 | 77 | ||
83 | |||
84 | |||
85 | /* returns the number of packets in the queue waiting to be successfully sent. */ | 78 | /* returns the number of packets in the queue waiting to be successfully sent. */ |
86 | uint32_t sendqueue(int connection_id); | 79 | uint32_t sendqueue(int connection_id); |
87 | 80 | ||
88 | |||
89 | /* returns the number of packets in the queue waiting to be successfully read with read_packet(...) */ | 81 | /* returns the number of packets in the queue waiting to be successfully read with read_packet(...) */ |
90 | uint32_t recvqueue(int connection_id); | 82 | uint32_t recvqueue(int connection_id); |
91 | 83 | ||
92 | |||
93 | /* check if connection is connected | 84 | /* check if connection is connected |
94 | return 0 no. | 85 | return 0 no. |
95 | return 1 if attempting handshake | 86 | return 1 if attempting handshake |
@@ -98,7 +89,6 @@ uint32_t recvqueue(int connection_id); | |||
98 | return 4 if timed out and wating to be killed */ | 89 | return 4 if timed out and wating to be killed */ |
99 | int is_connected(int connection_id); | 90 | int is_connected(int connection_id); |
100 | 91 | ||
101 | |||
102 | /* Call this function a couple times per second | 92 | /* Call this function a couple times per second |
103 | It's the main loop. */ | 93 | It's the main loop. */ |
104 | void doLossless_UDP(); | 94 | void doLossless_UDP(); |