Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
443 lines (433 sloc) 9.76 KB
/*
* Copyright (C) 1998
* Sony Computer Science Laboratories Inc. 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 SONY CSL 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 SONY CSL 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.
*
* $Id: tcpdstat.h,v 1.6 2001/03/26 07:23:03 kjc Exp kjc $
*/
struct pkt_cnt {
int packets;
long long bytes;
};
enum protos {
TOTAL,
IP,
TCP_IP,
FTPDATA_TCP,
FTP_TCP,
SSH_TCP,
TELNET_TCP,
SMTP_TCP,
NAME_TCP,
DNS_TCP,
HTTP_S_TCP,
HTTP_C_TCP,
KERB5_TCP,
POP3_TCP,
SUNRPC_TCP,
IDENT_TCP,
NNTP_TCP,
NTP_TCP,
E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GNED_PROTO_137_IP,
UNASSIGNED_PROTO_138_IP,
UNASSIGNED_PROTO_139_IP,
UNASSIGNED_PROTO_140_IP,
UNASSIGNED_PROTO_141_IP,
UNASSIGNED_PROTO_142_IP,
UNASSIGNED_PROTO_143_IP,
UNASSIGNED_PROTO_144_IP,
UNASSIGNED_PROTO_145_IP,
UNASSIGNED_PROTO_146_IP,
UNASSIGNED_PROTO_147_IP,
UNASSIGNED_PROTO_148_IP,
UNASSIGNED_PROTO_149_IP,
UNASSIGNED_PROTO_150_IP,
UNASSIGNED_PROTO_151_IP,
UNASSIGNED_PROTO_152_IP,
UNASSIGNED_PROTO_153_IP,
UNASSIGNED_PROTO_154_IP,
UNASSIGNED_PROTO_155_IP,
UNASSIGNED_PROTO_156_IP,
UNASSIGNED_PROTO_157_IP,
UNASSIGNED_PROTO_158_IP,
UNASSIGNED_PROTO_159_IP,
UNASSIGNED_PROTO_160_IP,
UNASSIGNED_PROTO_161_IP,
UNASSIGNED_PROTO_162_IP,
UNASSIGNED_PROTO_163_IP,
UNASSIGNED_PROTO_164_IP,
UNASSIGNED_PROTO_165_IP,
UNASSIGNED_PROTO_166_IP,
UNASSIGNED_PROTO_167_IP,
UNASSIGNED_PROTO_168_IP,
UNASSIGNED_PROTO_169_IP,
UNASSIGNED_PROTO_170_IP,
UNASSIGNED_PROTO_171_IP,
UNASSIGNED_PROTO_172_IP,
UNASSIGNED_PROTO_173_IP,
UNASSIGNED_PROTO_174_IP,
UNASSIGNED_PROTO_175_IP,
UNASSIGNED_PROTO_176_IP,
UNASSIGNED_PROTO_177_IP,
UNASSIGNED_PROTO_178_IP,
UNASSIGNED_PROTO_179_IP,
UNASSIGNED_PROTO_180_IP,
UNASSIGNED_PROTO_181_IP,
UNASSIGNED_PROTO_182_IP,
UNASSIGNED_PROTO_183_IP,
UNASSIGNED_PROTO_184_IP,
UNASSIGNED_PROTO_185_IP,
UNASSIGNED_PROTO_186_IP,
UNASSIGNED_PROTO_187_IP,
UNASSIGNED_PROTO_188_IP,
UNASSIGNED_PROTO_189_IP,
UNASSIGNED_PROTO_190_IP,
UNASSIGNED_PROTO_191_IP,
UNASSIGNED_PROTO_192_IP,
UNASSIGNED_PROTO_193_IP,
UNASSIGNED_PROTO_194_IP,
UNASSIGNED_PROTO_195_IP,
UNASSIGNED_PROTO_196_IP,
UNASSIGNED_PROTO_197_IP,
UNASSIGNED_PROTO_198_IP,
UNASSIGNED_PROTO_199_IP,
UNASSIGNED_PROTO_200_IP,
UNASSIGNED_PROTO_201_IP,
UNASSIGNED_PROTO_202_IP,
UNASSIGNED_PROTO_203_IP,
UNASSIGNED_PROTO_204_IP,
UNASSIGNED_PROTO_205_IP,
UNASSIGNED_PROTO_206_IP,
UNASSIGNED_PROTO_207_IP,
UNASSIGNED_PROTO_208_IP,
UNASSIGNED_PROTO_209_IP,
UNASSIGNED_PROTO_210_IP,
UNASSIGNED_PROTO_211_IP,
UNASSIGNED_PROTO_212_IP,
UNASSIGNED_PROTO_213_IP,
UNASSIGNED_PROTO_214_IP,
UNASSIGNED_PROTO_215_IP,
UNASSIGNED_PROTO_216_IP,
UNASSIGNED_PROTO_217_IP,
UNASSIGNED_PROTO_218_IP,
UNASSIGNED_PROTO_219_IP,
UNASSIGNED_PROTO_220_IP,
UNASSIGNED_PROTO_221_IP,
UNASSIGNED_PROTO_222_IP,
UNASSIGNED_PROTO_223_IP,
UNASSIGNED_PROTO_224_IP,
UNASSIGNED_PROTO_225_IP,
UNASSIGNED_PROTO_226_IP,
UNASSIGNED_PROTO_227_IP,
UNASSIGNED_PROTO_228_IP,
UNASSIGNED_PROTO_229_IP,
UNASSIGNED_PROTO_230_IP,
UNASSIGNED_PROTO_231_IP,
UNASSIGNED_PROTO_232_IP,
UNASSIGNED_PROTO_233_IP,
UNASSIGNED_PROTO_234_IP,
UNASSIGNED_PROTO_235_IP,
UNASSIGNED_PROTO_236_IP,
UNASSIGNED_PROTO_237_IP,
UNASSIGNED_PROTO_238_IP,
UNASSIGNED_PROTO_239_IP,
UNASSIGNED_PROTO_240_IP,
UNASSIGNED_PROTO_241_IP,
UNASSIGNED_PROTO_242_IP,
UNASSIGNED_PROTO_243_IP,
UNASSIGNED_PROTO_244_IP,
UNASSIGNED_PROTO_245_IP,
UNASSIGNED_PROTO_246_IP,
UNASSIGNED_PROTO_247_IP,
UNASSIGNED_PROTO_248_IP,
UNASSIGNED_PROTO_249_IP,
UNASSIGNED_PROTO_250_IP,
UNASSIGNED_PROTO_251_IP,
UNASSIGNED_PROTO_252_IP,
UNASSIGNED_PROTO_253_IP,
UNASSIGNED_PROTO_254_IP,
RESERVED_255_IP,
OTHER_IP,
FRAG_IP,
IP6,
TCP_IP6,
HTTP_S_TCP6,
HTTP_C_TCP6,
SQUID_TCP6,
SMTP_TCP6,
NNTP_TCP6,
FTP_TCP6,
POP3_TCP6,
IMAP_TCP6,
TELNET_TCP6,
SSH_TCP6,
DNS_TCP6,
BGP_TCP6,
NAPSTER_TCP6,
REALAUDIO_TCP6,
RTSP_TCP6,
SHOUTCAST_TCP6,
HOTLINE_TCP6,
OTHER_TCP6,
UDP_IP6,
DNS_UDP6,
RIP_UDP6,
MCAST_UDP6,
REALAUDIO_UDP6,
HALFLIFE_UDP6,
STARCRAFT_UDP6,
EVERQUEST_UDP6,
UNREAL_UDP6,
QUAKE_UDP6,
CUSEEME_UDP6,
OTHER_UDP6,
ICMP_IP6,
OSPF_IP6,
IP_IP6,
IP6_IP6,
IPSEC_IP6,
HBHOPT_IP6,
RTOPT_IP6,
DSTOPT_IP6,
PIM_IP6,
SCTP_IP6,
OTHER_IP6,
FRAG_IP6,
OTHER,
PROTOTYPE_MAX
};
extern long long int read_count;
extern struct timeval start_time, end_time;
extern struct pkt_cnt tcpdstat[PROTOTYPE_MAX];
//aextern int packet_length;
extern long long int caplen_total;
extern long int caplen_max;
extern int use_ipflow;
extern double rate_max;
extern double rate_mean;
extern double rate_var;
extern long int rate_count;
extern int debug;
int open_dump(char *);
void close_dump(void);
int read_dump(void);
void pktsize_add(int size);
void ipflow_destroy(void);
void ipflow_show(void);
int ipflow_count(int, struct ip *, int);
Something went wrong with that request. Please try again.