mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
NAT traversal: move TOX_TRAVERSAL_TYPE into tox.h
This commit is contained in:
parent
55f0400ad4
commit
5f3dc97eef
|
@ -348,6 +348,28 @@ enum class PROXY_TYPE {
|
||||||
SOCKS5,
|
SOCKS5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of technology used to try to traverse a NAT.
|
||||||
|
*/
|
||||||
|
enum class TRAVERSAL_TYPE {
|
||||||
|
/**
|
||||||
|
* Don't use any particular technology.
|
||||||
|
*/
|
||||||
|
NONE,
|
||||||
|
/**
|
||||||
|
* Use UPnP technology.
|
||||||
|
*/
|
||||||
|
UPNP,
|
||||||
|
/**
|
||||||
|
* Use NAT-PMP technology.
|
||||||
|
*/
|
||||||
|
NATPMP,
|
||||||
|
/**
|
||||||
|
* Use both UPnP and NAT-PMP technologies.
|
||||||
|
*/
|
||||||
|
ALL,
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of savedata to create the Tox instance from.
|
* Type of savedata to create the Tox instance from.
|
||||||
*/
|
*/
|
||||||
|
@ -393,6 +415,11 @@ static class options {
|
||||||
*/
|
*/
|
||||||
bool udp_enabled;
|
bool udp_enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try to traverse a NAT.
|
||||||
|
*/
|
||||||
|
TRAVERSAL_TYPE traversal_type;
|
||||||
|
|
||||||
namespace proxy {
|
namespace proxy {
|
||||||
/**
|
/**
|
||||||
* Pass communications through a proxy.
|
* Pass communications through a proxy.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#ifndef MESSENGER_H
|
#ifndef MESSENGER_H
|
||||||
#define MESSENGER_H
|
#define MESSENGER_H
|
||||||
|
|
||||||
|
#include "tox.h"
|
||||||
#include "friend_requests.h"
|
#include "friend_requests.h"
|
||||||
#include "friend_connection.h"
|
#include "friend_connection.h"
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "tox.h"
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) /* Put win32 includes here */
|
#if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) /* Put win32 includes here */
|
||||||
#ifndef WINVER
|
#ifndef WINVER
|
||||||
|
@ -165,33 +166,6 @@ typedef struct {
|
||||||
}
|
}
|
||||||
IP_Port;
|
IP_Port;
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of technology used to try to traverse a NAT.
|
|
||||||
*/
|
|
||||||
typedef enum TOX_TRAVERSAL_TYPE {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Don't use any particular technology.
|
|
||||||
*/
|
|
||||||
TOX_TRAVERSAL_TYPE_NONE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use UPnP technology.
|
|
||||||
*/
|
|
||||||
TOX_TRAVERSAL_TYPE_UPNP,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use NAT-PMP technology.
|
|
||||||
*/
|
|
||||||
TOX_TRAVERSAL_TYPE_NATPMP,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use both UPnP and NAT-PMP technologies.
|
|
||||||
*/
|
|
||||||
TOX_TRAVERSAL_TYPE_ALL,
|
|
||||||
|
|
||||||
} TOX_TRAVERSAL_TYPE;
|
|
||||||
|
|
||||||
/* Does the IP6 struct a contain an IPv4 address in an IPv6 one? */
|
/* Does the IP6 struct a contain an IPv4 address in an IPv6 one? */
|
||||||
#define IPV6_IPV4_IN_V6(a) ((a.uint64[0] == 0) && (a.uint32[2] == htonl (0xffff)))
|
#define IPV6_IPV4_IN_V6(a) ((a.uint64[0] == 0) && (a.uint32[2] == htonl (0xffff)))
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,15 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TOX_DEFINED
|
||||||
|
typedef struct Messenger Tox;
|
||||||
|
|
||||||
#include "Messenger.h"
|
#include "Messenger.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include "../toxencryptsave/defines.h"
|
#include "../toxencryptsave/defines.h"
|
||||||
|
|
||||||
#define TOX_DEFINED
|
|
||||||
typedef struct Messenger Tox;
|
|
||||||
|
|
||||||
#include "tox.h"
|
#include "tox.h"
|
||||||
|
|
||||||
#define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}}
|
#define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "network.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -361,6 +360,34 @@ typedef enum TOX_PROXY_TYPE {
|
||||||
} TOX_PROXY_TYPE;
|
} TOX_PROXY_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of technology used to try to traverse a NAT.
|
||||||
|
*/
|
||||||
|
typedef enum TOX_TRAVERSAL_TYPE {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't use any particular technology.
|
||||||
|
*/
|
||||||
|
TOX_TRAVERSAL_TYPE_NONE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use UPnP technology.
|
||||||
|
*/
|
||||||
|
TOX_TRAVERSAL_TYPE_UPNP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use NAT-PMP technology.
|
||||||
|
*/
|
||||||
|
TOX_TRAVERSAL_TYPE_NATPMP,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use both UPnP and NAT-PMP technologies.
|
||||||
|
*/
|
||||||
|
TOX_TRAVERSAL_TYPE_ALL,
|
||||||
|
|
||||||
|
} TOX_TRAVERSAL_TYPE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of savedata to create the Tox instance from.
|
* Type of savedata to create the Tox instance from.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user