Branch data Line data Source code
1 : : // $Id:$
2 : : //
3 : : // This code contributed by Nadi Sarrar.
4 : :
5 : : #ifndef bittorrent_h
6 : : #define bittorrent_h
7 : :
8 : : #include "TCP.h"
9 : :
10 : : #include "bittorrent_pac.h"
11 : :
12 : : class BitTorrent_Analyzer : public TCP_ApplicationAnalyzer {
13 : : public:
14 : : BitTorrent_Analyzer(Connection* conn);
15 : : virtual ~BitTorrent_Analyzer();
16 : :
17 : : virtual void Done();
18 : : virtual void DeliverStream(int len, const u_char* data, bool orig);
19 : : virtual void Undelivered(int seq, int len, bool orig);
20 : : virtual void EndpointEOF(TCP_Reassembler* endp);
21 : :
22 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
23 : 0 : { return new BitTorrent_Analyzer(conn); }
24 : :
25 : 1 : static bool Available()
26 [ + - ][ - + ]: 1 : { return bittorrent_peer_handshake || bittorrent_peer_piece; }
27 : :
28 : : protected:
29 : : void DeliverWeird(const char* msg, bool orig);
30 : :
31 : : binpac::BitTorrent::BitTorrent_Conn* interp;
32 : : bool stop_orig, stop_resp;
33 : : uint64 stream_len_orig, stream_len_resp;
34 : : };
35 : :
36 : : #endif
|