Asterisk - The Open Source Telephony Project GIT-master-2de1a68
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
20struct ao2_container;
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 */
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 */
183
184/*!
185 * \internal
186 * \brief Destroy global headers support
187 */
189
190/*!
191 * \internal
192 * \brief Pre-initialize OPTIONS request handling.
193 *
194 * \retval 0 on success
195 * \retval other on failure
196 */
198
199/*!
200 * \internal
201 * \brief Initialize OPTIONS request handling.
202 *
203 * XXX This currently includes qualifying peers. It shouldn't.
204 * That should go into a registrar. When that occurs, we won't
205 * need the reload stuff.
206 *
207 * \param reload Reload options handling
208 *
209 * \retval 0 on success
210 * \retval other on failure
211 */
213
214/*!
215 * \internal Initialize message IP updating handling.
216 *
217 * \retval 0 on success
218 * \retval other on failure
219 */
221
222/*!
223 * \internal
224 * \brief Initialize transport storage for contacts.
225 *
226 * \retval 0 on success
227 * \retval other on failure
228 */
230
231/*!
232 * \internal
233 * \brief Initialize system configuration
234 *
235 * \retval 0 Success
236 * \retval non-zero Failure
237 */
239
240/*!
241 * \internal
242 * \brief Destroy system configuration
243 */
244void ast_sip_destroy_system(void);
245
246/*!
247 * \internal
248 * \brief Initialize nameserver configuration
249 */
250void ast_sip_initialize_dns(void);
251
252/*!
253 * \internal
254 * \brief Initialize our own resolver support
255 */
257
258/*!
259 * \internal
260 * \brief Initialize global configuration
261 *
262 * \retval 0 Success
263 * \retval non-zero Failure
264 */
266
267/*!
268 * \internal
269 * \brief Clean up res_pjsip options handling
270 */
272
273/*!
274 * \internal
275 * \brief Clean up res_pjsip message ip updating handling
276 */
278
279/*!
280 * \internal
281 * \brief Get threadpool options
282 */
284
285/*!
286 * \internal
287 * \brief Retrieve the name of the default outbound endpoint.
288 *
289 * \note This returns a memory allocated copy of the name that
290 * needs to be freed by the caller.
291 *
292 * \retval The name of the default outbound endpoint.
293 * \retval NULL if configuration not found.
294 */
296
297/*!
298 * \internal
299 * \brief Functions for initializing and destroying the CLI.
300 */
301int ast_sip_initialize_cli(void);
302void ast_sip_destroy_cli(void);
303
304/*!
305 * \internal
306 * \brief Add res_pjsip global configuration options to the cli context.
307 *
308 * \param context context to add options to
309 * \retval 0 Success, -1 on failure
310 */
312
313/*!
314 * \internal
315 * \brief Add res_pjsip system configuration options to the cli context.
316 *
317 * \param context context to add options to
318 * \retval 0 Success, -1 on failure
319 */
321
323
324/*!
325 * \internal
326 * \brief Finds or creates contact_status for a contact
327 */
329
330/*!
331 * \internal
332 * \brief Validate that the uri meets pjproject length restrictions
333 */
334int ast_sip_validate_uri_length(const char *uri);
335
336/*!
337 * \brief Initialize scheduler
338 * \since 13.9.0
339 *
340 * \retval -1 failure
341 * \retval 0 success
342 */
344
345/*!
346 * \internal
347 * \brief Destroy scheduler
348 * \since 13.9.0
349 *
350 * \retval -1 failure
351 * \retval 0 success
352 */
354
355/*!
356 * \internal
357 * \brief Determines if a uri will still be valid after an asterisk restart
358 * \since 13.20.0
359 *
360 * \param uri uri to test
361 * \param endpoint The associated endpoint
362 * \param rdata The rdata to get transport information from
363 *
364 * \retval 1 Yes, 0 No
365 */
366int ast_sip_will_uri_survive_restart(pjsip_sip_uri *uri, struct ast_sip_endpoint *endpoint,
367 pjsip_rx_data *rdata);
368
369/*!
370 * \internal
371 * \brief Initialize the transport management module
372 * \since 13.20.0
373 *
374 * The transport management module is responsible for 3 things...
375 * 1. It automatically destroys any reliable transport that does not
376 * receive a valid request within system/timer_b milliseconds of the
377 * connection being opened. (Attack mitigation)
378 * 2. Since it increments the reliable transport's reference count
379 * for that period of time, it also prevents issues if the transport
380 * disconnects while we're still trying to process a response.
381 * (Attack mitigation)
382 * 3. If enabled by global/keep_alive_interval, it sends '\\r\\n'
383 * keepalives on reliable transports at the interval specified.
384 *
385 * \retval -1 Failure
386 * \retval 0 Success
387 */
389
390/*!
391 * \internal
392 * \brief Destruct the transport management module.
393 * \since 13.20.0
394 */
396
397/*!
398 * \internal
399 * \brief Add online persistent endpoints to the given regcontext
400 *
401 * \param regcontext The context to add endpoints to
402 *
403 * \retval -1 on error, 0 on success
404 */
406
412
414
416
417#endif /* RES_PJSIP_PRIVATE_H_ */
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:328
General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific...
Asterisk module definitions.
static int reload(void)
int ast_sip_initialize_scheduler(void)
Initialize scheduler.
int ast_res_pjsip_preinit_options_handling(void)
int ast_sip_initialize_transport_management(void)
int ast_sip_initialize_sorcery_transport(void)
Initialize sorcery with transport support.
int ast_sip_validate_uri_length(const char *uri)
Definition: location.c:528
void ast_sip_initialize_resolver(void)
void ast_sip_destroy_system(void)
int ast_sip_destroy_sorcery_global(void)
int ast_res_pjsip_init_contact_transports(void)
int ast_sip_initialize_sorcery_global(void)
char * ast_sip_global_default_outbound_endpoint(void)
int ast_res_pjsip_init_options_handling(int reload)
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger(void)
int ast_sip_initialize_sorcery_domain_alias(void)
Initialize sorcery with domain alias support.
int ast_sip_initialize_global(void)
int sip_cli_print_system(struct ast_sip_cli_context *context)
int ast_sip_initialize_distributor(void)
int ast_res_pjsip_reload_configuration(void)
int ast_sip_destroy_scheduler(void)
void ast_sip_initialize_global_headers(void)
void ast_res_pjsip_cleanup_options_handling(void)
void ast_sip_destroy_cli(void)
Definition: pjsip_cli.c:375
void ast_sip_destroy_transport_management(void)
int ast_sip_initialize_transport_events(void)
void ast_sip_destroy_distributor(void)
const char * ast_sip_overload_trigger_to_str(enum ast_sip_taskprocessor_overload_trigger trigger)
int ast_res_pjsip_initialize_configuration(void)
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
Definition: location.c:1369
void ast_sip_destroy_global_headers(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:525
int ast_sip_destroy_sorcery_transport(void)
int ast_sip_destroy_sorcery_location(void)
Definition: location.c:1471
void ast_res_pjsip_destroy_configuration(void)
int ast_sip_destroy_sorcery_auth(void)
Definition: config_auth.c:426
struct ast_sip_contact_status * ast_res_pjsip_find_or_create_contact_status(const struct ast_sip_contact *contact)
int ast_sip_initialize_system(void)
int ast_sip_initialize_sorcery_qualify(void)
int ast_res_pjsip_init_message_filter(void)
ast_sip_taskprocessor_overload_trigger
@ TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL
@ TASKPROCESSOR_OVERLOAD_TRIGGER_PJSIP_ONLY
@ TASKPROCESSOR_OVERLOAD_TRIGGER_NONE
void ast_sip_destroy_transport_events(void)
void ast_sip_initialize_dns(void)
void sip_get_threadpool_options(struct ast_threadpool_options *threadpool_options)
Definition: config_system.c:70
void ast_res_pjsip_cleanup_message_filter(void)
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
Definition: config_auth.c:370
int sip_cli_print_global(struct ast_sip_cli_context *context)
int ast_sip_initialize_cli(void)
Definition: pjsip_cli.c:360
static struct aco_type * threadpool_options[]
Definition: stasis.c:2210
Generic container type.
CLI Formatter Context passed to all formatters.
Definition: res_pjsip_cli.h:34
A contact's status.
Definition: res_pjsip.h:443
const ast_string_field uri
Definition: res_pjsip.h:449
Contact associated with an address of record.
Definition: res_pjsip.h:384
An entity with which Asterisk communicates.
Definition: res_pjsip.h:951
A supplement to SIP message processing.