msg_parser.c File Reference

SIP message parser. More...

#include <string.h>
#include <stdlib.h>
#include "msg_parser.h"
#include "parser_f.h"
#include "../ut.h"
#include "../error.h"
#include "../dprint.h"
#include "../data_lump_rpl.h"
#include "../mem/mem.h"
#include "../globals.h"
#include "../core_stats.h"
#include "../errinfo.h"
#include "parse_hname2.h"
#include "parse_uri.h"
#include "parse_content.h"

Include dependency graph for msg_parser.c:

Go to the source code of this file.

Defines

#define link_sibling_hdr(_hook, _hdr)
#define parse_hname(_b, _e, _h)   parse_hname2((_b),(_e),(_h))

Functions

int check_transaction_quadruple (struct sip_msg *msg)
void free_reply_lump (struct lump_rpl *lump)
void free_sip_msg (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


Detailed Description

SIP message parser.

Definition in file msg_parser.c.


Define Documentation

#define link_sibling_hdr ( _hook,
_hdr   ) 

Referenced by parse_headers().

#define parse_hname ( _b,
_e,
_h   )     parse_hname2((_b),(_e),(_h))

Definition at line 71 of file msg_parser.c.

Referenced by get_hdr_field().


Function Documentation

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_reply_lump ( struct lump_rpl lump  ) 

Definition at line 647 of file msg_parser.c.

References free_lump_rpl(), and lump_rpl::next.

Referenced by free_sip_msg().

void free_sip_msg ( 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 
)

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

Note:
: it continues where it previously stopped and goes ahead until end is encountered or desired HFs are found; if you call it twice for the same HF which is present only once, it will fail the second time; if you call it twice and the HF is found on second time too, it's not replaced in the well-known HF pointer but just added to header list; if you want to use a dumb convenience function which will give you the first occurrence of a header you are interested in, look at check_transaction_quadruple

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 
)

int set_dst_uri ( struct sip_msg msg,
str uri 
)

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().

int set_path_vector ( struct sip_msg msg,
str path 
)

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().


Variable Documentation

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().


Generated on Wed May 23 20:00:40 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6