ip_set.h

00001 /* $Id$
00002  *
00003  * Copyright (C) 2008 iptelorg GmbH
00004  *
00005  * This file is part of ser, a free SIP server.
00006  *
00007  * ser is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version
00011  *
00012  * For a license to use the ser software under conditions
00013  * other than those described here, or to purchase support for this
00014  * software, please contact iptel.org by e-mail at the following addresses:
00015  *    info@iptel.org
00016  *
00017  * ser is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 #ifndef _IP_SET_H_
00029 #define _IP_SET_H_
00030 
00031 #include "ip_tree.h"
00032 #include "../../ip_addr.h"
00033 #include <stdio.h>
00034 
00035 /* ip_set stuff, combines IPv4 and IPv6 tree in one set */
00036    
00037 struct ip_set {
00038         int use_shm;
00039         struct ip_tree_leaf *ipv4_tree;
00040 #ifdef USE_IPV6
00041         struct ip_tree_leaf *ipv6_tree; 
00042 #endif
00043 };
00044 
00045 extern void ip_set_init(struct ip_set *ip_set, int use_shm);
00046 extern void ip_set_destroy(struct ip_set *ip_set);
00047 extern int ip_set_add_ip(struct ip_set *ip_set, struct ip_addr *ip, unsigned int network_prefix);
00048 extern int ip_set_add_ip_s(struct ip_set *ip_set, str ip_s, str mask_s);
00049 extern int ip_set_ip_exists(struct ip_set *ip_set, struct ip_addr *ip);
00050 extern void ip_set_print(FILE *stream, struct ip_set *ip_set);
00051 extern int ip_set_add_list(struct ip_set *ip_set, str ip_set_s);
00052 
00053 #endif