/* * Copyright (c) 2001 Hellmuth Michaelis. All rights reserved. * * 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 THE 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 THE 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. * *--------------------------------------------------------------------------- * * nifmon - header file * -------------------- * * last edit-date: [Sun Sep 9 11:54:37 2001] * *---------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define VERSION 1 #define RELEASE 4 #define PIDFIL "/var/run/nifmon" #define PIDPID ".pid" #define TCPDUMP "tcpdump" #define TCPDUMPPATH "/usr/sbin/tcpdump" #define TCPDUMPFLAGS "-li" /*---------------------------------------------------------------------------* * curses fullscreen display definitions *---------------------------------------------------------------------------*/ /* horizontal positions for upper window */ #define V_IP 1 #define H_LOCIP 6 #define H_LOCHN 22 #define H_REMIP 64 #define V_LADCD 2 #define H_LADMCHG 5 #define H_LADMCHGL 30 #define H_PADMCHG 44 #define H_PADMCHGL 69 #define V_BIO 3 #define H_BIN 12 #define H_BINX 34 #define H_BOUT 53 #define H_BOUTX 74 #define V_PIO 4 #define H_PIN 12 #define H_POUT 53 #define V_IBYTE 5 #define H_SEC 70 #define H_MIN 42 #define H_HR 12 #define V_OBYTE 6 #define V_IPACK 7 #define V_OPACK 8 #define V_LOWERW 9 /* fullscreen mode menu window */ #define WMENU_LEN 26 /* width of menu window */ #define WMENU_TITLE "Command" /* title string */ #define WMENU_POSLN 15 /* menu position, line */ #define WMENU_POSCO 5 /* menu position, col */ #define WMITEMS 2 /* no of menu items */ #define WMENU_HGT (WMITEMS + 4) /* menu window height */ #define WREFRESH 0 #define WQUIT 1 #define WMTIMEOUT 5 /* timeout in seconds */ /*---------------------------------------------------------------------------* * global variables *---------------------------------------------------------------------------*/ #ifdef MAIN int curses_ready = 0; /* curses initialized */ int do_bell = 0; WINDOW *upper_w; /* curses upper window pointer */ WINDOW *lower_w; /* curses lower window pointer */ FILE *pfp; short if_flags = 0; char *rdev; char *term; int background = 0; int has_rdev = 0; int has_term = 0; char pidfile[MAXPATHLEN]; char *hostname = ""; #else /* !MAIN */ int curses_ready; int do_bell; WINDOW *upper_w; WINDOW *lower_w; FILE *pfp; short if_flags; char *rdev; char *term; int background; int has_rdev; int has_term; char pidfile[MAXPATHLEN]; char *hostname; #endif extern void init_screen ( char *interface ); extern void do_menu ( void ); extern void kbdrdhdl ( void ); extern void loghdl ( FILE * fp ); extern void init_interface ( char *interface ); extern void update_interface ( char *interface ); extern int main ( int argc, char **argv ); extern void do_exit ( int exitval ); extern FILE * mpopen ( char *interface, char *expression ); extern int mpclose ( FILE * fp ); extern void check_pid ( char * ); extern void write_pid ( char * ); extern void daemonize ( void );