00001 /* 00002 * Header file for address.c implementing allow_address function 00003 * 00004 * Copyright (C) 2006 Juha Heinanen 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio 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 * Kamailio 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 00023 #ifndef ADDRESS_H 00024 #define ADDRESS_H 00025 00026 #include "../../parser/msg_parser.h" 00027 00028 00029 /* Pointer to current address hash table pointer */ 00030 extern struct addr_list ***addr_hash_table; 00031 00032 00033 /* Pointer to current subnet table */ 00034 extern struct subnet **subnet_table; 00035 00036 00037 /* 00038 * Initialize data structures 00039 */ 00040 int init_addresses(void); 00041 00042 00043 /* 00044 * Open database connection if necessary 00045 */ 00046 int mi_init_addresses(void); 00047 00048 00049 /* 00050 * Reload address table to new hash table and when done, make new hash table 00051 * current one. 00052 */ 00053 int reload_address_table(void); 00054 00055 00056 /* 00057 * Close connections and release memory 00058 */ 00059 void clean_addresses(void); 00060 00061 00062 /* 00063 * Checks if an entry exists in cached address table that belongs to a 00064 * given address group and has given ip address and port. Port value 00065 * 0 in cached address table matches any port. 00066 */ 00067 int allow_address(struct sip_msg* _msg, char* _addr_group, char* _addr_sp, 00068 char* _port_sp); 00069 00070 00071 /* 00072 * allow_source_address("group") equals to allow_address("group", "$si", "$sp") 00073 * but is faster. 00074 */ 00075 int allow_source_address(struct sip_msg* _msg, char* _addr_group, char* _str2); 00076 00077 00078 /* 00079 * Checks if source address/port is found in cached address or 00080 * subnet table in any group. If yes, returns that group. If not returns -1. 00081 * Port value 0 in cached address and group table matches any port. 00082 */ 00083 int allow_source_address_group(struct sip_msg* _msg, char* _str1, char* _str2); 00084 00085 00086 #endif /* ADDRESS_H */
1.5.6