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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
|
/*
* Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
* 2002, 2003, 2004
* Ohio University.
*
* ---
*
* Starting with the release of tcptrace version 6 in 2001, tcptrace
* is licensed under the GNU General Public License (GPL). We believe
* that, among the available licenses, the GPL will do the best job of
* allowing tcptrace to continue to be a valuable, freely-available
* and well-maintained tool for the networking community.
*
* Previous versions of tcptrace were released under a license that
* was much less restrictive with respect to how tcptrace could be
* used in commercial products. Because of this, I am willing to
* consider alternate license arrangements as allowed in Section 10 of
* the GNU GPL. Before I would consider licensing tcptrace under an
* alternate agreement with a particular individual or company,
* however, I would have to be convinced that such an alternative
* would be to the greater benefit of the networking community.
*
* ---
*
* This file is part of Tcptrace.
*
* Tcptrace was originally written and continues to be maintained by
* Shawn Ostermann with the help of a group of devoted students and
* users (see the file 'THANKS'). The work on tcptrace has been made
* possible over the years through the generous support of NASA GRC,
* the National Science Foundation, and Sun Microsystems.
*
* Tcptrace is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Tcptrace is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tcptrace (in the file 'COPYING'); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Author: Shawn Ostermann
* School of Electrical Engineering and Computer Science
* Ohio University
* Athens, OH
* ostermann@cs.ohiou.edu
* http://www.tcptrace.org/
*/
static char const GCC_UNUSED rcsid_modules[] =
"$Header: /usr/local/cvs/tcptrace/modules.h,v 5.7 2004/03/04 20:33:56 mramadas Exp $";
/*
* modules.h -- Definitions for plug-in modules
*/
/* For a registered module, enter its info into the following structures */
struct module {
/* is this module being called? */
Bool module_inuse;
/* The SHORT name of the module, just for debugging */
char *module_name;
/* The LONG description of the module, just for debugging */
char *module_descr;
/* Init routine, called immediately at start-up time */
/* I'll pass you the argc and argv from the program invocation, */
/* delete any args you want (just make the pointer NULL) */
/* If you return TRUE, I'll call the other functions later, else */
/* I won't. */
int (*module_init) (int argc, char *argv[]);
/* TCP Reading routine, for each packet grabbed, I'll pass you the */
/* TCP structure and the IP packet itself (in */
/* host byte order). */
void (*module_read) (
struct ip *pip, /* the packet */
tcp_pair *ptp, /* info I have about this connection */
void *plast, /* pointer to last byte */
void *pmodstruct); /* module-specific structure */
/* Finish up routine. Called after tcpdump is finished printing. */
void (*module_done) (void);
/* Usage message additions */
void (*module_usage)(void);
/* If you want to be called as each file is processed */
void (*module_newfile)(
char *filename, /* the name of the current file */
u_long filesize, /* number of bytes in file (might be compressed) */
Bool fcompressed); /* is the file compressed? */
/* If you want to be called for each new connection */
/* If you want to attach a module-specifi structure to this */
/* tcp_pair, return its address and I'll hand it back to */
/* you with each read, otherwise return NULL */
void *(*module_newconn)(
tcp_pair *ptp); /* info I have about this connection */
/* UDP Reading routine, for each packet grabbed, I'll pass you the */
/* UDP structure and the IP packet itself (in */
/* host byte order). */
void (*module_udp_read) (
struct ip *pip, /* the packet */
udp_pair *pup, /* info I have about this connection */
void *plast, /* pointer to last byte */
void *pmodstruct); /* module-specific structure */
/* If you want to be called for each new UDP connection */
/* If you want to attach a module-specifi structure to this */
/* udp_pair, return its address and I'll hand it back to */
/* you with each read, otherwise return NULL */
void *(*module_udp_newconn)(
udp_pair *ptp); /* info I have about this connection */
/* Called for non-tcp packets. Tcptrace ignores them, but you */
/* might want them */
void (*module_nontcpudp_read) (
struct ip *pip, /* the packet */
void *plast); /* pointer to last byte */
/* Called for old TCP connections when they are deleted by */
/* the real-time version of the program */
void (*module_deleteconn) (
tcp_pair *ptp, /* info I have about this connection */
void *pmodstruct); /* module-specific structure */
};
/* module-specific header file (needs to give prototypes for the routines below) */
#ifdef LOAD_MODULE_HTTP
#include "mod_http.h" /* for the HTTP package */
#endif /* LOAD_MODULE_HTTP */
#ifdef LOAD_MODULE_TCPLIB
#include "mod_tcplib.h" /* for the TCPLIB package */
#endif /* LOAD_MODULE_TCPLIB */
#ifdef LOAD_MODULE_TRAFFIC
#include "mod_traffic.h" /* for the traffic package */
#endif /* LOAD_MODULE_TRAFFIC */
#ifdef LOAD_MODULE_RTTGRAPH
#include "mod_rttgraph.h" /* for the rttgraph package */
#endif /* LOAD_MODULE_RTTGRAPH */
#ifdef LOAD_MODULE_COLLIE
#include "mod_collie.h" /* for the collie package */
#endif /* LOAD_MODULE_COLLIE */
#ifdef LOAD_MODULE_SLICE
#include "mod_slice.h" /* for the slice package */
#endif /* LOAD_MODULE_SLICE */
#ifdef LOAD_MODULE_REALTIME
#include "mod_realtime.h" /* for the example real-time package */
#endif /* LOAD_MODULE_REALTIME */
#ifdef LOAD_MODULE_INBOUNDS
#include "mod_inbounds.h" /* include the INBOUNDS module */
#endif /* LOAD_MODULE_INBOUNDS */
/* declare (install) the various module routines */
struct module modules[] = {
#ifdef LOAD_MODULE_HTTP
/* this example is for the HTTP module */
{TRUE, /* make FALSE if you don't want to call it at all */
"http", /* name of the module */
"Http analysis package", /* description of the module */
http_init, /* routine to call to init the module */
http_read, /* routine to pass each TCP segment */
http_done, /* routine to call at program end */
http_usage, /* routine to call to print module usage */
http_newfile, /* routine to call on each new file */
http_newconn, /* routine to call on each new connection */
NULL, NULL, NULL, NULL}, /* not interested in non-tcp */
#endif /* LOAD_MODULE_HTTP */
/* list other modules here ... */
#ifdef LOAD_MODULE_TCPLIB
/* this example is for the TCPLIB module */
{TRUE, /* make FALSE if you don't want to call it at all */
"tcplib", /* name of the module */
"TCPLib analysis package", /* description of the module */
tcplib_init, /* routine to call to init the module */
tcplib_read, /* routine to pass each TCP segment */
tcplib_done, /* routine to call at program end */
tcplib_usage, /* routine to call to print module usage */
tcplib_newfile, /* routine to call on each new file */
tcplib_newconn, /* routine to call on each new connection */
NULL, NULL, NULL, NULL}, /* not interested in non-tcp */
#endif /* LOAD_MODULE_TCPLIB */
#ifdef LOAD_MODULE_TRAFFIC
/* ttl traffic analysis */
{TRUE, /* make FALSE if you don't want to call it at all */
"traffic", "traffic analysis package",
traffic_init, traffic_read, traffic_done,
traffic_usage, NULL, traffic_newconn, NULL, NULL, NULL, NULL},
#endif /* LOAD_MODULE_TRAFFIC */
#ifdef LOAD_MODULE_SLICE
/* ttl slice analysis */
{TRUE, /* make FALSE if you don't want to call it at all */
"slice", "traffic efficiency data by time slices",
slice_init, slice_read, slice_done,
slice_usage, NULL, slice_newconn, NULL, NULL, NULL, NULL},
#endif /* LOAD_MODULE_SLICE */
#ifdef LOAD_MODULE_RTTGRAPH
{TRUE, /* make FALSE if you don't want to call it at all */
"rttgraph", "round trip time analysis graphs",
rttgraph_init, /* routine to call to init the module */
rttgraph_read, /* routine to pass each TCP segment */
rttgraph_done, /* routine to call at program end */
rttgraph_usage, /* routine to call to print module usage */
NULL, /* routine to call on each new file */
rttgraph_newconn, /* routine to call on each new connection */
NULL, NULL, NULL, NULL}, /* not interested in non-tcp */
#endif /* LOAD_MODULE_TRAFFIC */
#ifdef LOAD_MODULE_COLLIE
/* ttl collie analysis */
{TRUE, /* make FALSE if you don't want to call it at all */
"collie", "connection summary package",
collie_init, NULL /* read */, collie_done,
collie_usage, collie_newfile, collie_newconn,
NULL, collie_newudpconn, NULL, NULL},
#endif /* LOAD_MODULE_COLLIE */
#ifdef LOAD_MODULE_REALTIME
{TRUE, /* make FALSE if you don't want to call it at all */
"realtime", /* name of the module */
"example real-time package",/* description of the module */
realtime_init, /* routine to call to init the module */
realtime_read, /* routine to pass each TCP segment */
realtime_done, /* routine to call at program end */
realtime_usage, /* routine to call to print module usage */
NULL, /* routine to call on each new file */
realtime_newconn, /* routine to call on each new connection */
realtime_udp_read, /* routine to pass each UDP segment */
NULL, /* routine to call on each new UDP conn */
realtime_nontcpudp_read, /* routine to pass each non-tcp and non-udp
packets*/
realtime_deleteconn},
#endif /* LOAD_MODULE_REALTIME */
#ifdef LOAD_MODULE_INBOUNDS
{TRUE, /* make FALSE if you don't want to call it at all */
"inbounds", /* name of the module */
"INBOUNDS analysis package",/* description of the module */
inbounds_init, /* routine to call to init the module */
inbounds_tcp_read, /* routine to pass each TCP segment */
inbounds_done, /* routine to call at program end */
inbounds_usage, /* routine to call to print module usage */
NULL, /* routine to call on each new file */
inbounds_tcp_newconn, /* routine to call on each new connection */
inbounds_udp_read, /* routine to pass each UDP segment */
inbounds_udp_newconn, /* routine to call on each new UDP conn */
inbounds_nontcpudp_read, /* routine to pass each non-tcp and non-udp
packets*/
inbounds_tcp_deleteconn}, /* routine to remove TCP connections */
#endif /* LOAD_MODULE_INBOUNDS */
};
#define NUM_MODULES (sizeof(modules) / sizeof(struct module))
|