diff options
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h index 1457a70b..f1b8b893 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -211,6 +211,11 @@ bool tox_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch); | |||
211 | #define TOX_PUBLIC_KEY_SIZE 32 | 211 | #define TOX_PUBLIC_KEY_SIZE 32 |
212 | 212 | ||
213 | /** | 213 | /** |
214 | * The size of a Tox Secret Key in bytes. | ||
215 | */ | ||
216 | #define TOX_SECRET_KEY_SIZE 32 | ||
217 | |||
218 | /** | ||
214 | * The size of a Tox address in bytes. Tox addresses are in the format | 219 | * The size of a Tox address in bytes. Tox addresses are in the format |
215 | * [Public Key (TOX_PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. | 220 | * [Public Key (TOX_PUBLIC_KEY_SIZE bytes)][nospam (4 bytes)][checksum (2 bytes)]. |
216 | * | 221 | * |
@@ -344,7 +349,7 @@ struct Tox_Options { | |||
344 | * | 349 | * |
345 | * This member is ignored (it can be NULL) if proxy_enabled is false. | 350 | * This member is ignored (it can be NULL) if proxy_enabled is false. |
346 | */ | 351 | */ |
347 | char *proxy_address; | 352 | const char *proxy_host; |
348 | 353 | ||
349 | /** | 354 | /** |
350 | * The port to use to connect to the proxy server. | 355 | * The port to use to connect to the proxy server. |
@@ -443,9 +448,9 @@ typedef enum TOX_ERR_NEW { | |||
443 | /** | 448 | /** |
444 | * proxy_type was invalid. | 449 | * proxy_type was invalid. |
445 | */ | 450 | */ |
446 | TOX_ERR_PROXY_TYPE, | 451 | TOX_ERR_NEW_PROXY_BAD_TYPE, |
447 | /** | 452 | /** |
448 | * proxy_type was valid but the proxy_address passed had an invalid format | 453 | * proxy_type was valid but the proxy_host passed had an invalid format |
449 | * or was NULL. | 454 | * or was NULL. |
450 | */ | 455 | */ |
451 | TOX_ERR_NEW_PROXY_BAD_HOST, | 456 | TOX_ERR_NEW_PROXY_BAD_HOST, |
@@ -454,7 +459,7 @@ typedef enum TOX_ERR_NEW { | |||
454 | */ | 459 | */ |
455 | TOX_ERR_NEW_PROXY_BAD_PORT, | 460 | TOX_ERR_NEW_PROXY_BAD_PORT, |
456 | /** | 461 | /** |
457 | * The proxy address passed could not be resolved. | 462 | * The proxy host passed could not be resolved. |
458 | */ | 463 | */ |
459 | TOX_ERR_NEW_PROXY_NOT_FOUND, | 464 | TOX_ERR_NEW_PROXY_NOT_FOUND, |
460 | /** | 465 | /** |
@@ -542,10 +547,10 @@ typedef enum TOX_ERR_BOOTSTRAP { | |||
542 | TOX_ERR_BOOTSTRAP_OK, | 547 | TOX_ERR_BOOTSTRAP_OK, |
543 | TOX_ERR_BOOTSTRAP_NULL, | 548 | TOX_ERR_BOOTSTRAP_NULL, |
544 | /** | 549 | /** |
545 | * The address could not be resolved to an IP address, or the IP address | 550 | * The host could not be resolved to an IP address, or the IP address |
546 | * passed was invalid. | 551 | * passed was invalid. |
547 | */ | 552 | */ |
548 | TOX_ERR_BOOTSTRAP_BAD_ADDRESS, | 553 | TOX_ERR_BOOTSTRAP_BAD_HOST, |
549 | /** | 554 | /** |
550 | * The port passed was invalid. The valid port range is (1, 65535). | 555 | * The port passed was invalid. The valid port range is (1, 65535). |
551 | */ | 556 | */ |
@@ -564,14 +569,14 @@ typedef enum TOX_ERR_BOOTSTRAP { | |||
564 | * also use the TCP connection when NAT hole punching is slow, and later switch | 569 | * also use the TCP connection when NAT hole punching is slow, and later switch |
565 | * to UDP if hole punching succeeds. | 570 | * to UDP if hole punching succeeds. |
566 | * | 571 | * |
567 | * @param address The hostname or IP address (IPv4 or IPv6) of the node. | 572 | * @param host The hostname or IP address (IPv4 or IPv6) of the node. |
568 | * @param port The port on the host on which the bootstrap Tox instance is | 573 | * @param port The port on the host on which the bootstrap Tox instance is |
569 | * listening. | 574 | * listening. |
570 | * @param public_key The long term public key of the bootstrap node | 575 | * @param public_key The long term public key of the bootstrap node |
571 | * (TOX_PUBLIC_KEY_SIZE bytes). | 576 | * (TOX_PUBLIC_KEY_SIZE bytes). |
572 | * @return true on success. | 577 | * @return true on success. |
573 | */ | 578 | */ |
574 | bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error); | 579 | bool tox_bootstrap(Tox *tox, const char *host, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error); |
575 | 580 | ||
576 | 581 | ||
577 | /** | 582 | /** |
@@ -581,13 +586,13 @@ bool tox_bootstrap(Tox *tox, const char *address, uint16_t port, const uint8_t * | |||
581 | * the same bootstrap node, or to add TCP relays without using them as | 586 | * the same bootstrap node, or to add TCP relays without using them as |
582 | * bootstrap nodes. | 587 | * bootstrap nodes. |
583 | * | 588 | * |
584 | * @param address The hostname or IP address (IPv4 or IPv6) of the TCP relay. | 589 | * @param host The hostname or IP address (IPv4 or IPv6) of the TCP relay. |
585 | * @param port The port on the host on which the TCP relay is listening. | 590 | * @param port The port on the host on which the TCP relay is listening. |
586 | * @param public_key The long term public key of the TCP relay | 591 | * @param public_key The long term public key of the TCP relay |
587 | * (TOX_PUBLIC_KEY_SIZE bytes). | 592 | * (TOX_PUBLIC_KEY_SIZE bytes). |
588 | * @return true on success. | 593 | * @return true on success. |
589 | */ | 594 | */ |
590 | bool tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8_t *public_key, | 595 | bool tox_add_tcp_relay(Tox *tox, const char *host, uint16_t port, const uint8_t *public_key, |
591 | TOX_ERR_BOOTSTRAP *error); | 596 | TOX_ERR_BOOTSTRAP *error); |
592 | 597 | ||
593 | 598 | ||
@@ -697,7 +702,7 @@ void tox_self_get_public_key(const Tox *tox, uint8_t *public_key); | |||
697 | /** | 702 | /** |
698 | * Copy the secret key from the Tox object. | 703 | * Copy the secret key from the Tox object. |
699 | * | 704 | * |
700 | * @param secret_key A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If | 705 | * @param secret_key A memory region of at least TOX_SECRET_KEY_SIZE bytes. If |
701 | * this parameter is NULL, this function has no effect. | 706 | * this parameter is NULL, this function has no effect. |
702 | */ | 707 | */ |
703 | void tox_self_get_secret_key(const Tox *tox, uint8_t *secret_key); | 708 | void tox_self_get_secret_key(const Tox *tox, uint8_t *secret_key); |
@@ -978,20 +983,20 @@ bool tox_friend_exists(const Tox *tox, uint32_t friend_number); | |||
978 | * Return the number of friends on the friend list. | 983 | * Return the number of friends on the friend list. |
979 | * | 984 | * |
980 | * This function can be used to determine how much memory to allocate for | 985 | * This function can be used to determine how much memory to allocate for |
981 | * tox_friend_list. | 986 | * tox_self_get_friend_list. |
982 | */ | 987 | */ |
983 | size_t tox_friend_list_size(const Tox *tox); | 988 | size_t tox_self_get_friend_list_size(const Tox *tox); |
984 | 989 | ||
985 | 990 | ||
986 | /** | 991 | /** |
987 | * Copy a list of valid friend numbers into an array. | 992 | * Copy a list of valid friend numbers into an array. |
988 | * | 993 | * |
989 | * Call tox_friend_list_size to determine the number of elements to allocate. | 994 | * Call tox_self_get_friend_list_size to determine the number of elements to allocate. |
990 | * | 995 | * |
991 | * @param list A memory region with enough space to hold the friend list. If | 996 | * @param list A memory region with enough space to hold the friend list. If |
992 | * this parameter is NULL, this function has no effect. | 997 | * this parameter is NULL, this function has no effect. |
993 | */ | 998 | */ |
994 | void tox_friend_get_list(const Tox *tox, uint32_t *list); | 999 | void tox_self_get_friend_list(const Tox *tox, uint32_t *list); |
995 | 1000 | ||
996 | 1001 | ||
997 | 1002 | ||
@@ -1096,7 +1101,7 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8 | |||
1096 | * tox_friend_get_status_message_size. | 1101 | * tox_friend_get_status_message_size. |
1097 | */ | 1102 | */ |
1098 | typedef void tox_friend_status_message_cb(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length, | 1103 | typedef void tox_friend_status_message_cb(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length, |
1099 | void *user_data); | 1104 | void *user_data); |
1100 | 1105 | ||
1101 | /** | 1106 | /** |
1102 | * Set the callback for the `friend_status_message` event. Pass NULL to unset. | 1107 | * Set the callback for the `friend_status_message` event. Pass NULL to unset. |
@@ -1155,7 +1160,7 @@ TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_ | |||
1155 | * tox_friend_get_connection_status on the passed friend_number. | 1160 | * tox_friend_get_connection_status on the passed friend_number. |
1156 | */ | 1161 | */ |
1157 | typedef void tox_friend_connection_status_cb(Tox *tox, uint32_t friend_number, TOX_CONNECTION connection_status, | 1162 | typedef void tox_friend_connection_status_cb(Tox *tox, uint32_t friend_number, TOX_CONNECTION connection_status, |
1158 | void *user_data); | 1163 | void *user_data); |
1159 | 1164 | ||
1160 | /** | 1165 | /** |
1161 | * Set the callback for the `friend_connection_status` event. Pass NULL to | 1166 | * Set the callback for the `friend_connection_status` event. Pass NULL to |
@@ -1655,7 +1660,7 @@ typedef enum TOX_ERR_FILE_SEND_CHUNK { | |||
1655 | /** | 1660 | /** |
1656 | * Packet queue is full. | 1661 | * Packet queue is full. |
1657 | */ | 1662 | */ |
1658 | TOX_ERR_FILE_SEND_CHUNK_QUEUE_FULL, | 1663 | TOX_ERR_FILE_SEND_CHUNK_SENDQ, |
1659 | /** | 1664 | /** |
1660 | * Position parameter was wrong. | 1665 | * Position parameter was wrong. |
1661 | */ | 1666 | */ |
@@ -1893,7 +1898,7 @@ bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uin | |||
1893 | * @param length The length of the packet data byte array. | 1898 | * @param length The length of the packet data byte array. |
1894 | */ | 1899 | */ |
1895 | typedef void tox_friend_lossless_packet_cb(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length, | 1900 | typedef void tox_friend_lossless_packet_cb(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length, |
1896 | void *user_data); | 1901 | void *user_data); |
1897 | 1902 | ||
1898 | /** | 1903 | /** |
1899 | * Set the callback for the `friend_lossless_packet` event. Pass NULL to unset. | 1904 | * Set the callback for the `friend_lossless_packet` event. Pass NULL to unset. |