"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "netwatch.c" between
netwatch-1.3.0-1.tgz and netwatch-1.3.1-2.tgz

About: NETWATCH views the Ethernet for hosts, packet counts, protocols and displays hosts activity.

netwatch.c  (netwatch-1.3.0-1.tgz):netwatch.c  (netwatch-1.3.1-2.tgz)
skipping to change at line 291 skipping to change at line 291
u_int16_t ssh_orig_port; u_int16_t ssh_orig_port;
u_int16_t ssh_dest_port; u_int16_t ssh_dest_port;
int ssh_mask=0; int ssh_mask=0;
Semaphore masterdo; Semaphore masterdo;
CREATE_LOCK(indisp); CREATE_LOCK(indisp);
CREATE_LOCK(inrlist); CREATE_LOCK(inrlist);
CREATE_LOCK(inllist); CREATE_LOCK(inllist);
CREATE_LOCK(resolvechange); CREATE_LOCK(resolvechange);
int show_watch = 0;
int show_help = 0;
/* * TIMER for measuring /* * TIMER for measuring
*/ */
time_t new; time_t new;
time_t starttime; time_t starttime;
time_t wakeup_reload; time_t wakeup_reload;
int wakeup_state = FALSE; int wakeup_state = FALSE;
time_t reload_timer_start; time_t reload_timer_start;
int reload_timer_sec = 0; int reload_timer_sec = 0;
int reload_active = FALSE; int reload_active = FALSE;
int statsdate = FALSE; int statsdate = FALSE;
int statsappend = TRUE; int statsappend = TRUE;
char tmstring[80] = "%Y.%m.%d.%H.%M"; char tmstring[256] = "%Y.%m.%d.%H.%M";
int freezedisplay = FALSE; int freezedisplay = FALSE;
int lastfreeze = FALSE; int lastfreeze = FALSE;
int sentclear = FALSE; int sentclear = FALSE;
int donecleaning = TRUE; int donecleaning = TRUE;
int recresolv = 0; int recresolv = 0;
int timeresolv = 0; int timeresolv = 0;
int sendresolv = 0; int sendresolv = 0;
int errread = 0; int errread = 0;
int errioctl = 0; int errioctl = 0;
skipping to change at line 331 skipping to change at line 334
int autostatus = TRUE; int autostatus = TRUE;
int noresolv = FALSE; int noresolv = FALSE;
int rel_hours, rel_mins; int rel_hours, rel_mins;
int localcount = 0; int localcount = 0;
int remotecount = 0; int remotecount = 0;
#define MAXSTATUS 14 #define MAXSTATUS 14
#define STATUSSIZE 256 #define STATUSSIZE 512
char status_lines[MAXSTATUS][STATUSSIZE]; char status_lines[MAXSTATUS][STATUSSIZE];
int cur_status_line = 0; int cur_status_line = 0;
int sREDTIME = 60; int sREDTIME = 60;
int sYELLOWTIME = 300; int sYELLOWTIME = 300;
int sGREENTIME = 1800; int sGREENTIME = 1800;
char configfile[MAXFILENAME] = "/etc/rc.d/rc.inet1"; char configfile[MAXFILENAME] = "/etc/rc.d/rc.inet1";
char statsfile[MAXFILENAME] = "/etc/netwatch.stats"; char statsfile[MAXFILENAME] = "/etc/netwatch.stats";
char newstatsfile[MAXFILENAME]; char newstatsfile[MAXFILENAME];
int newconfig = FALSE; int newconfig = FALSE;
skipping to change at line 361 skipping to change at line 364
int destroy_program = FALSE; int destroy_program = FALSE;
#define MAGNABUFSIZE 2048 #define MAGNABUFSIZE 2048
struct magrec struct magrec
{ {
int len; int len;
char dir; char dir;
unsigned char buf[MAGNABUFSIZE]; unsigned char buf[MAGNABUFSIZE];
}; };
#define MAGNAMAX 800 #define MAGNAMAX 1024
#define MAGNAOFFS 40 #define MAGNAOFFS 40
struct magrec magna[MAGNAMAX]; struct magrec magna[MAGNAMAX];
int magnacnt = 0; int magnacnt = 0;
int magnaoffs = MAGNAOFFS; int magnaoffs = MAGNAOFFS;
char magnamatch[RESOLVE_MAX]; char magnamatch[RESOLVE_MAX];
HOSTINFO *magnaspot; HOSTINFO *magnaspot;
u_int32_t magnakey; u_int32_t magnakey;
int magnaphys = 0; int magnaphys = 0;
int magnafirst = TRUE; int magnafirst = TRUE;
int magnafull = FALSE; int magnafull = FALSE;
skipping to change at line 422 skipping to change at line 425
int selectchange = FALSE; int selectchange = FALSE;
int bluedie = 0; int bluedie = 0;
int ignoredomain = 0; int ignoredomain = 0;
int statpid = -1010; /* int statpid = -1010; /*
* Magic number to indicate NO * Magic number to indicate NO
* status process present * status process present
*/ */
int sd; int sd;
char tmpbuf[256]; char tmpbuf[512];
char speclogfile[MAXFILENAME] = "/root/.watchlog"; char speclogfile[MAXFILENAME] = "/root/.watchlog";
FILE *fpspeclog; FILE *fpspeclog;
int speclog = 0; int speclog = 0;
int printtospeclog = 0; int printtospeclog = 0;
int speclogext = 0; int speclogext = 0;
int topflag = 0; int topflag = 0;
HOSTINFO *toplocal; HOSTINFO *toplocal;
HOSTINFO *topremote; HOSTINFO *topremote;
HOSTINFO tldummy, trdummy; HOSTINFO tldummy, trdummy;
skipping to change at line 456 skipping to change at line 459
int fishspeclog = 0; /* int fishspeclog = 0; /*
* old speclog for fishing * old speclog for fishing
* expedition * expedition
*/ */
long int ethcnt = 0; long int ethcnt = 0;
int isethdev = TRUE; int isethdev = TRUE;
int keycnt = 0; int keycnt = 0;
int repeatcount = 1; int repeatcount = 1;
int repeatindex = 0; int repeatindex = 0;
char repeatbuf[255]; char repeatbuf[512];
int isbridge = FALSE; int isbridge = FALSE;
int dupcount = 0; int dupcount = 0;
int forcelocal = FALSE; int forcelocal = FALSE;
u_int32_t flocal; u_int32_t flocal;
int nonameresolve = FALSE; int nonameresolve = FALSE;
int forcemask = FALSE; int forcemask = FALSE;
u_int32_t fmask; u_int32_t fmask;
int nokeys = FALSE; int nokeys = FALSE;
skipping to change at line 513 skipping to change at line 516
* PACKET OFFSET TIME (from starting time) * PACKET OFFSET TIME (from starting time)
* LENGTH of remainder in bytes * LENGTH of remainder in bytes
* PACKET Data (Length long) * PACKET Data (Length long)
* MAGIC (16 bits) * MAGIC (16 bits)
* etc... * etc...
*/ */
int simchange = FALSE; int simchange = FALSE;
int simfwdir = TRUE; int simfwdir = TRUE;
int simarr[8] = { 4, 4, 4, 4, 4, 4, 4, 4 }; int simarr[8] = { 4, 4, 4, 4, 4, 4, 4, 4 };
char *simfmt = "\\%d<\\%d<\\%d<\\%d%c\\%d>\\%d>\\%d>"; char *simfmt = "\\%d<\\%d<\\%d<\\%d%c\\%d>\\%d>\\%d>";
const int MAXTHEM = 20; const int MAXTHEM = 512;
const int MAXTHEMm1 = 19; const int MAXTHEMm1 = 511;
/* /*
* #define MAXTHEM 20 * #define MAXTHEM 20
* #define MAXTHEMm1 MAXTHEM * #define MAXTHEMm1 MAXTHEM
*/ */
int themnum = 0; int themnum = 0;
u_int32_t logthem[20]; /* Up to 20 log names allowed */ u_int32_t logthem[512]; /* Up to 20 log names allowed */
time_t actstart; time_t actstart;
double mactstart; double mactstart;
clock_t lasttime; /* last NOW... */ clock_t lasttime; /* last NOW... */
clock_t offsclk = 0; /* Offset from sim. start */ clock_t offsclk = 0; /* Offset from sim. start */
clock_t loff = 0; clock_t loff = 0;
clock_t lrealoff = 0; clock_t lrealoff = 0;
clock_t fileclk; /* Clock INSIDE file record */ clock_t fileclk; /* Clock INSIDE file record */
struct tms dumbtime; struct tms dumbtime;
clock_t sclk; /* Starting time of program... */ clock_t sclk; /* Starting time of program... */
int iseth = FALSE; int iseth = FALSE;
skipping to change at line 558 skipping to change at line 561
int nw_simrate = SIMSEC; int nw_simrate = SIMSEC;
int simkeyrate = 0; int simkeyrate = 0;
FILE *simfp = NULL; FILE *simfp = NULL;
int plogselect = 0; int plogselect = 0;
int plogdeselect = 0; int plogdeselect = 0;
int buf_detail = 0; /* For ASCII default */ int buf_detail = 0; /* For ASCII default */
#define BUF_DETAIL_MAX 3 #define BUF_DETAIL_MAX 3
int mailflag = 1; int mailflag = 1;
int syslogflag = 1; int syslogflag = 1;
char userwarn[256] = "noone@xxx.xxx.xxx"; /* ENTER your MAIL Address here.. char userwarn[512] = "noone@xxx.xxx.xxx"; /* ENTER your MAIL Address here..
*/ */
char fishstring[256] = ""; char fishstring[512] = "";
int fishstringlen = 0; int fishstringlen = 0;
void handle_frame (unsigned char *buf, int length, struct sockaddr *saddr, void handle_frame (unsigned char *buf, int length, struct sockaddr *saddr,
int eth, int direct); int eth, int direct);
void handle_ip (struct ip *buf, int length, int direct); void handle_ip (struct ip *buf, int length, int direct);
void processinetrc (unsigned char *netmask, unsigned char *local, int *peth); void processinetrc (unsigned char *netmask, unsigned char *local, int *peth);
void warning (char s[], unsigned char *buf); void warning (char s[], unsigned char *buf);
pthread_t keythread; pthread_t keythread;
pthread_t netthread; pthread_t netthread;
void *all_keyins( void *); void *all_keyins( void *);
skipping to change at line 1300 skipping to change at line 1303
if (i == cur_dayroute || dayroute[i] == -1) if (i == cur_dayroute || dayroute[i] == -1)
break; break;
} }
fprintf (fp, " %02d:%02d %10.2f\n", hrs, mins, dayroute[i]); fprintf (fp, " %02d:%02d %10.2f\n", hrs, mins, dayroute[i]);
} }
fclose (fp); fclose (fp);
} }
void disphelp (int helppage, int xoff) void disphelp (int helppage, int xoff)
{ {
LOCK(indisp); //LOCK(indisp);
switch (helppage) switch (helppage)
{ {
case 1: case 1:
mvprintw (6, xoff + 10, "HELP WINDOW"); mvprintw (6, xoff + 10, "HELP WINDOW");
mvprintw (8, xoff + 3, "Normal Mode Commands"); mvprintw (8, xoff + 3, "Normal Mode Commands");
mvprintw (10, xoff + 3, "<TAB> - toggle REMOTE/LOCAL"); mvprintw (10, xoff + 3, "<TAB> - toggle REMOTE/LOCAL");
mvprintw (11, xoff + 3, " for keyboard control"); mvprintw (11, xoff + 3, " for keyboard control");
mvprintw (12, xoff + 3, "<LEFT> - Go back ONE Option"); mvprintw (12, xoff + 3, "<LEFT> - Go back ONE Option");
mvprintw (13, xoff + 3, "<RIGHT> Go forward ONE OPTION"); mvprintw (13, xoff + 3, "<RIGHT> Go forward ONE OPTION");
mvprintw (14, xoff + 3, "<UP> - Back ONE PAGE on"); mvprintw (14, xoff + 3, "<UP> - Back ONE PAGE on");
skipping to change at line 1349 skipping to change at line 1352
mvprintw (14, xoff + 3, " service displayed"); mvprintw (14, xoff + 3, " service displayed");
mvprintw (15, xoff + 3, " or not"); mvprintw (15, xoff + 3, " or not");
mvprintw (16, xoff + 3, "t - TOP Mode toggle "); mvprintw (16, xoff + 3, "t - TOP Mode toggle ");
mvprintw (17, xoff + 3, "f - FREEZE SCREEN toggle"); mvprintw (17, xoff + 3, "f - FREEZE SCREEN toggle");
mvprintw (18, xoff + 3, "<ESC> Exit HELP MODE"); mvprintw (18, xoff + 3, "<ESC> Exit HELP MODE");
mvprintw (19, xoff + 3, "or <F10>"); mvprintw (19, xoff + 3, "or <F10>");
mvprintw (20, xoff + 3, "or <END> <ENTER> for MORE Help"); mvprintw (20, xoff + 3, "or <END> <ENTER> for MORE Help");
break; break;
} }
UNLOCK(indisp); //UNLOCK(indisp);
} }
void setupauxscr (int *xoff, int bigscreen) void setupauxscr (int *xoff, int bigscreen)
{ {
int xst = 1; int xst = 1;
int xend; int xend;
LOCK(indisp); //LOCK(indisp);
scrmid = MCOLS >> 1; scrmid = MCOLS >> 1;
xend = scrmid; xend = scrmid;
if (localkey) if (localkey)
{ {
xst = scrmid + 1; xst = scrmid + 1;
xend = MCOLS - 1; xend = MCOLS - 1;
} }
if (bigscreen) if (bigscreen)
{ {
xst = 1; xst = 1;
xend = MCOLS - 1; xend = MCOLS - 1;
} }
clrportion (4, xst, MLINES - 1, xend); clrportion (4, xst, MLINES - 1, xend);
mvhline (4, xst + 1, ACS_BLOCK, xend - xst - 2); mvhline (4, xst + 1, ACS_BLOCK, xend - xst - 2);
mvhline (MLINES - 3, xst + 1, ACS_BLOCK, xend - xst - 2); mvhline (MLINES - 3, xst + 1, ACS_BLOCK, xend - xst - 2);
mvvline (5, xst + 1, ACS_BLOCK, MLINES - 8); mvvline (5, xst + 1, ACS_BLOCK, MLINES - 8);
mvvline (5, xend - 2, ACS_BLOCK, MLINES - 8); mvvline (5, xend - 2, ACS_BLOCK, MLINES - 8);
UNLOCK(indisp); //UNLOCK(indisp);
*xoff = xst; *xoff = xst;
} }
#define MAXSTAT 6 #define MAXSTAT 6
void status_box (char header[], char mss[], int x, int y, int width) void status_box (char header[], char mss[], int x, int y, int width)
{ {
int mess_len; int mess_len;
int center; int center;
int mid; int mid;
skipping to change at line 1467 skipping to change at line 1470
strcat (debugstr, hexasc); strcat (debugstr, hexasc);
} }
status_box ("PPP DEBUG", debugstr, 10, 4, 40); status_box ("PPP DEBUG", debugstr, 10, 4, 40);
while (getch () == ERR); while (getch () == ERR);
} }
void setuphelp () void setuphelp ()
{ {
int xoff = 1; int xoff = 1;
setupauxscr (&xoff, SMALLSCREEN); setupauxscr (&xoff, magnafull);
disphelp (helppage, xoff); disphelp (helppage, xoff);
} }
void setupwatch (int bigscreen) void setupwatch (int bigscreen)
{ {
int xoff = 1; int xoff = 1;
setupauxscr (&xoff, bigscreen); setupauxscr (&xoff, bigscreen);
LOCK(indisp); //LOCK(indisp);
if (!bigscreen) if (!bigscreen)
{ {
mvprintw (6, xoff + 10, "WATCH WINDOW"); mvprintw (6, xoff + 10, "WATCH WINDOW");
if (!disprouterstats) if (!disprouterstats)
{ {
mvprintw (8, xoff + 3, "Special Commands"); mvprintw (8, xoff + 3, "Special Commands");
mvprintw (10, xoff + 3, "s - select host for trace"); mvprintw (10, xoff + 3, "s - select host for trace");
mvprintw (11, xoff + 3, " Up/Down Left/Right"); mvprintw (11, xoff + 3, " Up/Down Left/Right");
mvprintw (12, xoff + 3, " <new host> <pkt. spot>"); mvprintw (12, xoff + 3, " <new host> <pkt. spot>");
mvprintw (13, xoff + 3, "r - examine router stats"); mvprintw (13, xoff + 3, "r - examine router stats");
mvprintw (14, xoff + 3, "<ESC> Exit WATCH MODE"); mvprintw (14, xoff + 3, "<ESC> Exit WATCH MODE");
mvprintw (15, xoff + 3, "or <F10>"); mvprintw (15, xoff + 3, "or <F10>");
mvprintw (16, xoff + 3, "or <END>"); mvprintw (16, xoff + 3, "or <END>");
} }
} }
UNLOCK(indisp); //UNLOCK(indisp);
} }
void indepscreen () void indepscreen ()
{ {
curskeyspot = MCOLS - 12; curskeyspot = MCOLS - 12;
curskeyval = MCOLS - 5; curskeyval = MCOLS - 5;
cursllockout = MCOLS - 18; cursllockout = MCOLS - 18;
cursrlockout = MCOLS - 15; cursrlockout = MCOLS - 15;
curslines = MCOLS - 10; curslines = MCOLS - 10;
curshosttrim = MCOLS / 2 - 17; curshosttrim = MCOLS / 2 - 17;
skipping to change at line 1518 skipping to change at line 1521
void winchange () void winchange ()
{ {
static struct winsize size; static struct winsize size;
if (ioctl (0, TIOCGWINSZ, (char *) &size) >= 0) if (ioctl (0, TIOCGWINSZ, (char *) &size) >= 0)
{ {
LOCK(indisp); LOCK(indisp);
MLINES = size.ws_row; MLINES = size.ws_row;
MCOLS = size.ws_col; MCOLS = size.ws_col;
wresize (stdscr, MLINES, MCOLS); wresize (stdscr, MLINES, MCOLS);
UNLOCK(indisp);
indepscreen (); indepscreen ();
clrscr (); clrscr ();
if (watch) if (watch)
setupwatch (SMALLSCREEN); show_watch = TRUE;
//setupwatch (SMALLSCREEN);
if (help) if (help)
setuphelp (); show_help = TRUE;
//setuphelp ();
rewrite_labels = TRUE; rewrite_labels = TRUE;
refreshrem = TRUE; refreshrem = TRUE;
refreshloc = TRUE; refreshloc = TRUE;
} UNLOCK(indisp);
}
} }
clock_t putoneeth (FILE * fp, char *buf, int *plen) clock_t putoneeth (FILE * fp, char *buf, int *plen)
{ {
int st; int st;
short nlen; short nlen;
short len; short len;
unsigned short simcheck; unsigned short simcheck;
clock_t clk; clock_t clk;
long begrec; long begrec;
skipping to change at line 2136 skipping to change at line 2142
break; break;
case ':': case ':':
fprintf (stderr, "Missing Parameter\n\n"); fprintf (stderr, "Missing Parameter\n\n");
case 'h': case 'h':
default: default:
usage (argv[0]); usage (argv[0]);
break; break;
} }
} }
if (!isbridge)
{
processinetrc (netmask, localaddr, &ethok); processinetrc (netmask, localaddr, &ethok);
if (!ethok) if (!ethok)
{ {
printf ("NO %s Interface to work on!!\n", ethdevname); printf ("NO %s Interface to work on!!\n", ethdevname);
gh (3); gh (3);
exit (1); exit (1);
} }
}
if (ssh_mask) if (ssh_mask)
{ {
ssh_env = getenv("SSH_CLIENT"); ssh_env = getenv("SSH_CLIENT");
if (!ssh_env || !ssh_env[0]) if (!ssh_env || !ssh_env[0])
{ {
ssh_mask=0; // Turn it off!!! ssh_mask=0; // Turn it off!!!
} }
else else
{ {
skipping to change at line 2728 skipping to change at line 2737
if (work->plog == 0) if (work->plog == 0)
{ {
strncpy (nam, nw_indivmain, 239); strncpy (nam, nw_indivmain, 239);
mpaddr = (u_int32_t *)work->addr; mpaddr = (u_int32_t *)work->addr;
mw.s_addr = *mpaddr; mw.s_addr = *mpaddr;
//strncat (nam, inet_ntoa (*(u_int32_t *) work->addr), 17); //strncat (nam, inet_ntoa (*(u_int32_t *) work->addr), 17);
strncat (nam, inet_ntoa (mw), 17); strncat (nam, inet_ntoa (mw), 17);
work->plog = open (nam, O_APPEND | O_WRONLY); work->plog = open (nam, O_APPEND | O_WRONLY);
if (work->plog < 0) if (work->plog < 0)
{ {
work->plog = open (nam, O_APPEND | O_CREAT | O_WRONLY); work->plog = open (nam, O_APPEND | O_CREAT | O_WRONLY,00660);
st = write (work->plog, &starttime, sizeof (starttime)); st = write (work->plog, &starttime, sizeof (starttime));
st = write (work->plog, &simmagic, sizeof (simmagic)); st = write (work->plog, &simmagic, sizeof (simmagic));
} }
} }
if (work->plog > 0) if (work->plog > 0)
{ {
bb = (char *) buf; bb = (char *) buf;
if (iseth) if (iseth)
bb -= ETH_HLEN; bb -= ETH_HLEN;
nlen = htons (length); nlen = htons (length);
clk = times (&dumbtime) - sclk; /* X arch. problem? */ clk = times (&dumbtime) - sclk; /* X arch. problem? */
st = write (work->plog, &clk, sizeof (clk)); st = write (work->plog, &clk, sizeof (clk));
st = write (work->plog, &nlen, sizeof (nlen)); st = write (work->plog, &nlen, sizeof (nlen));
st = write (work->plog, bb, length); st = write (work->plog, bb, length);
if (st != length) if (st != length)
{ {
freezedisplay = TRUE;
if (st < 0) if (st < 0)
status_box (" N O T I C E ", status_box (" N O T I C E ",
"Error on WRITE to Log file 'f' to continue", "Error on WRITE to Log file 'f' to continue",
(MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20); (MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20);
else else
status_box (" N O T I C E ", status_box (" N O T I C E ",
"Disk may be full... Type 'f' to continue", "Disk may be full... Type 'f' to continue",
(MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20); (MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20);
freezedisplay = TRUE;
/* Disk full or other error?? */ /* Disk full or other error?? */
} }
st = write (work->plog, &nlen, sizeof (nlen)); st = write (work->plog, &nlen, sizeof (nlen));
st = write (work->plog, &simmagic, sizeof (simmagic)); st = write (work->plog, &simmagic, sizeof (simmagic));
} }
} }
wlen = ntohs (buf->tot_len); wlen = ntohs (buf->tot_len);
/* /*
skipping to change at line 2961 skipping to change at line 2971
} }
refresh (); refresh ();
} }
/* /*
* opt = 0 SOURCE opt = 1 DEST. * opt = 0 SOURCE opt = 1 DEST.
*/ */
#define SERVERTYPE 0 #define SERVERTYPE 0
#define GETTYPE 1 #define GETTYPE 1
#define FTPSERVERTYPE 2 #define FTPSERVERTYPE 2
static char space[256]; static char space[512];
static char ftpversion[256]; static char ftpversion[512];
void void
addtolocallist (u_int32_t * key, u_int32_t * okey, struct ip *buf, addtolocallist (u_int32_t * key, u_int32_t * okey, struct ip *buf,
int length, int opt, int direct) int length, int opt, int direct)
{ {
unsigned char *pk = (unsigned char *) key; unsigned char *pk = (unsigned char *) key;
int wlen; int wlen;
char *ss; char *ss;
static struct hostent *phost; static struct hostent *phost;
int kk; int kk;
skipping to change at line 3408 skipping to change at line 3418
} }
if (nw_fprem != NULL) if (nw_fprem != NULL)
{ {
clk = times (&dumbtime) - sclk; /* X arch. problem? */ clk = times (&dumbtime) - sclk; /* X arch. problem? */
st = fwrite (&clk, 1, sizeof (clk), nw_fprem); st = fwrite (&clk, 1, sizeof (clk), nw_fprem);
nlen = htons (length); nlen = htons (length);
st = fwrite (&nlen, 1, sizeof (short), nw_fprem); st = fwrite (&nlen, 1, sizeof (short), nw_fprem);
if ((st = fwrite (buf, 1, length, nw_fprem)) != length) if ((st = fwrite (buf, 1, length, nw_fprem)) != length)
{ {
freezedisplay = TRUE;
status_box (" N O T I C E ", status_box (" N O T I C E ",
"Disk may be full... Type 'f' to continue", "Disk may be full... Type 'f' to continue",
(MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20); (MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20);
freezedisplay = TRUE;
/* Disk full or other error?? */ /* Disk full or other error?? */
} }
else else
{ {
st = fwrite (&nlen, 1, sizeof (short), nw_fprem); st = fwrite (&nlen, 1, sizeof (short), nw_fprem);
st = fwrite (&simmagic, 1, sizeof (simmagic), nw_fprem); st = fwrite (&simmagic, 1, sizeof (simmagic), nw_fprem);
} }
} }
else else
{ {
freezedisplay = TRUE;
status_box (" N O T I C E ", status_box (" N O T I C E ",
"Remote Logfile will not open... Type 'f' to continue", "Remote Logfile will not open... Type 'f' to continue",
(MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20); (MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20);
/* Problem with open of Logfile!!! */ /* Problem with open of Logfile!!! */
freezedisplay = TRUE;
} }
} }
} }
void log_local (char *buf, int length) void log_local (char *buf, int length)
{ {
int st; int st;
short nlen; short nlen;
skipping to change at line 3844 skipping to change at line 3854
namecheck = FALSE; namecheck = FALSE;
handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1); handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1);
ethcnt++; ethcnt++;
} }
} }
else else
{ {
if (saddr.sll_ifindex == saved_index_ll) if (saddr.sll_ifindex == saved_index_ll)
{ {
if (isbridge) /* if (isbridge)
{ {
if (!memcmp (buf, rbuf, length)) if (!memcmp (buf, rbuf, length))
{ {
handle_frame (buf, length, handle_frame (buf, length,
(struct sockaddr *) &saddr, isethdev, 1); (struct sockaddr *) &saddr, isethdev, 1);
ethcnt++; ethcnt++;
memcpy (rbuf, buf, length); memcpy (rbuf, buf, length);
} }
else else
dupcount++; dupcount++;
} }
else else
{ {*/
handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1); handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1);
ethcnt++; ethcnt++;
} //}
} }
} }
#else #else
if (isbridge) if (isbridge)
{ {
if (!memcmp (buf, rbuf, length)) if (!memcmp (buf, rbuf, length))
{ {
handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1); handle_frame (buf, length, (struct sockaddr *) &saddr, isethdev, 1);
ethcnt++; ethcnt++;
memcpy (rbuf, buf, length); memcpy (rbuf, buf, length);
skipping to change at line 3950 skipping to change at line 3960
repeatindex = 0; repeatindex = 0;
*repeatbuf = 0; *repeatbuf = 0;
switch (in_char) switch (in_char)
{ {
case RETURNKEY: case RETURNKEY:
if (help) if (help)
{ {
helppage++; helppage++;
if (helppage > MAXHELPPAGE) if (helppage > MAXHELPPAGE)
helppage = 1; helppage = 1;
setuphelp (); show_help = TRUE;
//setuphelp ();
} }
break; break;
case ESC: case ESC:
case KEY_F (10): case KEY_F (10):
case KEY_END: case KEY_END:
if (watch || help) if (watch || help)
{ {
if (selecthost) if (selecthost)
selectside = localkey; selectside = localkey;
watch = help = selecthost = magnafull = FALSE; watch = help = selecthost = magnafull = FALSE;
skipping to change at line 3975 skipping to change at line 3986
refreshloc = TRUE; refreshloc = TRUE;
} }
break; break;
case CONTROLL: case CONTROLL:
LOCK(indisp); LOCK(indisp);
clrscr (); clrscr ();
UNLOCK(indisp); UNLOCK(indisp);
if (watch) if (watch)
{ {
if (magnafull) if (magnafull)
setupwatch (FULLSCREEN); show_watch = TRUE;
//setupwatch (FULLSCREEN);
else else
setupwatch (SMALLSCREEN); show_watch = TRUE;
//setupwatch (SMALLSCREEN);
} }
if (help) if (help)
setuphelp (); show_help = TRUE;
// setuphelp ();
rewrite_labels = TRUE; rewrite_labels = TRUE;
refreshrem = TRUE; refreshrem = TRUE;
refreshloc = TRUE; refreshloc = TRUE;
break; break;
case KEY_NPAGE: case KEY_NPAGE:
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
magnaphys += MLINES - 14; magnaphys += MLINES - 14;
if (magnaphys >= MAGNAMAX) if (magnaphys >= MAGNAMAX)
magnaphys -= MAGNAMAX; magnaphys -= MAGNAMAX;
} }
//UNLOCK(indisp);
break; break;
} }
//UNLOCK(indisp);
case KEY_DOWN: /* case KEY_DOWN: /*
* DOWN KEY * DOWN KEY
*/ */
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
if (magnafull) if (magnafull)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
magnaphys += 1; magnaphys += 1;
if (magnaphys >= MAGNAMAX) if (magnaphys >= MAGNAMAX)
magnaphys -= MAGNAMAX; magnaphys -= MAGNAMAX;
} }
skipping to change at line 4041 skipping to change at line 4059
} }
} }
else else
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
ydisp += (MLINES - 5); ydisp += (MLINES - 5);
refreshgen = TRUE; refreshgen = TRUE;
} }
} }
//UNLOCK(indisp);
break; break;
case KEY_LEFT: /* case KEY_LEFT: /*
* LEFT KEY * LEFT KEY
*/ */
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
magnaoffs -= 10; magnaoffs -= 10;
if (magnaoffs < 0) if (magnaoffs < 0)
magnaoffs = 0; magnaoffs = 0;
} }
} }
else else
skipping to change at line 4076 skipping to change at line 4096
else else
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
dispopt--; dispopt--;
if (dispopt < 0) if (dispopt < 0)
dispopt = DISP_MAX; dispopt = DISP_MAX;
} }
poschange = 1; poschange = 1;
rewrite_labels = 1; rewrite_labels = 1;
refreshgen = TRUE;
} }
} }
//UNLOCK(indisp);
break; break;
case KEY_PPAGE: case KEY_PPAGE:
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
magnaphys -= MLINES - 14; magnaphys -= MLINES - 14;
if (magnaphys < 0) if (magnaphys < 0)
magnaphys += MAGNAMAX; magnaphys += MAGNAMAX;
} }
//UNLOCK(indisp);
break; break;
} }
//UNLOCK(indisp);
case KEY_UP: /* case KEY_UP: /*
* UP KEY * UP KEY
*/ */
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
if (magnafull) if (magnafull)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
magnaphys -= 1; magnaphys -= 1;
if (magnaphys < 0) if (magnaphys < 0)
magnaphys += MAGNAMAX; magnaphys += MAGNAMAX;
} }
skipping to change at line 4139 skipping to change at line 4165
else else
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
ydisp -= (MLINES - 5); ydisp -= (MLINES - 5);
if (ydisp < 0) if (ydisp < 0)
ydisp = 0; ydisp = 0;
} }
refreshgen = TRUE; refreshgen = TRUE;
} }
//UNLOCK(indisp);
break; break;
case KEY_RIGHT: /* case KEY_RIGHT: /*
* RIGHT KEY * RIGHT KEY
*/ */
//LOCK(indisp);
if (selecthost) if (selecthost)
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
if (magnaoffs > sn_rcv_bufsize) if (magnaoffs > sn_rcv_bufsize)
magnaoffs = sn_rcv_bufsize - 10; magnaoffs = sn_rcv_bufsize - 10;
else else
magnaoffs += 10; magnaoffs += 10;
} }
skipping to change at line 4175 skipping to change at line 4203
} }
else else
{ {
for (rr = 0; rr < repeatcount; rr++) for (rr = 0; rr < repeatcount; rr++)
{ {
dispopt++; dispopt++;
if (dispopt > DISP_MAX) if (dispopt > DISP_MAX)
dispopt = 0; dispopt = 0;
} }
rewrite_labels = 1; rewrite_labels = 1;
refreshgen = TRUE;
poschange = 1; poschange = 1;
} }
} }
//UNLOCK(indisp);
break; break;
case KEY_F (1): case KEY_F (1):
case 'h': case 'h':
case 'H': case 'H':
help = TRUE; help = TRUE;
setuphelp (); show_help = TRUE;
//setuphelp ();
break; break;
case 'O': case 'O':
case 'o': case 'o':
if (selecthost) if (selecthost)
{ {
LOCK(indisp); LOCK(indisp);
buf_detail++; buf_detail++;
if (buf_detail >= BUF_DETAIL_MAX) if (buf_detail >= BUF_DETAIL_MAX)
buf_detail = 0; buf_detail = 0;
UNLOCK(indisp); UNLOCK(indisp);
} }
break; break;
case KEY_F (4): case KEY_F (4):
case 'w': case 'w':
case 'W': case 'W':
watch = TRUE; watch = TRUE;
disprouterstats = FALSE; disprouterstats = FALSE;
setupwatch (SMALLSCREEN); show_watch = TRUE;
//setupwatch (SMALLSCREEN);
break; break;
case 'R': case 'R':
case 'r': case 'r':
if (watch) if (watch)
{ {
setupauxscr (&dum, SMALLSCREEN); //setupauxscr (&dum, SMALLSCREEN);
disprouterstats = TRUE; disprouterstats = TRUE;
} }
else else
{ {
/* toggle rate flag for display in kbits/sec or bytes */ /* toggle rate flag for display in kbits/sec or bytes */
bpsflag = ++bpsflag & 1; bpsflag = ++bpsflag & 1;
rewrite_labels = 1; rewrite_labels = 1;
} }
break; break;
case 'f': case 'f':
skipping to change at line 4233 skipping to change at line 4265
/* print message */ /* print message */
status_box (" N O T I C E ", status_box (" N O T I C E ",
"Netwatch Display is frozen, but the actual monitoring is s till continuing", "Netwatch Display is frozen, but the actual monitoring is s till continuing",
(MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20); (MCOLS >> 1) - 10, (MLINES >> 1) - 3, 20);
} }
else else
{ {
/* make sure WHOLE screen is updated */ /* make sure WHOLE screen is updated */
if (watch) if (watch)
setupwatch (SMALLSCREEN); show_watch = TRUE;
//setupwatch (SMALLSCREEN);
if (help) if (help)
setuphelp (); show_help = TRUE;
// setuphelp ();
rewrite_labels = TRUE; rewrite_labels = TRUE;
refreshrem = TRUE; refreshrem = TRUE;
refreshloc = TRUE; refreshloc = TRUE;
} }
break; break;
case 'd': case 'd':
case 'D': case 'D':
if (selecthost) if (selecthost)
{ {
plogdeselect = TRUE; plogdeselect = TRUE;
skipping to change at line 4362 skipping to change at line 4396
if (magnafull) if (magnafull)
break; break;
selectchange = TRUE; selectchange = TRUE;
for (ii = 0; ii < MAGNAMAX; ii++) for (ii = 0; ii < MAGNAMAX; ii++)
magna[ii].len = -1; magna[ii].len = -1;
magnacnt = 0; magnacnt = 0;
magnaphys = 0; magnaphys = 0;
magnafirst = TRUE; magnafirst = TRUE;
magnacomhost = NULL; magnacomhost = NULL;
} }
LOCK(indisp);
localkey++; localkey++;
localkey &= 1; localkey &= 1;
if (localkey) if (localkey)
ydisp = lydisp; ydisp = lydisp;
else else
ydisp = rydisp; ydisp = rydisp;
if (selecthost) if (selecthost)
selectside = localkey; selectside = localkey;
if (watch) if (watch)
setupwatch (SMALLSCREEN); show_watch = TRUE;
//setupwatch (SMALLSCREEN);
else if (help) else if (help)
setuphelp (); show_help = TRUE;
//setuphelp ();
if (watch || help) if (watch || help)
{ {
if (localkey) if (localkey)
refreshrem = TRUE; refreshrem = TRUE;
else else
refreshloc = TRUE; refreshloc = TRUE;
} }
UNLOCK(indisp);
break; break;
case 't': case 't':
case 'T': /* TOP Users matched */ case 'T': /* TOP Users matched */
topflag++; topflag++;
topflag &= 1; topflag &= 1;
break; break;
case 'c': case 'c':
case 'C': case 'C':
/* /*
* Clear Counters * Clear Counters
skipping to change at line 4574 skipping to change at line 4613
* SELECT HOST in WATCH MODE * SELECT HOST in WATCH MODE
* or CHANGE status line (in all other modes) * or CHANGE status line (in all other modes)
*/ */
case 'S': case 'S':
if (watch) if (watch)
{ {
if (disprouterstats) if (disprouterstats)
{ {
routersummary++; routersummary++;
routersummary &= 1; routersummary &= 1;
setupauxscr (&dum, SMALLSCREEN); //setupauxscr (&dum, SMALLSCREEN);
refreshgen = TRUE; refreshgen = TRUE;
} }
else else
{ {
selecthost = TRUE; selecthost = TRUE;
selectside = localkey; selectside = localkey;
selectchange = TRUE; selectchange = TRUE;
for (ii = 0; ii < MAGNAMAX; ii++) for (ii = 0; ii < MAGNAMAX; ii++)
magna[ii].len = -1; magna[ii].len = -1;
magnacnt = 0; magnacnt = 0;
skipping to change at line 4611 skipping to change at line 4650
cur_status_line = 0; cur_status_line = 0;
} }
} }
break; break;
case 'z': /* case 'z': /*
* ZOOM for trace in WATCH MODE * ZOOM for trace in WATCH MODE
*/ */
case 'Z': case 'Z':
if (watch && selecthost) if (watch && selecthost)
{ {
LOCK(indisp);
magnafull++; magnafull++;
magnafull &= 1; magnafull &= 1;
if (!magnafull) if (!magnafull)
{ {
if (localkey) if (localkey)
refreshrem = TRUE; refreshrem = TRUE;
else else
refreshloc = TRUE; refreshloc = TRUE;
setupwatch (SMALLSCREEN); //setupwatch (SMALLSCREEN);
} }
else //else
setupwatch (FULLSCREEN); //setupwatch (FULLSCREEN);
show_watch = TRUE;
UNLOCK(indisp);
} }
break; break;
default: default:
nothing_special = TRUE; nothing_special = TRUE;
//mvprintw (0, 60, "%02x", in_char); //mvprintw (0, 60, "%02x", in_char);
break; break;
} }
repeatcount = 1; repeatcount = 1;
} }
if (magnafull) if (magnafull)
 End of changes. 67 change blocks. 
46 lines changed or deleted 88 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS