parser/msg_parser.h
512dcd98
 /*
c32feee5
  * Copyright (C) 2001-2003 FhG Fokus
7dd0b342
  *
07ca8c05
  * This file is part of Kamailio, a free SIP server.
7dd0b342
  *
07ca8c05
  * Kamailio is free software; you can redistribute it and/or modify
7dd0b342
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
07ca8c05
  * Kamailio is distributed in the hope that it will be useful,
7dd0b342
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
8a4f3a74
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
9e1ff448
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
049f64c2
  *
512dcd98
  */
 
8c4ed5f0
 /*! \file 
  * \brief Parser :: ???
  *
  * \ingroup parser
  */
 
7dd0b342
 
512dcd98
 #ifndef msg_parser_h
 #define msg_parser_h
 
0575e3b1
 
049f64c2
 #include "../comp_defs.h"
3881f12c
 #include "../str.h"
4c37101e
 #include "../lump_struct.h"
3881f12c
 #include "../flags.h"
4e2fdd79
 #include "../ip_addr.h"
caf80ae6
 #include "../md5utils.h"
7958eeae
 #include "../config.h"
2bb60634
 #include "parse_def.h"
 #include "parse_cseq.h"
 #include "parse_via.h"
 #include "parse_fline.h"
b861de9c
 #include "parse_retry_after.h"
2bb60634
 #include "hf.h"
0575e3b1
 #include "../error.h"
831faabf
 
512dcd98
 
8c4ed5f0
 /*! \name convenience short-cut macros */
aef825cc
 /*@{ */
1400b772
 #define REQ_LINE(_msg) ((_msg)->first_line.u.request)
1f377e97
 #define REQ_METHOD first_line.u.request.method_value
 #define REPLY_STATUS first_line.u.reply.statuscode
 #define REPLY_CLASS(_reply) ((_reply)->REPLY_STATUS/100)
aef825cc
 /*@} */
1f377e97
 
8c4ed5f0
 /*! \brief start of "actual" sip msg (start of first line) */
2c99a29d
 #define SIP_MSG_START(m)	((m)->first_line.u.request.method.s)
 
8c4ed5f0
 /*! \brief number methods as power of two to allow bitmap matching */
98301c7e
 typedef enum request_method {
8c4ed5f0
 	METHOD_UNDEF=0,           /*!< 0 - --- */
 	METHOD_INVITE=1,          /*!< 1 - 2^0 */
 	METHOD_CANCEL=2,          /*!< 2 - 2^1 */
17060b46
 	METHOD_ACK=4,             /*!< 4 - 2^2 */
 	METHOD_BYE=8,             /*!< 8 - 2^3 */
 	METHOD_INFO=16,           /*!< 16 - 2^4 */
 	METHOD_REGISTER=32,       /*!< 32 - 2^5 */
 	METHOD_SUBSCRIBE=64,      /*!< 64 - 2^6 */
 	METHOD_NOTIFY=128,        /*!< 128 - 2^7 */
 	METHOD_MESSAGE=256,       /*!< 256 - 2^8 */
 	METHOD_OPTIONS=512,       /*!< 512 - 2^9 */
 	METHOD_PRACK=1024,        /*!< 1024 - 2^10 */
 	METHOD_UPDATE=2048,       /*!< 2048 - 2^11 */
 	METHOD_REFER=4096,        /*!< 4096 - 2^12 */
 	METHOD_PUBLISH=8192,      /*!< 8192 - 2^13 */
 	METHOD_OTHER=16384        /*!< 16384 - 2^14 */
98301c7e
 } request_method_t;
f571aa35
 
8c4ed5f0
 #define FL_FORCE_RPORT  (1 << 0)  /*!< force rport */
 #define FL_FORCE_ACTIVE (1 << 1)  /*!< force active SDP */
 #define FL_SDP_IP_AFS   (1 << 2)  /*!< SDP IP rewritten */
 #define FL_SDP_PORT_AFS (1 << 3)  /*!< SDP port rewritten */
 #define FL_SHM_CLONE    (1 << 4)  /*!< msg cloned in SHM as a single chunk */
 #define FL_TIMEOUT      (1 << 5)  /*!< message belongs to an "expired" branch
ccc294fc
 									 (for failure route use) */
