|
@@ -38,13 +38,9 @@
|
|
|
#include "../../parser/parse_from.h"
|
|
|
#include "../../modules/tm/ut.h"
|
|
|
#include "../../lib/kmi/mi.h"
|
|
|
+#include "../../str_list.h"
|
|
|
#include "tmx_mod.h"
|
|
|
|
|
|
-/*! simple string list */
|
|
|
-struct str_list {
|
|
|
- str s;
|
|
|
- struct str_list *next;
|
|
|
-};
|
|
|
|
|
|
/*! Which header fields should be skipped */
|
|
|
#define skip_hf(_hf) \
|
|
@@ -160,35 +156,6 @@ static inline struct mi_root* mi_check_msg(struct sip_msg* msg, str* method,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-/*!
|
|
|
- * \brief Allocate a new str on a str list
|
|
|
- *
|
|
|
- * Allocate a new str in pkg_mem and attach it to a str list. Update
|
|
|
- * the total number of list elements.
|
|
|
- * \param s char array
|
|
|
- * \param len length of the char array
|
|
|
- * \param last last list element
|
|
|
- * \param total total number of list elements
|
|
|
- * \return pointer to the new list element
|
|
|
- */
|
|
|
-static inline struct str_list *new_str(char *s, int len, struct str_list **last, int *total)
|
|
|
-{
|
|
|
- struct str_list *new;
|
|
|
- new=pkg_malloc(sizeof(struct str_list));
|
|
|
- if (!new) {
|
|
|
- LM_ERR("no more pkg mem\n");
|
|
|
- return 0;
|
|
|
- }
|
|
|
- new->s.s=s;
|
|
|
- new->s.len=len;
|
|
|
- new->next=0;
|
|
|
-
|
|
|
- (*last)->next=new;
|
|
|
- *last=new;
|
|
|
- *total+=len;
|
|
|
-
|
|
|
- return new;
|
|
|
-}
|
|
|
|
|
|
/*!
|
|
|
* \brief Convert a header field block to char array
|
|
@@ -225,7 +192,7 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
|
|
|
while(hf_avail) {
|
|
|
d=memchr(needle, SUBST_CHAR, hf_avail);
|
|
|
if (!d || d+1>=needle+hf_avail) { /* nothing to substitute */
|
|
|
- new=new_str(begin, hf_avail, &last, &total_len);
|
|
|
+ new=append_str_list(begin, hf_avail, &last, &total_len);
|
|
|
if (!new) goto error;
|
|
|
break;
|
|
|
} else {
|
|
@@ -234,7 +201,7 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
|
|
|
switch(*d) {
|
|
|
case SUBST_CHAR: /* double SUBST_CHAR: IP */
|
|
|
/* string before substitute */
|
|
|
- new=new_str(begin, frag_len, &last, &total_len);
|
|
|
+ new=append_str_list(begin, frag_len, &last, &total_len);
|
|
|
if (!new) goto error;
|
|
|
/* substitute */
|
|
|
if (!sock_name) {
|
|
@@ -248,13 +215,13 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
|
|
|
sock_name=&(*send_sock)->address_str;
|
|
|
portname=&(*send_sock)->port_no_str;
|
|
|
}
|
|
|
- new=new_str(sock_name->s, sock_name->len,
|
|
|
+ new=append_str_list(sock_name->s, sock_name->len,
|
|
|
&last, &total_len );
|
|
|
if (!new) goto error;
|
|
|
/* inefficient - FIXME --andrei*/
|
|
|
- new=new_str(":", 1, &last, &total_len);
|
|
|
+ new=append_str_list(":", 1, &last, &total_len);
|
|
|
if (!new) goto error;
|
|
|
- new=new_str(portname->s, portname->len,
|
|
|
+ new=append_str_list(portname->s, portname->len,
|
|
|
&last, &total_len );
|
|
|
if (!new) goto error;
|
|
|
/* keep going ... */
|
|
@@ -268,7 +235,7 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
|
|
|
} /* possible substitute */
|
|
|
} /* substitution loop */
|
|
|
/* proceed to next header */
|
|
|
- /* new=new_str(CRLF, CRLF_LEN, &last, &total_len );
|
|
|
+ /* new=append_str_list(CRLF, CRLF_LEN, &last, &total_len );
|
|
|
if (!new) goto error; */
|
|
|
LM_DBG("one more hf processed\n");
|
|
|
} /* header loop */
|