#include "../str.h"
#include "../lump_struct.h"
#include "../flags.h"
#include "../ip_addr.h"
#include "../md5utils.h"
#include "../config.h"
#include "parse_def.h"
#include "parse_cseq.h"
#include "parse_via.h"
#include "parse_fline.h"
#include "hf.h"
#include "sdp/sdp.h"
#include "parse_to.h"

Go to the source code of this file.
Data Structures | |
| struct | sip_msg |
| struct | sip_uri |
Defines | |
| #define | FAKED_REPLY ((struct sip_msg *) -1) |
| #define | FL_DO_KEEPALIVE (1<<10) |
| #define | FL_FORCE_ACTIVE (1<<1) |
| #define | FL_FORCE_LOCAL_RPORT (1<<2) |
| #define | FL_FORCE_RPORT (1<<0) |
| #define | FL_REQ_UPSTREAM (1<<9) |
| #define | FL_SDP_IP_AFS (1<<3) |
| #define | FL_SDP_PORT_AFS (1<<4) |
| #define | FL_SHM_CLONE (1<<5) |
| #define | FL_USE_MEDIA_PROXY (1<<11) |
| #define | FL_USE_UAC_CSEQ (1<<8) |
| #define | FL_USE_UAC_FROM (1<<6) |
| #define | FL_USE_UAC_TO (1<<7) |
| #define | GET_NEXT_HOP(m) |
| #define | GET_RURI(m) (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri)) |
| #define | IFISMETHOD(methodname, firstchar) |
| #define | REPLY_CLASS(_reply) ((_reply)->REPLY_STATUS/100) |
| #define | REPLY_STATUS first_line.u.reply.statuscode |
| #define | REQ_LINE(_msg) ((_msg)->first_line.u.request) |
| #define | REQ_METHOD first_line.u.request.method_value |
Typedefs | |
| typedef enum _uri_type | uri_type |
Enumerations | |
| enum | _uri_type { ERROR_URI_T = 0, SIP_URI_T, SIPS_URI_T, TEL_URI_T, TELS_URI_T } |
| enum | request_method { METHOD_UNDEF = 0, METHOD_INVITE = 1, METHOD_CANCEL = 2, METHOD_ACK = 4, METHOD_BYE = 8, METHOD_INFO = 16, METHOD_OPTIONS = 32, METHOD_UPDATE = 64, METHOD_REGISTER = 128, METHOD_MESSAGE = 256, METHOD_SUBSCRIBE = 512, METHOD_NOTIFY = 1024, METHOD_PRACK = 2048, METHOD_REFER = 4096, METHOD_PUBLISH = 8192, METHOD_OTHER = 16384 } |
Functions | |
| static int | char_msg_val (struct sip_msg *msg, char *cv) |
| int | check_transaction_quadruple (struct sip_msg *msg) |
| void | free_sip_msg (struct sip_msg *msg) |
| static char * | get_body (struct sip_msg *msg) |
| char * | get_hdr_field (char *buf, char *end, struct hdr_field *hdr) |
| int | parse_headers (struct sip_msg *msg, hdr_flags_t flags, int next) |
| int | parse_msg (char *buf, unsigned int len, struct sip_msg *msg) |
| int | set_dst_uri (struct sip_msg *msg, str *uri) |
| int | set_path_vector (struct sip_msg *msg, str *path) |
Variables | |
| int | via_cnt |
Definition in file msg_parser.h.
| #define FAKED_REPLY ((struct sip_msg *) -1) |
pointer to a fakes message which was never received ; (when this message is "relayed", it is generated out of the original request)
Definition at line 285 of file msg_parser.h.
Referenced by __dialog_replies(), _reply_light(), acc_onreply_in(), cancel_invite(), create_as_action_reply(), env_set_code_status(), fake_reply(), free_cell(), get_reply_status(), get_rpl_to(), is_3263_failure(), local_reply(), mi_publ_rpl_cback(), mi_uac_dlg_hdl(), publ_cback_func(), pv_t_update_req(), pv_t_update_rpl(), qos_dialog_created_CB(), relay_reply(), shmcontact2dset(), Sipreply2Xmpp(), store_reply(), subs_cback_func(), t_local_replied(), trace_onreply_out(), and uac_auth().
| #define FL_DO_KEEPALIVE (1<<10) |
keepalive request's source after a positive reply
Definition at line 99 of file msg_parser.h.
Referenced by __dialog_created(), __sl_reply_out(), and NAT_Keepalive().
| #define FL_FORCE_ACTIVE (1<<1) |
| #define FL_FORCE_LOCAL_RPORT (1<<2) |
force local rport (local via)
Definition at line 91 of file msg_parser.h.
Referenced by build_req_buf_from_sip_req(), and do_action().
| #define FL_FORCE_RPORT (1<<0) |
force rport (top via)
Definition at line 89 of file msg_parser.h.
Referenced by build_req_buf_from_sip_req(), build_res_buf_from_sip_req(), do_action(), and update_sock_struct_from_via().
| #define FL_REQ_UPSTREAM (1<<9) |
it's an upstream going request
Definition at line 98 of file msg_parser.h.
Referenced by acc_onreq(), and core2strar().
| #define FL_SDP_IP_AFS (1<<3) |
SDP IP rewritten
Definition at line 92 of file msg_parser.h.
| #define FL_SDP_PORT_AFS (1<<4) |
| #define FL_SHM_CLONE (1<<5) |
msg cloned in SHM as a single chunk
Definition at line 94 of file msg_parser.h.
Referenced by free_cell(), run_trans_callbacks(), shmcontact2dset(), and sip_msg_cloner().
| #define FL_USE_MEDIA_PROXY (1<<11) |
use mediaproxy on all messages during a dialog
Definition at line 101 of file msg_parser.h.
Referenced by __dialog_created(), and EngageMediaProxy().
| #define FL_USE_UAC_CSEQ (1<<8) |
take CSEQ hdr from UAC insteas of UAS
Definition at line 97 of file msg_parser.h.
Referenced by build_local(), and check_hdrs_changes().
| #define FL_USE_UAC_FROM (1<<6) |
take FROM hdr from UAC insteas of UAS
Definition at line 95 of file msg_parser.h.
Referenced by build_local(), check_hdrs_changes(), replace_from(), and restore_from().
| #define FL_USE_UAC_TO (1<<7) |
take TO hdr from UAC insteas of UAS
Definition at line 96 of file msg_parser.h.
Referenced by build_local(), check_hdrs_changes(), and restore_from().
| #define GET_NEXT_HOP | ( | m | ) |
Value:
(((m)->dst_uri.s && (m)->dst_uri.len) ? (&(m)->dst_uri) : \ (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri)))
Definition at line 122 of file msg_parser.h.
Referenced by t_relay_to().
| #define GET_RURI | ( | m | ) | (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri)) |
Return the Reqeust URI of a message. The following fields are tried in this order: 1) new_uri 2) first_line.u.request.uri
Definition at line 133 of file msg_parser.h.
Referenced by ac_sl_msg(), add_uri_param(), assemble_msg(), decode_contact_header(), diameter_is_user_in(), ds_hash_ruri(), radius_authorize_sterman(), run_address_switch(), run_proxy(), t_forward_nonack(), t_load_contacts(), t_relay_to(), t_replicate(), and tel2sip().
| #define IFISMETHOD | ( | methodname, | |||
| firstchar | ) |
| #define REPLY_CLASS | ( | _reply | ) | ((_reply)->REPLY_STATUS/100) |
Definition at line 67 of file msg_parser.h.
| #define REPLY_STATUS first_line.u.reply.statuscode |
Definition at line 66 of file msg_parser.h.
| #define REQ_LINE | ( | _msg | ) | ((_msg)->first_line.u.request) |
Definition at line 64 of file msg_parser.h.
Referenced by ac_reply(), add_hf_helper(), assemble_msg(), get_realm(), get_uri(), get_uri_user(), parse_orig_ruri(), run_failure_handlers(), and t_reply_matching().
| #define REQ_METHOD first_line.u.request.method_value |
Definition at line 65 of file msg_parser.h.
Definition at line 138 of file msg_parser.h.
| enum _uri_type |
Definition at line 137 of file msg_parser.h.
| enum request_method |
Definition at line 70 of file msg_parser.h.
| static int char_msg_val | ( | struct sip_msg * | msg, | |
| char * | cv | |||
| ) | [inline, static] |
calculate characteristic value of a message -- this value is used to identify a transaction during the process of reply matching
Definition at line 307 of file msg_parser.h.
References hdr_field::body, via_body::branch, sip_msg::callid, check_transaction_quadruple(), sip_msg::first_line, sip_msg::from, get_cseq, via_body::host, LM_ERR, MD5_LEN, MD5StringArray(), via_body::port_str, msg_start::request, sip_msg::to, msg_start::u, via_param::value, and sip_msg::via1.
Referenced by append_fixed_vars(), and init_synonym_id().
| int check_transaction_quadruple | ( | struct sip_msg * | msg | ) |
make sure all HFs needed for transaction identification have been parsed; return 0 if those HFs can't be found
Definition at line 680 of file msg_parser.c.
References sip_msg::callid, sip_msg::cseq, E_BAD_TUPEL, sip_msg::from, HDR_CALLID_F, HDR_CSEQ_F, HDR_FROM_F, HDR_TO_F, parse_headers(), ser_error, and sip_msg::to.
Referenced by ac_uac_req(), char_msg_val(), t_check_trans(), and t_lookup_request().
| void free_sip_msg | ( | struct sip_msg * | msg | ) |
Definition at line 660 of file msg_parser.c.
References sip_msg::add_rm, sip_msg::body_lumps, sip_msg::buf, sip_msg::dst_uri, free_hdr_field_lst(), free_lump_list(), free_reply_lump(), sip_msg::headers, _str::len, sip_msg::new_uri, sip_msg::path_vec, pkg_free, sip_msg::reply_lump, _str::s, and sip_msg::sdp.
Referenced by __sl_reply_out(), buffered_printer(), extract_parsed_hdrs(), pv_t_update_req(), pv_t_update_rpl(), receive_msg(), and t_uac().
| static char* get_body | ( | struct sip_msg * | msg | ) | [inline, static] |
returns a pointer to the begining of the msg's body
Definition at line 338 of file msg_parser.h.
References sip_msg::buf, CRLF, CRLF_LEN, HDR_EOH_F, sip_msg::len, len, parse_headers(), and sip_msg::unparsed.
Referenced by ac_cancel(), ac_reply(), ac_uac_req(), assemble_msg(), bla_handle_notify(), clen_builder(), cmd_send_message(), do_replace_body_f(), do_script_action(), encode_msg(), extract_body(), filter_body_f(), func_handle_publish(), func_send_message(), get_sdp_message(), handle_publish(), imc_manager(), m_store(), mwi_publ_handl(), Notify2Xmpp(), push_on_network(), replace_body_f(), rls_handle_notify(), search_append_body_f(), search_body_f(), set_body_f(), subst_body_f(), xjab_manage_sipmsg(), and xml_publ_handl().
| char* get_hdr_field | ( | char * | buf, | |
| char * | end, | |||
| struct hdr_field * | hdr | |||
| ) |
returns pointer to next header line, and fill hdr_f ; if at end of header returns pointer to the last crlf (always buf)
Definition at line 78 of file msg_parser.c.
References to_body::body, hdr_field::body, eat_lws_end(), cseq_body::error, via_body::error, to_body::error, free_via_list(), via_body::hdr, HDR_ACCEPT_T, HDR_ACCEPTDISPOSITION_T, HDR_ACCEPTLANGUAGE_T, HDR_ALLOW_T, HDR_AUTHORIZATION_T, HDR_CALLID_T, HDR_CONTACT_T, HDR_CONTENTDISPOSITION_T, HDR_CONTENTLENGTH_T, HDR_CONTENTTYPE_T, HDR_CSEQ_T, HDR_DIVERSION_T, HDR_EOH_T, HDR_ERROR_T, HDR_EVENT_T, HDR_EXPIRES_T, HDR_FROM_T, HDR_MAXFORWARDS_T, HDR_MIN_SE_T, HDR_ORGANIZATION_T, HDR_OTHER_T, HDR_PAI_T, HDR_PATH_T, HDR_PPI_T, HDR_PRIORITY_T, HDR_PRIVACY_T, HDR_PROXYAUTH_T, HDR_PROXYREQUIRE_T, HDR_RECORDROUTE_T, HDR_REFER_TO_T, HDR_RETRY_AFTER_T, HDR_ROUTE_T, HDR_RPID_T, HDR_SESSION_EXPIRES_T, HDR_SUBJECT_T, HDR_SUPPORTED_T, HDR_TO_T, HDR_UNSUPPORTED_T, HDR_USERAGENT_T, HDR_VIA_T, hdr_field::len, _str::len, LM_CRIT, LM_DBG, LM_ERR, cseq_body::method, hdr_field::name, cseq_body::number, OSER_EC_PARSER, OSER_EL_MEDIUM, parse_content_length(), parse_cseq(), PARSE_ERROR, parse_hname, parse_to(), parse_via(), hdr_field::parsed, pkg_free, pkg_malloc, _str::s, set_err_info(), set_err_reply(), trim_r, hdr_field::type, update_stat, to_body::uri, via_cnt, and ZSW.
Referenced by parse_headers().
| int parse_headers | ( | struct sip_msg * | msg, | |
| hdr_flags_t | flags, | |||
| int | next | |||
| ) |
parse the headers and adds them to msg->headers and msg->to, from etc. It stops when all the headers requested in flags were parsed, on error (bad header) or end of headers
Definition at line 287 of file msg_parser.c.
References allow, hdr_field::body, sip_msg::buf, sip_msg::callid, sip_msg::content_disposition, sip_msg::content_length, sip_msg::content_type, sip_msg::cseq, E_BAD_REQ, E_OUT_OF_MEM, sip_msg::eoh, sip_msg::expires, sip_msg::from, get_hdr_field(), sip_msg::h_via1, sip_msg::h_via2, HDR_ACCEPT_F, HDR_ACCEPT_T, HDR_ACCEPTDISPOSITION_F, HDR_ACCEPTDISPOSITION_T, HDR_ACCEPTLANGUAGE_F, HDR_ACCEPTLANGUAGE_T, HDR_ALLOW_F, HDR_ALLOW_T, HDR_AUTHORIZATION_F, HDR_AUTHORIZATION_T, HDR_CALLID_F, HDR_CALLID_T, HDR_CONTACT_F, HDR_CONTACT_T, HDR_CONTENTDISPOSITION_F, HDR_CONTENTDISPOSITION_T, HDR_CONTENTLENGTH_F, HDR_CONTENTLENGTH_T, HDR_CONTENTTYPE_F, HDR_CONTENTTYPE_T, HDR_CSEQ_F, HDR_CSEQ_T, HDR_DIVERSION_F, HDR_DIVERSION_T, HDR_EOH_F, HDR_EOH_T, HDR_ERROR_T, HDR_EVENT_F, HDR_EVENT_T, HDR_EXPIRES_F, HDR_EXPIRES_T, HDR_FROM_F, HDR_FROM_T, HDR_MAXFORWARDS_F, HDR_MAXFORWARDS_T, HDR_MIN_SE_F, HDR_MIN_SE_T, HDR_ORGANIZATION_F, HDR_ORGANIZATION_T, HDR_OTHER_T, HDR_PAI_F, HDR_PAI_T, HDR_PATH_F, HDR_PATH_T, HDR_PPI_F, HDR_PPI_T, HDR_PRIORITY_F, HDR_PRIORITY_T, HDR_PRIVACY_F, HDR_PRIVACY_T, HDR_PROXYAUTH_F, HDR_PROXYAUTH_T, HDR_PROXYREQUIRE_F, HDR_PROXYREQUIRE_T, HDR_RECORDROUTE_F, HDR_RECORDROUTE_T, HDR_REFER_TO_F, HDR_REFER_TO_T, HDR_RETRY_AFTER_T, HDR_ROUTE_F, HDR_ROUTE_T, HDR_RPID_F, HDR_RPID_T, HDR_SESSION_EXPIRES_F, HDR_SESSION_EXPIRES_T, HDR_SUBJECT_F, HDR_SUBJECT_T, HDR_SUPPORTED_F, HDR_SUPPORTED_T, HDR_TO_F, HDR_TO_T, HDR_UNSUPPORTED_F, HDR_UNSUPPORTED_T, HDR_USERAGENT_F, HDR_USERAGENT_T, HDR_VIA2_F, HDR_VIA_F, HDR_VIA_T, sip_msg::headers, sip_msg::last_header, _str::len, sip_msg::len, link_sibling_hdr, LM_CRIT, LM_DBG, LM_ERR, LM_INFO, sip_msg::maxforwards, sip_msg::min_se, hdr_field::name, hdr_field::next, via_body::next, sip_msg::organization, sip_msg::pai, hdr_field::parsed, sip_msg::parsed_flag, pkg_free, pkg_malloc, sip_msg::ppi, sip_msg::priority, sip_msg::privacy, record_route(), sip_msg::refer_to, sip_msg::rpid, _str::s, ser_error, sip_msg::session_expires, sip_msg::subject, sip_msg::to, hdr_field::type, sip_msg::unparsed, sip_msg::user_agent, sip_msg::via1, sip_msg::via2, and ZSW.
Referenced by ac_cancel(), ac_uac_req(), acc_onreply_in(), acc_preparse_req(), add_cisco_vsa(), add_contacts_to_loc_set(), add_diversion_helper(), add_hf_helper(), add_sdp(), add_sock_hdr(), adjust_clen(), allow_uri(), append_header(), append_rpid_helper(), apply_urihdr_changes(), assemble_msg(), bla_handle_notify(), bla_set_flag(), build_path_vector(), build_res_buf_from_sip_req(), check_message_support(), check_register(), check_routing(), check_to(), check_transaction_quadruple(), cmd_send_message(), contact_iterator(), decode_contact_header(), decode_msg(), dlg_bridge_tm_callback(), dlg_confirmed_resp_uac(), dlg_new_dialog(), dlg_onreply(), dlg_onroute(), dlg_request_uas(), do_load_gws(), do_script_action(), ds_hash_authusername(), ds_hash_callid(), ds_hash_touri(), encode_contact(), encode_msg(), eval_elem(), extract_parsed_hdrs(), find_credentials(), find_first_route(), find_next_route(), find_rem_target(), forward_reply(), func_handle_publish(), func_handle_subscribe(), func_send_message(), get_autenticate_hdr(), get_body(), get_callid(), get_contact_uri(), get_cseq_method(), get_cseq_number(), get_dest_user(), get_expires(), get_realm(), get_register_expire(), get_sl_branch(), get_sock_hdr(), get_source_uri(), get_to_uri(), get_uri(), get_user_agent(), handle_publish(), handle_subscribe(), has_body_f(), has_totag(), is_maxfwd_present(), is_method_f(), is_preloaded(), is_present_hf_f(), is_present_hf_re_f(), m_dump(), mi_tm_uac_dlg(), NAT_Keepalive(), Notify2Xmpp(), ospAppendHeader(), ospGetOspHeader(), ospGetToUserpart(), pack_ci(), parse_ac_msg(), parse_accept_hdr(), parse_allow(), parse_content_disposition(), parse_content_type_hdr(), parse_diversion_header(), parse_dlg(), parse_from_header(), parse_message(), parse_msg(), parse_pai_header(), parse_ppi_header(), parse_privacy(), parse_refer_to_header(), parse_rpid_header(), parse_supported(), patch_content_length(), pike_check_req(), populate_leg_info(), pre_match_parse(), prepend_path(), preprocess_request(), print_msg_info(), publ_cback_func(), push_on_network(), remove_header(), remove_hf_f(), remove_hf_re_f(), remove_sdp(), replace_from(), reply_received(), request2dlg(), response2dlg(), restore_from(), restore_to_reply(), ring_filter(), ring_insert_callid(), rls_handle_notify(), rls_handle_subscribe(), run_address_switch(), run_language_switch(), run_priority_switch(), run_proxy(), run_string_switch(), save_ruri(), send_ack(), set_env(), shmcontact2dset(), should_acc_reply(), sip_trace(), sipping_rpl_filter(), sl_filter_ACK(), sl_send_reply_helper(), sst_dialog_response_fwded_CB(), subs_cback_func(), t_check(), t_newtran(), t_reply_matching(), trace_onreply_in(), trace_onreply_out(), trace_onreq_in(), trace_onreq_out(), trace_sl_onreply_out(), unmatched_totag(), update_contact(), update_cseqs(), validate_msg(), verify_destination(), verify_source(), w_dlg_manage(), and xjab_manage_sipmsg().
| int parse_msg | ( | char * | buf, | |
| unsigned int | len, | |||
| struct sip_msg * | msg | |||
| ) |
returns 0 if ok, -1 for errors
Definition at line 533 of file msg_parser.c.
References sip_msg::buf, via_body::comment, sip_msg::first_line, HDR_VIA_F, via_body::host, sip_msg::len, _str::len, LM_DBG, LM_ERR, via_body::name, via_body::params, parse_first_line(), parse_headers(), via_body::port, via_body::port_str, msg_start::reply, msg_start::request, _str::s, SIP_INVALID, SIP_REPLY, SIP_REQUEST, via_body::transport, msg_start::type, msg_start::u, sip_msg::unparsed, via_body::version, sip_msg::via1, sip_msg::via2, and ZSW.
Referenced by __sl_reply_out(), ac_cancel(), buffered_printer(), faked_msg_init(), parse_ac_msg(), pv_t_copy_msg(), and receive_msg().
Make a private copy of the string and assign it to dst_uri
Definition at line 695 of file msg_parser.c.
References sip_msg::dst_uri, _str::len, LM_ERR, pkg_free, pkg_malloc, and _str::s.
Referenced by after_loose(), after_strict(), do_action(), dp_apply_policy(), ds_update_dst(), lookup(), ops_pushto_avp(), path_rr_callback(), t_next_contacts(), and t_replicate().
Make a private copy of the string and assign it to path_vec
Definition at line 725 of file msg_parser.c.
References _str::len, LM_ERR, sip_msg::path_vec, pkg_free, pkg_malloc, and _str::s.
Referenced by lookup(), pack_ci(), and t_next_contacts().
| int via_cnt |
number of via's encountered
Definition at line 74 of file msg_parser.c.
Referenced by get_hdr_field(), receive_msg(), and warning_builder().
1.5.6