mod_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 MOD_SANITY_CHK_H
00032 #define MOD_SANITY_CHK_H
00033 
00034 #include "../../str.h"
00035 #include "../../modules/sl/sl.h"
00036 #include "../../parser/msg_parser.h"
00037 
00038 #define SANITY_RURI_SIP_VERSION        (1<<0)
00039 #define SANITY_RURI_SCHEME             (1<<1)
00040 #define SANITY_REQUIRED_HEADERS        (1<<2)
00041 #define SANITY_VIA_SIP_VERSION         (1<<3)
00042 #define SANITY_VIA_PROTOCOL            (1<<4)
00043 #define SANITY_CSEQ_METHOD             (1<<5)
00044 #define SANITY_CSEQ_VALUE              (1<<6)
00045 #define SANITY_CL                      (1<<7)
00046 #define SANITY_EXPIRES_VALUE           (1<<8)
00047 #define SANITY_PROXY_REQUIRE           (1<<9)
00048 #define SANITY_PARSE_URIS              (1<<10)
00049 #define SANITY_CHECK_DIGEST            (1<<11)
00050 #define SANITY_CHECK_DUPTAGS           (1<<12)
00051 #define SANITY_MAX_CHECKS              (1<<13)  /* Make sure this is the highest value */
00052 
00053 /* VIA_SIP_VERSION and VIA_PROTOCOL do not work yet
00054  * and PARSE_URIS is very expensive */
00055 #define SANITY_DEFAULT_CHECKS   SANITY_RURI_SIP_VERSION | \
00056                                                                 SANITY_RURI_SCHEME | \
00057                                                                 SANITY_REQUIRED_HEADERS | \
00058                                                                 SANITY_CSEQ_METHOD | \
00059                                                                 SANITY_CSEQ_VALUE | \
00060                                                                 SANITY_CL | \
00061                                                                 SANITY_EXPIRES_VALUE | \
00062                                                                 SANITY_PROXY_REQUIRE | \
00063                                 SANITY_CHECK_DIGEST
00064 
00065 
00066 #define SANITY_URI_CHECK_RURI    (1<<0)
00067 #define SANITY_URI_CHECK_FROM    (1<<1)
00068 #define SANITY_URI_CHECK_TO      (1<<2)
00069 #define SANITY_URI_CHECK_CONTACT (1<<3)
00070 #define SANITY_URI_MAX_CHECKS    (1<<4)  /* Make sure this is the highest value */
00071 
00072 #define SANITY_DEFAULT_URI_CHECKS       SANITY_URI_CHECK_RURI | \
00073                                                                         SANITY_URI_CHECK_FROM | \
00074                                                                         SANITY_URI_CHECK_TO
00075 
00076 #define SANITY_CHECK_PASSED 1
00077 #define SANITY_CHECK_FAILED 0
00078 #define SANITY_CHECK_ERROR -1
00079 
00080 struct _strlist {
00081         str string;            /* the string */
00082         struct _strlist* next; /* the next strlist element */
00083 };
00084 
00085 typedef struct _strlist strl;
00086 
00087 extern int default_checks;
00088 extern strl* proxyrequire_list;
00089 
00090 extern sl_api_t slb;
00091 
00092 #endif /* MOD_SANITY_CHK_H */