@@ -350,6 +350,24 @@ uint32_t tox_max_filename_length(void);
350350
351351uint32_t tox_max_hostname_length (void );
352352
353+ /**
354+ * Maximum length of a SOCKS5 proxy username in bytes.
355+ *
356+ * @deprecated The macro will be removed in 0.3.0. Use the function instead.
357+ */
358+ #define TOX_MAX_PROXY_SOCKS5_USERNAME_LENGTH 255
359+
360+ uint32_t tox_max_proxy_socks5_username_length (void );
361+
362+ /**
363+ * Maximum length of a SOCKS5 proxy password in bytes.
364+ *
365+ * @deprecated The macro will be removed in 0.3.0. Use the function instead.
366+ */
367+ #define TOX_MAX_PROXY_SOCKS5_PASSWORD_LENGTH 255
368+
369+ uint32_t tox_max_proxy_socks5_password_length (void );
370+
353371
354372/*******************************************************************************
355373 *
@@ -604,6 +622,54 @@ struct Tox_Options {
604622 uint16_t proxy_port ;
605623
606624
625+ /**
626+ * The username to use to connect to a SOCKS5 proxy.
627+ *
628+ * If set to NULL, the username/password authentication is disabled.
629+ *
630+ * This member is ignored (it can be NULL) if proxy_type is not
631+ * TOX_PROXY_TYPE_SOCKS5.
632+ *
633+ * The data pointed at by this member is owned by the user, so must
634+ * outlive the options object.
635+ */
636+ const uint8_t * proxy_socks5_username ;
637+
638+
639+ /**
640+ * The length of the username.
641+ *
642+ * Must be at most TOX_MAX_PROXY_SOCKS5_USERNAME_LENGTH.
643+ *
644+ * TODO(iphydf): this creates a pointless tox_options_set_proxy_socks5_username_length() function.
645+ */
646+ size_t proxy_socks5_username_length ;
647+
648+
649+ /**
650+ * The password to use to connect to a Socks proxy.
651+ *
652+ * If set to NULL, the username/password authentication is disabled.
653+ *
654+ * This member is ignored (it can be NULL) if proxy_type is not
655+ * TOX_PROXY_TYPE_SOCKS5.
656+ *
657+ * The data pointed at by this member is owned by the user, so must
658+ * outlive the options object.
659+ */
660+ const uint8_t * proxy_socks5_password ;
661+
662+
663+ /**
664+ * The length of the password.
665+ *
666+ * Must be at most TOX_MAX_PROXY_SOCKS5_PASSWORD_LENGTH.
667+ *
668+ * TODO(iphydf): this creates a pointless tox_options_set_proxy_socks5_password_length() function.
669+ */
670+ size_t proxy_socks5_password_length ;
671+
672+
607673 /**
608674 * The start port of the inclusive port range to attempt to use.
609675 *
@@ -662,6 +728,7 @@ struct Tox_Options {
662728
663729 /**
664730 * The length of the savedata.
731+ * TODO(iphydf): this creates a pointless tox_options_set_savedata_length() function.
665732 */
666733 size_t savedata_length ;
667734
@@ -718,6 +785,22 @@ uint16_t tox_options_get_proxy_port(const struct Tox_Options *options);
718785
719786void tox_options_set_proxy_port (struct Tox_Options * options , uint16_t port );
720787
788+ const uint8_t * tox_options_get_proxy_socks5_username (const struct Tox_Options * options );
789+
790+ void tox_options_set_proxy_socks5_username (struct Tox_Options * options , const uint8_t * username , size_t length );
791+
792+ size_t tox_options_get_proxy_socks5_username_length (const struct Tox_Options * options );
793+
794+ void tox_options_set_proxy_socks5_username_length (struct Tox_Options * options , size_t username_length );
795+
796+ const uint8_t * tox_options_get_proxy_socks5_password (const struct Tox_Options * options );
797+
798+ void tox_options_set_proxy_socks5_password (struct Tox_Options * options , const uint8_t * password , size_t length );
799+
800+ size_t tox_options_get_proxy_socks5_password_length (const struct Tox_Options * options );
801+
802+ void tox_options_set_proxy_socks5_password_length (struct Tox_Options * options , size_t password_length );
803+
721804uint16_t tox_options_get_start_port (const struct Tox_Options * options );
722805
723806void tox_options_set_start_port (struct Tox_Options * options , uint16_t start_port );
@@ -875,6 +958,20 @@ typedef enum TOX_ERR_NEW {
875958 */
876959 TOX_ERR_NEW_LOAD_BAD_FORMAT ,
877960
961+ /**
962+ * The proxy_socks5_username_length is zero or too long.
963+ *
964+ * TODO(iphydf): allow duplicate namespaces (e.g. PROXY).
965+ */
966+ TOX_ERR_NEW_PROXY_SOCKS5_BAD_USERNAME_LENGTH ,
967+
968+ /**
969+ * The proxy_socks5_password_length is zero or too long.
970+ *
971+ * TODO(iphydf): allow duplicate namespaces (e.g. PROXY).
972+ */
973+ TOX_ERR_NEW_PROXY_SOCKS5_BAD_PASSWORD_LENGTH ,
974+
878975} TOX_ERR_NEW ;
879976
880977
0 commit comments