data_lump.h
831faabf
 /*
  * adding/removing headers or any other data chunk from a message
7dd0b342
  *
53c7e0f1
  * Copyright (C) 2001-2003 FhG Fokus
7dd0b342
  *
02ca141b
  * This file is part of Kamailio, a free SIP server.
7dd0b342
  *
02ca141b
  * Kamailio is free software; you can redistribute it and/or modify
7dd0b342
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
02ca141b
  * Kamailio is distributed in the hope that it will be useful,
7dd0b342
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License 
  * along with this program; if not, write to the Free Software 
9e1ff448
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
f15bede1
  */
3ca1a53f
 
 /*!
  * \file
6806e46a
  * \brief Kamailio core :: Data_lumps
02ca141b
  * \author jiri, andrei, janakj
  * adding/removing headers or any other data chunk from a message
3ca1a53f
  * \ingroup core
  * Module: \ref core
  */
 
7dd0b342
 
831faabf
 #ifndef data_lump_h
 #define data_lump_h
 
4c37101e
 #include "lump_struct.h"
 #include "parser/msg_parser.h"
182fea0e
 #include "parser/hf.h"
831faabf
 
b663c49c
 
 /* adds a header right after an anchor point if exists */
 struct lump* add_new_lump(struct lump** list, char* new_hdr,
 							 int len, enum _hdr_types_t type);
 
3ca1a53f
 /*! \brief adds a header to the end */
831faabf
 struct lump* append_new_lump(struct lump** list, char* new_hdr,
182fea0e
 							 int len, enum _hdr_types_t type);
3ca1a53f
 /*! \brief inserts a header to the beginning */
831faabf
 struct lump* insert_new_lump(struct lump** list, char* new_hdr,
182fea0e
 							  int len, enum _hdr_types_t type);
831faabf
 struct lump* insert_new_lump_after(struct lump* after,
182fea0e
 									char* new_hdr, int len, enum _hdr_types_t type);
831faabf
 struct lump* insert_new_lump_before(struct lump* before, char* new_hdr,
182fea0e
 									int len,enum _hdr_types_t type);
3ca1a53f
 /*! \brief substitutions (replace with ip address, port etc) */
f15bede1
 struct lump* insert_subst_lump_after(struct lump* after,  enum lump_subst subst,
182fea0e
 									enum _hdr_types_t type);
f15bede1
 struct lump* insert_subst_lump_before(struct lump* before,enum lump_subst subst,
182fea0e
 									enum _hdr_types_t type);
831faabf
 
3ca1a53f
 /*! \brief conditional lumps */
73eec4b2
 struct lump* insert_cond_lump_after(struct lump* after, enum lump_conditions c,
182fea0e
 									enum _hdr_types_t type);
73eec4b2
 struct lump* insert_cond_lump_before(struct lump* after, enum lump_conditions c,
182fea0e
 									enum _hdr_types_t type);
831faabf
 
b663c49c
 /* set an anchor if there is no existing one at the given offset,
  * otherwise return the existing anchor */
 struct lump* anchor_lump2(struct sip_msg* msg, int offset, int len, enum _hdr_types_t type,
 								int *is_ref);
878b343f
 /*! \brief removes an already existing header */
182fea0e
 struct lump* del_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_t type);
3ca1a53f
 /*! \brief set an anchor */
182fea0e
 struct lump* anchor_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_t type);
831faabf
 
 
 
3ca1a53f
 /*! \brief duplicates a lump list shallowly in pkg-mem */
4d93f145
 struct lump* dup_lump_list( struct lump *l );
3ca1a53f
 /*! \brief frees a shallowly duplicated lump list */
4d93f145
 void free_duped_lump_list(struct lump* l);
 
41f45c80
 
3ca1a53f
 /*! \brief remove all non-SHMEM lumps from the list */
41f45c80
 void del_nonshm_lump( struct lump** lump_list );
 
7fd56197
 /*! \brief remove the lump from the internal lists */
 int remove_lump(sip_msg_t *msg, struct lump *l);
831faabf
 #endif