modules_s/permissions/permissions.h

00001 /*
00002  * $Id$
00003  *
00004  * PERMISSIONS module
00005  *
00006  * Copyright (C) 2003 Miklós Tirpák (mtirpak@sztaki.hu)
00007  * Copyright (C) 2006 iptelorg GmbH
00008  *
00009  * This file is part of ser, a free SIP server.
00010  *
00011  * ser is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version
00015  *
00016  * For a license to use the ser software under conditions
00017  * other than those described here, or to purchase support for this
00018  * software, please contact iptel.org by e-mail at the following addresses:
00019  *    info@iptel.org
00020  *
00021  * ser is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  * GNU General Public License for more details.
00025  *
00026  * You should have received a copy of the GNU General Public License 
00027  * along with this program; if not, write to the Free Software 
00028  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029  *
00030  */
00031 /*
00032  * History:
00033  * --------
00034  *  2003-09-03  replaced /usr/local/et/ser/ with CFG_DIR (andrei)
00035  */
00036  
00037 #ifndef PERMISSIONS_H
00038 #define PERMISSIONS_H 1
00039 
00040 #include "../../sr_module.h"
00041 #include "../../lib/srdb2/db.h"
00042 #include "rule.h"
00043 
00044 #define DEFAULT_ALLOW_FILE "permissions.allow"
00045 #define DEFAULT_DENY_FILE  "permissions.deny"
00046 
00047 typedef struct rule_file {
00048         rule* rules;    /* Parsed rule set */
00049         char* filename; /* The name of the file */
00050 } rule_file_t;
00051 
00052 /*
00053  * Maximum number if allow/deny file pairs that can be opened
00054  * at any time
00055  */
00056 #define MAX_RULE_FILES 64
00057 
00058 extern rule_file_t      *allow; /* Parsed allow files */
00059 extern rule_file_t      *deny;  /* Parsed deny files */
00060 extern int              max_rule_files;
00061 extern int check_all_branches;
00062 extern int safe_file_load;
00063 
00064 extern char* db_url;        /* Database URL */
00065 extern int db_mode;         /* Database usage mode: 0=no cache, 1=cache */
00066 extern char* trusted_table; /* Name of trusted table */
00067 extern char* source_col;    /* Name of source address column */
00068 extern char* proto_col;     /* Name of protocol column */
00069 extern char* from_col;      /* Name of from pattern column */
00070 extern char* ipmatch_table; /* Name of trusted table */
00071 
00072 /* Database API */
00073 extern db_ctx_t *db_conn;
00074 
00075 #define DISABLE_CACHE 0
00076 #define ENABLE_CACHE 1
00077 
00078 #endif