RTS API Documentation
1.10.11
|
Enumerations | |
enum | switch_nat_type_t { SWITCH_NAT_TYPE_NONE, SWITCH_NAT_TYPE_PMP, SWITCH_NAT_TYPE_UPNP } |
enum | switch_nat_ip_proto_t { SWITCH_NAT_UDP, SWITCH_NAT_TCP } |
Functions | |
const char * | switch_nat_get_type (void) |
void | switch_nat_init (switch_memory_pool_t *pool, switch_bool_t mapping) |
Initilize the NAT Traversal System. More... | |
void | switch_nat_late_init (void) |
Initilize the rest of the NAT Traversal System. More... | |
void | switch_nat_shutdown (void) |
Shuts down the NAT Traversal System. More... | |
char * | switch_nat_status (void) |
Returns a list of nat mappings and other status info. More... | |
void | switch_nat_republish (void) |
Republishes the nap mappings. More... | |
void | switch_nat_reinit (void) |
re-initializes NAT subsystem More... | |
void | switch_nat_set_mapping (switch_bool_t mapping) |
Update the setting if port mapping will be created. More... | |
switch_status_t | switch_nat_add_mapping (switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky) |
Maps a port through the NAT Traversal System. More... | |
switch_bool_t | switch_nat_is_initialized (void) |
Has the NAT subsystem been initialized. More... | |
switch_status_t | switch_nat_del_mapping (switch_port_t port, switch_nat_ip_proto_t proto) |
Deletes a NAT mapping. More... | |
Enumerator | |
---|---|
SWITCH_NAT_UDP | |
SWITCH_NAT_TCP |
Definition at line 47 of file switch_nat.h.
enum switch_nat_type_t |
Enumerator | |
---|---|
SWITCH_NAT_TYPE_NONE | |
SWITCH_NAT_TYPE_PMP | |
SWITCH_NAT_TYPE_UPNP |
Definition at line 41 of file switch_nat.h.
switch_status_t switch_nat_add_mapping | ( | switch_port_t | port, |
switch_nat_ip_proto_t | proto, | ||
switch_port_t * | external_port, | ||
switch_bool_t | sticky | ||
) |
Maps a port through the NAT Traversal System.
port | Internal port to map |
proto | Protocol |
external_port | [out] Mapped external port |
sticky | make the mapping permanent |
Definition at line 619 of file switch_nat.c.
References switch_nat_add_mapping_internal(), and SWITCH_TRUE.
Referenced by switch_core_media_choose_port().
switch_status_t switch_nat_del_mapping | ( | switch_port_t | port, |
switch_nat_ip_proto_t | proto | ||
) |
Deletes a NAT mapping.
proto | Protocol |
Definition at line 625 of file switch_nat.c.
References nat_globals_t::nat_type, switch_event_add_header(), switch_event_add_header_string(), switch_event_create, switch_event_fire, SWITCH_EVENT_NAT, switch_nat_del_mapping_pmp(), switch_nat_del_mapping_upnp(), SWITCH_NAT_TYPE_PMP, SWITCH_NAT_TYPE_UPNP, SWITCH_STACK_BOTTOM, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_deactivate_rtp().
const char* switch_nat_get_type | ( | void | ) |
void switch_nat_init | ( | switch_memory_pool_t * | pool, |
switch_bool_t | mapping | ||
) |
Initilize the NAT Traversal System.
pool | the memory pool to use for long term allocations |
Definition at line 399 of file switch_nat.c.
References nat_globals_t::descURL, first_init, init_pmp(), init_upnp(), initialized, nat_globals_t::mapping, memset(), nat_thread_p, nat_globals_t::nat_type, nat_globals_t::nat_type_str, pool, nat_globals_perm_t::pool, nat_globals_t::pub_addr, nat_globals_t::pvt_addr, SWITCH_CHANNEL_LOG, switch_core_set_variable(), SWITCH_FALSE, switch_find_local_ip(), SWITCH_LOG_DEBUG, SWITCH_LOG_INFO, switch_log_printf(), switch_nat_thread_start(), SWITCH_NAT_TYPE_PMP, switch_safe_free, SWITCH_TRUE, and nat_globals_t::urls.
Referenced by switch_core_init(), and switch_nat_reinit().
switch_bool_t switch_nat_is_initialized | ( | void | ) |
Has the NAT subsystem been initialized.
Definition at line 736 of file switch_nat.c.
References initialized.
void switch_nat_late_init | ( | void | ) |
Initilize the rest of the NAT Traversal System.
Definition at line 708 of file switch_nat.c.
References NAT_REFRESH_INTERVAL, nat_globals_perm_t::running, SSHF_OWN_THREAD, switch_epoch_time_now(), and switch_scheduler_add_task().
Referenced by switch_core_init().
void switch_nat_reinit | ( | void | ) |
re-initializes NAT subsystem
Definition at line 215 of file switch_nat.c.
References nat_globals_t::mapping, nat_globals_perm_t::pool, and switch_nat_init().
Referenced by switch_nat_multicast_runtime().
void switch_nat_republish | ( | void | ) |
Republishes the nap mappings.
Definition at line 652 of file switch_nat.c.
References switch_stream_handle::data, switch_api_execute(), SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_DEBUG1, SWITCH_LOG_ERROR, switch_log_printf(), switch_nat_add_mapping_internal(), switch_safe_free, SWITCH_STANDARD_STREAM, switch_xml_child(), switch_xml_find_child(), switch_xml_free(), switch_xml_next, switch_xml_parse_str_dup, and switch_xml::txt.
Referenced by switch_nat_multicast_runtime(), and SWITCH_STANDARD_SCHED_FUNC().
void switch_nat_set_mapping | ( | switch_bool_t | mapping | ) |
Update the setting if port mapping will be created.
Definition at line 210 of file switch_nat.c.
References nat_globals_t::mapping.
void switch_nat_shutdown | ( | void | ) |
Shuts down the NAT Traversal System.
Definition at line 741 of file switch_nat.c.
References nat_globals_t::descURL, switch_nat_thread_stop(), switch_safe_free, and nat_globals_t::urls.
Referenced by switch_core_destroy().
char* switch_nat_status | ( | void | ) |
Returns a list of nat mappings and other status info.
Definition at line 716 of file switch_nat.c.
References switch_stream_handle::data, nat_globals_t::mapping, nat_globals_t::nat_type, nat_globals_t::pub_addr, switch_api_execute(), SWITCH_NAT_TYPE_PMP, SWITCH_NAT_TYPE_UPNP, SWITCH_STANDARD_STREAM, and switch_stream_handle::write_function.