|
@@ -1,9 +1,6 @@
|
|
|
/*
|
|
|
- * $Id$
|
|
|
- *
|
|
|
* sip msg. header proxy parser
|
|
|
*
|
|
|
- *
|
|
|
* Copyright (C) 2001-2003 FhG Fokus
|
|
|
*
|
|
|
* This file is part of ser, a free SIP server.
|
|
@@ -88,7 +85,7 @@ unsigned int global_req_flags = 0;
|
|
|
|
|
|
/* returns pointer to next header line, and fill hdr_f ;
|
|
|
* if at end of header returns pointer to the last crlf (always buf)*/
|
|
|
-char* get_hdr_field(char* buf, char* end, struct hdr_field* hdr)
|
|
|
+char* get_hdr_field(char* const buf, char* const end, struct hdr_field* const hdr)
|
|
|
{
|
|
|
|
|
|
char* tmp;
|
|
@@ -316,7 +313,7 @@ error:
|
|
|
give you the first occurrence of a header you are interested in,
|
|
|
look at check_transaction_quadruple
|
|
|
*/
|
|
|
-int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next)
|
|
|
+int parse_headers(struct sip_msg* const msg, const hdr_flags_t flags, const int next)
|
|
|
{
|
|
|
struct hdr_field* hf;
|
|
|
char* tmp;
|
|
@@ -595,7 +592,7 @@ error:
|
|
|
|
|
|
|
|
|
/* returns 0 if ok, -1 for errors */
|
|
|
-int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
|
|
|
+int parse_msg(char* const buf, const unsigned int len, struct sip_msg* const msg)
|
|
|
{
|
|
|
|
|
|
char *tmp;
|
|
@@ -610,9 +607,6 @@ int parse_msg(char* buf, unsigned int len, struct sip_msg* msg)
|
|
|
offset=tmp-buf;
|
|
|
fl=&(msg->first_line);
|
|
|
rest=parse_first_line(tmp, len-offset, fl);
|
|
|
-#if 0
|
|
|
- rest=parse_fline(tmp, buf+len, fl);
|
|
|
-#endif
|
|
|
offset+=rest-tmp;
|
|
|
tmp=rest;
|
|
|
switch(fl->type){
|
|
@@ -722,7 +716,7 @@ void free_reply_lump( struct lump_rpl *lump)
|
|
|
|
|
|
|
|
|
/*only the content*/
|
|
|
-void free_sip_msg(struct sip_msg* msg)
|
|
|
+void free_sip_msg(struct sip_msg* const msg)
|
|
|
{
|
|
|
if (msg->new_uri.s) { pkg_free(msg->new_uri.s); msg->new_uri.len=0; }
|
|
|
if (msg->dst_uri.s) { pkg_free(msg->dst_uri.s); msg->dst_uri.len=0; }
|
|
@@ -742,7 +736,7 @@ void free_sip_msg(struct sip_msg* msg)
|
|
|
/*
|
|
|
* Make a private copy of the string and assign it to dst_uri
|
|
|
*/
|
|
|
-int set_dst_uri(struct sip_msg* msg, str* uri)
|
|
|
+int set_dst_uri(struct sip_msg* const msg, const str* const uri)
|
|
|
{
|
|
|
char* ptr;
|
|
|
|
|
@@ -772,7 +766,7 @@ int set_dst_uri(struct sip_msg* msg, str* uri)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void reset_dst_uri(struct sip_msg* msg)
|
|
|
+void reset_dst_uri(struct sip_msg* const msg)
|
|
|
{
|
|
|
if(msg->dst_uri.s != 0) {
|
|
|
pkg_free(msg->dst_uri.s);
|
|
@@ -811,7 +805,7 @@ int set_path_vector(struct sip_msg* msg, str* path)
|
|
|
}
|
|
|
|
|
|
|
|
|
-void reset_path_vector(struct sip_msg* msg)
|
|
|
+void reset_path_vector(struct sip_msg* const msg)
|
|
|
{
|
|
|
if(msg->path_vec.s != 0) {
|
|
|
pkg_free(msg->path_vec.s);
|
|
@@ -821,7 +815,7 @@ void reset_path_vector(struct sip_msg* msg)
|
|
|
}
|
|
|
|
|
|
|
|
|
-hdr_field_t* get_hdr(sip_msg_t *msg, enum _hdr_types_t ht)
|
|
|
+hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
|
|
|
{
|
|
|
hdr_field_t *hdr;
|
|
|
|
|
@@ -833,7 +827,7 @@ hdr_field_t* get_hdr(sip_msg_t *msg, enum _hdr_types_t ht)
|
|
|
}
|
|
|
|
|
|
|
|
|
-hdr_field_t* next_sibling_hdr(hdr_field_t *hf)
|
|
|
+hdr_field_t* next_sibling_hdr(const hdr_field_t* const hf)
|
|
|
{
|
|
|
hdr_field_t *hdr;
|
|
|
|
|
@@ -843,7 +837,7 @@ hdr_field_t* next_sibling_hdr(hdr_field_t *hf)
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
-hdr_field_t* get_hdr_by_name(sip_msg_t *msg, char *name, int name_len)
|
|
|
+hdr_field_t* get_hdr_by_name(const sip_msg_t* const msg, const char* const name, const int name_len)
|
|
|
{
|
|
|
hdr_field_t *hdr;
|
|
|
|
|
@@ -855,8 +849,8 @@ hdr_field_t* get_hdr_by_name(sip_msg_t *msg, char *name, int name_len)
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-hdr_field_t* next_sibling_hdr_by_name(hdr_field_t *hf)
|
|
|
+/** not used yet */
|
|
|
+hdr_field_t* next_sibling_hdr_by_name(const hdr_field_t* const hf)
|
|
|
{
|
|
|
hdr_field_t *hdr;
|
|
|
|
|
@@ -872,7 +866,7 @@ hdr_field_t* next_sibling_hdr_by_name(hdr_field_t *hf)
|
|
|
* set msg context id
|
|
|
* - return: -1 on error; 0 - on set
|
|
|
*/
|
|
|
-int msg_ctx_id_set(sip_msg_t *msg, msg_ctx_id_t *mid)
|
|
|
+int msg_ctx_id_set(const sip_msg_t* const msg, msg_ctx_id_t* const mid)
|
|
|
{
|
|
|
if(msg==NULL || mid==NULL)
|
|
|
return -1;
|
|
@@ -885,7 +879,7 @@ int msg_ctx_id_set(sip_msg_t *msg, msg_ctx_id_t *mid)
|
|
|
* check msg context id
|
|
|
* - return: -1 on error; 0 - on no match; 1 - on match
|
|
|
*/
|
|
|
-int msg_ctx_id_match(sip_msg_t *msg, msg_ctx_id_t *mid)
|
|
|
+int msg_ctx_id_match(const sip_msg_t* const msg, const msg_ctx_id_t* const mid)
|
|
|
{
|
|
|
if(msg==NULL || mid==NULL)
|
|
|
return -1;
|
|
@@ -897,7 +891,7 @@ int msg_ctx_id_match(sip_msg_t *msg, msg_ctx_id_t *mid)
|
|
|
/**
|
|
|
* set msg time value
|
|
|
*/
|
|
|
-int msg_set_time(sip_msg_t *msg)
|
|
|
+int msg_set_time(sip_msg_t* const msg)
|
|
|
{
|
|
|
if(unlikely(msg==NULL))
|
|
|
return -2;
|