~ubuntu-branches/ubuntu/vivid/sflphone/vivid

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip/include/pjsip/sip_endpoint.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: sip_endpoint.h 4154 2012-06-05 10:41:17Z bennylp $ */
 
2
/*
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 */
 
20
#ifndef __PJSIP_SIP_ENDPOINT_H__
 
21
#define __PJSIP_SIP_ENDPOINT_H__
 
22
 
 
23
/**
 
24
 * @file sip_endpoint.h
 
25
 * @brief SIP Endpoint.
 
26
 */
 
27
 
 
28
#include <pjsip/sip_transport.h>
 
29
#include <pjsip/sip_resolve.h>
 
30
 
 
31
/**
 
32
 * @defgroup PJSIP_CORE_CORE At the Very Core
 
33
 * @ingroup PJSIP_CORE
 
34
 * @brief The very core of PJSIP.
 
35
 */
 
36
 
 
37
PJ_BEGIN_DECL
 
38
 
 
39
/**
 
40
 * @defgroup PJSIP_ENDPT Endpoint
 
41
 * @ingroup PJSIP_CORE_CORE
 
42
 * @brief The master, owner of all objects
 
43
 *
 
44
 * SIP Endpoint instance (pjsip_endpoint) can be viewed as the master/owner of
 
45
 * all SIP objects in an application. It performs the following roles:
 
46
 *  - it manages the allocation/deallocation of memory pools for all objects.
 
47
 *  - it manages listeners and transports, and how they are used by
 
48
 *    transactions.
 
49
 *  - it receives incoming messages from transport layer and automatically
 
50
 *    dispatches them to the correct transaction (or create a new one).
 
51
 *  - it has a single instance of timer management (timer heap).
 
52
 *  - it manages modules, which is the primary means of extending the library.
 
53
 *  - it provides single polling function for all objects and distributes
 
54
 *    events.
 
55
 *  - it automatically handles incoming requests which can not be handled by
 
56
 *    existing modules (such as when incoming request has unsupported method).
 
57
 *  - and so on..
 
58
 *
 
59
 * Application should only instantiate one SIP endpoint instance for every
 
60
 * process.
 
61
 *
 
62
 * @{
 
63
 */
 
64
 
 
65
 
 
66
/**
 
67
 * Type of callback to register to pjsip_endpt_atexit().
 
68
 */
 
69
typedef void (*pjsip_endpt_exit_callback)(pjsip_endpoint *endpt);
 
70
 
 
71
 
 
72
/**
 
73
 * Create an instance of SIP endpoint from the specified pool factory.
 
74
 * The pool factory reference then will be kept by the endpoint, so that
 
75
 * future memory allocations by SIP components will be taken from the same
 
76
 * pool factory.
 
77
 *
 
78
 * @param pf            Pool factory that will be used for the lifetime of
 
79
 *                      endpoint.
 
80
 * @param name          Optional name to be specified for the endpoint.
 
81
 *                      If this parameter is NULL, then the name will use
 
82
 *                      local host name.
 
83
 * @param endpt         Pointer to receive endpoint instance.
 
84
 *
 
85
 * @return              PJ_SUCCESS on success.
 
86
 */
 
87
PJ_DECL(pj_status_t) pjsip_endpt_create(pj_pool_factory *pf,
 
88
                                        const char *name,
 
89
                                        pjsip_endpoint **endpt);
 
90
 
 
91
/**
 
92
 * Destroy endpoint instance. Application must make sure that all pending
 
93
 * transactions have been terminated properly, because this function does not
 
94
 * check for the presence of pending transactions.
 
95
 *
 
96
 * @param endpt         The SIP endpoint to be destroyed.
 
97
 */
 
98
PJ_DECL(void) pjsip_endpt_destroy(pjsip_endpoint *endpt);
 
99
 
 
100
/**
 
101
 * Get endpoint name.
 
102
 *
 
103
 * @param endpt         The SIP endpoint instance.
 
104
 *
 
105
 * @return              Endpoint name, as was registered during endpoint
 
106
 *                      creation. The string is NULL terminated.
 
107
 */
 
108
PJ_DECL(const pj_str_t*) pjsip_endpt_name(const pjsip_endpoint *endpt);
 
