Module: sip-router
Branch: master
Commit: 53c5e9c34fee88989f362fb6e3ab83bc67b1eea3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=53c5e9c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Jul 29 18:53:42 2010 +0200
textops(k): msg_apply_changes() moved to textops
---
modules_k/textops/README | 27 ----------
modules_k/textops/doc/textops_admin.xml | 32 ------------
modules_k/textops/textops.c | 82 -------------------------------
3 files changed, 0 insertions(+), 141 deletions(-)
diff --git a/modules_k/textops/README b/modules_k/textops/README
index 9797b57..7cad37b 100644
--- a/modules_k/textops/README
+++ b/modules_k/textops/README
@@ -76,7 +76,6 @@ Juha Heinanen
3.31. cmp_str(str1, str2)
3.32. cmp_istr(str1, str2)
3.33. starts_with(str1, str2)
- 3.34. msg_apply_changes()
4. Known Limitations
@@ -121,7 +120,6 @@ Juha Heinanen
1.31. cmp_str usage
1.32. cmp_str usage
1.33. starts_with usage
- 1.34. msg_apply_changes() usage
Chapter 1. Admin Guide
@@ -171,7 +169,6 @@ Chapter 1. Admin Guide
3.31. cmp_str(str1, str2)
3.32. cmp_istr(str1, str2)
3.33. starts_with(str1, str2)
- 3.34. msg_apply_changes()
4. Known Limitations
@@ -244,7 +241,6 @@ From: medabeda
3.31. cmp_str(str1, str2)
3.32. cmp_istr(str1, str2)
3.33. starts_with(str1, str2)
- 3.34. msg_apply_changes()
3.1. search(re)
@@ -888,29 +884,6 @@ if (starts_with("$rU", "+358"))
}
...
-3.34. msg_apply_changes()
-
- Use this function to apply changes done on SIP request content. Be
- careful when using this function -- due to special handling of changes
- done to SIM message buffer so far, using this function might change the
- behaviour of your config as it was so far -- do test properly your
- config!
-
- This function can be used from REQUEST_ROUTE.
-
- Example 1.34. msg_apply_changes() usage
-...
-append_hf("My-Header: yes\r\n");
-if(msg_apply_changes())
-{
- # msg buffer has a new content
- if(is_present_hf("My-Header"))
- {
- # will get here always
- }
-}
-...
-
4. Known Limitations
Search functions are applied to the original request, i.e., they ignore
diff --git a/modules_k/textops/doc/textops_admin.xml
b/modules_k/textops/doc/textops_admin.xml
index 05e8240..0c8ea28 100644
--- a/modules_k/textops/doc/textops_admin.xml
+++ b/modules_k/textops/doc/textops_admin.xml
@@ -1233,38 +1233,6 @@ if (starts_with("$rU", "+358"))
</example>
</section>
- <section>
- <title>
- <function moreinfo="none">msg_apply_changes()</function>
- </title>
- <para>
- Use this function to apply changes done on SIP request content. Be
- careful when using this function -- due to special handling of changes
- done to SIM message buffer so far, using this function might change
- the behaviour of your config as it was so far -- do test properly
- your config!
- </para>
- <para>
- This function can be used from REQUEST_ROUTE.
- </para>
- <example>
- <title><function>msg_apply_changes()</function> usage</title>
- <programlisting format="linespecific">
-...
-append_hf("My-Header: yes\r\n");
-if(msg_apply_changes())
-{
- # msg buffer has a new content
- if(is_present_hf("My-Header"))
- {
- # will get here always
- }
-}
-...
-</programlisting>
- </example>
- </section>
-
</section>
<section>
<title>Known Limitations</title>
diff --git a/modules_k/textops/textops.c b/modules_k/textops/textops.c
index e5527e4..cb3907d 100644
--- a/modules_k/textops/textops.c
+++ b/modules_k/textops/textops.c
@@ -124,7 +124,6 @@ static int cmp_istr_f(struct sip_msg *msg, char *str1, char *str2 );
static int starts_with_f(struct sip_msg *msg, char *str1, char *str2 );
static int remove_hf_re_f(struct sip_msg* msg, char* key, char* foo);
static int is_present_hf_re_f(struct sip_msg* msg, char* key, char* foo);
-static int msg_apply_changes_f(sip_msg_t *msg, char *str1, char *str2);
static int fixup_substre(void**, int);
static int hname_fixup(void** param, int param_no);
@@ -247,9 +246,6 @@ static cmd_export_t cmds[]={
{"starts_with", (cmd_function)starts_with_f, 2,
fixup_spve_spve, 0,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
- {"msg_apply_changes", (cmd_function)msg_apply_changes_f, 0,
- 0, 0,
- REQUEST_ROUTE },
{0,0,0,0,0,0}
};
@@ -1878,84 +1874,6 @@ static int starts_with_f(struct sip_msg *msg, char *str1, char
*str2 )
return -2;
}
-static int msg_apply_changes_f(sip_msg_t *msg, char *str1, char *str2)
-{
- struct dest_info dst;
- str obuf;
- sip_msg_t tmp;
-
- if(get_route_type()!=REQUEST_ROUTE)
- {
- LM_ERR("invalid usage - not in request route\n");
- return -1;
- }
-
- init_dest_info(&dst);
- dst.proto = PROTO_UDP;
- obuf.s = build_req_buf_from_sip_req(msg,
- (unsigned int*)&obuf.len, &dst,
- BUILD_NO_LOCAL_VIA|BUILD_NO_VIA1_UPDATE);
- if(obuf.s == NULL)
- {
- LM_ERR("couldn't update msg buffer content\n");
- return -1;
- }
- if(obuf.len>=BUF_SIZE)
- {
- LM_ERR("new buffer overflow (%d)\n", obuf.len);
- pkg_free(obuf.s);
- return -1;
- }
- /* temporary copy */
- memcpy(&tmp, msg, sizeof(sip_msg_t));
-
- /* reset dst uri and path vector to avoid freeing - restored later */
- if(msg->dst_uri.s!=NULL)
- {
- msg->dst_uri.s = NULL;
- msg->dst_uri.len = 0;
- }
- if(msg->path_vec.s!=NULL)
- {
- msg->path_vec.s = NULL;
- msg->path_vec.len = 0;
- }
-
- /* free old msg structure */
- free_sip_msg(msg);
- memset(msg, 0, sizeof(sip_msg_t));
-
- /* restore msg fields */
- msg->buf = tmp.buf;
- msg->id = tmp.id;
- msg->rcv = tmp.rcv;
- msg->set_global_address = tmp.set_global_address;
- msg->set_global_port = tmp.set_global_port;
- msg->flags = tmp.flags;
- msg->msg_flags = tmp.msg_flags;
- msg->force_send_socket = tmp.force_send_socket;
- msg->fwd_send_flags = tmp.fwd_send_flags;
- msg->rpl_send_flags = tmp.rpl_send_flags;
- msg->dst_uri = tmp.dst_uri;
- msg->path_vec = tmp.path_vec;
-
- memcpy(msg->buf, obuf.s, obuf.len);
- msg->len = obuf.len;
- msg->buf[msg->len] = '\0';
-
- /* free new buffer - copied in the static buffer from old sip_msg_t */
- pkg_free(obuf.s);
-
- /* reparse the message */
- LM_DBG("SIP Request content updated - reparsing\n");
- if (parse_msg(msg->buf, msg->len, msg)!=0){
- LM_ERR("parse_msg failed\n");
- return -1;
- }
-
- return 1;
-}
-
int fixup_regexpNL_none(void** param, int param_no)
{
regex_t* re;