1 #ifndef INC_IPTCfgParser_hpp_
2 #define INC_IPTCfgParser_hpp_
3 
4 #line 38 "iptables.g"
5 
6     // gets inserted before antlr generated includes in the header
7     // file
8 #include "IPTImporter.h"
9 
10 #line 11 "IPTCfgParser.hpp"
11 #include <antlr/config.hpp>
12 /* $ANTLR 2.7.7 (20090306): "iptables.g" -> "IPTCfgParser.hpp"$ */
13 #include <antlr/TokenStream.hpp>
14 #include <antlr/TokenBuffer.hpp>
15 #include "IPTCfgParserTokenTypes.hpp"
16 #include <antlr/LLkParser.hpp>
17 
18 #line 45 "iptables.g"
19 
20     // gets inserted after antlr generated includes in the header file
21     // outside any generated namespace specifications
22 
23 #include <sstream>
24 
25 class IPTImporter;
26 
27 #line 28 "IPTCfgParser.hpp"
28 #line 74 "iptables.g"
29 
30     // gets inserted after generated namespace specifications in the
31     // header file. But outside the generated class.
32 
33 #line 34 "IPTCfgParser.hpp"
34 class CUSTOM_API IPTCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public IPTCfgParserTokenTypes
35 {
36 #line 91 "iptables.g"
37 
38 // additional methods and members
39 
40     public:
41 
42     std::ostream *dbg;
43     IPTImporter *importer;
44 
45     /// Parser error-reporting function can be overridden in subclass
reportError(const ANTLR_USE_NAMESPACE (antlr)RecognitionException & ex)46     virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
47     {
48         importer->addMessageToLog("Parser error: " + ex.toString());
49         std::cerr << ex.toString() << std::endl;
50     }
51 
52     /// Parser error-reporting function can be overridden in subclass
reportError(const ANTLR_USE_NAMESPACE (std)string & s)53     virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
54     {
55         importer->addMessageToLog("Parser error: " + s);
56         std::cerr << s << std::endl;
57     }
58 
59     /// Parser warning-reporting function can be overridden in subclass
reportWarning(const ANTLR_USE_NAMESPACE (std)string & s)60     virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
61     {
62         importer->addMessageToLog("Parser warning: " + s);
63         std::cerr << s << std::endl;
64     }
65 
66 #line 38 "IPTCfgParser.hpp"
67 public:
68 	void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory );
69 protected:
70 	IPTCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k);
71 public:
72 	IPTCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf);
73 protected:
74 	IPTCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k);
75 public:
76 	IPTCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer);
77 	IPTCfgParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state);
getNumTokens() const78 	int getNumTokens() const
79 	{
80 		return IPTCfgParser::NUM_TOKENS;
81 	}
getTokenName(int type) const82 	const char* getTokenName( int type ) const
83 	{
84 		if( type > getNumTokens() ) return 0;
85 		return IPTCfgParser::tokenNames[type];
86 	}
getTokenNames() const87 	const char* const* getTokenNames() const
88 	{
89 		return IPTCfgParser::tokenNames;
90 	}
91 	public: void cfgfile();
92 	public: void comment();
93 	public: void start_table();
94 	public: void create_chain();
95 	public: void add_rule();
96 	public: void commit();
97 	public: void chain_def();
98 	public: void ipt_option();
99 	public: void negation();
100 	public: void module();
101 	public: void match_mark();
102 	public: void match_recent();
103 	public: void src();
104 	public: void dst();
105 	public: void i_intf();
106 	public: void o_intf();
107 	public: void proto();
108 	public: void target();
109 	public: void fragm();
110 	public: void icmp_type_spec();
111 	public: void basic_tcp_udp_port_spec();
112 	public: void multiport_tcp_udp_port_spec();
113 	public: void tcp_options();
114 	public: void match_limit();
115 	public: void match_limit_burst();
116 	public: void match_length();
117 	public: void match_iprange_src();
118 	public: void match_iprange_dst();
119 	public: void unknown_option();
120 	public: void unknown_parameter();
121 	public: void m_state();
122 	public: void m_mport();
123 	public: void m_icmp();
124 	public: void m_tcp();
125 	public: void m_udp();
126 	public: void m_limit();
127 	public: void m_length();
128 	public: void m_iprange();
129 	public: void m_comment();
130 	public: void m_pkttype();
131 	public: void m_unknown_module();
132 	public: void protocol_word();
133 	public: void target_options();
134 	public: void nat_spec();
135 	public: void redirect_spec();
136 	public: void nat_addr_range();
137 	public: void nat_port_def_with_range();
138 	public: void state_word();
139 	public: void m_mark();
140 	public: void limit_rate();
141 	public: void m_recent();
142 	public: void recent_opts();
143 	public: void recent_args_no_param();
144 	public: void recent_args_param();
145 	public: void length_spec();
146 	public: void pkt_type_spec();
147 	public: void port_def_with_range();
148 	public: void port_def_no_range();
149 	public: void port_def_with_incomplete_range();
150 	public: void syn();
151 	public: void tcp_flags();
152 	public: void tcp_option();
153 	public: void tcp_flag_word();
154 	public: void tcp_flags_list();
155 public:
ANTLR_USE_NAMESPACE(antlr)156 	ANTLR_USE_NAMESPACE(antlr)RefAST getAST()
157 	{
158 		return returnAST;
159 	}
160 
161 protected:
162 	ANTLR_USE_NAMESPACE(antlr)RefAST returnAST;
163 private:
164 	static const char* tokenNames[];
165 #ifndef NO_STATIC_CONSTS
166 	static const int NUM_TOKENS = 146;
167 #else
168 	enum {
169 		NUM_TOKENS = 146
170 	};
171 #endif
172 
173 	static const unsigned long _tokenSet_0_data_[];
174 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0;
175 	static const unsigned long _tokenSet_1_data_[];
176 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1;
177 	static const unsigned long _tokenSet_2_data_[];
178 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2;
179 	static const unsigned long _tokenSet_3_data_[];
180 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3;
181 	static const unsigned long _tokenSet_4_data_[];
182 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4;
183 	static const unsigned long _tokenSet_5_data_[];
184 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5;
185 	static const unsigned long _tokenSet_6_data_[];
186 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6;
187 	static const unsigned long _tokenSet_7_data_[];
188 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7;
189 	static const unsigned long _tokenSet_8_data_[];
190 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8;
191 	static const unsigned long _tokenSet_9_data_[];
192 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9;
193 	static const unsigned long _tokenSet_10_data_[];
194 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10;
195 	static const unsigned long _tokenSet_11_data_[];
196 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11;
197 	static const unsigned long _tokenSet_12_data_[];
198 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12;
199 	static const unsigned long _tokenSet_13_data_[];
200 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13;
201 	static const unsigned long _tokenSet_14_data_[];
202 	static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14;
203 };
204 
205 #endif /*INC_IPTCfgParser_hpp_*/
206