00001 /* 00002 * $Id$ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of ser, a free SIP server. 00007 * 00008 * ser is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version 00012 * 00013 * For a license to use the ser software under conditions 00014 * other than those described here, or to purchase support for this 00015 * software, please contact iptel.org by e-mail at the following addresses: 00016 * info@iptel.org 00017 * 00018 * ser is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program; if not, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 */ 00027 00034 /* 00035 * 2003-01-21 added rport parsing code, contributed by 00036 * Maxim Sobolev <sobomax@FreeBSD.org> 00037 * 2003-01-21 added extra via param parsing code (i=...), used 00038 * by tcp to identify the sending socket, by andrei 00039 * 2003-01-27 added a new member (start) to via_param, by andrei 00040 * 2003-10-27 added alias to via && PARAM_ALIAS (andrei) 00041 * 2006-02-24 added comp/PARAM_COMP support (andrei) 00042 */ 00043 00044 00045 00046 #ifndef PARSE_VIA_H 00047 #define PARSE_VIA_H 00048 00049 #include "../str.h" 00050 00051 struct sip_msg; 00052 00053 /* via param types 00054 * WARNING: keep in sync with parse_via.c FIN_HIDDEN... 00055 * and with tm/sip_msg.c via_body_cloner 00056 */ 00057 enum { 00058 PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 00059 PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, PARAM_ALIAS, 00060 #ifdef USE_COMP 00061 PARAM_COMP, 00062 #endif 00063 GEN_PARAM=253, 00064 PARAM_ERROR 00065 }; 00066 00067 00068 00069 struct via_param { 00070 int type; /* Type of the parameter */ 00071 str name; /* Name of the parameter */ 00072 str value; /* Value of the parameter */ 00073 char* start; /* Pointer to param start, just after ';', 00074 * (it can be diff. from name.s!) */ 00075 int size; /* total size, including preceding and trailing 00076 * white space */ 00077 struct via_param* next; /* Next parameter in the list */ 00078 }; 00079 00080 00081 /* Format: name/version/transport host:port;params comment */ 00082 /* WARNING: keep in sync with tm/sip_msg.c via_body_cloner */ 00083 struct via_body { 00084 int error; 00085 str hdr; /* Contains "Via" or "v" */ 00086 str name; 00087 str version; 00088 str transport; 00089 str host; 00090 short proto; /* transport */ 00091 unsigned short port; 00092 #ifdef USE_COMP 00093 short comp_no; 00094 #endif 00095 str port_str; 00096 str params; 00097 str comment; 00098 int bsize; /* body size, not including hdr */ 00099 struct via_param* param_lst; /* list of parameters*/ 00100 struct via_param* last_param; /*last via parameter, internal use*/ 00101 00102 /* shortcuts to "important" params*/ 00103 struct via_param* branch; 00104 str tid; /* transaction id, part of branch */ 00105 struct via_param* received; 00106 struct via_param* rport; 00107 struct via_param* i; 00108 struct via_param* alias; /* alias see draft-ietf-sip-connect-reuse-00 */ 00109 #ifdef USE_COMP 00110 struct via_param* comp; /* see rfc3486 */ 00111 #endif 00112 struct via_body* next; /* pointer to next via body string if 00113 compact via or null */ 00114 }; 00115 00116 00117 /* 00118 * Main Via header field parser 00119 */ 00120 char* parse_via(char* buffer, char* end, struct via_body *vb); 00121 00122 00123 /* 00124 * Free allocated memory 00125 */ 00126 void free_via_list(struct via_body *vb); 00127 00128 00129 /* 00130 * Get one Via header 00131 */ 00132 int parse_via_header( struct sip_msg *msg, int n, struct via_body** q); 00133 00134 00135 #endif /* PARSE_VIA_H */
1.7.1