modules_k/domain/domain.h

00001 /* domain.h v 0.1 2002/12/27
00002  *
00003  * Header file for domain table relates functions
00004  *
00005  * Copyright (C) 2002-2012 Juha Heinanen
00006  *
00007  * This file is part of Kamailio, a free SIP server.
00008  *
00009  * Kamailio is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version
00013  *
00014  * Kamailio is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License 
00020  * along with this program; if not, write to the Free Software 
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  */
00023 
00024 
00025 #ifndef DOMAIN_H
00026 #define DOMAIN_H
00027                 
00028 
00029 #include "../../parser/msg_parser.h"
00030 
00031 
00032 /*
00033  * Check if host in From uri is local
00034  */
00035 int is_from_local(struct sip_msg* _msg, char* _s1, char* _s2);
00036 
00037 
00038 /*
00039  * Check if host in Request URI is local
00040  */
00041 int is_uri_host_local(struct sip_msg* _msg, char* _s1, char* _s2);
00042 
00043 
00044 /*
00045  * Check if domain given by parameter is local
00046  *
00047  * parameter can be one of:
00048  * - $ruri             - check domain from request uri
00049  * - $from             - check domain from From header
00050  * - avp name or alias - check the domain given by the value
00051  *                       pointed by the avp name/alias
00052  */
00053 int w_is_domain_local(struct sip_msg* _msg, char* _s1, char* _s2);
00054 
00055 int w_lookup_domain(struct sip_msg* _msg, char* _s1, char* _s2);
00056 int w_lookup_domain_no_prefix(struct sip_msg* _msg, char* _s1, char* _s2);
00057 
00058 int is_domain_local(str* domain);
00059 
00060 int domain_check_self(str* host, unsigned short port, unsigned short proto);
00061 
00062 int domain_db_bind(const str* db_url);
00063 int domain_db_init(const str* db_url);
00064 void domain_db_close(void);
00065 int domain_db_ver(str* name, int version);
00066 
00067 int reload_tables(void);
00068 
00069 #endif /* DOMAIN_H */