Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include "asterisk/utils.h"
#include "include/route.h"
#include "include/reqresp_parser.h"
Go to the source code of this file.
Data Structures | |
struct | sip_route_hop |
Structure to save a route hop. More... | |
Macros | |
#define | sip_route_first(route) AST_LIST_FIRST(&(route)->list) |
#define | sip_route_traverse(route, elem) AST_LIST_TRAVERSE(&(route)->list, elem, list) |
Traverse route hops. More... | |
Functions | |
const char * | sip_route_add (struct sip_route *route, const char *uri, size_t len, int inserthead) |
Add a new hop to the route. More... | |
void | sip_route_clear (struct sip_route *route) |
Free all routes in the list. More... | |
void | sip_route_copy (struct sip_route *dst, const struct sip_route *src) |
copy route-set More... | |
void | sip_route_dump (const struct sip_route *route) |
Verbose dump of all hops for debugging. More... | |
const char * | sip_route_first_uri (const struct sip_route *route) |
Get the URI of the route's first hop. More... | |
int | sip_route_is_strict (struct sip_route *route) |
Check if the route is strict. More... | |
struct ast_str * | sip_route_list (const struct sip_route *route, int formatcli, int skip) |
Make the comma separated list of route hops. More... | |
void | sip_route_process_header (struct sip_route *route, const char *header, int inserthead) |
Add routes from header. More... | |
#define sip_route_first | ( | route | ) | AST_LIST_FIRST(&(route)->list) |
Definition at line 37 of file route.c.
Referenced by sip_route_first_uri(), and sip_route_is_strict().
#define sip_route_traverse | ( | route, | |
elem | |||
) | AST_LIST_TRAVERSE(&(route)->list, elem, list) |
Traverse route hops.
Definition at line 36 of file route.c.
Referenced by sip_route_copy(), sip_route_dump(), and sip_route_list().
const char* sip_route_add | ( | struct sip_route * | route, |
const char * | uri, | ||
size_t | len, | ||
int | inserthead | ||
) |
Add a new hop to the route.
route | Route |
uri | Address of this hop |
len | Length of hop not including null terminator |
inserthead | If true then inserted the new route to the top of the list |
Pointer | to null terminated copy of URI on success |
NULL | on error |
Definition at line 47 of file route.c.
References ast_copy_string(), AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, ast_malloc, sip_route_hop::list, sip_route::list, sip_route_hop::next, NULL, route_invalidated, sip_route_empty, sip_route::type, and sip_route_hop::uri.
Referenced by build_route(), sip_route_copy(), and sip_route_process_header().
void sip_route_clear | ( | struct sip_route * | route | ) |
Free all routes in the list.
Definition at line 132 of file route.c.
References ast_free, AST_LIST_REMOVE_HEAD, sip_route_hop::list, sip_route::list, route_loose, and sip_route::type.
Referenced by build_path(), build_route(), sip_destroy_peer(), sip_pvt_dtor(), and sip_route_copy().
copy route-set
non-zero | on failure |
0 | on success |
Definition at line 115 of file route.c.
References ast_debug, sip_route_add(), sip_route_clear(), sip_route_traverse, sip_route::type, and sip_route_hop::uri.
Referenced by create_addr_from_peer(), and sip_poke_peer().
void sip_route_dump | ( | const struct sip_route * | route | ) |
Verbose dump of all hops for debugging.
Definition at line 143 of file route.c.
References ast_verbose(), sip_route_empty, sip_route_traverse, and sip_route_hop::uri.
Referenced by build_path(), and build_route().
const char* sip_route_first_uri | ( | const struct sip_route * | route | ) |
Get the URI of the route's first hop.
Definition at line 199 of file route.c.
References NULL, sip_route_first, and sip_route_hop::uri.
Referenced by build_route(), create_addr_from_peer(), reqprep(), and sip_poke_peer().
int sip_route_is_strict | ( | struct sip_route * | route | ) |
Check if the route is strict.
Definition at line 183 of file route.c.
References NULL, route_invalidated, route_loose, route_strict, sip_route_first, sip_route::type, and sip_route_hop::uri.
Referenced by build_path(), build_route(), and reqprep().
Make the comma separated list of route hops.
route | Source of route list |
formatcli | Add's space after comma's, print's N/A if list is empty. |
skip | Number of hops to skip |
an | allocated struct ast_str on success |
NULL | on failure |
Definition at line 155 of file route.c.
References ast_str_append(), ast_str_create, buf, NULL, sip_route_traverse, and sip_route_hop::uri.
Referenced by _sip_show_peer(), add_route(), parse_register_contact(), sip_show_channel(), and update_peer().
void sip_route_process_header | ( | struct sip_route * | route, |
const char * | header, | ||
int | inserthead | ||
) |
Add routes from header.
Definition at line 79 of file route.c.
References ast_debug, ast_do_crash(), ast_log, get_in_brackets_const(), len(), LOG_ERROR, NULL, sip_route_add(), and sip_route_hop::uri.
Referenced by build_path(), and build_route().