Branch data Line data Source code
1 : : // $Id:$
2 : : //
3 : : // Analyzer for connections that transfer binary data.
4 : :
5 : : #ifndef FILEANALYZER_H
6 : : #define FILEANALYZER_H
7 : :
8 : : #include "TCP.h"
9 : :
10 : : #ifdef HAVE_LIBMAGIC
11 : : #include <magic.h>
12 : : #endif
13 : :
14 [ # # ][ # # ]: 0 : class File_Analyzer : public TCP_ApplicationAnalyzer {
15 : : public:
16 : : File_Analyzer(Connection* conn);
17 : :
18 : : virtual void Done();
19 : :
20 : : virtual void DeliverStream(int len, const u_char* data, bool orig);
21 : :
22 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
23 : 0 : { return new File_Analyzer(conn); }
24 : :
25 : 1 : static bool Available() { return file_transferred; }
26 : :
27 : : protected:
28 : : File_Analyzer() {}
29 : :
30 : : void Identify();
31 : :
32 : : static const int BUFFER_SIZE = 1024;
33 : : char buffer[BUFFER_SIZE];
34 : : int buffer_len;
35 : :
36 : : #ifdef HAVE_LIBMAGIC
37 : : static void InitMagic(magic_t* magic, int flags);
38 : :
39 : : static magic_t magic;
40 : : static magic_t magic_mime;
41 : : #endif
42 : : };
43 : :
44 : : #endif
|