summaryrefslogtreecommitdiff
path: root/toxcore/ping_array.api.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-26 09:42:08 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-26 17:32:19 +0000
commita1035cf81494c3ab22c49b01788ca8ad933c5eb0 (patch)
treefee86f8751cc93eca9702fd50c3380483ff0f86a /toxcore/ping_array.api.h
parent64ddb7fff21e8cfcd197ba31bbb08ee6d3964c54 (diff)
Add some tests for `ping_array`.
No timeout test here yet, because we don't yet have the ability to manipulate time at will, so we would have to actually sleep.
Diffstat (limited to 'toxcore/ping_array.api.h')
-rw-r--r--toxcore/ping_array.api.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/toxcore/ping_array.api.h b/toxcore/ping_array.api.h
index 61021e24..74e2b002 100644
--- a/toxcore/ping_array.api.h
+++ b/toxcore/ping_array.api.h
@@ -22,10 +22,15 @@
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 23 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
24 */ 24 */
25#ifndef PING_ARRAY_H 25#ifndef C_TOXCORE_TOXCORE_PING_ARRAY_H
26#define PING_ARRAY_H 26#define C_TOXCORE_TOXCORE_PING_ARRAY_H
27 27
28#include "network.h" 28#include <stddef.h>
29#include <stdint.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
29%} 34%}
30 35
31class mono_Time { struct this; } 36class mono_Time { struct this; }
@@ -36,11 +41,11 @@ struct this;
36 41
37/** 42/**
38 * Initialize a Ping_Array. 43 * Initialize a Ping_Array.
39 * size represents the total size of the array and should be a power of 2.
40 * timeout represents the maximum timeout in seconds for the entry.
41 * 44 *
42 * return 0 on success. 45 * @param size represents the total size of the array and should be a power of 2.
43 * return -1 on failure. 46 * @param timeout represents the maximum timeout in seconds for the entry.
47 *
48 * @return 0 on success, -1 on failure.
44 */ 49 */
45static this new(uint32_t size, uint32_t timeout); 50static this new(uint32_t size, uint32_t timeout);
46 51
@@ -52,8 +57,7 @@ void kill();
52/** 57/**
53 * Add a data with length to the Ping_Array list and return a ping_id. 58 * Add a data with length to the Ping_Array list and return a ping_id.
54 * 59 *
55 * return ping_id on success. 60 * @return ping_id on success, 0 on failure.
56 * return 0 on failure.
57 */ 61 */
58uint64_t add(const mono_Time::this *mono_time, const uint8_t *data, uint32_t length); 62uint64_t add(const mono_Time::this *mono_time, const uint8_t *data, uint32_t length);
59 63
@@ -62,13 +66,16 @@ uint64_t add(const mono_Time::this *mono_time, const uint8_t *data, uint32_t len
62 * 66 *
63 * On success, copies the data into data of length, 67 * On success, copies the data into data of length,
64 * 68 *
65 * return length of data copied on success. 69 * @return length of data copied on success, -1 on failure.
66 * return -1 on failure.
67 */ 70 */
68int32_t check(const mono_Time::this *mono_time, uint8_t[length] data, uint64_t ping_id); 71int32_t check(const mono_Time::this *mono_time, uint8_t[length] data, uint64_t ping_id);
69 72
70} 73}
71 74
72%{ 75%{
76#ifdef __cplusplus
77} // extern "C"
73#endif 78#endif
79
80#endif // C_TOXCORE_TOXCORE_PING_ARRAY_H
74%} 81%}