2 * $Id: hf.c,v 1.21 2004/12/03 17:11:36 jamey Exp $
4 * Copyright (C) 2001-2003 FhG Fokus
6 * This file is part of ser, a free SIP server.
8 * ser is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version
13 * For a license to use the ser software under conditions
14 * other than those described here, or to purchase support for this
15 * software, please contact iptel.org by e-mail at the following addresses:
18 * ser is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 * 2003-03-26 Frees also hdr->parsed for Route & Record-Route (janakj)
30 * 2003-04-26 ZSW (jiri)
31 * 2003-08-05 free the parsed part of Accept header (bogdan)
36 #include "parse_via.h"
38 #include "parse_cseq.h"
39 #include "../dprint.h"
40 #include "../mem/mem.h"
41 #include "parse_def.h"
42 #include "digest/digest.h" /* free_credentials */
43 #include "parse_event.h"
44 #include "parse_expires.h"
46 #include "contact/parse_contact.h"
47 #include "parse_disposition.h"
52 * Frees a hdr_field structure,
53 * WARNING: it frees only parsed (and not name.s, body.s)
55 void clean_hdr_field(struct hdr_field* hf)
60 free_via_list(hf->parsed);
72 free_cseq(hf->parsed);
79 free_contact((contact_body_t**)(&(hf->parsed)));
86 free_rr((rr_t**)(&hf->parsed));
90 free_rr((rr_t**)(&hf->parsed));
96 case HDR_CONTENTLENGTH:
99 case HDR_AUTHORIZATION:
100 free_credentials((auth_body_t**)(&(hf->parsed)));
104 free_expires((exp_body_t**)(&(hf->parsed)));
108 free_credentials((auth_body_t**)(&(hf->parsed)));
114 case HDR_PROXYREQUIRE:
117 case HDR_UNSUPPORTED:
124 free_event((event_t**)(&(hf->parsed)));
128 pkg_free(hf->parsed);
131 case HDR_ACCEPTLANGUAGE:
134 case HDR_ORGANIZATION:
146 case HDR_ACCEPTDISPOSITION:
149 case HDR_CONTENTDISPOSITION:
150 free_disposition( ((struct disposition**)(&hf->parsed)) );
162 LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
171 * Frees a hdr_field list,
172 * WARNING: frees only ->parsed and ->next*/
173 void free_hdr_field_lst(struct hdr_field* hf)
175 struct hdr_field* foo;
180 clean_hdr_field(foo);
185 void dump_hdr_field( struct hdr_field* hf )
187 LOG(L_ERR, "DEBUG: dump_hdr_field: type=%d, name=%.*s, "
188 "body=%.*s, parsed=%p, next=%p\n",
189 hf->type, hf->name.len, ZSW(hf->name.s),
190 hf->body.len, ZSW(hf->body.s),
191 hf->parsed, hf->next );