Route & Record-Route module, loose routing support. More...
#include <string.h>#include "../../ut.h"#include "../../str.h"#include "../../dprint.h"#include "../../forward.h"#include "../../data_lump.h"#include "../../socket_info.h"#include "../../parser/parse_rr.h"#include "../../parser/parse_uri.h"#include "../../parser/parse_from.h"#include "../../mem/mem.h"#include "../../dset.h"#include "loose.h"#include "rr_cb.h"#include "rr_mod.h"
Go to the source code of this file.
Definition in file modules_k/rr/loose.c.
| static int after_loose | ( | struct sip_msg * | _m, | |
| int | preloaded | |||
| ) | [inline, static] |
| _m | SIP message | |
| preloaded | do we have a preloaded route set |
Definition at line 670 of file modules_k/rr/loose.c.
References hdr_field::body, sip_msg::buf, enable_double_rr, enable_socket_mismatch_warning, find_next_route(), get_maddr_uri(), handle_sr(), sip_uri::host, sip_msg::id, is_myself(), is_strict(), hdr_field::len, _str::len, hdr_field::name, NOT_RR_DRIVEN, sip_uri::params, hdr_field::parsed, sip_uri::proto, routed_msg_id, run_rr_callbacks(), _str::s, set_dst_uri(), and set_force_socket.
Referenced by loose_route().


| static int after_strict | ( | struct sip_msg * | _m | ) | [inline, static] |
| _m | SIP message |
Definition at line 489 of file modules_k/rr/loose.c.
References hdr_field::body, sip_msg::buf, enable_double_rr, enable_socket_mismatch_warning, find_next_route(), find_rem_target(), get_maddr_uri(), sip_uri::host, sip_msg::id, is_myself(), is_strict(), hdr_field::len, _str::len, hdr_field::name, sip_uri::params, hdr_field::parsed, sip_msg::parsed_uri, sip_uri::proto, routed_msg_id, run_rr_callbacks(), _str::s, set_dst_uri(), and set_force_socket.
Referenced by loose_route().


| int check_route_param | ( | struct sip_msg * | msg, | |
| regex_t * | re | |||
| ) |
The function checks for the request "msg" if the URI parameters of the local Route header (corresponding to the local server) matches the given regular expression "re". It must be call after the loose_route was done.
| msg | SIP message request that will has the Route header parameters checked | |
| re | compiled regular expression to be checked against the Route header parameters |
Definition at line 865 of file modules_k/rr/loose.c.
References sip_msg::id, _str::len, routed_msg_id, and _str::s.
| static int find_first_route | ( | struct sip_msg * | _m | ) | [inline, static] |
| _m | SIP message |
Definition at line 95 of file modules_k/rr/loose.c.
References parse_rr().
Referenced by loose_route().


| _m | SIP message | |
| _hdr | SIP header |
Definition at line 155 of file modules_k/rr/loose.c.
References HDR_ROUTE_T, sip_msg::last_header, hdr_field::next, parse_rr(), and hdr_field::type.
Referenced by after_loose(), and after_strict().


| static int find_rem_target | ( | struct sip_msg * | _m, | |
| struct hdr_field ** | _h, | |||
| rr_t ** | _l, | |||
| rr_t ** | _p | |||
| ) | [inline, static] |
Find last route in the last Route header field, if there was a previous route in the last Route header field, it will be saved in _p parameter
| _m | SIP message | |
| _h | SIP header field | |
| _l | Route & Record-Route header field body | |
| _p | Route & Record-Route header field body |
Definition at line 446 of file modules_k/rr/loose.c.
References HDR_EOH_F, HDR_ROUTE_T, rr::next, hdr_field::next, parse_rr(), hdr_field::parsed, and hdr_field::type.
Referenced by after_strict().


| uri | URI to be checked if it has maddr, and also the output URI | |
| puri | parsed URI |
Definition at line 341 of file modules_k/rr/loose.c.
References _str::len, sip_uri::maddr_val, sip_uri::port, and _str::s.
Referenced by after_loose(), after_strict(), and handle_sr().

The function search in to the "msg"'s Route header parameters the parameter called "name" and returns its value into "val". It must be call only after the loose_route is done.
| msg | - request that will have the Route header parameter searched | |
| name | - contains the Route header parameter to be serached | |
| val | returns the value of the searched Route header parameter if found. It might be an empty string if the parameter had no value. |
Definition at line 909 of file modules_k/rr/loose.c.
References sip_msg::id, _str::len, routed_msg_id, and _str::s.
Referenced by is_direction().

| _m | SIP message | |
| _hdr | SIP header field | |
| _r | Route & Record-Route header field body |
Definition at line 395 of file modules_k/rr/loose.c.
References hdr_field::body, sip_msg::buf, get_maddr_uri(), hdr_field::len, name_addr::name, hdr_field::name, rr::nameaddr, rr::next, _str::s, save_ruri(), and name_addr::uri.
Referenced by after_loose().


| int is_direction | ( | struct sip_msg * | msg, | |
| int | dir | |||
| ) |
The function checks the flow direction of the request "msg". As for checking it's used the "ftag" Route header parameter, the append_fromtag module parameter must be enables. Also this must be call only after the loose_route is done.
| msg | SIP message request that will have the direction checked | |
| dir | direction to be checked against. It may be RR_FLOW_UPSTREAM or RR_FLOW_DOWNSTREAM |
Definition at line 1001 of file modules_k/rr/loose.c.
References get_route_param(), sip_msg::id, _str::len, parse_from_header(), hdr_field::parsed, and _str::s.

| static int is_myself | ( | sip_uri_t * | _puri | ) | [inline, static] |
| _host | host | |
| _port | port |
Definition at line 121 of file modules_k/rr/loose.c.
References sip_uri::host, _str::len, _str::s, SIP_PORT, and sip_uri::user.
Referenced by after_loose(), after_strict(), and loose_route().

| static int is_preloaded | ( | struct sip_msg * | msg | ) | [static] |
| msg | SIP message |
Definition at line 65 of file modules_k/rr/loose.c.
References _str::len, and _str::s.
Referenced by loose_route().

| static int is_strict | ( | str * | _params | ) | [inline, static] |
| _params | URI string |
Definition at line 198 of file modules_k/rr/loose.c.
References _str::len, and _str::s.
Referenced by after_loose(), and after_strict().

| int loose_route | ( | struct sip_msg * | _m | ) |
| _m | SIP message |
Definition at line 824 of file modules_k/rr/loose.c.
References after_loose(), after_strict(), find_first_route(), is_myself(), is_preloaded(), and sip_msg::parsed_uri.
Referenced by w_loose_route().


| static int save_ruri | ( | struct sip_msg * | _m | ) | [inline, static] |
Set Request-URI as last Route header of a SIP message, this is necessary when forwarding to a strict router. Allocates memory for message lump in private memory.
| _m | SIP message |
Definition at line 288 of file modules_k/rr/loose.c.
References anchor_lump(), sip_msg::buf, sip_msg::first_line, HDR_EOH_F, ROUTE_SUFFIX, and sip_msg::unparsed.
Referenced by handle_sr().


1.7.1