109
 
 
110
/**
 
111
 * Poll for events. Application must call this function periodically to ensure
 
112
 * that all events from both transports and timer heap are handled in timely
 
113
 * manner.  This function, like all other endpoint functions, is thread safe,
 
114
 * and application may have more than one thread concurrently calling this function.
 
115
 *
 
116
 * @param endpt         The endpoint.
 
117
 * @param max_timeout   Maximum time to wait for events, or NULL to wait forever
 
118
 *                      until event is received.
 
119
 *
 
120
 * @return              PJ_SUCCESS on success.
 
121
 */
 
122
PJ_DECL(pj_status_t) pjsip_endpt_handle_events( pjsip_endpoint *endpt,
 
123
                                                const pj_time_val *max_timeout);
 
124
 
 
125
 
 
126
/**
 
127
 * Handle events with additional info about number of events that
 
128
 * have been handled.
 
129
 *
 
130
 * @param endpt         The endpoint.
 
131
 * @param max_timeout   Maximum time to wait for events, or NULL to wait forever
 
132
 *                      until event is received.
 
133
 * @param count         Optional argument to receive the number of events that
 
134
 *                      have been handled by the function.
 
135
 *
 
136
 * @return              PJ_SUCCESS on success.
 
137
 */
 
138
PJ_DECL(pj_status_t) pjsip_endpt_handle_events2(pjsip_endpoint *endpt,
 
139
                                                const pj_time_val *max_timeout,
 
140
                                                unsigned *count);
 
141
/**
 
142
 * Schedule timer to endpoint's timer heap. Application must poll the endpoint
 
143
 * periodically (by calling #pjsip_endpt_handle_events) to ensure that the
 
144
 * timer events are handled in timely manner. When the timeout for the timer
 
145
 * has elapsed, the callback specified in the entry argument will be called.
 
146
 * This function, like all other endpoint functions, is thread safe.
 
147
 *
 
148
 * @param endpt     The endpoint.
 
149
 * @param entry     The timer entry.
 
150
 * @param delay     The relative delay of the timer.
 
151
 * @return          PJ_OK (zero) if successfull.
 
152
 */
 
153
#if PJ_TIMER_DEBUG
 
154
#define pjsip_endpt_schedule_timer(ept,ent,d) \
 
155
                        pjsip_endpt_schedule_timer_dbg(ept, ent, d, \
 
156
                                                       __FILE__, __LINE__)
 
157
 
 
158
PJ_DECL(pj_status_t) pjsip_endpt_schedule_timer_dbg(pjsip_endpoint *endpt,
 
159
                                                    pj_timer_entry *entry,
 
160
                                                    const pj_time_val *delay,
 
161
                                                    const char *src_file,
 
162
                                                    int src_line);
 
163
#else
 
164
PJ_DECL(pj_status_t) pjsip_endpt_schedule_timer( pjsip_endpoint *endpt,
 
165
                                                 pj_timer_entry *entry,
 
166
                                                 const pj_time_val *delay );
 
167
#endif
 
168
 
 
169
/**
 
170
 * Cancel the previously registered timer.
 
171
 * This function, like all other endpoint functions, is thread safe.
 
172
 *
 
173
 * @param endpt     The endpoint.
 
174
 * @param entry     The timer entry previously registered.
 
175
 */
 
176
PJ_DECL(void) pjsip_endpt_cancel_timer( pjsip_endpoint *endpt,
 
177
                                        pj_timer_entry *entry );
 
178
 
 
179
/**
 
180
 * Get the timer heap instance of the SIP endpoint.
 
181
 *
 
182
 * @param endpt     The endpoint.
 
183
 *
 
184
 * @return          The timer heap instance.
 
185
 */
 
186
PJ_DECL(pj_timer_heap_t*) pjsip_endpt_get_timer_heap(pjsip_endpoint *endpt);
 
187
 
 
188
 
 
189
/**
 
190
 * Register new module to the endpoint.
 
191
 * The endpoint will then call the load and start function in the module to
 
192
 * properly initialize the module, and assign a unique module ID for the
 
193
 * module.
 
194
 *
 
195
 * @param endpt         The endpoint.
 
196
 * @param module        The module to be registered.
 
197
 *
 
198
 * @return              PJ_SUCCESS on success.
 
199
 */
 
200
PJ_DECL(pj_status_t) pjsip_endpt_register_module( pjsip_endpoint *endpt,
 
201
                                                  pjsip_module *module );
 
