#include "../../action.h"#include "../../sr_module.h"#include "../../dprint.h"#include "../../data_lump.h"#include "../../data_lump_rpl.h"#include "../../error.h"#include "../../mem/mem.h"#include "../../str.h"#include "../../re.h"#include "../../mod_fix.h"#include "../../parser/parse_uri.h"#include "../../parser/parse_hname2.h"#include "../../parser/parse_methods.h"#include "../../parser/parse_content.h"#include "../../parser/parse_privacy.h"#include "../../ut.h"#include "../../cmpapi.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <regex.h>#include <time.h>#include <sys/time.h>#include "textops.h"#include "txt_var.h"#include "api.h"

Go to the source code of this file.
Defines | |
| #define | MAX_TIME 64 |
| #define | TIME_FORMAT "Date: %a, %d %b %Y %H:%M:%S GMT" |
Functions | |
| static int | add_header_fixup (void **param, int param_no) |
| int | add_hf_helper (struct sip_msg *msg, str *str1, str *str2, gparam_p hfval, int mode, gparam_p hfanc) |
| static int | append_hf_1 (struct sip_msg *msg, char *str1, char *str2) |
| static int | append_hf_2 (struct sip_msg *msg, char *str1, char *str2) |
| static int | append_time_f (struct sip_msg *msg, char *, char *) |
| static int | append_to_reply_f (struct sip_msg *msg, char *key, char *str) |
| static int | append_urihf (struct sip_msg *msg, char *str1, char *str2) |
| static int | cmp_istr_f (struct sip_msg *msg, char *str1, char *str2) |
| static int | cmp_str_f (struct sip_msg *msg, char *str1, char *str2) |
| static int | do_replace_body_f (struct sip_msg *msg, char *key, char *str2, int nobol) |
| static int | filter_body_f (struct sip_msg *, char *, char *) |
| static int | find_line_start (char *text, unsigned int text_len, char **buf, unsigned int *buf_len) |
| static int | fixup_body_type (void **param, int param_no) |
| static int | fixup_method (void **param, int param_no) |
| static int | fixup_privacy (void **param, int param_no) |
| static int | fixup_substre (void **, int) |
| static int | free_hname_fixup (void **param, int param_no) |
| static char * | get_header (struct sip_msg *msg) |
| static int | has_body_f (struct sip_msg *msg, char *type, char *str2) |
| static int | hname_fixup (void **param, int param_no) |
| static int | insert_hf_1 (struct sip_msg *msg, char *str1, char *str2) |
| static int | insert_hf_2 (struct sip_msg *msg, char *str1, char *str2) |
| static int | is_method_f (struct sip_msg *msg, char *, char *) |
| static int | is_present_hf_f (struct sip_msg *msg, char *str_hf, char *foo) |
| static int | is_present_hf_re_f (struct sip_msg *msg, char *key, char *foo) |
| static int | is_privacy_f (struct sip_msg *msg, char *privacy, char *str2) |
| static int | mod_init (void) |
| int | mod_register (char *path, int *dlflags, void *p1, void *p2) |
| int | remove_hf_f (struct sip_msg *msg, char *str_hf, char *foo) |
| static int | remove_hf_re_f (struct sip_msg *msg, char *key, char *foo) |
| static int | replace_all_f (struct sip_msg *, char *, char *) |
| static int | replace_body_all_f (struct sip_msg *, char *, char *) |
| static int | replace_body_atonce_f (struct sip_msg *, char *, char *) |
| static int | replace_body_f (struct sip_msg *, char *, char *) |
| static int | replace_f (struct sip_msg *, char *, char *) |
| static int | search_append_body_f (struct sip_msg *, char *, char *) |
| int | search_append_f (struct sip_msg *msg, char *key, char *str2) |
| static int | search_body_f (struct sip_msg *, char *, char *) |
| int | search_f (struct sip_msg *msg, char *key, char *str2) |
| static int | set_body_f (struct sip_msg *msg, char *, char *) |
| static int | set_rpl_body_f (struct sip_msg *msg, char *, char *) |
| static int | subst_body_f (struct sip_msg *, char *, char *) |
| static int | subst_f (struct sip_msg *, char *, char *) |
| static int | subst_uri_f (struct sip_msg *, char *, char *) |
| static int | subst_user_f (struct sip_msg *, char *, char *) |
Variables | |
| static cmd_export_t | cmds [] |
| struct module_exports | exports |
| static tr_export_t | mod_trans [] |
| #define MAX_TIME 64 |
| #define TIME_FORMAT "Date: %a, %d %b %Y %H:%M:%S GMT" |
| static int add_header_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1645 of file textops.c.
References E_UNSPEC, fixup_spve_null(), hname_fixup(), and LM_ERR.
| int add_hf_helper | ( | struct sip_msg * | msg, | |
| str * | str1, | |||
| str * | str2, | |||
| gparam_p | hfval, | |||
| int | mode, | |||
| gparam_p | hfanc | |||
| ) |
Definition at line 1335 of file textops.c.
References anchor_lump(), sip_msg::buf, cmp_hdrname_str(), fixup_get_svalue(), GPARAM_TYPE_INT, HDR_EOH_F, sip_msg::headers, insert_new_lump_before(), _gparam::ival, hdr_field::len, _str::len, len, LM_ERR, hdr_field::name, hdr_field::next, NULL, parse_headers(), pkg_free, pkg_malloc, REQ_LINE, _str::s, s, _gparam::sval, hdr_field::type, _gparam::type, sip_msg::unparsed, and _gparam::v.
Referenced by append_hf_1(), append_hf_2(), append_hf_api(), append_urihf(), insert_hf_1(), and insert_hf_2().
| static int append_hf_1 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int append_hf_2 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int append_time_f | ( | struct sip_msg * | msg, | |
| char * | p1, | |||
| char * | p2 | |||
| ) | [static] |
Definition at line 1047 of file textops.c.
References add_lump_rpl(), len, LM_ERR, LUMP_RPL_HDR, MAX_TIME, NULL, and TIME_FORMAT.
| static int append_to_reply_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str | |||
| ) | [static] |
Definition at line 1307 of file textops.c.
References add_lump_rpl(), fixup_get_svalue(), _str::len, LM_ERR, LUMP_RPL_HDR, NULL, and _str::s.
| static int append_urihf | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int cmp_istr_f | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int cmp_str_f | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int do_replace_body_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2, | |||
| int | nobol | |||
| ) | [static] |
Definition at line 444 of file textops.c.
References buf, sip_msg::buf, del_lump(), get_body(), insert_new_lump_after(), sip_msg::len, _str::len, len, LM_DBG, LM_ERR, pkg_free, pkg_malloc, _str::s, and s.
Referenced by replace_body_all_f(), and replace_body_atonce_f().
| static int filter_body_f | ( | struct sip_msg * | msg, | |
| char * | _content_type, | |||
| char * | ignored | |||
| ) | [static] |
Definition at line 833 of file textops.c.
References sip_msg::buf, del_lump(), find_line_start(), get_body(), sip_msg::len, _str::len, len, LM_DBG, LM_ERR, and _str::s.
| static int find_line_start | ( | char * | text, | |
| unsigned int | text_len, | |||
| char ** | buf, | |||
| unsigned int * | buf_len | |||
| ) | [inline, static] |
| static int fixup_body_type | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1659 of file textops.c.
References decode_mime_type(), E_CFG, LM_ERR, pkg_free, and hdr_field::type.
| static int fixup_method | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1553 of file textops.c.
References E_UNSPEC, _str::len, LM_DBG, LM_ERR, METHOD_OTHER, METHOD_UNDEF, parse_methods(), pkg_free, pkg_malloc, _str::s, and s.
| static int fixup_privacy | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
| static int fixup_substre | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1024 of file textops.c.
References E_BAD_RE, _str::len, LM_DBG, LM_ERR, module_exports::name, _str::s, and subst_parser().
| static int free_hname_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1538 of file textops.c.
References GPARAM_TYPE_STR, pkg_free, and hdr_field::type.
| static char* get_header | ( | struct sip_msg * | msg | ) | [static] |
Definition at line 273 of file textops.c.
References sip_msg::buf, sip_msg::first_line, and msg_start::len.
Referenced by replace_all_f(), replace_f(), search_append_f(), and subst_f().
| static int has_body_f | ( | struct sip_msg * | msg, | |
| char * | type, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 1688 of file textops.c.
References sip_msg::content_length, get_content_length, HDR_CONTENTLENGTH_F, LM_DBG, LM_ERR, NULL, parse_content_type_hdr(), parse_headers(), SUBTYPE_SDP, and TYPE_APPLICATION.
| static int hname_fixup | ( | void ** | param, | |
| int | param_no | |||
| ) | [static] |
Definition at line 1483 of file textops.c.
References E_UNSPEC, GPARAM_TYPE_INT, GPARAM_TYPE_STR, HDR_ERROR_T, HDR_OTHER_T, LM_ERR, LM_INFO, NULL, parse_hname2(), pkg_free, pkg_malloc, and hdr_field::type.
Referenced by add_header_fixup().
| static int insert_hf_1 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int insert_hf_2 | ( | struct sip_msg * | msg, | |
| char * | str1, | |||
| char * | str2 | |||
| ) | [static] |
| static int is_method_f | ( | struct sip_msg * | msg, | |
| char * | meth, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 1450 of file textops.c.
References sip_msg::cseq, sip_msg::first_line, get_cseq, HDR_CSEQ_F, _str::len, LM_ERR, METHOD_OTHER, NULL, parse_headers(), msg_start::request, _str::s, SIP_REQUEST, msg_start::type, and msg_start::u.
| static int is_present_hf_f | ( | struct sip_msg * | msg, | |
| char * | str_hf, | |||
| char * | foo | |||
| ) | [static] |
Definition at line 971 of file textops.c.
References cmp_hdrname_str(), GPARAM_TYPE_INT, HDR_EOH_F, sip_msg::headers, _gparam::ival, _str::len, hdr_field::name, hdr_field::next, parse_headers(), _gparam::sval, hdr_field::type, _gparam::type, and _gparam::v.
| static int is_present_hf_re_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | foo | |||
| ) | [static] |
Definition at line 996 of file textops.c.
References HDR_EOH_F, sip_msg::headers, _str::len, hdr_field::name, hdr_field::next, parse_headers(), and _str::s.
| static int is_privacy_f | ( | struct sip_msg * | msg, | |
| char * | privacy, | |||
| char * | str2 | |||
| ) | [static] |
| int mod_register | ( | char * | path, | |
| int * | dlflags, | |||
| void * | p1, | |||
| void * | p2 | |||
| ) |
| int remove_hf_f | ( | struct sip_msg * | msg, | |
| char * | str_hf, | |||
| char * | foo | |||
| ) |
Definition at line 899 of file textops.c.
References sip_msg::buf, cmp_hdrname_str(), del_lump(), GPARAM_TYPE_INT, HDR_EOH_F, sip_msg::headers, _gparam::ival, hdr_field::len, _str::len, LM_ERR, hdr_field::name, hdr_field::next, parse_headers(), _str::s, _gparam::sval, hdr_field::type, _gparam::type, and _gparam::v.
Referenced by remove_hf_api().
| static int remove_hf_re_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | foo | |||
| ) | [static] |
Definition at line 935 of file textops.c.
References sip_msg::buf, del_lump(), HDR_EOH_F, sip_msg::headers, hdr_field::len, _str::len, LM_ERR, hdr_field::name, hdr_field::next, parse_headers(), and _str::s.
| static int replace_all_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 389 of file textops.c.
References sip_msg::buf, buf, del_lump(), get_header(), insert_new_lump_after(), sip_msg::len, len, LM_ERR, pkg_free, pkg_malloc, and s.
| static int replace_body_all_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
| static int replace_body_atonce_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
| static int replace_body_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 557 of file textops.c.
References sip_msg::buf, del_lump(), get_body(), insert_new_lump_after(), sip_msg::len, _str::len, len, LM_DBG, LM_ERR, pkg_free, pkg_malloc, _str::s, and s.
| static int replace_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 521 of file textops.c.
References sip_msg::buf, del_lump(), get_header(), insert_new_lump_after(), len, LM_ERR, pkg_free, pkg_malloc, and s.
| static int search_append_body_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 345 of file textops.c.
References anchor_lump(), sip_msg::buf, get_body(), insert_new_lump_after(), sip_msg::len, _str::len, len, LM_DBG, LM_ERR, pkg_free, pkg_malloc, _str::s, and s.
| int search_append_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) |
Definition at line 312 of file textops.c.
References anchor_lump(), sip_msg::buf, get_header(), insert_new_lump_after(), len, LM_ERR, pkg_free, pkg_malloc, and s.
Referenced by search_append_api().
| static int search_body_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) | [static] |
Definition at line 290 of file textops.c.
References sip_msg::buf, get_body(), sip_msg::len, _str::len, LM_DBG, LM_ERR, and _str::s.
| int search_f | ( | struct sip_msg * | msg, | |
| char * | key, | |||
| char * | str2 | |||
| ) |
| static int set_body_f | ( | struct sip_msg * | msg, | |
| char * | p1, | |||
| char * | p2 | |||
| ) | [static] |
Definition at line 1084 of file textops.c.
References anchor_lump(), hdr_field::body, sip_msg::body_lumps, sip_msg::buf, buf, CONTENT_LENGTH, sip_msg::content_length, CONTENT_LENGTH_LEN, sip_msg::content_type, CRLF, CRLF_LEN, del_lump(), fixup_get_svalue(), free_lump_list(), get_body(), get_content_length, insert_new_lump_after(), int2str(), hdr_field::len, sip_msg::len, _str::len, len, LM_DBG, LM_ERR, hdr_field::name, nc, NULL, pkg_free, pkg_malloc, _str::s, and sip_msg::unparsed.
| static int set_rpl_body_f | ( | struct sip_msg * | msg, | |
| char * | p1, | |||
| char * | p2 | |||
| ) | [static] |
Definition at line 1241 of file textops.c.
References add_lump_rpl(), buf, CRLF, CRLF_LEN, fixup_get_svalue(), _str::len, len, LM_ERR, LUMP_RPL_BODY, LUMP_RPL_HDR, nc, NULL, pkg_free, pkg_malloc, and _str::s.
| static int subst_body_f | ( | struct sip_msg * | msg, | |
| char * | subst, | |||
| char * | ignored | |||
| ) | [static] |
Definition at line 741 of file textops.c.
References sip_msg::buf, del_lump(), get_body(), insert_new_lump_after(), sip_msg::len, _str::len, LM_DBG, LM_ERR, module_exports::name, replace_lst::next, replace_lst::offset, replace_lst_free(), replace_lst::rpl, _str::s, replace_lst::size, and subst_run().
| static int subst_f | ( | struct sip_msg * | msg, | |
| char * | subst, | |||
| char * | ignored | |||
| ) | [static] |
Definition at line 607 of file textops.c.
References sip_msg::buf, del_lump(), get_header(), insert_new_lump_after(), _str::len, LM_DBG, LM_ERR, module_exports::name, replace_lst::next, replace_lst::offset, replace_lst_free(), replace_lst::rpl, _str::s, replace_lst::size, and subst_run().
| static int subst_uri_f | ( | struct sip_msg * | msg, | |
| char * | subst, | |||
| char * | ignored | |||
| ) | [static] |
Definition at line 656 of file textops.c.
References sip_msg::first_line, _str::len, len, LM_DBG, module_exports::name, sip_msg::new_uri, sip_msg::parsed_uri_ok, pkg_free, msg_start::request, _str::s, subst_str(), and msg_start::u.
| static int subst_user_f | ( | struct sip_msg * | msg, | |
| char * | subst, | |||
| char * | ignored | |||
| ) | [static] |
Definition at line 697 of file textops.c.
References do_action(), action::elem, LM_ERR, NULL, parse_sip_msg_uri(), sip_msg::parsed_uri, pkg_free, _str::s, SET_USER_T, action_elem_::string, STRING_ST, subst_str(), action_elem_::type, action::type, action_elem_::u, sip_uri::user, and user.
cmd_export_t cmds[] [static] |
| struct module_exports exports |
tr_export_t mod_trans[] [static] |
1.5.6