1 /* 2 * $Id: parse_header.h 850 2008-04-04 21:29:36Z sayer $ 3 * 4 * Copyright (C) 2007 Raphael Coeffic 5 * 6 * This file is part of SEMS, a free SIP media server. 7 * 8 * SEMS 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. This program is released under 12 * the GPL with the additional exemption that compiling, linking, 13 * and/or using OpenSSL is allowed. 14 * 15 * For a license to use the SEMS software under conditions 16 * other than those described here, or to purchase support for this 17 * software, please contact iptel.org by e-mail at the following addresses: 18 * info@iptel.org 19 * 20 * SEMS is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * You should have received a copy of the GNU General Public License 26 * along with this program; if not, write to the Free Software 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 */ 29 30 #ifndef _parse_header_h 31 #define _parse_header_h 32 33 #include "cstring.h" 34 35 #include <list> 36 using std::list; 37 38 struct sip_parsed_hdr 39 { ~sip_parsed_hdrsip_parsed_hdr40 virtual ~sip_parsed_hdr(){} 41 }; 42 43 44 struct sip_header 45 { 46 // 47 // Header types 48 // 49 50 enum { 51 H_UNPARSED=0, 52 53 H_TO, 54 H_VIA, 55 H_FROM, 56 H_CSEQ, 57 H_RSEQ, 58 H_RACK, 59 H_ROUTE, 60 H_CALL_ID, 61 H_CONTACT, 62 H_REQUIRE, 63 H_RECORD_ROUTE, 64 H_CONTENT_TYPE, 65 H_CONTENT_LENGTH, 66 H_MAX_FORWARDS, 67 68 H_OTHER 69 }; 70 71 int type; 72 cstring name; 73 cstring value; 74 75 sip_parsed_hdr* p; 76 77 sip_header(); 78 sip_header(const sip_header& hdr); 79 sip_header(int type, const cstring& name, const cstring& value); 80 ~sip_header(); 81 }; 82 83 int parse_header_type(sip_header* h); 84 85 int parse_headers(list<sip_header*>& hdrs, char** c, char* end); 86 void free_headers(list<sip_header*>& hdrs); 87 88 #endif 89 90 /** EMACS ** 91 * Local variables: 92 * mode: c++ 93 * c-basic-offset: 4 94 * End: 95 */ 96