8c4ed5f0
 #define FL_REPLIED      (1 << 6)  /*!< message branch received at least one reply
ccc294fc
 									 (for failure route use) */
8c4ed5f0
 #define FL_HASH_INDEX   (1 << 7)  /*!< msg->hash_index contains a valid value (tm use)*/
3e8c3475
 
ccc294fc
 #define FL_MTU_TCP_FB   (1 << 8)
 #define FL_MTU_TLS_FB   (1 << 9)
 #define FL_MTU_SCTP_FB  (1 << 10)
8c4ed5f0
 #define FL_ADD_LOCAL_RPORT  (1 << 11) /*!< add 'rport' to local via hdr */
05b5d018
 #define FL_SDP_BODY     (1 << 12)  /*!< msg has SDP in body */
b347fd4f
 #define FL_USE_UAC_FROM      (1<<13)  /* take FROM hdr from UAC instead of UAS*/
 #define FL_USE_UAC_TO        (1<<14)  /* take TO hdr from UAC instead of UAS */
230a1389
 #define FL_TM_RPL_MATCHED    (1<<15)  /* tm matched reply already */
8b8132c1
 #define FL_RPL_SUSPENDED     (1<<16)  /* for async reply processing */
0dc5f4bc
 #define FL_BODY_MULTIPART    (1<<17)  /* body modified is multipart */
79a01b9d
 #define FL_RR_ADDED          (1<<18)  /* Record-Route header was added */
b2dcdf63
 #define FL_UAC_AUTH          (1<<19)  /* Proxy UAC-like authentication */
00dbf3d7
 
55812477
 /* WARNING: Value (1 << 28) is temporarily reserved for use in kamailio call_control
  * module (flag  FL_USE_CALL_CONTROL )! */
 
8d26ed40
 /* WARNING: Value (1 << 29) is temporarily reserved for use in kamailio acc
00dbf3d7
  * module (flag FL_REQ_UPSTREAM)! */
 
8d26ed40
 /* WARNING: Value (1 << 30) is temporarily reserved for use in kamailio
5a1522e0
  * media proxy module (flag FL_USE_MEDIA_PROXY)! */
 
8d26ed40
 /* WARNING: Value (1 << 31) is temporarily reserved for use in kamailio
  * nat_traversal module (flag FL_DO_KEEPALIVE)! */
 
bf8dfee3
 #define FL_MTU_FB_MASK  (FL_MTU_TCP_FB|FL_MTU_TLS_FB|FL_MTU_SCTP_FB)
 
f2f969dd
 
