sanity.h

00001 /*
00002  * $Id$
00003  *
00004  * Sanity Checks Module
00005  *
00006  * Copyright (C) 2006 iptelorg GbmH
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  */
00030 
00031 #ifndef SANITY_CHK_H
00032 #define SANITY_CHK_H
00033 
00034 #include "mod_sanity.h"
00035 
00036 #define SIP_VERSION_TWO_POINT_ZERO "2.0"
00037 #define SIP_VERSION_TWO_POINT_ZERO_LENGTH 3
00038 
00039 /* check if the given string is a valid unsigned int value
00040  * and converts it into _result. returns -1 on error and 0 on success*/
00041 int str2valid_uint(str* _number, unsigned int* _result);
00042 
00043 /* parses the given comma seperated string into a string list */
00044 strl* parse_str_list(str* _string);
00045 
00046 /* compare the protocol string in the Via header with the transport */
00047 int check_via_protocol(struct sip_msg* _msg);
00048 
00049 /* check if the SIP version in the Via header is 2.0 */
00050 int check_via_sip_version(struct sip_msg* _msg);
00051 
00052 /* compare the Content-Length value with the accutal body length */
00053 int check_cl(struct sip_msg* _msg);
00054 
00055 /* compare the method in the CSeq header with the request line value */
00056 int check_cseq_method(struct sip_msg* _msg);
00057 
00058 /* check the number within the CSeq header */
00059 int check_cseq_value(struct sip_msg* _msg);
00060 
00061 /* check the number within the Expires header */
00062 int check_expires_value(struct sip_msg* _msg);
00063 
00064 /* check for the presence of the minimal required headers */
00065 int check_required_headers(struct sip_msg* _msg);
00066 
00067 /* check the content of the Proxy-Require header */
00068 int check_proxy_require(struct sip_msg* _msg);
00069 
00070 /* check the SIP version in the request URI */
00071 int check_ruri_sip_version(struct sip_msg* _msg);
00072 
00073 /* check if the r-uri scheme */
00074 int check_ruri_scheme(struct sip_msg* _msg);
00075 
00076 /* check if the typical URIs are parseable */
00077 int check_parse_uris(struct sip_msg* _msg, int checks);
00078 
00079 /* Make sure that username attribute in all digest credentials
00080  * instances has a meaningful value
00081  */
00082 int check_digest(struct sip_msg* _msg, int checks);
00083 
00084 /* check if there are duplicate tag params in From/To headers */
00085 int check_duptags(sip_msg_t* _msg);
00086 
00087 #endif /* SANITY_CHK_H */