/* ipguard.h * * Copyright (c) 2005 SeaD * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef _IPGUARD_H #define _IPGUARD_H 1 #include #include #include #include #include #include /* PATH_MAX */ #define IP_ADDR_LEN 4 #ifndef IFNAMSIZ # define IFNAMSIZ 16 #endif #define NAME "ipguard" #define VERSION "0.04" #define AUTHOR "SeaD" #define MAIL "sead@deep.perm.ru" #define ETHERSFILE ETHERS #define LOGNAME "/var/log/ipguard" #define LOGEXT "log" #define PIDNAME "/var/run/ipguard" #define PIDEXT "pid" #define FAKEMAC "de:ad:xx:xx:xx:xx" #define ETHERSTO 0 #define FAKENUM 3 #define BUFSIZE 10 #define PACKET_SIZE 100 #define IP_SIZE 16 /* strlen("255.255.255.255") == 15 */ #define MAC_SIZE 18 /* strlen("00:00:00:00:00:00") == 17 */ #define MAC_RAND 'x' #define FAKE_INTERVAL 50000 /* microseconds */ #define ERROR 1 #define WARNING 2 #define NOTICE 3 char iface[IFNAMSIZ]; char ethers_name[PATH_MAX]; char log_name[PATH_MAX]; char pid_name[PATH_MAX]; char fmac[MAC_SIZE]; int ethers_update; int fake_num; int buffer_num; int addr_nosubst; int read_only; int duplex; int hidden; int promisc; int dont_fork; int verbose; unsigned int all, good, zmac, zip, bad, bmac, bip, bdip, bnew, bent, mymac, fake, nze, mis; char s[128]; /* ethers.c */ void ethers_init(void); void ethers_reinit(void); /* packet.c */ void buffer_init(void); void buffer_destroy(void); void buffer_dump(void); void pair_init(char *iface); void pair_destroy (void); void pair_add(char *mac, char *ip); void pair_dump(void); void packet_init(void); void packet_destroy (void); void packet_recv(void); void stat_dump(void); /* system.c */ void exit_ipguard(int reason); void rand_mac(char *mac); void sig_init(void); void sig_func(int signal); void sig_catch(void); void log_open(void); void log_str(int pri, char *ent, char *err); void log_close(void); void log_reopen(void); void pid_creat(void); void pid_unlink(void); char *time_get(void); void ethers_rand(char *mac); void ethers_stat(void); #endif /* _IPGUARD_H */