#include "data_lump.h"
#include "dprint.h"
#include "mem/mem.h"
#include "globals.h"
#include "error.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.
Enumerations | |
| enum | lump_dir { LD_NEXT, LD_BEFORE, LD_AFTER } |
Functions | |
| struct lump * | anchor_lump (struct sip_msg *msg, unsigned int offset, int unsigned len, enum _hdr_types_t type) |
| add an anchor WARNING: this function adds the lump either to the msg->add_rm or msg->body_lumps list, depending on the offset being greater than msg->eoh, so msg->eoh must be parsed (parse with HDR_EOH) if you think your lump might affect the body!! | |
| struct lump * | append_new_lump (struct lump **list, char *new_hdr, unsigned int len, enum _hdr_types_t type) |
| adds a header to the end | |
| static int | compare_flaged_lumps (const enum lump_flag flag1, const enum lump_flag flag2) |
| static int | compare_not_flaged_lumps (const enum lump_flag flag1, const enum lump_flag flag2) |
| void | del_flaged_lumps (struct lump **lump_list, const enum lump_flag flags) |
| Delete flagged lumps. | |
| static void | del_flaged_lumps_helper (struct lump **lump_list, const enum lump_flag flags, int(*compare_lump_flags)(const enum lump_flag flag1, const enum lump_flag flag2)) |
| helper method for flagged lump deletion | |
| struct lump * | del_lump (struct sip_msg *msg, unsigned int offset, unsigned int len, enum _hdr_types_t type) |
| removes an already existing header/data lump | |
| void | del_notflaged_lumps (struct lump **lump_list, const enum lump_flag not_flags) |
| Delete not flagged lumps. | |
| struct lump * | dup_lump_list (struct lump *l) |
| shallow pkg copy of a lump list | |
| static struct lump * | dup_lump_list_r (struct lump *l, enum lump_dir dir, int *error) |
| * duplicate (shallow-ly) a lump list into pkg memory | |
| void | free_duped_lump_list (struct lump *l) |
| Free duplicated lump list. | |
| void | free_lump (struct lump *lmp) |
| frees the content of a lump struct | |
| void | free_lump_list (struct lump *l) |
| frees an entire lump list, recursively | |
| static void | free_shallow_lump (struct lump *l) |
| free (shallow-ly) a lump and its after/before lists | |
| struct lump * | insert_cond_lump_after (struct lump *after, enum lump_conditions c, enum _hdr_types_t type) |
| inserts a cond lump immediately after hdr | |
| struct lump * | insert_cond_lump_before (struct lump *before, enum lump_conditions c, enum _hdr_types_t type) |
| inserts a conditional lump immediately before "before" | |
| struct lump * | insert_new_lump (struct lump **list, char *new_hdr, unsigned int len, enum _hdr_types_t type) |
| inserts a header to the beginning | |
| struct lump * | insert_new_lump_after (struct lump *after, char *new_hdr, unsigned int len, enum _hdr_types_t type) |
| inserts a header/data lump immediately after hdr | |
| struct lump * | insert_new_lump_before (struct lump *before, char *new_hdr, unsigned int len, enum _hdr_types_t type) |
| inserts a header/data lump immediately before "before" | |
| struct lump * | insert_subst_lump_after (struct lump *after, enum lump_subst subst, enum _hdr_types_t type) |
| inserts a subst lump immediately after hdr | |
| struct lump * | insert_subst_lump_before (struct lump *before, enum lump_subst subst, enum _hdr_types_t type) |
| inserts a subst lump immediately before "before" | |
Variables | |
| int | init_lump_flags = 0 |
Definition in file data_lump.c.
| enum lump_dir |
Definition at line 56 of file data_lump.c.
| struct lump* anchor_lump | ( | struct sip_msg * | msg, | |
| unsigned int | offset, | |||
| int unsigned | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
add an anchor WARNING: this function adds the lump either to the msg->add_rm or msg->body_lumps list, depending on the offset being greater than msg->eoh, so msg->eoh must be parsed (parse with HDR_EOH) if you think your lump might affect the body!!
Definition at line 333 of file data_lump.c.
References sip_msg::add_rm, sip_msg::body_lumps, sip_msg::buf, E_OUT_OF_MEM, sip_msg::eoh, lump::flags, init_lump_flags, lump::len, sip_msg::len, LM_ERR, LM_WARN, LUMP_DEL, LUMP_NOP, lump::next, lump::offset, lump::op, pkg_malloc, ser_error, lump::type, and lump::u.
Referenced by add_diversion_helper(), add_hf_helper(), add_maxfwd_header(), add_rcv_param_f(), add_sock_hdr(), adjust_clen(), alter_mediaip(), alter_mediaport(), append_header(), append_rpid_helper(), apply_urihdr_changes(), build_req_buf_from_sip_req(), fix_nated_sdp_f(), force_rtp_proxy(), get_fdisplay_anchor(), insert_element(), insert_path_as_route(), ospAppendHeader(), prepend_path(), record_route(), record_route_preset(), save_ruri(), search_append_body_f(), search_append_f(), and set_body_f().
| struct lump* append_new_lump | ( | struct lump ** | list, | |
| char * | new_hdr, | |||
| unsigned int | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
adds a header to the end
Definition at line 62 of file data_lump.c.
References lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD, lump::op, pkg_malloc, lump::type, lump::u, and lump::value.
Delete flagged lumps.
remove all flagged lumps from the list
| lump_list | list of lumps | |
| flags | flags for lumps that should be deleted |
Definition at line 635 of file data_lump.c.
References compare_flaged_lumps(), and del_flaged_lumps_helper().
Referenced by post_print_uac_request().
| static void del_flaged_lumps_helper | ( | struct lump ** | lump_list, | |
| const enum lump_flag | flags, | |||
| int(*)(const enum lump_flag flag1, const enum lump_flag flag2) | compare_lump_flags | |||
| ) | [static] |
helper method for flagged lump deletion
| lump_list | list of lumps | |
| flags | flags for lumps that should be deleted | |
| compare_lump_flags | helper function that compares two lump flags |
Definition at line 575 of file data_lump.c.
References lump::after, lump::before, lump::flags, free_lump(), free_lump_list(), lump::next, and pkg_free.
Referenced by del_flaged_lumps(), and del_notflaged_lumps().
| struct lump* del_lump | ( | struct sip_msg * | msg, | |
| unsigned int | offset, | |||
| unsigned int | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
removes an already existing header/data lump
removes an already existing header
Definition at line 276 of file data_lump.c.
References sip_msg::add_rm, sip_msg::body_lumps, sip_msg::buf, sip_msg::eoh, lump::flags, init_lump_flags, lump::len, sip_msg::len, LM_CRIT, LM_ERR, LM_WARN, LUMP_DEL, LUMP_NOP, lump::next, lump::offset, lump::op, pkg_malloc, lump::type, and lump::u.
Referenced by adjust_clen(), after_loose(), after_strict(), alter_mediaip(), alter_mediaport(), alter_rtcp(), build_req_buf_from_sip_req(), build_res_buf_from_sip_res(), consume_credentials(), do_replace_body_f(), filter_body_f(), fix_nated_contact_f(), FixContact(), handle_sr(), patch(), remove_element(), remove_header(), remove_hf_f(), remove_hf_re_f(), replace_all_f(), replace_body_f(), replace_element(), replace_f(), replace_from(), restore_from(), restore_from_reply(), restore_to_reply(), set_body_f(), subst_body_f(), and subst_f().
Delete not flagged lumps.
remove all unflagged lumps from the list
| lump_list | list of lumps | |
| not_flags | flags for lumps that should not deleted |
Definition at line 646 of file data_lump.c.
References compare_not_flaged_lumps(), and del_flaged_lumps_helper().
Referenced by free_faked_req().
shallow pkg copy of a lump list
duplicates a lump list shallowly in pkg-mem
Definition at line 511 of file data_lump.c.
References dup_lump_list_r(), and LD_NEXT.
| static struct lump* dup_lump_list_r | ( | struct lump * | l, | |
| enum lump_dir | dir, | |||
| int * | error | |||
| ) | [static, read] |
* duplicate (shallow-ly) a lump list into pkg memory
Definition at line 452 of file data_lump.c.
References lump::after, lump::before, lump::flags, free_shallow_lump(), init_lump_flags, LD_AFTER, LD_BEFORE, LD_NEXT, LM_CRIT, LM_ERR, LUMPFLAG_DUPED, lump::next, and pkg_malloc.
Referenced by dup_lump_list().
| void free_duped_lump_list | ( | struct lump * | l | ) |
frees a shallowly duplicated lump list
Definition at line 523 of file data_lump.c.
References lump::after, lump::before, lump::flags, free_lump(), LUMPFLAG_DUPED, lump::next, and pkg_free.
| void free_lump | ( | struct lump * | lmp | ) |
frees the content of a lump struct
Definition at line 387 of file data_lump.c.
References lump::flags, lump::len, LM_CRIT, LUMP_ADD, LUMPFLAG_DUPED, LUMPFLAG_SHMEM, lump::op, pkg_free, lump::u, and lump::value.
Referenced by del_flaged_lumps_helper(), free_duped_lump_list(), free_lump_list(), and free_via_clen_lump().
| void free_lump_list | ( | struct lump * | l | ) |
frees an entire lump list, recursively
Definition at line 406 of file data_lump.c.
References lump::after, lump::before, free_lump(), lump::next, and pkg_free.
Referenced by del_flaged_lumps_helper(), free_sip_msg(), free_sip_msg_lite(), and set_body_f().
| static void free_shallow_lump | ( | struct lump * | l | ) | [static] |
free (shallow-ly) a lump and its after/before lists
Definition at line 434 of file data_lump.c.
References lump::after, lump::before, and pkg_free.
Referenced by dup_lump_list_r().
| struct lump* insert_cond_lump_after | ( | struct lump * | after, | |
| enum lump_conditions | c, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a cond lump immediately after hdr
conditional lumps - insert
Definition at line 220 of file data_lump.c.
References lump::after, lump::cond, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD_OPT, lump::op, pkg_malloc, ser_error, lump::type, and lump::u.
Referenced by build_rr(), and record_route().
| struct lump* insert_cond_lump_before | ( | struct lump * | before, | |
| enum lump_conditions | c, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a conditional lump immediately before "before"
conditional lumps - before
Definition at line 246 of file data_lump.c.
References lump::before, lump::cond, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD_OPT, lump::op, pkg_malloc, ser_error, lump::type, and lump::u.
Referenced by record_route().
| struct lump* insert_new_lump | ( | struct lump ** | list, | |
| char * | new_hdr, | |||
| unsigned int | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a header to the beginning
Definition at line 90 of file data_lump.c.
References lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD, lump::next, lump::op, pkg_malloc, lump::type, lump::u, and lump::value.
| struct lump* insert_new_lump_after | ( | struct lump * | after, | |
| char * | new_hdr, | |||
| unsigned int | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a header/data lump immediately after hdr
inserts a header to the beginning - after
Definition at line 115 of file data_lump.c.
References lump::after, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD, lump::op, pkg_malloc, ser_error, lump::type, lump::u, and lump::value.
Referenced by add_rcv_param_f(), adjust_clen(), alter_mediaip(), alter_mediaport(), alter_rtcp(), build_req_buf_from_sip_req(), build_rr(), do_replace_body_f(), fix_nated_contact_f(), fix_nated_sdp_f(), FixContact(), force_rtp_proxy(), get_fdisplay_anchor(), insert_element(), patch(), record_route_preset(), replace_all_f(), replace_body_f(), replace_element(), replace_f(), replace_from(), restore_from(), restore_from_reply(), restore_to_reply(), search_append_body_f(), search_append_f(), set_body_f(), subst_body_f(), and subst_f().
| struct lump* insert_new_lump_before | ( | struct lump * | before, | |
| char * | new_hdr, | |||
| unsigned int | len, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a header/data lump immediately before "before"
inserts a header to the beginning - before
Definition at line 141 of file data_lump.c.
References lump::before, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD, lump::op, pkg_malloc, ser_error, lump::type, lump::u, and lump::value.
Referenced by add_diversion_helper(), add_hf_helper(), add_maxfwd_header(), add_sock_hdr(), append_header(), append_rpid_helper(), apply_urihdr_changes(), build_req_buf_from_sip_req(), build_rr(), insert_path_as_route(), insert_rr_param_lump(), ospAppendHeader(), prepend_path(), and save_ruri().
| struct lump* insert_subst_lump_after | ( | struct lump * | after, | |
| enum lump_subst | subst, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a subst lump immediately after hdr
substitutions (replace with ip address, port etc) - after
Definition at line 167 of file data_lump.c.
References lump::after, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD_SUBST, lump::op, pkg_malloc, ser_error, lump::subst, lump::type, and lump::u.
Referenced by build_rr().
| struct lump* insert_subst_lump_before | ( | struct lump * | before, | |
| enum lump_subst | subst, | |||
| enum _hdr_types_t | type | |||
| ) | [read] |
inserts a subst lump immediately before "before"
substitutions (replace with ip address, port etc) - before
Definition at line 193 of file data_lump.c.
References lump::before, E_OUT_OF_MEM, lump::flags, init_lump_flags, lump::len, LM_ERR, LUMP_ADD_SUBST, lump::op, pkg_malloc, ser_error, lump::subst, lump::type, and lump::u.
Referenced by prepend_path().
| int init_lump_flags = 0 |
Definition at line 58 of file data_lump.c.
Referenced by anchor_lump(), append_new_lump(), del_lump(), dup_lump_list_r(), insert_cond_lump_after(), insert_cond_lump_before(), insert_new_lump(), insert_new_lump_after(), insert_new_lump_before(), insert_subst_lump_after(), and insert_subst_lump_before().
1.5.6