Annotation of embedaddon/ipguard/ipguard.h, revision 1.1

1.1     ! misho       1: /*  ipguard.h
        !             2:  *
        !             3:  * Copyright (c) 2010 SeaD <sead at deep.perm.ru>
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  *
        !            14:  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            15:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            16:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            17:  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
        !            18:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            19:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            20:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            21:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            22:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            23:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            24:  * SUCH DAMAGE.
        !            25:  *
        !            26:  *  $Id: ipguard.h,v 1.17 2010/07/12 03:46:36 sead Exp $
        !            27:  *
        !            28:  */
        !            29: 
        !            30: #ifndef _IPGUARD_H
        !            31: #define _IPGUARD_H 1
        !            32: 
        !            33: #include <stdlib.h>
        !            34: #include <stdio.h>
        !            35: #include <string.h>
        !            36: #include <unistd.h>
        !            37: #include <errno.h>
        !            38: 
        !            39: #include <limits.h>             /* PATH_MAX */
        !            40: 
        !            41: #define IP_ADDR_LEN     4
        !            42: #ifndef IFNAMSIZ
        !            43: # define IFNAMSIZ       16
        !            44: #endif
        !            45: #ifndef MAXLOGNAME
        !            46: # define MAXLOGNAME     16
        !            47: #endif
        !            48: 
        !            49: #define NAME            "ipguard"
        !            50: #define VERSION         "1.04"
        !            51: #define AUTHOR          "SeaD"
        !            52: #define MAIL            "sead at deep.perm.ru"
        !            53: 
        !            54: #define ETHERSFILE      ETHERS
        !            55: #define LOGNAME         "/var/log/ipguard"
        !            56: #define PIDNAME         "/var/run/ipguard"
        !            57: #define FAKEMAC         "de:ad:xx:xx:xx:xx"
        !            58: #define PCAPFSIZ        128
        !            59: 
        !            60: #define ETHERSTO        0
        !            61: #define FAKEREGEN       0
        !            62: #define FAKENUM         2
        !            63: #define FAKETIME        50      /* milliseconds */
        !            64: #define BUFSIZE         10
        !            65: 
        !            66: #define ERROR           1
        !            67: #define WARNING         2
        !            68: #define NOTICE          3
        !            69: #define INFO            4
        !            70: 
        !            71: char iface[IFNAMSIZ];
        !            72: char ethers_name[PATH_MAX];
        !            73: char log_name[PATH_MAX];
        !            74: char pid_name[PATH_MAX];
        !            75: char fmac[18];
        !            76: char pcapf[PCAPFSIZ];
        !            77: char suser[MAXLOGNAME];
        !            78: int ethers_update;
        !            79: int fake_regen;
        !            80: int fake_num;
        !            81: int fake_time;
        !            82: int buffer_num;
        !            83: int addr_nosubst;
        !            84: int nofirst;
        !            85: int grant;
        !            86: int read_only;
        !            87: int duplex;
        !            88: int fixbc;
        !            89: int hidden;
        !            90: int promisc;
        !            91: int debug;
        !            92: int verbose;
        !            93: 
        !            94: unsigned int all, good, grat, wgrat, zmac, zip, bad, bmac, bsip, btip,
        !            95:     bnew, bgrat, mymac, fake, pfake, nzh, nbe, mis;
        !            96: char pfmac[18];
        !            97: char s[128+1];
        !            98: 
        !            99: /*  ethers.c
        !           100:  */
        !           101: void ethers_init(void);
        !           102: void ethers_reinit(void);
        !           103: 
        !           104: /*  packet.c
        !           105:  */
        !           106: void buffer_dump(void);
        !           107: void buffer_dump2ethers(void);
        !           108: void pair_init(void);
        !           109: void pair_destroy (void);
        !           110: void pair_add(char *mac, char *ip);
        !           111: void pair_dump(void);
        !           112: void packet_init(char *iface);
        !           113: void packet_destroy (void);
        !           114: void packet_recv(void);
        !           115: void stat_dump(void);
        !           116: 
        !           117: /*  system.c
        !           118:  */
        !           119: void exit_ipguard(int reason);
        !           120: void sig_init(void);
        !           121: void sig_func(int signal);
        !           122: void sig_catch(void);
        !           123: void log_open(void);
        !           124: void log_str(int pri, char *ent, char *err);
        !           125: void log_close(void);
        !           126: void log_reopen(void);
        !           127: void pid_creat(void);
        !           128: void pid_unlink(void);
        !           129: void daemonize(void);
        !           130: void set_user(void);
        !           131: void mac_rand(char *mac);
        !           132: void mac_regen(char *mac);
        !           133: char *time_get(void);
        !           134: void ethers_stat(void);
        !           135: 
        !           136: #endif  /* _IPGUARD_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>