File: ttt.h

package info (click to toggle)
ttt 1.7-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 568 kB
  • ctags: 544
  • sloc: ansic: 4,767; sh: 2,804; tcl: 159; makefile: 136
file content (127 lines) | stat: -rw-r--r-- 3,858 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* $Id: ttt.h,v 0.10 2000/12/20 14:29:45 kjc Exp kjc $ */
/*
 *  Copyright (c) 1996-2000
 *	Sony Computer Science Laboratories, Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms of parts of or the
 * whole original or derived work are permitted provided that the above
 * copyright notice is retained and the original work is properly
 * attributed to the author. The name of the author may not be used to
 * endorse or promote products derived from this software without
 * specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */
/* ttt.h -- common header for all ttt programs */
#ifndef _TTT_H_
#define _TTT_H_

#include <sys/types.h>

#define TTT_MAJOR	1
#define TTT_MINOR	7
#define TTT_VERSION	"1.7"

/* default path for ttt.tcl */
#ifndef TTT_LIBRARY
#define TTT_LIBRARY	"/usr/local/lib/ttt"
#endif

/* uncommnet the following line not to lookup hostnames. */
/*
 * #define DONT_LOOKUP_HOSTNAME 
 */

/* ttt protocol types */
#define TTTTYPE_PROTO		0	/* wild card for protocol type */
#define TTTTYPE_ETHER		1
#define TTTTYPE_FDDI		2
#define TTTTYPE_IP		8
#define TTTTYPE_TCP		16
#define TTTTYPE_UDP		17
#define TTTTYPE_IPV6		32
#define TTTTYPE_UDPV6		40
#define TTTTYPE_TCPV6		41

/* all protocols should be below TTTTYPE_HOST */
/* ttt host types */
#define TTTTYPE_HOST		128	/* wild card for host type */
#define TTTTYPE_IPHOST		129
#define TTTTYPE_IPV6HOST	130

/* trace filter */
#define TTTFILTER_SRCHOST	0x01
#define TTTFILTER_DSTHOST	0x02
#define TTTFILTER_SRCPORT	0x04
#define TTTFILTER_DSTPORT	0x08

/* for remote monitoring */
#define TTT_PORT		7288		/* receiver port */
#define TTT_MCASTADDR		"224.8.8.0"	/* default multicast address */

/* parameters */
#define TTT_MAX_NODES		1000

/* globals */
extern char *ttt_version;
extern int ttt_interval;	/* graph update interval in ms */
extern char *ttt_interface;	/* interface name for packet capture */
extern int ttt_max_nodes;	/* limit of max nodes */
extern char *ttt_viewname;	/* view address */
extern char *ttt_mcastif;	/* multicast interface address */
extern int ttt_portno;		/* viewer's port number */
extern int ttt_nohostname;	/* don't lookup host names */
extern int ttt_filter;		/* trace filter */
extern char *ttt_dumpfile;	/* tcpdump file to replay */
extern int ttt_speed;		/* replay speed */
extern int ttt_yscale;		/* scale of y axis */
extern struct timeval ttt_dumptime;

//extern void fatal_error(/*const char *fmt, ...*/);
extern void fatal_error(const char *fmt, ...);

/* function prototypes */

/* ttt.c */
extern void ttt_parseargs(int argc, char **argv);
extern double get_timeindouble(void);

/* display.c */
extern void display_init(void);
extern void ttt_display(int time_tick);

/* net_names.c */
extern void netname_init(unsigned long netaddr, unsigned long netmask);
extern char *net_getname(long type, long *id);

/* net_read.c */
extern int open_pf(char *interface);
extern void close_pf(void);
extern int open_dump(char *file, char *interface);
extern int get_pcapstat(u_long *recvp, u_long *dropp, u_long *lostp);
extern int dumpfile_read(void);

/* viewer.c */
extern int view_opensock(void);
extern void view_closesock(int sockfd);
/* int get_pcapstat(u_long *recvp, u_long *dropp, u_long *lostp); */

/* textview.c */
extern void ttt_textview(int seq_no);

/* endian defines in case they are missing from the system headers */
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#define LITTLE_ENDIAN 1234
#endif
#ifndef BYTE_ORDER
#if defined(_BIG_ENDIAN) || defined(sparc)
#define BYTE_ORDER BIG_ENDIAN
#endif
#if defined(_LITTLE_ENDIAN) || defined(i386)
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif /* BYTE_ORDER */

#endif /* _TTT_H_ */