modules_s/mangler/contact_ops.h

00001 /*
00002  *  mangler module
00003  *
00004  * $Id$
00005  *
00006  * Copyright (C) 2001-2003 FhG Fokus
00007  *
00008  * This file is part of ser, a free SIP server.
00009  *
00010  * ser is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * For a license to use the ser software under conditions
00016  * other than those described here, or to purchase support for this
00017  * software, please contact iptel.org by e-mail at the following addresses:
00018  *    info@iptel.org
00019  *
00020  * ser is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License 
00026  * along with this program; if not, write to the Free Software 
00027  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  */
00029 /* History:
00030  * --------
00031  *  2003-04-07 first version.  
00032  */
00033 
00034 /* TODO :decode2format unpleasant */
00035 
00036 #ifndef CONTACT_OPS_H
00037 #define CONTACT_OPS_H
00038 
00039 /* if you want to parse all contacts not just de first one */
00040 
00041 
00042 
00043 #include "../../parser/msg_parser.h"    /* struct sip_msg */
00044 #include "common.h"
00045 
00046 #define ENCODE_ALL_CONTACTS 1
00047 #define DECODE_ALL_CONTACTS 1
00048 
00049 #define DEFAULT_SEPARATOR "*"
00050 
00051 
00052 char *contact_flds_separator;
00053 
00054 
00055 struct uri_format
00056 {
00057         str username;
00058         str password;
00059         str ip;
00060         str port;
00061         str protocol;
00062         str rcv_ip;
00063         str rcv_port;
00064         str rcv_proto;
00065         str transport; /* used only when encoding */
00066         str rest; /* used only when encoding */
00067         int first;
00068         int second;
00069 };
00070 
00071 typedef struct uri_format contact_fields_t;
00072 
00073 
00074 int encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip);
00075 int decode_contact (struct sip_msg *msg, char *unused1,char *unused2);
00076 int decode_contact_header (struct sip_msg *msg, char *unused1,char *unused2);
00077         
00078 int encode2format (struct sip_msg* msg, str* uri, struct uri_format *format);
00079 int decode2format (str* uri, char separator, struct uri_format *format);
00080 
00081 int encode_uri (struct sip_msg* msg, str* uri, char *encoding_prefix,
00082                                 char *public_ip,char separator, str * result);
00083 int decode_uri (str* uri, char separator, str * result, str* dst_uri);
00084 
00085 
00086 
00087 
00088 
00089 #endif