Branch data Line data Source code
1 : : // $Id: IRC.h 4582 2007-07-04 01:14:09Z vern $
2 : :
3 : : // An IRC analyzer contributed by Roland Gruber.
4 : :
5 : : #ifndef irc_h
6 : : #define irc_h
7 : : #include "TCP.h"
8 : :
9 : : /**
10 : : * \brief Main class for analyzing IRC traffic.
11 : : */
12 [ # # ][ # # ]: 0 : class IRC_Analyzer : public TCP_ApplicationAnalyzer {
13 : : enum { WAIT_FOR_REGISTRATION, REGISTERED, };
14 : : enum { NO_ZIP, ACCEPT_ZIP, ZIP_LOADED, };
15 : : public:
16 : : /**
17 : : * \brief Constructor, builds a new analyzer object.
18 : : */
19 : : IRC_Analyzer(Connection* conn);
20 : :
21 : : /**
22 : : * \brief Called when connection is closed.
23 : : */
24 : : virtual void Done();
25 : :
26 : : /**
27 : : * \brief New input line in network stream.
28 : : *
29 : : * \param len the line length
30 : : * \param data pointer to line start
31 : : * \param orig was this data sent from connection originator?
32 : : */
33 : : virtual void DeliverStream(int len, const u_char* data, bool orig);
34 : :
35 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
36 : : {
37 : 0 : return new IRC_Analyzer(conn);
38 : : }
39 : :
40 : : static bool Available();
41 : :
42 : : protected:
43 : : int orig_status;
44 : : int orig_zip_status;
45 : : int resp_status;
46 : : int resp_zip_status;
47 : :
48 : : private:
49 : : /** \brief counts number of invalid IRC messages */
50 : : int invalid_msg_count;
51 : :
52 : : /** \brief maximum count of invalid IRC messages */
53 : : int invalid_msg_max_count;
54 : :
55 : : /**
56 : : * \brief Splits a string into its words which are separated by
57 : : * the split character.
58 : : *
59 : : * \param input string which will be splitted
60 : : * \param split character which separates the words
61 : : * \return vector containing words
62 : : */
63 : : vector<string> SplitWords(const string input, const char split);
64 : :
65 : : };
66 : :
67 : : #endif
|