Branch data Line data Source code
1 : : // $Id: InterConn.h 6219 2008-10-01 05:39:07Z vern $
2 : : //
3 : : // See the file "COPYING" in the main distribution directory for copyright.
4 : :
5 : : #ifndef interconn_h
6 : : #define interconn_h
7 : :
8 : : #include "TCP.h"
9 : : #include "Timer.h"
10 : : #include "NetVar.h"
11 : :
12 [ # # ][ # # ]: 0 : class InterConnEndpoint : public BroObj {
13 : : public:
14 : : InterConnEndpoint(TCP_Endpoint* e);
15 : :
16 : : int DataSent(double t, int seq, int len, int caplen, const u_char* data,
17 : : const IP_Hdr* ip, const struct tcphdr* tp);
18 : :
19 : : RecordVal* BuildStats();
20 : :
21 : : protected:
22 : : int EstimateGapPacketNum(int gap) const;
23 : : int IsPotentialKeystrokePacket(int len) const;
24 : : int IsNormalKeystrokeInterarrival(double t) const;
25 : :
26 : : TCP_Endpoint* endp;
27 : : double last_keystroke_time;
28 : : int max_top_seq;
29 : : uint32 num_pkts;
30 : : uint32 num_keystrokes_two_in_a_row;
31 : : uint32 num_normal_interarrivals;
32 : : uint32 num_8k4_pkts;
33 : : uint32 num_8k0_pkts;
34 : : uint32 num_bytes;
35 : : uint32 num_7bit_ascii;
36 : : uint32 num_lines;
37 : : uint32 num_normal_lines;
38 : : int is_partial;
39 : : int keystroke_just_seen;
40 : : };
41 : :
42 : :
43 : : class InterConn_Analyzer : public TCP_ApplicationAnalyzer {
44 : : public:
45 : : InterConn_Analyzer(Connection* c);
46 : : ~InterConn_Analyzer();
47 : :
48 : : virtual void Init();
49 : : virtual void Done();
50 : : void StatTimer(double t, int is_expire);
51 : :
52 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
53 : 0 : { return new InterConn_Analyzer(conn); }
54 : :
55 : 939 : static bool Available() { return interconn_stats; }
56 : :
57 : : protected:
58 : : // We support both packet and stream input and can be put in place even
59 : : // if the TCP analyzer is not yet reassembling.
60 : : virtual void DeliverPacket(int len, const u_char* data, bool is_orig,
61 : : int seq, const IP_Hdr* ip, int caplen);
62 : : virtual void DeliverStream(int len, const u_char* data, bool is_orig);
63 : :
64 : : void StatEvent();
65 : : void RemoveEvent();
66 : :
67 : : InterConnEndpoint* orig_endp;
68 : : InterConnEndpoint* resp_endp;
69 : :
70 : : int orig_stream_pos;
71 : : int resp_stream_pos;
72 : :
73 : : double timeout;
74 : : double backoff;
75 : : };
76 : :
77 : : class InterConnTimer : public Timer {
78 : : public:
79 : : InterConnTimer(double t, InterConn_Analyzer* a);
80 : : ~InterConnTimer();
81 : :
82 : : void Dispatch(double t, int is_expire);
83 : :
84 : : protected:
85 : : InterConn_Analyzer* analyzer;
86 : : };
87 : :
88 : : #endif
|