f571aa35
 #define IFISMETHOD(methodname,firstchar)                                  \
 if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&                  \
         strncasecmp( tmp+1, #methodname +1, methodname##_LEN-1)==0 &&     \
         *(tmp+methodname##_LEN)==' ') {                                   \
                 fl->type=SIP_REQUEST;                                     \
                 fl->u.request.method.len=methodname##_LEN;                \
                 fl->u.request.method_value=METHOD_##methodname;           \
                 tmp=buffer+methodname##_LEN;                              \
 }
f8d46776
 
0dc121bb
 #define IS_HTTP(req)                                                \
     ((req)->first_line.u.request.version.len >= HTTP_VERSION_LEN && \
     !strncasecmp((req)->first_line.u.request.version.s,             \
 		HTTP_VERSION, HTTP_VERSION_LEN))
512dcd98
 
ac34f9f4
 #define IS_SIP(req)                                                \
     ((req)->first_line.u.request.version.len >= SIP_VERSION_LEN && \
     !strncasecmp((req)->first_line.u.request.version.s,             \
 		SIP_VERSION, SIP_VERSION_LEN))
 
33557b2d
 #define IS_HTTP_REPLY(rpl)                                                \
     ((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
     !strncasecmp((rpl)->first_line.u.reply.version.s,             \
 		HTTP_VERSION, HTTP_VERSION_LEN))
 
 #define IS_SIP_REPLY(rpl)                                                \
     ((rpl)->first_line.u.reply.version.len >= SIP_VERSION_LEN && \
     !strncasecmp((rpl)->first_line.u.reply.version.s,             \
 		SIP_VERSION, SIP_VERSION_LEN))
 
8c4ed5f0
 /*! \brief
de0062e6
  * Return a URI to which the message should be really sent (not what should
  * be in the Request URI. The following fields are tried in this order:
  * 1) dst_uri
  * 2) new_uri
  * 3) first_line.u.request.uri
  */
 #define GET_NEXT_HOP(m) \
257181a0
 (((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)))
de0062e6
 
 
8c4ed5f0
 /*! \brief
de0062e6
  * Return the Reqeust URI of a message.
  * The following fields are tried in this order:
  * 1) new_uri
  * 2) first_line.u.request.uri
  */
 #define GET_RURI(m) \
257181a0
 (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri))
de0062e6
 
855c2e68
 
fecefaf1
 enum _uri_type{ERROR_URI_T=0, SIP_URI_T, SIPS_URI_T, TEL_URI_T, TELS_URI_T, URN_URI_T};
2518c900
 typedef enum _uri_type uri_type;
9b1ad373
 enum _uri_flags{
 	URI_USER_NORMALIZE=1,
 	URI_SIP_USER_PHONE=2
 }; /* bit fields */
 typedef enum _uri_flags uri_flags;
2518c900
 
8c4ed5f0
 /*! \brief The SIP uri object */
4b50480e
 struct sip_uri {
8c4ed5f0
 	str user;     /*!< Username */
 	str passwd;   /*!< Password */
 	str host;     /*!< Host name */
 	str port;     /*!< Port number */
 	str params;   /*!< Parameters */
 	str sip_params; /*!< Parameters of the sip: URI.
773f8568
 			  * (If a tel: URI is embedded in a sip: URI, then
 			  * params points to the parameters of the tel: URI,
 			  * and sip_params to the parameters of the sip: URI. 
 			  */
8a4f3a74
 	str headers;
4b50480e
 	unsigned short port_no;
8c4ed5f0
 	unsigned short proto; /*!< from transport */
 	uri_type type; /*!< uri scheme */
9b1ad373
 	uri_flags flags;
8c4ed5f0
 	/*!< parameters */
4b50480e
 	str transport;
 	str ttl;
 	str user_param;
 	str maddr;
 	str method;
 	str lr;
8c4ed5f0
 	str r2; /*!< ser specific rr parameter */
1dd73047
 	str gr;
8c4ed5f0
 	str transport_val; /*!< transport value */
 	str ttl_val;	 /*!< TTL value */
 	str user_param_val; /*!< User= param value */
 	str maddr_val; /*!< Maddr= param value */
 	str method_val; /*!< Method value */
 	str lr_val; /*!< lr value placeholder for lr=on a.s.o*/
3f601bd0
 	str r2_val;
1dd73047
 	str gr_val;
9b1ad373
 #ifdef USE_COMP
 	unsigned short comp;
 #endif
4b50480e
 };
855c2e68
 
d3542654
 typedef struct sip_uri sip_uri_t;
 
5a897710
 struct msg_body;
 
 typedef void (*free_msg_body_f)(struct msg_body** ptr);
 
 typedef enum msg_body_type {
 	MSG_BODY_UNKNOWN = 0,
 	MSG_BODY_SDP
 } msg_body_type_t;
 
8c4ed5f0
 /*! \brief This structure represents a generic SIP message body, regardless of the
  * body type.
  * 
  * Body parsers are supposed to cast this structure to some other
5a897710
  * body-type specific structure, but the body type specific structure must
  * retain msg_body_type variable and a pointer to the free function as the 
  * first two variables within the structure.
  */
 typedef struct msg_body {
 	msg_body_type_t type;
 	free_msg_body_f free;
 } msg_body_t;
 
855c2e68
 
d4ed4771
 /* pre-declaration, to include sys/time.h in .c */
 struct timeval;
 
949e1f3c
 /* structure for cached decoded flow for outbound */
 typedef struct ocd_flow {
 		int decoded;
 		struct receive_info rcv;
 } ocd_flow_t;
 
 /* structure holding fields that don't have to be cloned in shm
  * - its content is memset'ed to in shm clone
  * - add to msg_ldata_reset() if a field uses dynamic memory */
 typedef struct msg_ldata {
 	ocd_flow_t flow;
 } msg_ldata_t;
 
8c4ed5f0
 /*! \brief The SIP message */
615f634a
 typedef struct sip_msg {
8c4ed5f0
 	unsigned int id;               /*!< message id, unique/process*/
76f7847f
 	int pid;                       /*!< process id */
d4ed4771
 	struct timeval tval;           /*!< time value associated to message */
8c4ed5f0
 	snd_flags_t fwd_send_flags;    /*!< send flags for forwarding */
 	snd_flags_t rpl_send_flags;    /*!< send flags for replies */
 	struct msg_start first_line;   /*!< Message first line */
 	struct via_body* via1;         /*!< The first via */
 	struct via_body* via2;         /*!< The second via */
 	struct hdr_field* headers;     /*!< All the parsed headers*/
 	struct hdr_field* last_header; /*!< Pointer to the last parsed header*/
 	hdr_flags_t parsed_flag;    /*!< Already parsed header field types */
e4067ffb
 
2bb60634
 	     /* Via, To, CSeq, Call-Id, From, end of header*/
c32feee5
 	     /* pointers to the first occurrences of these headers;
97f17e60
 		  * everything is also saved in 'headers'
 		  * (WARNING: do not deallocate them twice!)*/
e4067ffb
 
e72b5b50
 	struct hdr_field* h_via1;
 	struct hdr_field* h_via2;
 	struct hdr_field* callid;
 	struct hdr_field* to;
 	struct hdr_field* cseq;
 	struct hdr_field* from;
 	struct hdr_field* contact;
10febf05
 	struct hdr_field* maxforwards;
 	struct hdr_field* route;
f2278164
 	struct hdr_field* record_route;
33032483
 	struct hdr_field* content_type;
 	struct hdr_field* content_length;
e3c29827
 	struct hdr_field* authorization;
 	struct hdr_field* expires;
 	struct hdr_field* proxy_auth;
 	struct hdr_field* supported;
e696bf82
 	struct hdr_field* require;
e3c29827
 	struct hdr_field* proxy_require;
 	struct hdr_field* unsupported;
 	struct hdr_field* allow;
70ae655f
 	struct hdr_field* event;
71be0c4a
 	struct hdr_field* accept;
2f43c732
 	struct hdr_field* accept_language;
 	struct hdr_field* organization;
 	struct hdr_field* priority;
 	struct hdr_field* subject;
 	struct hdr_field* user_agent;
fbac8f84
 	struct hdr_field* server;
2f43c732
 	struct hdr_field* content_disposition;
dccbcda9
 	struct hdr_field* diversion;
 	struct hdr_field* rpid;
8a4f3a74
 	struct hdr_field* refer_to;
 	struct hdr_field* session_expires;
 	struct hdr_field* min_se;
9200d410
 	struct hdr_field* sipifmatch;
48862405
 	struct hdr_field* subscription_state;
e7317b87
 	struct hdr_field* date;
 	struct hdr_field* identity;
 	struct hdr_field* identity_info;
c8f8eacb
 	struct hdr_field* pai;
 	struct hdr_field* ppi;
e430fa02
 	struct hdr_field* path;
87d84978
 	struct hdr_field* privacy;
2bb60634
 
5a897710
 	struct msg_body* body;
 
8c4ed5f0
 	char* eoh;        /*!< pointer to the end of header (if found) or null */
 	char* unparsed;   /*!< here we stopped parsing*/
8a4f3a74
 
8c4ed5f0
 	struct receive_info rcv; /*!< source & dest ip, ports, proto a.s.o*/
049f64c2
 
8c4ed5f0
 	char* buf;        /*!< scratch pad, holds a modified message,
f2f969dd
 					   *  via, etc. point into it */
8c4ed5f0
 	unsigned int len; /*!< message len (orig) */
7268726e
 
2bb60634
 	     /* modifications */
8a4f3a74
 
8c4ed5f0
 	str new_uri; /*!< changed first line uri, when you change this
6f96d99f
 	                don't forget to set parsed_uri_ok to 0*/
88edf618
 
8c4ed5f0
 	str dst_uri; /*!< Destination URI, must be forwarded to this URI if len != 0 */
88edf618
 
b2fcef3c
 	/* current uri */
8c4ed5f0
 	int parsed_uri_ok; /*!< 1 if parsed_uri is valid, 0 if not, set if to 0
6f96d99f
 	                      if you modify the uri (e.g change new_uri)*/
8c4ed5f0
 	struct sip_uri parsed_uri; /*!< speed-up > keep here the parsed uri*/
 	int parsed_orig_ruri_ok; /*!< 1 if parsed_orig_uri is valid, 0 if not, set if to 0
                               if you modify the uri (e.g change new_uri)*/
 	struct sip_uri parsed_orig_ruri; /*!< speed-up > keep here the parsed orig uri*/
8a4f3a74
 
8c4ed5f0
 	struct lump* add_rm;       /*!< used for all the forwarded requests/replies */
 	struct lump* body_lumps;     /*!< Lumps that update Content-Length */
 	struct lump_rpl *reply_lump; /*!< only for localy generated replies !!!*/
caf80ae6
 
8c4ed5f0
 	/*! \brief str add_to_branch;
aa9f500c
 	   whatever whoever want to append to Via branch comes here */
0a6afa42
 	char add_to_branch_s[MAX_BRANCH_PARAM_LEN];
416db8cd
 	int add_to_branch_len;
8a4f3a74
 
8c4ed5f0
 	unsigned int  hash_index; /*!< index to TM hash table; stored in core to avoid unnecessary calculations */
aa9f500c
 	unsigned int msg_flags; /*!< internal flags used by core */
 	flag_t flags; /*!< config flags */
6bfaa042
 	str set_global_address;
 	str set_global_port;
aa9f500c
 	struct socket_info* force_send_socket; /*!< force sending on this socket */
d752afff
 	str path_vec;
aa9f500c
 	str instance;
 	unsigned int reg_id;
e3ba8f38
 	str ruid;
8ca114df
 	str location_ua;
56be9d61
 
949e1f3c
 	/* structure with fields that are needed for local processing
 	 * - not cloned to shm, reset to 0 in the clone */
 	msg_ldata_t ldv;
10cc1dd7
 
 	/* IMPORTANT: when adding new fields in this structure (sip_msg_t),
 	 * be sure it is freed in free_sip_msg() and it is cloned or reset
 	 * to shm structure for transaction - see sip_msg_clone.c. In tm
 	 * module, take care of these fields for faked environemt used for
 	 * runing failure handlers - see modules/tm/t_reply.c */
615f634a
 } sip_msg_t;
888ca09d
 
8c4ed5f0
 /*! \brief pointer to a fakes message which was never received ;
caf80ae6
    (when this message is "relayed", it is generated out
     of the original request)
 */
 #define FAKED_REPLY     ((struct sip_msg *) -1)
 
 extern int via_cnt;
70b2fe02
 /** global  request flags.
  *  msg->msg_flags should be OR'ed with it before
  * a flag value is checked, e.g.:
  * if ((msg->msg_flags|global_req_flags) & FL_XXX) ...
  */
 extern unsigned int global_req_flags;
 
512dcd98
 
a8e108ec
 int parse_msg(char* const buf, const unsigned int len, struct sip_msg* const msg);
512dcd98
 
a8e108ec
 int parse_headers(struct sip_msg* const msg, const hdr_flags_t flags, const int next);
512dcd98
 
f7b97e8a
 char* get_hdr_field(char* const buf, char* const end, struct hdr_field* const hdr);
363f516f
 
a8e108ec
 void free_sip_msg(struct sip_msg* const msg);
e72b5b50
 
8c4ed5f0
 /*! \brief make sure all HFs needed for transaction identification have been
0575e3b1
    parsed; return 0 if those HFs can't be found
 */
a8e108ec
 inline static int check_transaction_quadruple(struct sip_msg* const msg)
0575e3b1
 {
 	if ( parse_headers(msg, HDR_FROM_F|HDR_TO_F|HDR_CALLID_F|HDR_CSEQ_F,0)!=-1
 		&& msg->from && msg->to && msg->callid && msg->cseq ) {
 		return 1;
 	} else {
 		ser_error=E_BAD_TUPEL;
 		return 0;
 	}
 }
 
 
caf80ae6
 
8c4ed5f0
 /*! \brief returns a pointer to the begining of the msg's body
ec147e2e
  */
a8e108ec
 inline static char* get_body(struct sip_msg* const msg)
ec147e2e
 {
 	int offset;
0ba367ec
 	unsigned int len;
ec147e2e
 
5c28a534
 	if ( parse_headers(msg, HDR_EOH_F, 0)==-1 )
ec147e2e
 		return 0;
 
f2f969dd
 	if (msg->unparsed){
0ba367ec
 		len=(unsigned int)(msg->unparsed-msg->buf);
f2f969dd
 	}else return 0;
 	if ((len+2<=msg->len) && (strncmp(CRLF,msg->unparsed,CRLF_LEN)==0) )
ec147e2e
 		offset = CRLF_LEN;
f2f969dd
 	else if ( (len+1<=msg->len) &&
 				(*(msg->unparsed)=='\n' || *(msg->unparsed)=='\r' ) )
ec147e2e
 		offset = 1;
 	else
 		return 0;
 
 	return msg->unparsed + offset;
 }
 
cae96597
 /*! \brief If the new_uri is set, then reset it */
 void reset_new_uri(struct sip_msg* const msg);
846a7aa0
 
8c4ed5f0
 /*! \brief
846a7aa0
  * Make a private copy of the string and assign it to dst_uri
  */
a8e108ec
 int set_dst_uri(struct sip_msg* const msg, const str* const uri);
846a7aa0
 
8c4ed5f0
 /*! \brief If the dst_uri is set to an URI then reset it */
a8e108ec
 void reset_dst_uri(struct sip_msg* const msg);
846a7aa0
 
6742b34b
 hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht);
 hdr_field_t* next_sibling_hdr(const hdr_field_t* const hf);
 /** not used yet */
 hdr_field_t* get_hdr_by_name(const sip_msg_t* const msg, const char* const name, const int name_len);
 hdr_field_t* next_sibling_hdr_by_name(const hdr_field_t* const hf);
