From ef78169842514d6f8507caebb7f791b9227812bf Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 14 Aug 2014 18:34:20 -0400 Subject: Added disabling of UDP and basic SOCKS5 proxy support to public API. tox_new() now takes a Tox_Options struct as argument. If a NULL pointer is passed to that struct, defaults are used. --- toxcore/tox.h | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'toxcore/tox.h') diff --git a/toxcore/tox.h b/toxcore/tox.h index 8caa01e0..6cad6b10 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -622,20 +622,39 @@ int tox_bootstrap_from_address(Tox *tox, const char *address, uint8_t ipv6enable */ int tox_isconnected(const Tox *tox); +typedef struct { + /* + * The type of UDP socket created depends on ipv6enabled: + * If set to 0 (zero), creates an IPv4 socket which subsequently only allows + * IPv4 communication + * If set to anything else (default), creates an IPv6 socket which allows both IPv4 AND + * IPv6 communication + */ + uint8_t ipv6enabled; + + /* Set to 1 to disable udp support. (default: 0) + This will force Tox to use TCP only which may slow things down. + Disabling udp support is necessary when using anonymous proxies or Tor.*/ + uint8_t udp_disabled; + + /* Enable proxy support. (only basic TCP socks5 proxy currently supported.) (default: 0 (disabled))*/ + uint8_t proxy_enabled; + char proxy_address[256]; /* Proxy ip or domain in NULL terminated string format. */ + uint16_t proxy_port; /* Proxy port: in host byte order. */ +} Tox_Options; + /* * Run this function at startup. * - * Initializes a tox structure - * The type of communication socket depends on ipv6enabled: - * If set to 0 (zero), creates an IPv4 socket which subsequently only allows - * IPv4 communication - * If set to anything else, creates an IPv6 socket which allows both IPv4 AND - * IPv6 communication + * Options are some options that can be passed to the Tox instance (see above struct). * + * If options is NULL, tox_new() will use default settings. + * + * Initializes a tox structure * return allocated instance of tox on success. - * return 0 if there are problems. + * return NULL on failure. */ -Tox *tox_new(uint8_t ipv6enabled); +Tox *tox_new(Tox_Options *options); /* Run this before closing shop. * Free all datastructures. */ -- cgit v1.2.3