Asterisk - The Open Source Telephony Project  18.5.0
res_pjsip_private.h
Go to the documentation of this file.
1 /*
2  * res_pjsip_private.h
3  *
4  * Created on: Jan 25, 2013
5  * Author: mjordan
6  */
7 
8 #ifndef RES_PJSIP_PRIVATE_H_
9 #define RES_PJSIP_PRIVATE_H_
10 
11 /*!
12  * \todo XXX Functions prototyped in this file that begin with "ast_sip_"
13  * need to be renamed so res_pjsip.so does not export the names outside
14  * of the module.
15  */
16 
17 #include "asterisk/module.h"
18 #include "asterisk/compat.h"
19 
20 struct ao2_container;
22 struct ast_sip_cli_context;
23 
24 /*!
25  * \internal
26  * \brief Initialize the configuration for res_pjsip
27  */
29 
30 /*!
31  * \internal
32  * \brief Annihilate the configuration objects
33  */
35 
36 /*!
37  * \internal
38  * \brief Reload the configuration
39  */
41 
42 /*!
43  * \internal
44  * \brief Initialize transport support on a sorcery instance
45  *
46  * \retval -1 failure
47  * \retval 0 success
48  */
50 
51 /*!
52  * \internal
53  * \brief Destroy transport support on a sorcery instance
54  *
55  * \retval -1 failure
56  * \retval 0 success
57  */
59 
60 /*!
61  * \internal
62  * \brief Initialize qualify support on a sorcery instance
63  *
64  * \retval -1 failure
65  * \retval 0 success
66  */
68 
69 /*!
70  * \internal
71  * \brief Initialize location support on a sorcery instance
72  *
73  * \retval -1 failure
74  * \retval 0 success
75  */
77 
78 /*!
79  * \internal
80  * \brief Destroy location support on a sorcery instance
81  *
82  * \retval -1 failure
83  * \retval 0 success
84  */
86 
87 /*!
88  * \internal
89  * \brief Initialize domain aliases support on a sorcery instance
90  *
91  * \retval -1 failure
92  * \retval 0 success
93  */
95 
96 /*!
97  * \internal
98  * \brief Initialize authentication support on a sorcery instance
99  *
100  * \retval -1 failure
101  * \retval 0 success
102  */
104 
105 /*!
106  * \internal
107  * \brief Destroy authentication support on a sorcery instance
108  *
109  * \retval -1 failure
110  * \retval 0 success
111  */
113 
114 /*!
115  * \internal
116  * \brief Initialize the distributor module
117  *
118  * The distributor module is responsible for taking an incoming
119  * SIP message and placing it into the threadpool. Once in the threadpool,
120  * the distributor will perform endpoint lookups and authentication, and
121  * then distribute the message up the stack to any further modules.
122  *
123  * \retval -1 Failure
124  * \retval 0 Success
125  */
127 
128 /*!
129  * \internal
130  * \brief Destruct the distributor module.
131  *
132  * Unregisters pjsip modules and cleans up any allocated resources.
133  */
134 void ast_sip_destroy_distributor(void);
135 
136 /*!
137  * \internal
138  * \brief Initialize the transport events notify module
139  * \since 13.18.0
140  *
141  * The transport events notify module is responsible for monitoring
142  * when transports die and calling any registered callbacks when that
143  * happens. It also manages any PJPROJECT transport state callbacks
144  * registered to it so the callbacks be more dynamic allowing module
145  * loading/unloading.
146  *
147  * \retval -1 Failure
148  * \retval 0 Success
149  */
151 
152 /*!
153  * \internal
154  * \brief Destruct the transport events notify module.
155  * \since 13.18.0
156  */
158 
159 /*!
160  * \internal
161  * \brief Initialize global type on a sorcery instance
162  *
163  * \retval -1 failure
164  * \retval 0 success
165  */
167 
168 /*!
169  * \internal
170  * \brief Destroy global type on a sorcery instance
171  * \since 13.3.0
172  *
173  * \retval -1 failure
174  * \retval 0 success
175  */
177 
178 /*!
179  * \internal
180  * \brief Initialize global headers support
181  *
182  * \return Nothing
183  */
185 
186 /*!
187  * \internal
188  * \brief Destroy global headers support
189  *
190  * \return Nothing
191  */
193 
194 /*!
195  * \internal
196  * \brief Pre-initialize OPTIONS request handling.
197  *
198  * \retval 0 on success
199  * \retval other on failure
200  */
202 
203 /*!
204  * \internal
205  * \brief Initialize OPTIONS request handling.
206  *
207  * XXX This currently includes qualifying peers. It shouldn't.
208  * That should go into a registrar. When that occurs, we won't
209  * need the reload stuff.
210  *
211  * \param reload Reload options handling
212  *
213  * \retval 0 on success
214  * \retval other on failure
215  */
217 
218 /*!
219  * \internal Initialize message IP updating handling.
220  *
221  * \retval 0 on success
222  * \retval other on failure
223  */
225 
226 /*!
227  * \internal
228  * \brief Initialize transport storage for contacts.
229  *
230  * \retval 0 on success
231  * \retval other on failure
232  */
234 
235 /*!
236  * \internal
237  * \brief Initialize system configuration
238  *
239  * \retval 0 Success
240  * \retval non-zero Failure
241  */
242 int ast_sip_initialize_system(void);
243 
244 /*!
245  * \internal
246  * \brief Destroy system configuration
247  */
248 void ast_sip_destroy_system(void);
249 
250 /*!
251  * \internal
252  * \brief Initialize nameserver configuration
253  */
254 void ast_sip_initialize_dns(void);
255 
256 /*!
257  * \internal
258  * \brief Initialize our own resolver support
259  */
260 void ast_sip_initialize_resolver(void);
261 
262 /*!
263  * \internal
264  * \brief Initialize global configuration
265  *
266  * \retval 0 Success
267  * \retval non-zero Failure
268  */
269 int ast_sip_initialize_global(void);
270 
271 /*!
272  * \internal
273  * \brief Clean up res_pjsip options handling
274  */
276 
277 /*!
278  * \internal
279  * \brief Clean up res_pjsip message ip updating handling
280  */
282 
283 /*!
284  * \internal
285  * \brief Get threadpool options
286  */
288 
289 /*!
290  * \internal
291  * \brief Retrieve the name of the default outbound endpoint.
292  *
293  * \note This returns a memory allocated copy of the name that
294  * needs to be freed by the caller.
295  *
296  * \retval The name of the default outbound endpoint.
297  * \retval NULL if configuration not found.
298  */
300 
301 /*!
302  * \internal
303  * \brief Functions for initializing and destroying the CLI.
304  */
305 int ast_sip_initialize_cli(void);
306 void ast_sip_destroy_cli(void);
307 
308 /*!
309  * \internal
310  * \brief Add res_pjsip global configuration options to the cli context.
311  *
312  * \param context context to add options to
313  * \retval 0 Success, -1 on failure
314  */
316 
317 /*!
318  * \internal
319  * \brief Add res_pjsip system configuration options to the cli context.
320  *
321  * \param context context to add options to
322  * \retval 0 Success, -1 on failure
323  */
325 
327 
328 /*!
329  * \internal
330  * \brief Finds or creates contact_status for a contact
331  */
333 
334 /*!
335  * \internal
336  * \brief Validate that the uri meets pjproject length restrictions
337  */
338 int ast_sip_validate_uri_length(const char *uri);
339 
340 /*!
341  * \brief Initialize scheduler
342  * \since 13.9.0
343  *
344  * \retval -1 failure
345  * \retval 0 success
346  */
348 
349 /*!
350  * \internal
351  * \brief Destroy scheduler
352  * \since 13.9.0
353  *
354  * \retval -1 failure
355  * \retval 0 success
356  */
357 int ast_sip_destroy_scheduler(void);
358 
359 /*!
360  * \internal
361  * \brief Determines if a uri will still be valid after an asterisk restart
362  * \since 13.20.0
363  *
364  * \param uri uri to test
365  * \param endpoint The associated endpoint
366  * \param rdata The rdata to get transport information from
367  *
368  * \retval 1 Yes, 0 No
369  */
370 int ast_sip_will_uri_survive_restart(pjsip_sip_uri *uri, struct ast_sip_endpoint *endpoint,
371  pjsip_rx_data *rdata);
372 
373 /*!
374  * \internal
375  * \brief Initialize the transport management module
376  * \since 13.20.0
377  *
378  * The transport management module is responsible for 3 things...
379  * 1. It automatically destroys any reliable transport that does not
380  * receive a valid request within system/timer_b milliseconds of the
381  * connection being opened. (Attack mitigation)
382  * 2. Since it increments the reliable transport's reference count
383  * for that period of time, it also prevents issues if the transport
384  * disconnects while we're still trying to process a response.
385  * (Attack mitigation)
386  * 3. If enabled by global/keep_alive_interval, it sends '\r\n'
387  * keepalives on reliable transports at the interval specified.
388  *
389  * \retval -1 Failure
390  * \retval 0 Success
391  */
393 
394 /*!
395  * \internal
396  * \brief Destruct the transport management module.
397  * \since 13.20.0
398  */
400 
401 /*!
402  * \internal
403  * \brief Add online persistent endpoints to the given regcontext
404  *
405  * \param regcontext The context to add endpoints to
406  *
407  * \retval -1 on error, 0 on success
408  */
410 
415 };
416 
418 
420 
421 #endif /* RES_PJSIP_PRIVATE_H_ */
int ast_sip_initialize_sorcery_global(void)
int ast_res_pjsip_preinit_options_handling(void)
A contact's status.
Definition: res_pjsip.h:341
int ast_sip_initialize_system(void)
void ast_sip_initialize_global_headers(void)
void ast_sip_destroy_global_headers(void)
int ast_sip_initialize_scheduler(void)
Initialize scheduler.
void sip_get_threadpool_options(struct ast_threadpool_options *threadpool_options)
Definition: config_system.c:70
int ast_sip_initialize_cli(void)
Definition: pjsip_cli.c:360
int ast_sip_initialize_distributor(void)
void ast_sip_initialize_dns(void)
int sip_cli_print_system(struct ast_sip_cli_context *context)
int ast_sip_destroy_scheduler(void)
int ast_sip_destroy_sorcery_transport(void)
int ast_sip_initialize_transport_management(void)
const ast_string_field uri
Definition: res_pjsip.h:347
void ast_res_pjsip_cleanup_options_handling(void)
void ast_sip_destroy_transport_events(void)
void ast_sip_initialize_resolver(void)
void ast_sip_destroy_system(void)
int ast_sip_initialize_sorcery_qualify(void)
void ast_sip_destroy_transport_management(void)
const char * ast_sip_overload_trigger_to_str(enum ast_sip_taskprocessor_overload_trigger trigger)
void ast_sip_destroy_cli(void)
Definition: pjsip_cli.c:375
An entity with which Asterisk communicates.
Definition: res_pjsip.h:812
int ast_sip_destroy_sorcery_auth(void)
Definition: config_auth.c:426
int ast_res_pjsip_init_options_handling(int reload)
int ast_sip_initialize_transport_events(void)
Contact associated with an address of record.
Definition: res_pjsip.h:281
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger(void)
General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific...
int ast_sip_initialize_sorcery_domain_alias(void)
Initialize sorcery with domain alias support.
static int reload(void)
Definition: cdr_mysql.c:741
int ast_res_pjsip_reload_configuration(void)
int ast_sip_will_uri_survive_restart(pjsip_sip_uri *uri, struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
Definition: res_pjsip.c:3723
int ast_res_pjsip_initialize_configuration(void)
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
Definition: config_auth.c:370
char * ast_sip_global_default_outbound_endpoint(void)
A supplement to SIP message processing.
void ast_res_pjsip_destroy_configuration(void)
void ast_res_pjsip_cleanup_message_filter(void)
int ast_sip_destroy_sorcery_location(void)
Definition: location.c:1467
int ast_sip_validate_uri_length(const char *uri)
Definition: location.c:525
int sip_cli_print_global(struct ast_sip_cli_context *context)
int ast_res_pjsip_init_contact_transports(void)
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:321
Generic container type.
int ast_res_pjsip_init_message_filter(void)
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
static struct aco_type * threadpool_options[]
Definition: stasis.c:2210
int ast_sip_initialize_sorcery_transport(void)
Initialize sorcery with transport support.
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
Asterisk module definitions.
ast_sip_taskprocessor_overload_trigger
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
Definition: location.c:1366
int ast_sip_destroy_sorcery_global(void)
int ast_sip_initialize_global(void)
struct ast_sip_contact_status * ast_res_pjsip_find_or_create_contact_status(const struct ast_sip_contact *contact)
void ast_sip_destroy_distributor(void)