diff options
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h index c17125a7..1f251085 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -354,6 +354,53 @@ void tox_set_nospam(Tox *tox, uint32_t nospam); | |||
354 | if the pointer is NULL, no data will be copied to it.*/ | 354 | if the pointer is NULL, no data will be copied to it.*/ |
355 | void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key); | 355 | void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key); |
356 | 356 | ||
357 | /* Maximum size of custom packets. */ | ||
358 | #define TOX_MAX_CUSTOM_PACKET_SIZE 1373 | ||
359 | |||
360 | /* Set handlers for custom lossy packets. | ||
361 | * Set the function to be called when friend sends us a lossy packet starting with byte. | ||
362 | * byte must be in the 200-254 range. | ||
363 | * | ||
364 | * NOTE: lossy packets behave like UDP packets meaning they might never reach the other side | ||
365 | * or might arrive more than once (if someone is messing with the connection) or might arrive | ||
366 | * in the wrong order. | ||
367 | * | ||
368 | * Unless latency is an issue, it is recommended that you use lossless packets instead. | ||
369 | * | ||
370 | * return -1 on failure. | ||
371 | * return 0 on success. | ||
372 | */ | ||
373 | int tox_lossy_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, | ||
374 | int (*packet_handler_callback)(void *object, const uint8_t *data, uint32_t len), void *object); | ||
375 | |||
376 | /* Function to send custom lossy packets. | ||
377 | * First byte of data must be in the range: 200-254. | ||
378 | * | ||
379 | * return -1 on failure. | ||
380 | * return 0 on success. | ||
381 | */ | ||
382 | int tox_send_lossy_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length); | ||
383 | |||
384 | /* Set handlers for custom lossless packets. | ||
385 | * Set the function to be called when friend sends us a lossless packet starting with byte. | ||
386 | * byte must be in the 160-191 range. | ||
387 | * | ||
388 | * Lossless packets behave kind of like TCP (reliability, arrive in order.) but with packets instead of a stream. | ||
389 | * | ||
390 | * return -1 on failure. | ||
391 | * return 0 on success. | ||
392 | */ | ||
393 | int tox_lossless_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, | ||
394 | int (*packet_handler_callback)(void *object, const uint8_t *data, uint32_t len), void *object); | ||
395 | |||
396 | /* Function to send custom lossless packets. | ||
397 | * First byte of data must be in the range: 160-191. | ||
398 | * | ||
399 | * return -1 on failure. | ||
400 | * return 0 on success. | ||
401 | */ | ||
402 | int tox_send_lossless_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length); | ||
403 | |||
357 | /**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ | 404 | /**********GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change ************/ |
358 | 405 | ||
359 | /* Set the callback for group invites. | 406 | /* Set the callback for group invites. |