7b878801
 
d752afff
 int set_path_vector(struct sip_msg* msg, str* path);
9c2f5f65
 
6742b34b
 void reset_path_vector(struct sip_msg* const msg);
9c2f5f65
 
55e78206
 int set_instance(struct sip_msg* msg, str* instance);
 
 void reset_instance(struct sip_msg* const msg);
8fb1a212
 
e3ba8f38
 int set_ruid(struct sip_msg* msg, str* ruid);
 
 void reset_ruid(struct sip_msg* const msg);
 
8ca114df
 int set_ua(struct sip_msg* msg, str *location_ua);
 
 void reset_ua(struct sip_msg* const msg);
 
8fb1a212
 /** force a specific send socket for forwarding a request.
  * @param msg - sip msg.
  * @param fsocket - forced socket, pointer to struct socket_info, can be 0 (in
  *                  which case it's equivalent to reset_force_socket()).
  */
 #define set_force_socket(msg, fsocket) \
 	do { \
 		(msg)->force_send_socket=(fsocket); \
 		if ((msg)->force_send_socket) \
8cf5dde5
 			(msg)->fwd_send_flags.f |= SND_F_FORCE_SOCKET; \
8fb1a212
 		else \
8cf5dde5
 			(msg)->fwd_send_flags.f &= ~SND_F_FORCE_SOCKET; \
8fb1a212
 	} while (0)
 
 /** reset a previously forced send socket. */
 #define reset_force_socket(msg) set_force_socket(msg, 0)
 
cf9269d7
 /**
  * struct to identify a msg context
  * - the pair of pid and message-id
  */
 typedef struct msg_ctx_id {
 	int pid;
 	int msgid;
 } msg_ctx_id_t;
 
 /**
  * set msg context id
  * - return: -1 on error; 0 - on set 
  */
a8e108ec
 int msg_ctx_id_set(const sip_msg_t* const msg, msg_ctx_id_t* const mid);
cf9269d7
 
 /**
  * check msg context id
  * - return: -1 on error; 0 - on no match; 1 - on match
  */
a8e108ec
 int msg_ctx_id_match(const sip_msg_t* const msg, const msg_ctx_id_t* const mid);
8fb1a212
 
d4ed4771
 /**
  * set msg time value
  */
a8e108ec
 int msg_set_time(sip_msg_t* const msg);
d4ed4771
 
949e1f3c
 /**
  * reset content of msg->ldv (msg_ldata_t structure)
  */
 void msg_ldata_reset(sip_msg_t*);
 
512dcd98
 #endif