diff options
author | irungentoo <irungentoo@gmail.com> | 2014-08-14 18:34:20 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-08-14 18:34:20 -0400 |
commit | ef78169842514d6f8507caebb7f791b9227812bf (patch) | |
tree | d5ec7da3921cd302e3f18cbcffc8022977db0e77 /toxcore/tox.h | |
parent | f0b2cd7ad2b6f8223161a6ed850c7bc6548dde62 (diff) |
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.
Diffstat (limited to 'toxcore/tox.h')
-rw-r--r-- | toxcore/tox.h | 35 |
1 files changed, 27 insertions, 8 deletions
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 | |||
622 | */ | 622 | */ |
623 | int tox_isconnected(const Tox *tox); | 623 | int tox_isconnected(const Tox *tox); |
624 | 624 | ||
625 | typedef struct { | ||
626 | /* | ||
627 | * The type of UDP socket created depends on ipv6enabled: | ||
628 | * If set to 0 (zero), creates an IPv4 socket which subsequently only allows | ||
629 | * IPv4 communication | ||
630 | * If set to anything else (default), creates an IPv6 socket which allows both IPv4 AND | ||
631 | * IPv6 communication | ||
632 | */ | ||
633 | uint8_t ipv6enabled; | ||
634 | |||
635 | /* Set to 1 to disable udp support. (default: 0) | ||
636 | This will force Tox to use TCP only which may slow things down. | ||
637 | Disabling udp support is necessary when using anonymous proxies or Tor.*/ | ||
638 | uint8_t udp_disabled; | ||
639 | |||
640 | /* Enable proxy support. (only basic TCP socks5 proxy currently supported.) (default: 0 (disabled))*/ | ||
641 | uint8_t proxy_enabled; | ||
642 | char proxy_address[256]; /* Proxy ip or domain in NULL terminated string format. */ | ||
643 | uint16_t proxy_port; /* Proxy port: in host byte order. */ | ||
644 | } Tox_Options; | ||
645 | |||
625 | /* | 646 | /* |
626 | * Run this function at startup. | 647 | * Run this function at startup. |
627 | * | 648 | * |
628 | * Initializes a tox structure | 649 | * Options are some options that can be passed to the Tox instance (see above struct). |
629 | * The type of communication socket depends on ipv6enabled: | ||
630 | * If set to 0 (zero), creates an IPv4 socket which subsequently only allows | ||
631 | * IPv4 communication | ||
632 | * If set to anything else, creates an IPv6 socket which allows both IPv4 AND | ||
633 | * IPv6 communication | ||
634 | * | 650 | * |
651 | * If options is NULL, tox_new() will use default settings. | ||
652 | * | ||
653 | * Initializes a tox structure | ||
635 | * return allocated instance of tox on success. | 654 | * return allocated instance of tox on success. |
636 | * return 0 if there are problems. | 655 | * return NULL on failure. |
637 | */ | 656 | */ |
638 | Tox *tox_new(uint8_t ipv6enabled); | 657 | Tox *tox_new(Tox_Options *options); |
639 | 658 | ||
640 | /* Run this before closing shop. | 659 | /* Run this before closing shop. |
641 | * Free all datastructures. */ | 660 | * Free all datastructures. */ |