Ver código fonte

Implements function reset_path_vector.

This function can be used to reset the path_vec variable that stores
the path vector for a SIP message. It can be used just like
reset_dst_uri.
Jan Janak 16 anos atrás
pai
commit
9c2f5f658a
2 arquivos alterados com 14 adições e 0 exclusões
  1. 11 0
      parser/msg_parser.c
  2. 3 0
      parser/msg_parser.h

+ 11 - 0
parser/msg_parser.c

@@ -783,6 +783,17 @@ int set_path_vector(struct sip_msg* msg, str* path)
 	return 0;
 	return 0;
 }
 }
 
 
+
+void reset_path_vector(struct sip_msg* msg)
+{
+	if(msg->path_vec.s != 0) {
+		pkg_free(msg->path_vec.s);
+	}
+	msg->path_vec.s = 0;
+	msg->path_vec.len = 0;
+}
+
+
 struct hdr_field* get_hdr(struct sip_msg *msg, enum _hdr_types_t ht)
 struct hdr_field* get_hdr(struct sip_msg *msg, enum _hdr_types_t ht)
 {
 {
 	struct hdr_field *hdr;
 	struct hdr_field *hdr;

+ 3 - 0
parser/msg_parser.h

@@ -464,4 +464,7 @@ struct hdr_field* get_hdr(struct sip_msg *msg, enum _hdr_types_t ht);
 struct hdr_field* next_sibling_hdr(struct hdr_field *hf);
 struct hdr_field* next_sibling_hdr(struct hdr_field *hf);
 
 
 int set_path_vector(struct sip_msg* msg, str* path);
 int set_path_vector(struct sip_msg* msg, str* path);
+
+void reset_path_vector(struct sip_msg* msg);
+
 #endif
 #endif