202
 
 
203
/**
 
204
 * Unregister a module from the endpoint.
 
205
 * The endpoint will then call the stop and unload function in the module to
 
206
 * properly shutdown the module.
 
207
 *
 
208
 * @param endpt         The endpoint.
 
209
 * @param module        The module to be registered.
 
210
 *
 
211
 * @return              PJ_SUCCESS on success.
 
212
 */
 
213
PJ_DECL(pj_status_t) pjsip_endpt_unregister_module( pjsip_endpoint *endpt,
 
214
                                                    pjsip_module *module );
 
215
 
 
216
 
 
217
/**
 
218
 * Create pool from the endpoint. All SIP components should allocate their
 
219
 * memory pool by calling this function, to make sure that the pools are
 
220
 * allocated from the same pool factory. This function, like all other endpoint
 
221
 * functions, is thread safe.
 
222
 *
 
223
 * @param endpt         The SIP endpoint.
 
224
 * @param pool_name     Name to be assigned to the pool.
 
225
 * @param initial       The initial size of the pool.
 
226
 * @param increment     The resize size.
 
227
 * @return              Memory pool, or NULL on failure.
 
228
 *
 
229
 * @see pj_pool_create
 
230
 */
 
231
PJ_DECL(pj_pool_t*) pjsip_endpt_create_pool( pjsip_endpoint *endpt,
 
232
                                             const char *pool_name,
 
233
                                             pj_size_t initial,
 
234
                                             pj_size_t increment );
 
235
 
 
236
/**
 
237
 * Return back pool to endpoint to be released back to the pool factory.
 
238
 * This function, like all other endpoint functions, is thread safe.
 
239
 *
 
240
 * @param endpt     The endpoint.
 
241
 * @param pool      The pool to be destroyed.
 
242
 */
 
243
PJ_DECL(void) pjsip_endpt_release_pool( pjsip_endpoint *endpt,
 
244
                                        pj_pool_t *pool );
 
245
 
 
246
/**
 
247
 * Find transaction in endpoint's transaction table by the transaction's key.
 
248
 * This function normally is only used by modules. The key for a transaction
 
249
 * can be created by calling #pjsip_tsx_create_key.
 
250
 *
 
251
 * @param endpt     The endpoint instance.
 
252
 * @param key       Transaction key, as created with #pjsip_tsx_create_key.
 
253
 *
 
254
 * @return          The transaction, or NULL if it's not found.
 
255
 */
 
256
PJ_DECL(pjsip_transaction*) pjsip_endpt_find_tsx( pjsip_endpoint *endpt,
 
257
                                                  const pj_str_t *key );
 
258
 
 
259
/**
 
260
 * Register the transaction to the endpoint's transaction table.
 
261
 * This function should only be used internally by the stack.
 
262
 *
 
263
 * @param endpt     The SIP endpoint.
 
264
 * @param tsx       The transaction.
 
265
 */
 
266
PJ_DECL(void) pjsip_endpt_register_tsx( pjsip_endpoint *endpt,
 
267
                                        pjsip_transaction *tsx);
 
268
 
 
269
/**
 
270
 * Forcefull destroy the transaction. This function should only be used
 
271
 * internally by the stack.
 
272
 *
 
273
 * @param endpt     The endpoint.
 
274
 * @param tsx       The transaction to destroy.
 
275
 */
 
276
PJ_DECL(void) pjsip_endpt_destroy_tsx( pjsip_endpoint *endpt,
 
277
                                      pjsip_transaction *tsx);
 
278
 
 
279
/**
 
280
 * Create a new transmit data buffer.
 
281
 * This function, like all other endpoint functions, is thread safe.
 
282
 *
 
283
 * @param endpt     The endpoint.
 
284
 * @param p_tdata    Pointer to receive transmit data buffer.
 
285
 *
 
286
 * @return          PJ_SUCCESS or the appropriate error code.
 
287
 */
 
288
PJ_DECL(pj_status_t) pjsip_endpt_create_tdata( pjsip_endpoint *endpt,
 
289
                                               pjsip_tx_data **p_tdata);
 
290
 
 
291
/**
 
292
 * Create the DNS resolver instance. Application creates the DNS
 
293
 * resolver instance, set the nameserver to be used by the DNS
 
294
 * resolver, then set the DNS resolver to be used by the endpoint
 
295
 * by calling #pjsip_endpt_set_resolver().
 
296
 *
 
297
 * @param endpt         The SIP endpoint instance.
 
298
 * @param p_resv        Pointer to receive the DNS resolver instance.
 
299
 *
 
300
 * @return              PJ_SUCCESS on success, or the appropriate error
 
301
 *                      code.
 
302
 */
 
