cr_data.h

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2007-2008 1&1 Internet AG
00005  *
00006  * This file is part of SIP-router, a free SIP server.
00007  *
00008  * SIP-router is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * SIP-router is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00030 #ifndef CR_DATA_H
00031 #define CR_DATA_H
00032 
00033 #include <sys/types.h>
00034 #include "../../locking.h"
00035 #include "../../flags.h"
00036 #include "cr_map.h"
00037 
00038 
00042 struct route_data_t {
00043         struct name_map_t * carrier_map; 
00044         struct name_map_t * domain_map; 
00045         struct carrier_data_t ** carriers; 
00046         size_t carrier_num; 
00047         size_t first_empty_carrier; 
00048         size_t domain_num; 
00049         int default_carrier_id;
00050         int proc_cnt; 
00051         gen_lock_t lock; 
00052 };
00053 
00059 int init_route_data(void);
00060 
00061 
00065 void destroy_route_data(void);
00066 
00067 
00073 void clear_route_data(struct route_data_t *data);
00074 
00075 
00084 int add_carrier_data(struct route_data_t * rd, struct carrier_data_t * carrier_data);
00085 
00086 
00094 int reload_route_data(void);
00095 
00096 
00104 struct route_data_t * get_data(void);
00105 
00106 
00112 void release_data(struct route_data_t *data);
00113 
00114 
00124 struct carrier_data_t *get_carrier_data(struct route_data_t * rd, int carrier_id);
00125 
00126 
00157 int add_route(struct route_data_t * rd, int carrier_id,
00158                 int domain_id, const str * scan_prefix, flag_t flags, flag_t mask, int max_targets,
00159                 double prob, const str * rewrite_hostpart, int strip, const str * rewrite_local_prefix,
00160                 const str * rewrite_local_suffix, int status, int hash_index, int backup, int * backed_up,
00161                 const str * comment);
00162 
00163 
00183 int add_failure_route(struct route_data_t * rd, int carrier_id, int domain_id,
00184                 const str * scan_prefix, const str * host, const str * reply_code,
00185                 flag_t flags, flag_t mask, int next_domain_id, const str * comment);
00186 
00187 
00196 int rule_fixup(struct route_data_t * rd);
00197 
00198 
00199 #endif