1 /* 2 * mangler module 3 * 4 * Copyright (C) 2001-2003 FhG Fokus 5 * 6 * This file is part of Kamailio, a free SIP server. 7 * 8 * Kamailio 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 12 * 13 * Kamailio is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 */ 22 23 /* TODO :decode2format unpleasant */ 24 25 #ifndef CONTACT_OPS_H 26 #define CONTACT_OPS_H 27 28 /* if you want to parse all contacts not just de first one */ 29 30 31 32 #include "../../core/parser/msg_parser.h" /* struct sip_msg */ 33 #include "common.h" 34 35 #define ENCODE_ALL_CONTACTS 1 36 #define DECODE_ALL_CONTACTS 1 37 38 #define DEFAULT_SEPARATOR "*" 39 40 41 extern char *contact_flds_separator; 42 43 44 struct uri_format 45 { 46 str username; 47 str password; 48 str ip; 49 str port; 50 str protocol; 51 str rcv_ip; 52 str rcv_port; 53 str rcv_proto; 54 str transport; /* used only when encoding */ 55 str rest; /* used only when encoding */ 56 int first; 57 int second; 58 }; 59 60 typedef struct uri_format contact_fields_t; 61 62 63 int encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip); 64 int decode_contact (struct sip_msg *msg, char *unused1,char *unused2); 65 int decode_contact_header (struct sip_msg *msg, char *unused1,char *unused2); 66 67 int encode2format (struct sip_msg* msg, str* uri, struct uri_format *format); 68 int decode2format (str* uri, char separator, struct uri_format *format); 69 70 int encode_uri (struct sip_msg* msg, str* uri, char *encoding_prefix, 71 char *public_ip,char separator, str * result); 72 int decode_uri (str* uri, char separator, str * result, str* dst_uri); 73 74 75 76 77 78 #endif 79