modules_k/siputils/checks.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Various URI checks
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-03-26 created by janakj
00027  * 2004-04-14 uri_param and add_uri_param introduced (jih)
00028  */
00029 
00039 #ifndef CHECKS_H
00040 #define CHECKS_H
00041 
00042 #include "../../parser/msg_parser.h"
00043 
00044 
00045 /*
00046  * Check if given username matches those in digest credentials
00047  */
00048 int is_user(struct sip_msg* _msg, char* _user, char* _str2);
00049 
00050 
00051 /*
00052  * Check if message includes a to-tag
00053  */
00054 int has_totag(struct sip_msg* _m, char* _foo, char* _bar);
00055 
00056 
00057 /*
00058  * Find if Request URI has a given parameter with no value
00059  */
00060 int uri_param_1(struct sip_msg* _msg, char* _param, char* _str2);
00061 
00062 
00063 /*
00064  * Find if Request URI has a given parameter with matching value
00065  */
00066 int uri_param_2(struct sip_msg* _msg, char* _param, char* _value);
00067 
00068 
00069 /*
00070  * Adds a new parameter to Request URI
00071  */
00072 int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2);
00073 
00074 
00075 /*
00076  * Converts URI, if it is tel URI, to SIP URI.  Returns 1, if
00077  * conversion succeeded or if no conversion was needed, i.e., URI was not
00078  * tel URI.  Returns -1, if conversion failed.  Takes SIP URI hostpart from
00079  * second parameter and (if needed) writes the result to third paramater.
00080  */
00081 int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res);
00082 
00083 
00084 /*
00085  * Check if user part of URI in pseudo variable is an e164 number
00086  */
00087 int w_is_uri_user_e164(struct sip_msg* _m, char* _sp, char* _s2);
00088 int is_uri_user_e164(str *uri);
00089 
00090 /*
00091  * Check if pseudo variable argument value is an e164 number
00092  */
00093 int is_e164(struct sip_msg* _m, char* _sp, char* _s2);
00094 
00095 /*
00096  * Set userpart of URI
00097  */
00098 int set_uri_user(struct sip_msg* _m, char* _uri, char* _value);
00099 
00100 /*
00101  * Set hostpart of URI
00102  */
00103 int set_uri_host(struct sip_msg* _m, char* _uri, char* _value);
00104 
00105 /*
00106  * Return true (1) if SIP message is request, otherwise false (-1)
00107  */
00108 int w_is_request(struct sip_msg* msg, char *foo, char *bar);
00109 
00110 /*
00111  * Return true (1) if SIP message is reply, otherwise false (-1)
00112  */
00113 int w_is_reply(struct sip_msg* msg, char *foo, char *bar);
00114 
00115 #endif /* CHECKS_H */