modules_k/siputils/contact_ops.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  *  mangler module
00005  *
00006  * Copyright (C) 2001-2003 FhG Fokus
00007  *
00008  * This file is part of SIP-router, a free SIP server.
00009  *
00010  * SIP-router 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  * SIP-router is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software 
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * History:
00025  * --------
00026  *  2003-04-07 first version.  
00027  */
00028 
00039 /* TODO :decode2format unpleasant */
00040 
00041 #ifndef CONTACT_OPS_H
00042 #define CONTACT_OPS_H
00043 
00044 /* if you want to parse all contacts not just de first one */
00045 
00046 
00047 
00048 #include "../../parser/msg_parser.h"    /* struct sip_msg */
00049 
00050 #define ENCODE_ALL_CONTACTS 1
00051 #define DECODE_ALL_CONTACTS 1
00052 
00053 #define DEFAULT_SEPARATOR "*"
00054 
00055 
00056 char *contact_flds_separator;
00057 
00058 
00059 struct uri_format
00060 {
00061         str username;
00062         str password;
00063         str ip;
00064         str port;
00065         str protocol;
00066         int first;
00067         int second;
00068 };
00069 
00070 typedef struct uri_format contact_fields_t;
00071 
00072 
00073 int encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip);
00074 int decode_contact (struct sip_msg *msg, char *unused1,char *unused2);
00075 int decode_contact_header (struct sip_msg *msg, char *unused1,char *unused2);
00076         
00077 int encode2format (str uri, struct uri_format *format);
00078 int decode2format (str uri, char separator, struct uri_format *format);
00079 
00080 int encode_uri (str uri, char *encoding_prefix, char *public_ip,char separator, str * result);
00081 int decode_uri (str uri, char separator, str * result);
00082 
00083 
00084 
00085 
00086 
00087 #endif