303
PJ_DECL(pj_status_t) pjsip_endpt_create_resolver(pjsip_endpoint *endpt,
 
304
                                                 pj_dns_resolver **p_resv);
 
305
 
 
306
/**
 
307
 * Set DNS resolver to be used by the SIP resolver. Application can set
 
308
 * the resolver instance to NULL to disable DNS resolution (perhaps
 
309
 * temporarily). When DNS resolver is disabled, the endpoint will resolve
 
310
 * hostnames with the normal pj_gethostbyname() function.
 
311
 *
 
312
 * @param endpt         The SIP endpoint instance.
 
313
 * @param resv          The resolver instance to be used by the SIP
 
314
 *                      endpoint.
 
315
 *
 
316
 * @return              PJ_SUCCESS on success, or the appropriate error
 
317
 *                      code.
 
318
 */
 
319
PJ_DECL(pj_status_t) pjsip_endpt_set_resolver(pjsip_endpoint *endpt,
 
320
                                              pj_dns_resolver *resv);
 
321
 
 
322
/**
 
323
 * Get the DNS resolver being used by the SIP resolver.
 
324
 *
 
325
 * @param endpt         The SIP endpoint instance.
 
326
 *
 
327
 * @return              The DNS resolver instance currently being used
 
328
 *                      by the SIP endpoint.
 
329
 */
 
330
PJ_DECL(pj_dns_resolver*) pjsip_endpt_get_resolver(pjsip_endpoint *endpt);
 
331
 
 
332
/**
 
333
 * Asynchronously resolve a SIP target host or domain according to rule
 
334
 * specified in RFC 3263 (Locating SIP Servers). When the resolving operation
 
335
 * has completed, the callback will be called.
 
336
 *
 
337
 * @param endpt     The endpoint instance.
 
338
 * @param pool      The pool to allocate resolver job.
 
339
 * @param target    The target specification to be resolved.
 
340
 * @param token     A user defined token to be passed back to callback function.
 
341
 * @param cb        The callback function.
 
342
 */
 
343
PJ_DECL(void) pjsip_endpt_resolve( pjsip_endpoint *endpt,
 
344
                                   pj_pool_t *pool,
 
345
                                   pjsip_host_info *target,
 
346
                                   void *token,
 
347
                                   pjsip_resolver_callback *cb);
 
348
 
 
349
/**
 
350
 * Get transport manager instance.
 
351
 *
 
352
 * @param endpt     The endpoint.
 
353
 *
 
354
 * @return          Transport manager instance.
 
355
 */
 
356
PJ_DECL(pjsip_tpmgr*) pjsip_endpt_get_tpmgr(pjsip_endpoint *endpt);
 
357
 
 
358
/**
 
359
 * Get ioqueue instance.
 
360
 *
 
361
 * @param endpt     The endpoint.
 
362
 *
 
363
 * @return          The ioqueue.
 
364
 */
 
365
PJ_DECL(pj_ioqueue_t*) pjsip_endpt_get_ioqueue(pjsip_endpoint *endpt);
 
366
 
 
367
/**
 
368
 * Find a SIP transport suitable for sending SIP message to the specified
 
369
 * address. If transport selector ("sel") is set, then the function will
 
370
 * check if the transport selected is suitable to send requests to the
 
371
 * specified address.
 
372
 *
 
373
 * @see pjsip_tpmgr_acquire_transport
 
374
 *
 
375
 * @param endpt     The SIP endpoint instance.
 
376
 * @param type      The type of transport to be acquired.
 
377
 * @param remote    The remote address to send message to.
 
378
 * @param addr_len  Length of the remote address.
 
379
 * @param sel       Optional pointer to transport selector instance which is
 
380
 *                  used to find explicit transport, if required.
 
381
 * @param p_tp      Pointer to receive the transport instance, if one is found.
 
382
 *
 
383
 * @return          PJ_SUCCESS on success, or the appropriate error code.
 
384
 */
 
385
PJ_DECL(pj_status_t)
 
386
pjsip_endpt_acquire_transport( pjsip_endpoint *endpt,
 
387
                               pjsip_transport_type_e type,
 
388
                               const pj_sockaddr_t *remote,
 
389
                               int addr_len,
 
390
                               const pjsip_tpselector *sel,
 
391
                               pjsip_transport **p_tp);
 
