diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-06-25 15:18:14 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-06-25 19:56:11 +0000 |
commit | 56d249e5ad798f65a6cf97ecc9ae22b4c86ddf5b (patch) | |
tree | 737483763195e9993fbb739b2118a591f5e439a5 /toxcore/tox.h | |
parent | d22332dd505b5a269d379863a091d74522fce27b (diff) |
Add a MAX_HOSTNAME_LENGTH constant.
Fixes #946.
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/toxcore/tox.h b/toxcore/tox.h index 1b4ce7be..b71e1a02 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -332,6 +332,18 @@ uint32_t tox_file_id_length(void); | |||
332 | 332 | ||
333 | uint32_t tox_max_filename_length(void); | 333 | uint32_t tox_max_filename_length(void); |
334 | 334 | ||
335 | /** | ||
336 | * Maximum length of a hostname, e.g. proxy or bootstrap node names. | ||
337 | * | ||
338 | * This length includes the NUL byte. Hostnames are NUL-terminated C strings, so | ||
339 | * they are 255 characters plus one NUL byte. | ||
340 | * | ||
341 | * @deprecated The macro will be removed in 0.3.0. Use the function instead. | ||
342 | */ | ||
343 | #define TOX_MAX_HOSTNAME_LENGTH 256 | ||
344 | |||
345 | uint32_t tox_max_hostname_length(void); | ||
346 | |||
335 | 347 | ||
336 | /******************************************************************************* | 348 | /******************************************************************************* |
337 | * | 349 | * |
@@ -551,8 +563,8 @@ struct Tox_Options { | |||
551 | * The IP address or DNS name of the proxy to be used. | 563 | * The IP address or DNS name of the proxy to be used. |
552 | * | 564 | * |
553 | * If used, this must be non-NULL and be a valid DNS name. The name must not | 565 | * If used, this must be non-NULL and be a valid DNS name. The name must not |
554 | * exceed 255 characters, and be in a NUL-terminated C string format | 566 | * exceed TOX_MAX_HOSTNAME_LENGTH characters, and be in a NUL-terminated C string |
555 | * (255 chars + 1 NUL byte). | 567 | * format (TOX_MAX_HOSTNAME_LENGTH includes the NUL byte). |
556 | * | 568 | * |
557 | * This member is ignored (it can be NULL) if proxy_type is TOX_PROXY_TYPE_NONE. | 569 | * This member is ignored (it can be NULL) if proxy_type is TOX_PROXY_TYPE_NONE. |
558 | * | 570 | * |
@@ -913,7 +925,8 @@ typedef enum TOX_ERR_BOOTSTRAP { | |||
913 | * This function will attempt to connect to the node using UDP. You must use | 925 | * This function will attempt to connect to the node using UDP. You must use |
914 | * this function even if Tox_Options.udp_enabled was set to false. | 926 | * this function even if Tox_Options.udp_enabled was set to false. |
915 | * | 927 | * |
916 | * @param address The hostname or IP address (IPv4 or IPv6) of the node. | 928 | * @param address The hostname or IP address (IPv4 or IPv6) of the node. Must be |
929 | * at most TOX_MAX_HOSTNAME_LENGTH chars, including the NUL byte. | ||
917 | * @param port The port on the host on which the bootstrap Tox instance is | 930 | * @param port The port on the host on which the bootstrap Tox instance is |
918 | * listening. | 931 | * listening. |
919 | * @param public_key The long term public key of the bootstrap node | 932 | * @param public_key The long term public key of the bootstrap node |