/*
 * TCPVIEW
 *
 * Author:	Martin Hunt
 *		Networks and Distributed Computing
 *		Computing & Communications
 *		University of Washington
 *		Administration Building, AG-44
 *		Seattle, WA  98195
 *		Internet: martinh@cac.washington.edu
 *
 *
 * Copyright 1992 by the University of Washington
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted, provided
 * that the above copyright notice appears in all copies and that both the
 * above copyright notice and this permission notice appear in supporting
 * documentation, and that the name of the University of Washington not be
 * used in advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  This software is made
 * available "as is", and
 * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
 * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
 * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
 * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include <stdio.h>

/* these are now functions in print.c */
#undef putchar
#undef putc

#include <sys/types.h>
#include <sys/time.h>
#include "md.h"			/* machine dependent stuff */
#include "os.h"			/* operating system stuff */
#include "savefile.h"

#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))
#endif

/* TCPDUMP FLAGS */
extern int fflag;			/* don't translate "foreign" IP address */
extern int nflag;			/* leave addresses as numbers */
extern int Nflag;			/* remove domains from printed host names */
extern int pflag;			/* don't go promiscuous */
extern int qflag;			/* quick (shorter) output */
extern int tflag;			/* print packet arrival time */
extern int eflag;			/* print ethernet header */
extern int vflag;			/* verbose */
extern int xflag;			/* print packet in hex */
extern int Oflag;			/* run filter code optimizer */
extern int Sflag;			/* print raw TCP sequence numbers */
extern int Rflag;			/* read Sniffer format file */
extern int Wflag;			/* write Sniffer format file */
extern int dflag;			/* print filter code */
extern int aflag;			/* assemble TCP packets into stream */
extern int zflag;			/* write TCP or UDP data to stdout */
extern int Zflag;			/* write packets and data to stdout */
extern int Xflag;			/* write TCP or UDP data in hex */

/* TCPVIEW FLAGS */
extern u_long Addr_Flag;  /* for summary display */
extern u_short Line_Flag;  /* print line numbers */
extern u_short Man_Flag;   /* print manufacturer's id in ethernet address */

#define ADDR_DLC       1  /* use DLC addresses */
#define ADDR_NUMERICAL 2  /* don't resolve names */
#define ADDR_MANUF     4  /* use manufacturer's names on DLC addresses */
#define ADDR_DOMAIN    8  /* use full domain names */

/* MAX_CAPLEN is the maximum number of bytes that can be captured on any media */
#define MAX_SNAPLEN	16000

/* the following are used in the protocol modules */
extern struct packet_header *Phdr;  /* packet header of current packet */
extern u_int Offset;     /* current offset from beginning of packet (used for Hexlist */
extern char *StrPtr;     /* buffer pointer ( used by print() ) */
extern FILE * Xfile;

/* here we redefine perror(), error(), and warning() so the output goes */
/* to a Motif Dialog, instead of stderr */
#define perror	xperror
#define error	eprint
#define warning	iprint
#ifdef __STDC__
void xperror(char *);  /* perror() that uses an error dialog */
#else
void perror();
#endif

void iprint(char *, ...);         /* print Motif information */
void eprint(char *, ...);         /* print Motif error */

void detail_ether();
void detail_tcp();
void detail_udp();

void default_print();

#ifdef __STDC__
int hex_start(int);
int hex_stop(int);
void hex(int,int);
#else
int hex_start();
int hex_stop();
void hex();
#endif
void hex_reset();

/* hightlighting */
extern u_short HighlightTimeout;	/* highlight timeouts? */
extern u_short AssembleOOO;		/* highlight out-of-order packets? */
extern u_short HighlightPacket;	/* highlight this packet? */




syntax highlighted by Code2HTML, v. 0.9.1