392
 
 
393
 
 
394
/**
 
395
 * Find a SIP transport suitable for sending SIP message to the specified
 
396
 * address by also considering the outgoing SIP message data. If transport
 
397
 * selector ("sel") is set, then the function will check if the transport
 
398
 * selected is suitable to send requests to the specified address.
 
399
 *
 
400
 * @see pjsip_tpmgr_acquire_transport
 
401
 *
 
402
 * @param endpt     The SIP endpoint instance.
 
403
 * @param type      The type of transport to be acquired.
 
404
 * @param remote    The remote address to send message to.
 
405
 * @param addr_len  Length of the remote address.
 
406
 * @param sel       Optional pointer to transport selector instance which is
 
407
 *                  used to find explicit transport, if required.
 
408
 * @param tdata     Optional pointer to SIP message data to be sent.
 
409
 * @param p_tp      Pointer to receive the transport instance, if one is found.
 
410
 *
 
411
 * @return          PJ_SUCCESS on success, or the appropriate error code.
 
412
 */
 
413
PJ_DECL(pj_status_t)
 
414
pjsip_endpt_acquire_transport2(pjsip_endpoint *endpt,
 
415
                               pjsip_transport_type_e type,
 
416
                               const pj_sockaddr_t *remote,
 
417
                               int addr_len,
 
418
                               const pjsip_tpselector *sel,
 
419
                               pjsip_tx_data *tdata,
 
420
                               pjsip_transport **p_tp);
 
421
 
 
422
 
 
423
/*****************************************************************************
 
424
 *
 
425
 * Capabilities Management
 
426
 *
 
427
 * Modules may implement new capabilities to the stack. These capabilities
 
428
 * are indicated by the appropriate SIP header fields, such as Accept,
 
429
 * Accept-Encoding, Accept-Language, Allow, Supported, etc.
 
430
 *
 
431
 * When a module provides new capabilities to the stack, it registers these
 
432
 * capabilities to the endpoint by supplying new tags (strings) to the
 
433
 * appropriate header fields. Application (or other modules) can then query
 
434
 * these header fields to get the list of supported capabilities, and may
 
435
 * include these headers in the outgoing message.
 
436
 *****************************************************************************
 
437
 */
 
438
 
 
439
/**
 
440
 * Get the value of the specified capability header field.
 
441
 *
 
442
 * @param endpt     The endpoint.
 
443
 * @param htype     The header type to be retrieved, which value may be:
 
444
 *                  - PJSIP_H_ACCEPT
 
445
 *                  - PJSIP_H_ALLOW
 
446
 *                  - PJSIP_H_SUPPORTED
 
447
 * @param hname     If htype specifies PJSIP_H_OTHER, then the header name
 
448
 *                  must be supplied in this argument. Otherwise the value
 
449
 *                  must be set to NULL.
 
450
 *
 
451
 * @return          The appropriate header, or NULL if the header is not
 
452
 *                  available.
 
453
 */
 
454
PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_capability( pjsip_endpoint *endpt,
 
455
                                                      int htype,
 
456
                                                      const pj_str_t *hname);
 
457
 
 
458
 
 
459
/**
 
460
 * Check if we have the specified capability.
 
461
 *
 
462
 * @param endpt     The endpoint.
 
463
 * @param htype     The header type to be retrieved, which value may be:
 
464
 *                  - PJSIP_H_ACCEPT
 
465
 *                  - PJSIP_H_ALLOW
 
466
 *                  - PJSIP_H_SUPPORTED
 
467
 * @param hname     If htype specifies PJSIP_H_OTHER, then the header name
 
468
 *                  must be supplied in this argument. Otherwise the value
 
469
 *                  must be set to NULL.
 
470
 * @param token     The capability token to check. For example, if \a htype
 
471
 *                  is PJSIP_H_ALLOW, then \a token specifies the method
 
472
 *                  names; if \a htype is PJSIP_H_SUPPORTED, then \a token
 
473
 *                  specifies the extension names such as "100rel".
 
474
 *
 
475
 * @return          PJ_TRUE if the specified capability is supported,
 
476
 *                  otherwise PJ_FALSE..
 
477
 */
 
478
PJ_DECL(pj_bool_t) pjsip_endpt_has_capability( pjsip_endpoint *endpt,
 
479
                                               int htype,
 
480
                                               const pj_str_t *hname,
 
481
                                               const pj_str_t *token);
 
482
 
 
483
 
 
484
/**
 
485
 * Add or register new capabilities as indicated by the tags to the
 
486
 * appropriate header fields in the endpoint.
 
487
 *
 
488
 * @param endpt     The endpoint.
 
489
 * @param mod       The module which registers the capability.
 
490
 * @param htype     The header type to be set, which value may be:
 
491
 *                  - PJSIP_H_ACCEPT
 
492
 *                  - PJSIP_H_ALLOW
 
493
 *                  - PJSIP_H_SUPPORTED
 
494
 * @param hname     If htype specifies PJSIP_H_OTHER, then the header name
 
495
 *                  must be supplied in this argument. Otherwise the value
 
496
 *                  must be set to NULL.
 
497
 * @param count     The number of tags in the array.
 
498
 * @param tags      Array of tags describing the capabilities or extensions
 
499
 *                  to be added to the appropriate header.
 
500
 *
 
501
 * @return          PJ_SUCCESS on success.
 
502
 */
 
503
PJ_DECL(pj_status_t) pjsip_endpt_add_capability( pjsip_endpoint *endpt,
 
504
                                                 pjsip_module *mod,
 
505
                                                 int htype,
 
506
                                                 const pj_str_t *hname,
 
507
                                                 unsigned count,
 
508
                                                 const pj_str_t tags[]);
 
509
 
 
510
/**
 
511
 * Get list of additional headers to be put in outgoing request message.
 
512
 * Currently only Max-Forwards are defined.
 
513
 *
 
514
 * @param e         The endpoint.
 
515
 *
 
516
 * @return          List of headers.
 
517
 */
 
518
PJ_DECL(const pjsip_hdr*) pjsip_endpt_get_request_headers(pjsip_endpoint *e);
 
519
 
 
520
 
 
521
/**
 
522
 * Dump endpoint status to the log. This will print the status to the log
 
523
 * with log level 3.
 
524
 *
 
525
 * @param endpt         The endpoint.
 
526
 * @param detail        If non zero, then it will dump a detailed output.
 
527
 *                      BEWARE that this option may crash the system because
 
528
 *                      it tries to access all memory pools.
 
529
 */
 
530
PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail );
 
531
 
 
532
 
 
533
/**
 
534
 * Register cleanup function to be called by SIP endpoint when
 
535
 * #pjsip_endpt_destroy() is called.  Note that application should not
 
536
 * use or access any endpoint resource (such as pool, ioqueue, timer heap)
 
537
 * from within the callback as such resource may have been released when
 
538
 * the callback function is invoked.
 
539
 *
 
540
 * @param endpt         The SIP endpoint.
 
541
 * @param func          The function to be registered.
 
542
 *
 
543
 * @return              PJ_SUCCESS on success.
 
544
 */
 
545
PJ_DECL(pj_status_t) pjsip_endpt_atexit(pjsip_endpoint *endpt,
 
546
                                        pjsip_endpt_exit_callback func);
 
547
 
 
548
 
 
549
/**
 
550
 * @}
 
551
 */
 
552
 
 
553
 
 
554
/**
 
555
 * Log an error.
 
556
 */
 
557
PJ_DECL(void) pjsip_endpt_log_error( pjsip_endpoint *endpt,
 
558
                                     const char *sender,
 
559
                                     pj_status_t error_code,
 
560
                                     const char *format,
 
561
                                     ... );
 
562
 
 
563
#define PJSIP_ENDPT_LOG_ERROR(expr)   \
 
564
            pjsip_endpt_log_error expr
 
565
 
 
566
#define PJSIP_ENDPT_TRACE(tracing,expr) \
 
567
            do {                        \
 
568
                if ((tracing))          \
 
569
                    PJ_LOG(4,expr);     \
 
570
            } while (0)
 
571
 
 
572
/*
 
573
 * Internal functions.
 
574
 */
 
575
/*
 
576
 * Receive transaction events from transactions and put in the event queue
 
577
 * to be processed later.
 
578
 */
 
579
void pjsip_endpt_send_tsx_event( pjsip_endpoint *endpt, pjsip_event *evt );
 
580
 
 
581
PJ_END_DECL
 
582
 
 
583
#endif  /* __PJSIP_SIP_ENDPOINT_H__ */