RTS API Documentation  1.10.11
switch_nat.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  * Brian K. West <brian@freeswitch.org>
28  *
29  *
30  * switch_nat.h NAT Traversal via NAT-PMP or uPNP
31  *
32  */
33 /*!
34  \defgroup nat1 NAT code
35  \ingroup core1
36  \{
37 */
38 #ifndef FREESWITCH_NAT_H
39 #define FREESWITCH_NAT_H
40 
41 SWITCH_BEGIN_EXTERN_C typedef enum {
46 
47 typedef enum {
51 
52 SWITCH_DECLARE(const char *) switch_nat_get_type(void);
53 
54 /*!
55  \brief Initilize the NAT Traversal System
56  \param pool the memory pool to use for long term allocations
57  \note Generally called by the core_init
58 */
60 
61 /*!
62  \brief Initilize the rest of the NAT Traversal System
63  \note nat_init is called prior to some other modules being loaded.
64  This method allows us to init the rest of the NAT system.
65 */
67 
68 /*!
69  \brief Shuts down the NAT Traversal System
70 */
72 
73 /*!
74  \brief Returns a list of nat mappings and other status info
75  \note caller must free the string
76 */
77 SWITCH_DECLARE(char *) switch_nat_status(void);
78 
79 /*!
80  \brief Republishes the nap mappings
81  */
83 
84 /*!
85  \brief re-initializes NAT subsystem
86 */
88 
89 /*!
90  \brief Update the setting if port mapping will be created
91 */
93 
94 /*!
95  \brief Maps a port through the NAT Traversal System
96  \param port Internal port to map
97  \param proto Protocol
98  \param external_port [out] Mapped external port
99  \param sticky make the mapping permanent
100 */
102  switch_bool_t sticky);
103 /*!
104  \brief Has the NAT subsystem been initialized
105 */
107 /*!
108  \brief Deletes a NAT mapping
109  \param proto Protocol
110 */
112 
113 
115 #endif
116 /* For Emacs:
117  * Local Variables:
118  * mode:c
119  * indent-tabs-mode:t
120  * tab-width:4
121  * c-basic-offset:4
122  * End:
123  * For VIM:
124  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
125  */
switch_nat_type_t
Definition: switch_nat.h:41
void switch_nat_shutdown(void)
Shuts down the NAT Traversal System.
Definition: switch_nat.c:741
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
void switch_nat_reinit(void)
re-initializes NAT subsystem
Definition: switch_nat.c:215
switch_bool_t
Definition: switch_types.h:437
switch_memory_pool_t * pool
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.
Definition: switch_nat.c:619
void switch_nat_set_mapping(switch_bool_t mapping)
Update the setting if port mapping will be created.
Definition: switch_nat.c:210
const char * switch_nat_get_type(void)
Definition: switch_nat.c:575
char * switch_nat_status(void)
Returns a list of nat mappings and other status info.
Definition: switch_nat.c:716
void switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping)
Initilize the NAT Traversal System.
Definition: switch_nat.c:399
switch_bool_t switch_nat_is_initialized(void)
Has the NAT subsystem been initialized.
Definition: switch_nat.c:736
uint16_t switch_port_t
switch_status_t switch_nat_del_mapping(switch_port_t port, switch_nat_ip_proto_t proto)
Deletes a NAT mapping.
Definition: switch_nat.c:625
void switch_nat_late_init(void)
Initilize the rest of the NAT Traversal System.
Definition: switch_nat.c:708
switch_status_t
Common return values.
#define SWITCH_DECLARE(type)
struct fspr_pool_t switch_memory_pool_t
void switch_nat_republish(void)
Republishes the nap mappings.
Definition: switch_nat.c:652
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
switch_nat_ip_proto_t
Definition: switch_nat.h:47