cr_domain.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_DOMAIN_H
00031 #define CR_DOMAIN_H
00032 
00033 #include "../../str.h"
00034 #include "../../flags.h"
00035 #include "../../lib/trie/dtrie.h"
00036 
00037 
00042 struct domain_data_t {
00043         int id; 
00044         str * name; 
00045         struct dtrie_node_t * tree; 
00046         struct dtrie_node_t * failure_tree; 
00047 };
00048 
00049 
00059 struct domain_data_t * create_domain_data(int id, str * domain);
00060 
00061 
00067 void destroy_domain_data(struct domain_data_t *domain_data);
00068 
00069 
00101 int add_route_to_tree(struct dtrie_node_t *node, const str * scan_prefix,
00102                 flag_t flags, flag_t mask, const str * full_prefix, int max_targets, double prob,
00103                 const str * rewrite_hostpart, int strip, const str * rewrite_local_prefix,
00104                 const str * rewrite_local_suffix, int status, int hash_index, 
00105                 int backup, int * backed_up, const str * comment);
00106 
00107 
00128 int add_failure_route_to_tree(struct dtrie_node_t * failure_node, const str * scan_prefix,
00129                 const str * full_prefix, const str * host, const str * reply_code,
00130                 const flag_t flags, const flag_t mask, const int next_domain, const str * comment);
00131 
00132 
00139 int compare_domain_data(const void *v1, const void *v2);
00140 
00141 
00142 #endif