| 1 | /********************************************************************\ |
|---|
| 2 | * This program is free software; you can redistribute it and/or * |
|---|
| 3 | * modify it under the terms of the GNU General Public License as * |
|---|
| 4 | * published by the Free Software Foundation; either version 2 of * |
|---|
| 5 | * the License, or (at your option) any later version. * |
|---|
| 6 | * * |
|---|
| 7 | * This program is distributed in the hope that it will be useful, * |
|---|
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 10 | * GNU General Public License for more details. * |
|---|
| 11 | * * |
|---|
| 12 | * You should have received a copy of the GNU General Public License* |
|---|
| 13 | * along with this program; if not, contact: * |
|---|
| 14 | * * |
|---|
| 15 | * Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 16 | * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 17 | * Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 18 | * * |
|---|
| 19 | \********************************************************************/ |
|---|
| 20 | |
|---|
| 21 | /* $Header$ */ |
|---|
| 22 | /** @file firewall.h |
|---|
| 23 | @brief Firewall update functions |
|---|
| 24 | @author Copyright (C) 2004 Philippe April <papril777@yahoo.com> |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | #ifndef _FIREWALL_H_ |
|---|
| 28 | #define _FIREWALL_H_ |
|---|
| 29 | |
|---|
| 30 | typedef struct _t_node { |
|---|
| 31 | struct _t_node *next; |
|---|
| 32 | char *ip, |
|---|
| 33 | *mac, |
|---|
| 34 | *token; |
|---|
| 35 | int active, /* boolean */ |
|---|
| 36 | fd; /* socket */ |
|---|
| 37 | long int counter; |
|---|
| 38 | UserRights *rights; |
|---|
| 39 | } t_node; |
|---|
| 40 | |
|---|
| 41 | int fw_init(void); |
|---|
| 42 | int fw_destroy(void); |
|---|
| 43 | int fw_allow(char *ip, char *mac, int profile); |
|---|
| 44 | int fw_deny(char *ip, char *mac, int profile); |
|---|
| 45 | void fw_counter(void); |
|---|
| 46 | int execute(char **argv); |
|---|
| 47 | char *arp_get(char *req_ip); |
|---|
| 48 | |
|---|
| 49 | void node_init(void); |
|---|
| 50 | t_node *node_add(char *ip, char *mac, char *token, long int counter, |
|---|
| 51 | int active); |
|---|
| 52 | t_node *node_find_by_ip(char *ip); |
|---|
| 53 | t_node *node_find_by_token(char *token); |
|---|
| 54 | void node_delete(t_node *node); |
|---|
| 55 | void free_node(t_node *node); |
|---|
| 56 | |
|---|
| 57 | int check_userrights(t_node *node); |
|---|
| 58 | |
|---|
| 59 | #endif /* _FIREWALL_H_ */ |
|---|