FreeSWITCH API Documentation
1.7.0
|
#include <switch.h>
#include "../libs/miniupnpc/miniwget.h"
#include "../libs/miniupnpc/miniupnpc.h"
#include "../libs/miniupnpc/upnpcommands.h"
#include "../libs/miniupnpc/upnperrors.h"
#include "../libs/libnatpmp/natpmp.h"
Go to the source code of this file.
Data Structures | |
struct | nat_globals_t |
struct | nat_globals_perm_t |
Macros | |
#define | MULTICAST_BUFFSIZE 65536 |
#define | IP_LEN 16 |
#define | NAT_REFRESH_INTERVAL 900 |
Variables | |
static nat_globals_t | nat_globals |
static nat_globals_perm_t | nat_globals_perm |
static switch_bool_t | first_init = SWITCH_TRUE |
static switch_bool_t | initialized = SWITCH_FALSE |
switch_thread_t * | nat_thread_p = NULL |
#define IP_LEN 16 |
Definition at line 43 of file switch_nat.c.
Referenced by get_pmp_pubaddr(), switch_nat_add_mapping_upnp(), and switch_nat_del_mapping_upnp().
#define MULTICAST_BUFFSIZE 65536 |
Definition at line 42 of file switch_nat.c.
Referenced by switch_nat_multicast_runtime().
#define NAT_REFRESH_INTERVAL 900 |
Definition at line 44 of file switch_nat.c.
Referenced by switch_nat_late_init(), and SWITCH_STANDARD_SCHED_FUNC().
|
static |
Definition at line 147 of file switch_nat.c.
References IP_LEN, nat_globals_t::nat_type, SWITCH_CHANNEL_LOG, switch_copy_string(), SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_NAT_TYPE_PMP, SWITCH_POLL_ERROR, SWITCH_POLL_HUP, SWITCH_POLL_READ, and switch_wait_sock().
Referenced by init_pmp(), and switch_nat_multicast_runtime().
|
static |
Definition at line 71 of file switch_nat.c.
References nat_globals_t::data, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_GENERR, SWITCH_STATUS_SUCCESS, nat_globals_t::urls, and zstr_buf.
Referenced by init_upnp(), and switch_nat_multicast_runtime().
switch_status_t init_nat_monitor | ( | switch_memory_pool_t * | pool | ) |
Definition at line 220 of file switch_nat.c.
References nat_globals_perm_t::maddress, nat_globals_perm_t::msocket, nat_globals_t::nat_type, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, switch_log_printf(), switch_mcast_join(), SWITCH_NAT_TYPE_PMP, SWITCH_NAT_TYPE_UPNP, SWITCH_SO_NONBLOCK, SWITCH_SO_REUSEADDR, switch_sockaddr_info_get(), switch_socket_bind(), switch_socket_close(), switch_socket_create(), switch_socket_opt_set(), SWITCH_STATUS_SUCCESS, SWITCH_STATUS_TERM, SWITCH_UNSPEC, and TRUE.
Referenced by switch_nat_thread_start().
|
static |
Definition at line 205 of file switch_nat.c.
References get_pmp_pubaddr(), and nat_globals_t::pub_addr.
Referenced by switch_nat_init().
|
static |
Definition at line 86 of file switch_nat.c.
References nat_globals_t::data, nat_globals_t::descURL, get_upnp_pubaddr(), memset(), nat_globals_t::nat_type, nat_globals_t::pub_addr, SWITCH_CHANNEL_LOG, switch_core_get_variable(), SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_NAT_TYPE_UPNP, SWITCH_STATUS_SUCCESS, switch_stristr(), and nat_globals_t::urls.
Referenced by switch_nat_init().
switch_status_t switch_nat_add_mapping_internal | ( | switch_port_t | port, |
switch_nat_ip_proto_t | proto, | ||
switch_port_t * | external_port, | ||
switch_bool_t | sticky, | ||
switch_bool_t | publish | ||
) |
Definition at line 580 of file switch_nat.c.
References initialized, nat_globals_t::mapping, nat_globals_t::nat_type, SWITCH_CHANNEL_LOG, switch_event_add_header(), switch_event_add_header_string(), switch_event_create, switch_event_fire, SWITCH_EVENT_NAT, SWITCH_LOG_INFO, switch_log_printf(), switch_nat_add_mapping_pmp(), switch_nat_add_mapping_upnp(), SWITCH_NAT_TYPE_PMP, SWITCH_NAT_TYPE_UPNP, SWITCH_STACK_BOTTOM, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_nat_add_mapping(), and switch_nat_republish().
|
static |
Definition at line 444 of file switch_nat.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, switch_log_printf(), SWITCH_NAT_TCP, SWITCH_NAT_UDP, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_nat_add_mapping_internal().
|
static |
Definition at line 491 of file switch_nat.c.
References nat_globals_t::data, IP_LEN, nat_globals_t::pvt_addr, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_NAT_TCP, SWITCH_NAT_UDP, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and nat_globals_t::urls.
Referenced by switch_nat_add_mapping_internal().
|
static |
Definition at line 516 of file switch_nat.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_NAT_TCP, SWITCH_NAT_UDP, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_nat_del_mapping().
|
static |
Definition at line 553 of file switch_nat.c.
References nat_globals_t::data, IP_LEN, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_NAT_TCP, SWITCH_NAT_UDP, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and nat_globals_t::urls.
Referenced by switch_nat_del_mapping().
|
static |
Definition at line 266 of file switch_nat.c.
References buf, nat_globals_t::data, nat_globals_t::descURL, get_pmp_pubaddr(), get_upnp_pubaddr(), nat_globals_perm_t::maddress, memset(), nat_globals_perm_t::msocket, MULTICAST_BUFFSIZE, nat_globals_t::nat_type, nat_globals_t::pub_addr, nat_globals_perm_t::running, switch_assert, SWITCH_CHANNEL_LOG, switch_event_add_header_string(), switch_event_create, switch_event_fire, SWITCH_EVENT_TRAP, SWITCH_FALSE, SWITCH_LOG_DEBUG, SWITCH_LOG_INFO, switch_log_printf(), SWITCH_LOG_WARNING, switch_nat_reinit(), switch_nat_republish(), SWITCH_NAT_TYPE_UPNP, switch_safe_free, switch_set_string, switch_socket_recvfrom(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_IS_BREAK, SWITCH_STATUS_SUCCESS, SWITCH_TRUE, and switch_yield.
Referenced by switch_nat_thread_start().
void switch_nat_thread_start | ( | void | ) |
Definition at line 357 of file switch_nat.c.
References init_nat_monitor(), nat_thread_p, nat_globals_perm_t::pool, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), switch_nat_multicast_runtime(), SWITCH_STATUS_SUCCESS, switch_thread_create(), and switch_threadattr_create().
Referenced by switch_nat_init().
void switch_nat_thread_stop | ( | void | ) |
Definition at line 371 of file switch_nat.c.
References nat_thread_p, nat_globals_perm_t::running, SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, switch_log_printf(), SWITCH_LOG_WARNING, switch_thread_join(), and switch_yield.
Referenced by switch_nat_shutdown().
SWITCH_STANDARD_SCHED_FUNC | ( | switch_nat_republish_sched | ) |
Definition at line 700 of file switch_nat.c.
References NAT_REFRESH_INTERVAL, nat_globals_perm_t::running, switch_epoch_time_now(), and switch_nat_republish().
|
static |
Definition at line 68 of file switch_nat.c.
Referenced by switch_nat_init().
|
static |
Definition at line 69 of file switch_nat.c.
Referenced by switch_nat_add_mapping_internal(), switch_nat_init(), and switch_nat_is_initialized().
|
static |
Definition at line 57 of file switch_nat.c.
|
static |
Definition at line 66 of file switch_nat.c.
switch_thread_t* nat_thread_p = NULL |
Definition at line 355 of file switch_nat.c.
Referenced by switch_nat_init(), switch_nat_thread_start(), and switch_nat_thread_stop().