mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-23 11:47:24 +01:00
see #2445 fixed import of tcp/udp ports defined by names; still need to test all possible names to make sure mappings work
This commit is contained in:
parent
a3a07b4b42
commit
aac598f1cc
@ -251,6 +251,7 @@ void PFImporter::addSrv()
|
||||
psi!=dst_port_group.end(); ++psi)
|
||||
{
|
||||
PortSpec ps = *psi;
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
QString port_spec =
|
||||
QString("%1 %2")
|
||||
@ -293,6 +294,7 @@ bool PFImporter::buildTCPUDPObjectSingature(ObjectSignature *sig,
|
||||
const QString &flags_check,
|
||||
const QString &flags_mask)
|
||||
{
|
||||
|
||||
if (protocol == "tcp")
|
||||
sig->type_name = TCPService::TYPENAME;
|
||||
else
|
||||
|
||||
@ -119,6 +119,9 @@ public:
|
||||
|
||||
PortSpec(const std::string s1, const std::string s2, const std::string s3)
|
||||
{ port1 = s1; port2 = s2; port_op = s3; }
|
||||
|
||||
std::string toString()
|
||||
{ return std::string("PortSpec: ") + port_op + " " + port1 + " " + port2; }
|
||||
};
|
||||
|
||||
class IcmpSpec
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgLexer.cpp"$ */
|
||||
#line 42 "pf.g"
|
||||
#line 43 "pf.g"
|
||||
|
||||
// gets inserted before the antlr generated includes in the cpp
|
||||
// file
|
||||
@ -14,7 +14,7 @@
|
||||
#include <antlr/CharStreamIOException.hpp>
|
||||
#include <antlr/NoViableAltForCharException.hpp>
|
||||
|
||||
#line 48 "pf.g"
|
||||
#line 49 "pf.g"
|
||||
|
||||
// gets inserted after the antlr generated includes in the cpp
|
||||
// file
|
||||
@ -441,11 +441,11 @@ void PFCfgLexer::mLINE_COMMENT(bool _createToken) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
goto _loop156;
|
||||
goto _loop157;
|
||||
}
|
||||
|
||||
}
|
||||
_loop156:;
|
||||
_loop157:;
|
||||
} // ( ... )*
|
||||
mNEWLINE(false);
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@ -477,7 +477,7 @@ void PFCfgLexer::mNEWLINE(bool _createToken) {
|
||||
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1085 "pf.g"
|
||||
#line 1086 "pf.g"
|
||||
newline();
|
||||
#line 483 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -558,7 +558,7 @@ void PFCfgLexer::mWhitespace(bool _createToken) {
|
||||
}
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1080 "pf.g"
|
||||
#line 1081 "pf.g"
|
||||
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
|
||||
#line 564 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -745,10 +745,10 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
_ttype = NUMBER_ADDRESS_OR_WORD;
|
||||
ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex;
|
||||
|
||||
bool synPredMatched181 = false;
|
||||
bool synPredMatched182 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) {
|
||||
int _m181 = mark();
|
||||
synPredMatched181 = true;
|
||||
int _m182 = mark();
|
||||
synPredMatched182 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@ -759,12 +759,12 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched181 = false;
|
||||
synPredMatched182 = false;
|
||||
}
|
||||
rewind(_m181);
|
||||
rewind(_m182);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched181 ) {
|
||||
if ( synPredMatched182 ) {
|
||||
{
|
||||
mNUM_3DIGIT(false);
|
||||
match('.' /* charlit */ );
|
||||
@ -775,99 +775,99 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_3DIGIT(false);
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1122 "pf.g"
|
||||
#line 1123 "pf.g"
|
||||
_ttype = IPV4;
|
||||
#line 781 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched188 = false;
|
||||
bool synPredMatched189 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) {
|
||||
int _m188 = mark();
|
||||
synPredMatched188 = true;
|
||||
int _m189 = mark();
|
||||
synPredMatched189 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt185=0;
|
||||
int _cnt186=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt185>=1 ) { goto _loop185; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt186>=1 ) { goto _loop186; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt185++;
|
||||
_cnt186++;
|
||||
}
|
||||
_loop185:;
|
||||
_loop186:;
|
||||
} // ( ... )+
|
||||
match('.' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt187=0;
|
||||
int _cnt188=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt187>=1 ) { goto _loop187; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt188>=1 ) { goto _loop188; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt187++;
|
||||
_cnt188++;
|
||||
}
|
||||
_loop187:;
|
||||
_loop188:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched188 = false;
|
||||
synPredMatched189 = false;
|
||||
}
|
||||
rewind(_m188);
|
||||
rewind(_m189);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched188 ) {
|
||||
if ( synPredMatched189 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt191=0;
|
||||
int _cnt192=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt191>=1 ) { goto _loop191; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt192>=1 ) { goto _loop192; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt191++;
|
||||
_cnt192++;
|
||||
}
|
||||
_loop191:;
|
||||
_loop192:;
|
||||
} // ( ... )+
|
||||
match('.' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt193=0;
|
||||
int _cnt194=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt193>=1 ) { goto _loop193; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt194>=1 ) { goto _loop194; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt193++;
|
||||
_cnt194++;
|
||||
}
|
||||
_loop193:;
|
||||
_loop194:;
|
||||
} // ( ... )+
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1125 "pf.g"
|
||||
#line 1126 "pf.g"
|
||||
_ttype = NUMBER;
|
||||
#line 864 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched212 = false;
|
||||
bool synPredMatched213 = false;
|
||||
if (((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && ((LA(3) >= 0x30 /* '0' */ && LA(3) <= 0x39 /* '9' */ )))) {
|
||||
int _m212 = mark();
|
||||
synPredMatched212 = true;
|
||||
int _m213 = mark();
|
||||
synPredMatched213 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@ -877,12 +877,12 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched212 = false;
|
||||
synPredMatched213 = false;
|
||||
}
|
||||
rewind(_m212);
|
||||
rewind(_m213);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched212 ) {
|
||||
if ( synPredMatched213 ) {
|
||||
match(':' /* charlit */ );
|
||||
match(':' /* charlit */ );
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
@ -893,23 +893,23 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
goto _loop214;
|
||||
goto _loop215;
|
||||
}
|
||||
|
||||
}
|
||||
_loop214:;
|
||||
_loop215:;
|
||||
} // ( ... )*
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1148 "pf.g"
|
||||
#line 1149 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 906 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched197 = false;
|
||||
bool synPredMatched198 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && ((LA(2) >= 0x61 /* 'a' */ && LA(2) <= 0x66 /* 'f' */ )))) {
|
||||
int _m197 = mark();
|
||||
synPredMatched197 = true;
|
||||
int _m198 = mark();
|
||||
synPredMatched198 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@ -918,60 +918,60 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched197 = false;
|
||||
synPredMatched198 = false;
|
||||
}
|
||||
rewind(_m197);
|
||||
rewind(_m198);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched197 ) {
|
||||
if ( synPredMatched198 ) {
|
||||
{
|
||||
bool synPredMatched202 = false;
|
||||
bool synPredMatched203 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && ((LA(2) >= 0x61 /* 'a' */ && LA(2) <= 0x66 /* 'f' */ )) && ((LA(3) >= 0x30 /* '0' */ && LA(3) <= 0x3a /* ':' */ )))) {
|
||||
int _m202 = mark();
|
||||
synPredMatched202 = true;
|
||||
int _m203 = mark();
|
||||
synPredMatched203 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt201=0;
|
||||
int _cnt202=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
if ( _cnt201>=1 ) { goto _loop201; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt202>=1 ) { goto _loop202; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt201++;
|
||||
_cnt202++;
|
||||
}
|
||||
_loop201:;
|
||||
_loop202:;
|
||||
} // ( ... )+
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched202 = false;
|
||||
synPredMatched203 = false;
|
||||
}
|
||||
rewind(_m202);
|
||||
rewind(_m203);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched202 ) {
|
||||
if ( synPredMatched203 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt205=0;
|
||||
int _cnt206=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
if ( _cnt205>=1 ) { goto _loop205; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt206>=1 ) { goto _loop206; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt205++;
|
||||
_cnt206++;
|
||||
}
|
||||
_loop205:;
|
||||
_loop206:;
|
||||
} // ( ... )+
|
||||
match(':' /* charlit */ );
|
||||
{
|
||||
@ -984,11 +984,11 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
goto _loop208;
|
||||
goto _loop209;
|
||||
}
|
||||
|
||||
}
|
||||
_loop208:;
|
||||
_loop209:;
|
||||
} // ( ... )*
|
||||
}
|
||||
else {
|
||||
@ -997,7 +997,7 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1139 "pf.g"
|
||||
#line 1140 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1003 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1005,22 +1005,22 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && ((LA(2) >= 0x61 /* 'a' */ && LA(2) <= 0x66 /* 'f' */ )) && ((LA(3) >= 0x30 /* '0' */ && LA(3) <= 0x3a /* ':' */ ))) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt210=0;
|
||||
int _cnt211=0;
|
||||
for (;;) {
|
||||
if ((LA(1) == 0x3a /* ':' */ )) {
|
||||
match(':' /* charlit */ );
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt210>=1 ) { goto _loop210; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt211>=1 ) { goto _loop211; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt210++;
|
||||
_cnt211++;
|
||||
}
|
||||
_loop210:;
|
||||
_loop211:;
|
||||
} // ( ... )+
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1142 "pf.g"
|
||||
#line 1143 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1026 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1144 "pf.g"
|
||||
#line 1145 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1037 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1040,28 +1040,28 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
match(':' /* charlit */ );
|
||||
match(':' /* charlit */ );
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1151 "pf.g"
|
||||
#line 1152 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1046 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true)) {
|
||||
{ // ( ... )+
|
||||
int _cnt195=0;
|
||||
int _cnt196=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt195>=1 ) { goto _loop195; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt196>=1 ) { goto _loop196; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt195++;
|
||||
_cnt196++;
|
||||
}
|
||||
_loop195:;
|
||||
_loop196:;
|
||||
} // ( ... )+
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1130 "pf.g"
|
||||
#line 1131 "pf.g"
|
||||
_ttype = INT_CONST;
|
||||
#line 1067 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1069,7 +1069,7 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
else if ((LA(1) == 0x3a /* ':' */ ) && (true)) {
|
||||
match(':' /* charlit */ );
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1154 "pf.g"
|
||||
#line 1155 "pf.g"
|
||||
_ttype = COLON;
|
||||
#line 1075 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1282,14 +1282,14 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
default:
|
||||
{
|
||||
goto _loop217;
|
||||
goto _loop218;
|
||||
}
|
||||
}
|
||||
}
|
||||
_loop217:;
|
||||
_loop218:;
|
||||
} // ( ... )*
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1166 "pf.g"
|
||||
#line 1167 "pf.g"
|
||||
_ttype = WORD;
|
||||
#line 1295 "PFCfgLexer.cpp"
|
||||
}
|
||||
@ -1319,11 +1319,11 @@ void PFCfgLexer::mSTRING(bool _createToken) {
|
||||
matchNot('\"' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
goto _loop220;
|
||||
goto _loop221;
|
||||
}
|
||||
|
||||
}
|
||||
_loop220:;
|
||||
_loop221:;
|
||||
} // ( ... )*
|
||||
match('\"' /* charlit */ );
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
|
||||
@ -20,21 +20,22 @@
|
||||
// gets inserted after antlr generated includes in the header file
|
||||
// outside any generated namespace specifications
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
class PFImporter;
|
||||
|
||||
#line 28 "PFCfgLexer.hpp"
|
||||
#line 56 "pf.g"
|
||||
#line 29 "PFCfgLexer.hpp"
|
||||
#line 57 "pf.g"
|
||||
|
||||
// gets inserted after generated namespace specifications in the
|
||||
// header file. But outside the generated class.
|
||||
|
||||
#line 34 "PFCfgLexer.hpp"
|
||||
#line 35 "PFCfgLexer.hpp"
|
||||
class CUSTOM_API PFCfgLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PFCfgParserTokenTypes
|
||||
{
|
||||
#line 1 "pf.g"
|
||||
#line 38 "PFCfgLexer.hpp"
|
||||
#line 39 "PFCfgLexer.hpp"
|
||||
private:
|
||||
void initLiterals();
|
||||
public:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParser.cpp"$ */
|
||||
#line 42 "pf.g"
|
||||
#line 43 "pf.g"
|
||||
|
||||
// gets inserted before the antlr generated includes in the cpp
|
||||
// file
|
||||
@ -9,7 +9,7 @@
|
||||
#include <antlr/NoViableAltException.hpp>
|
||||
#include <antlr/SemanticException.hpp>
|
||||
#include <antlr/ASTFactory.hpp>
|
||||
#line 48 "pf.g"
|
||||
#line 49 "pf.g"
|
||||
|
||||
// gets inserted after the antlr generated includes in the cpp
|
||||
// file
|
||||
@ -160,7 +160,7 @@ void PFCfgParser::macro_definition() {
|
||||
try { // for error handling
|
||||
match(WORD);
|
||||
match(EQUAL);
|
||||
#line 153 "pf.g"
|
||||
#line 154 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -179,7 +179,7 @@ void PFCfgParser::altq_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(ALTQ);
|
||||
#line 173 "pf.g"
|
||||
#line 174 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -200,7 +200,7 @@ void PFCfgParser::antispoof_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(ANTISPOOF);
|
||||
#line 162 "pf.g"
|
||||
#line 163 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -221,7 +221,7 @@ void PFCfgParser::queue_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(QUEUE);
|
||||
#line 184 "pf.g"
|
||||
#line 185 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -242,7 +242,7 @@ void PFCfgParser::set_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(SET);
|
||||
#line 195 "pf.g"
|
||||
#line 196 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -263,7 +263,7 @@ void PFCfgParser::scrub_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(SCRUB);
|
||||
#line 206 "pf.g"
|
||||
#line 207 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -286,7 +286,7 @@ void PFCfgParser::table_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(TABLE);
|
||||
#line 218 "pf.g"
|
||||
#line 219 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -360,7 +360,7 @@ void PFCfgParser::table_command() {
|
||||
match(FILE);
|
||||
file = LT(1);
|
||||
match(STRING);
|
||||
#line 230 "pf.g"
|
||||
#line 231 "pf.g"
|
||||
|
||||
importer->newAddressTableObject(
|
||||
name->getText(), file->getText());
|
||||
@ -405,7 +405,7 @@ void PFCfgParser::table_command() {
|
||||
_loop18:;
|
||||
} // ( ... )*
|
||||
match(CLOSING_BRACE);
|
||||
#line 242 "pf.g"
|
||||
#line 243 "pf.g"
|
||||
|
||||
importer->newAddressTableObject(
|
||||
name->getText(), importer->tmp_group);
|
||||
@ -431,7 +431,7 @@ void PFCfgParser::nat_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(NAT);
|
||||
#line 313 "pf.g"
|
||||
#line 314 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -452,7 +452,7 @@ void PFCfgParser::rdr_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(RDR);
|
||||
#line 335 "pf.g"
|
||||
#line 336 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -473,7 +473,7 @@ void PFCfgParser::binat_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(BINAT);
|
||||
#line 324 "pf.g"
|
||||
#line 325 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -494,7 +494,7 @@ void PFCfgParser::pass_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(PASS);
|
||||
#line 369 "pf.g"
|
||||
#line 370 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -504,7 +504,7 @@ void PFCfgParser::pass_command() {
|
||||
|
||||
#line 506 "PFCfgParser.cpp"
|
||||
rule_extended();
|
||||
#line 377 "pf.g"
|
||||
#line 378 "pf.g"
|
||||
|
||||
importer->pushRule();
|
||||
|
||||
@ -522,7 +522,7 @@ void PFCfgParser::block_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(BLOCK);
|
||||
#line 384 "pf.g"
|
||||
#line 385 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -532,7 +532,7 @@ void PFCfgParser::block_command() {
|
||||
|
||||
#line 534 "PFCfgParser.cpp"
|
||||
rule_extended();
|
||||
#line 392 "pf.g"
|
||||
#line 393 "pf.g"
|
||||
|
||||
importer->pushRule();
|
||||
|
||||
@ -550,7 +550,7 @@ void PFCfgParser::timeout_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(TIMEOUT);
|
||||
#line 346 "pf.g"
|
||||
#line 347 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -571,7 +571,7 @@ void PFCfgParser::unknown_command() {
|
||||
|
||||
try { // for error handling
|
||||
match(WORD);
|
||||
#line 358 "pf.g"
|
||||
#line 359 "pf.g"
|
||||
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
@ -587,7 +587,7 @@ void PFCfgParser::unknown_command() {
|
||||
|
||||
void PFCfgParser::tableaddr_spec() {
|
||||
Tracer traceInOut(this, "tableaddr_spec");
|
||||
#line 249 "pf.g"
|
||||
#line 250 "pf.g"
|
||||
AddressSpec as;
|
||||
#line 593 "PFCfgParser.cpp"
|
||||
|
||||
@ -597,7 +597,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case EXLAMATION:
|
||||
{
|
||||
match(EXLAMATION);
|
||||
#line 250 "pf.g"
|
||||
#line 251 "pf.g"
|
||||
as.neg = true;
|
||||
#line 603 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -619,7 +619,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case WORD:
|
||||
{
|
||||
match(WORD);
|
||||
#line 253 "pf.g"
|
||||
#line 254 "pf.g"
|
||||
|
||||
as.at = AddressSpec::INTERFACE_NAME;
|
||||
as.address = LT(0)->getText();
|
||||
@ -635,7 +635,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case NETWORK:
|
||||
{
|
||||
match(NETWORK);
|
||||
#line 261 "pf.g"
|
||||
#line 262 "pf.g"
|
||||
|
||||
as.at = AddressSpec::INTERFACE_NETWORK;
|
||||
|
||||
@ -645,7 +645,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case BROADCAST:
|
||||
{
|
||||
match(BROADCAST);
|
||||
#line 266 "pf.g"
|
||||
#line 267 "pf.g"
|
||||
|
||||
as.at = AddressSpec::INTERFACE_BROADCAST;
|
||||
|
||||
@ -655,7 +655,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case PEER:
|
||||
{
|
||||
match(PEER);
|
||||
#line 271 "pf.g"
|
||||
#line 272 "pf.g"
|
||||
|
||||
importer->error_tracker->registerError(
|
||||
QString("import of 'interface:peer' is not supported."));
|
||||
@ -666,7 +666,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case INT_CONST:
|
||||
{
|
||||
match(INT_CONST);
|
||||
#line 277 "pf.g"
|
||||
#line 278 "pf.g"
|
||||
|
||||
importer->error_tracker->registerError(
|
||||
QString("import of 'interface:0' is not supported."));
|
||||
@ -702,7 +702,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case SELF:
|
||||
{
|
||||
match(SELF);
|
||||
#line 285 "pf.g"
|
||||
#line 286 "pf.g"
|
||||
|
||||
as.at = AddressSpec::SPECIAL_ADDRESS;
|
||||
as.address = "self";
|
||||
@ -713,7 +713,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case IPV4:
|
||||
{
|
||||
match(IPV4);
|
||||
#line 291 "pf.g"
|
||||
#line 292 "pf.g"
|
||||
|
||||
as.at = AddressSpec::HOST_ADDRESS;
|
||||
as.address = LT(0)->getText();
|
||||
@ -724,7 +724,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
case SLASH:
|
||||
{
|
||||
match(SLASH);
|
||||
#line 297 "pf.g"
|
||||
#line 298 "pf.g"
|
||||
|
||||
as.at = AddressSpec::NETWORK_ADDRESS;
|
||||
|
||||
@ -747,7 +747,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 301 "pf.g"
|
||||
#line 302 "pf.g"
|
||||
|
||||
as.netmask = LT(0)->getText();
|
||||
|
||||
@ -777,7 +777,7 @@ void PFCfgParser::tableaddr_spec() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 306 "pf.g"
|
||||
#line 307 "pf.g"
|
||||
|
||||
importer->tmp_group.push_back(as);
|
||||
|
||||
@ -1118,7 +1118,7 @@ void PFCfgParser::direction() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 411 "pf.g"
|
||||
#line 412 "pf.g"
|
||||
|
||||
importer->direction = LT(0)->getText();
|
||||
|
||||
@ -1174,7 +1174,7 @@ void PFCfgParser::logging() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 418 "pf.g"
|
||||
#line 419 "pf.g"
|
||||
|
||||
importer->logging = true;
|
||||
|
||||
@ -1191,7 +1191,7 @@ void PFCfgParser::quick() {
|
||||
|
||||
try { // for error handling
|
||||
match(QUICK);
|
||||
#line 440 "pf.g"
|
||||
#line 441 "pf.g"
|
||||
|
||||
importer->quick = true;
|
||||
|
||||
@ -1274,7 +1274,7 @@ void PFCfgParser::address_family() {
|
||||
case INET6:
|
||||
{
|
||||
match(INET6);
|
||||
#line 470 "pf.g"
|
||||
#line 471 "pf.g"
|
||||
|
||||
importer->address_family = LT(0)->getText();
|
||||
|
||||
@ -1314,7 +1314,7 @@ void PFCfgParser::hosts() {
|
||||
case ALL:
|
||||
{
|
||||
match(ALL);
|
||||
#line 513 "pf.g"
|
||||
#line 514 "pf.g"
|
||||
|
||||
importer->src_group.push_back(
|
||||
AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0"));
|
||||
@ -1475,7 +1475,7 @@ void PFCfgParser::logopts() {
|
||||
for (;;) {
|
||||
if ((LA(1) == COMMA)) {
|
||||
match(COMMA);
|
||||
#line 427 "pf.g"
|
||||
#line 428 "pf.g"
|
||||
importer->logopts += ",";
|
||||
#line 1481 "PFCfgParser.cpp"
|
||||
logopt();
|
||||
@ -1514,7 +1514,7 @@ void PFCfgParser::logopt() {
|
||||
{
|
||||
match(TO);
|
||||
match(WORD);
|
||||
#line 434 "pf.g"
|
||||
#line 435 "pf.g"
|
||||
|
||||
importer->logopts += LT(0)->getText();
|
||||
|
||||
@ -1535,7 +1535,7 @@ void PFCfgParser::logopt() {
|
||||
|
||||
void PFCfgParser::ifspec() {
|
||||
Tracer traceInOut(this, "ifspec");
|
||||
#line 448 "pf.g"
|
||||
#line 449 "pf.g"
|
||||
InterfaceSpec is;
|
||||
#line 1541 "PFCfgParser.cpp"
|
||||
|
||||
@ -1545,7 +1545,7 @@ void PFCfgParser::ifspec() {
|
||||
case EXLAMATION:
|
||||
{
|
||||
match(EXLAMATION);
|
||||
#line 449 "pf.g"
|
||||
#line 450 "pf.g"
|
||||
is.neg = true;
|
||||
#line 1551 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -1561,7 +1561,7 @@ void PFCfgParser::ifspec() {
|
||||
}
|
||||
}
|
||||
match(WORD);
|
||||
#line 451 "pf.g"
|
||||
#line 452 "pf.g"
|
||||
|
||||
is.name = LT(0)->getText();
|
||||
importer->iface_group.push_back(is);
|
||||
@ -1760,7 +1760,7 @@ void PFCfgParser::proto_name() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 490 "pf.g"
|
||||
#line 491 "pf.g"
|
||||
|
||||
importer->proto_list.push_back(LT(0)->getText());
|
||||
|
||||
@ -1777,7 +1777,7 @@ void PFCfgParser::proto_number() {
|
||||
|
||||
try { // for error handling
|
||||
match(INT_CONST);
|
||||
#line 496 "pf.g"
|
||||
#line 497 "pf.g"
|
||||
|
||||
importer->proto_list.push_back(LT(0)->getText());
|
||||
|
||||
@ -1976,7 +1976,7 @@ void PFCfgParser::src_hosts_part() {
|
||||
case URPF_FAILED:
|
||||
{
|
||||
match(URPF_FAILED);
|
||||
#line 536 "pf.g"
|
||||
#line 537 "pf.g"
|
||||
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, false,
|
||||
@ -1991,7 +1991,7 @@ void PFCfgParser::src_hosts_part() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 542 "pf.g"
|
||||
#line 543 "pf.g"
|
||||
|
||||
importer->src_neg = importer->tmp_neg;
|
||||
importer->src_group.splice(importer->src_group.begin(),
|
||||
@ -2033,7 +2033,7 @@ void PFCfgParser::src_port_part() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 860 "pf.g"
|
||||
#line 861 "pf.g"
|
||||
|
||||
importer->src_port_group.splice(importer->src_port_group.begin(),
|
||||
importer->tmp_port_group);
|
||||
@ -2051,7 +2051,7 @@ void PFCfgParser::dst_hosts_part() {
|
||||
|
||||
try { // for error handling
|
||||
common_hosts_part();
|
||||
#line 551 "pf.g"
|
||||
#line 552 "pf.g"
|
||||
|
||||
importer->dst_neg = importer->tmp_neg;
|
||||
importer->dst_group.splice(importer->dst_group.begin(),
|
||||
@ -2093,7 +2093,7 @@ void PFCfgParser::dst_port_part() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 868 "pf.g"
|
||||
#line 869 "pf.g"
|
||||
|
||||
importer->dst_port_group.splice(importer->dst_port_group.begin(),
|
||||
importer->tmp_port_group);
|
||||
@ -2114,7 +2114,7 @@ void PFCfgParser::common_hosts_part() {
|
||||
case ANY:
|
||||
{
|
||||
match(ANY);
|
||||
#line 560 "pf.g"
|
||||
#line 561 "pf.g"
|
||||
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0"));
|
||||
@ -2125,7 +2125,7 @@ void PFCfgParser::common_hosts_part() {
|
||||
case NO_ROUTE:
|
||||
{
|
||||
match(NO_ROUTE);
|
||||
#line 566 "pf.g"
|
||||
#line 567 "pf.g"
|
||||
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, false, "no-route", ""));
|
||||
@ -2163,7 +2163,7 @@ void PFCfgParser::common_hosts_part() {
|
||||
void PFCfgParser::host() {
|
||||
Tracer traceInOut(this, "host");
|
||||
ANTLR_USE_NAMESPACE(antlr)RefToken tn = ANTLR_USE_NAMESPACE(antlr)nullToken;
|
||||
#line 576 "pf.g"
|
||||
#line 577 "pf.g"
|
||||
AddressSpec as;
|
||||
#line 2169 "PFCfgParser.cpp"
|
||||
|
||||
@ -2173,7 +2173,7 @@ void PFCfgParser::host() {
|
||||
case EXLAMATION:
|
||||
{
|
||||
match(EXLAMATION);
|
||||
#line 577 "pf.g"
|
||||
#line 578 "pf.g"
|
||||
as.neg = true;
|
||||
#line 2179 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -2197,7 +2197,7 @@ void PFCfgParser::host() {
|
||||
case WORD:
|
||||
{
|
||||
match(WORD);
|
||||
#line 580 "pf.g"
|
||||
#line 581 "pf.g"
|
||||
|
||||
// interface name or domain/host name
|
||||
as.at = AddressSpec::INTERFACE_NAME;
|
||||
@ -2214,7 +2214,7 @@ void PFCfgParser::host() {
|
||||
case NETWORK:
|
||||
{
|
||||
match(NETWORK);
|
||||
#line 589 "pf.g"
|
||||
#line 590 "pf.g"
|
||||
|
||||
as.at = AddressSpec::INTERFACE_NETWORK;
|
||||
|
||||
@ -2224,7 +2224,7 @@ void PFCfgParser::host() {
|
||||
case BROADCAST:
|
||||
{
|
||||
match(BROADCAST);
|
||||
#line 594 "pf.g"
|
||||
#line 595 "pf.g"
|
||||
|
||||
as.at = AddressSpec::INTERFACE_BROADCAST;
|
||||
|
||||
@ -2234,7 +2234,7 @@ void PFCfgParser::host() {
|
||||
case PEER:
|
||||
{
|
||||
match(PEER);
|
||||
#line 599 "pf.g"
|
||||
#line 600 "pf.g"
|
||||
|
||||
importer->error_tracker->registerError(
|
||||
QString("import of 'interface:peer' is not supported."));
|
||||
@ -2245,7 +2245,7 @@ void PFCfgParser::host() {
|
||||
case INT_CONST:
|
||||
{
|
||||
match(INT_CONST);
|
||||
#line 605 "pf.g"
|
||||
#line 606 "pf.g"
|
||||
|
||||
importer->error_tracker->registerError(
|
||||
QString("import of 'interface:0' is not supported."));
|
||||
@ -2292,7 +2292,7 @@ void PFCfgParser::host() {
|
||||
case SELF:
|
||||
{
|
||||
match(SELF);
|
||||
#line 613 "pf.g"
|
||||
#line 614 "pf.g"
|
||||
|
||||
as.at = AddressSpec::SPECIAL_ADDRESS;
|
||||
as.address = "self";
|
||||
@ -2303,7 +2303,7 @@ void PFCfgParser::host() {
|
||||
case IPV6:
|
||||
{
|
||||
match(IPV6);
|
||||
#line 619 "pf.g"
|
||||
#line 620 "pf.g"
|
||||
|
||||
importer->addMessageToLog(QString("IPv6 import is not supported. "));
|
||||
consumeUntil(NEWLINE);
|
||||
@ -2314,7 +2314,7 @@ void PFCfgParser::host() {
|
||||
case IPV4:
|
||||
{
|
||||
match(IPV4);
|
||||
#line 625 "pf.g"
|
||||
#line 626 "pf.g"
|
||||
|
||||
as.at = AddressSpec::HOST_ADDRESS;
|
||||
as.address = LT(0)->getText();
|
||||
@ -2325,7 +2325,7 @@ void PFCfgParser::host() {
|
||||
case SLASH:
|
||||
{
|
||||
match(SLASH);
|
||||
#line 631 "pf.g"
|
||||
#line 632 "pf.g"
|
||||
|
||||
as.at = AddressSpec::NETWORK_ADDRESS;
|
||||
|
||||
@ -2348,7 +2348,7 @@ void PFCfgParser::host() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 635 "pf.g"
|
||||
#line 636 "pf.g"
|
||||
|
||||
as.netmask = LT(0)->getText();
|
||||
|
||||
@ -2389,7 +2389,7 @@ void PFCfgParser::host() {
|
||||
tn = LT(1);
|
||||
match(WORD);
|
||||
match(GREATER_THAN);
|
||||
#line 641 "pf.g"
|
||||
#line 642 "pf.g"
|
||||
|
||||
as.at = AddressSpec::TABLE;
|
||||
as.address = tn->getText();
|
||||
@ -2403,7 +2403,7 @@ void PFCfgParser::host() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 646 "pf.g"
|
||||
#line 647 "pf.g"
|
||||
|
||||
importer->tmp_group.push_back(as);
|
||||
|
||||
@ -2465,7 +2465,7 @@ void PFCfgParser::route_to() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 668 "pf.g"
|
||||
#line 669 "pf.g"
|
||||
|
||||
importer->route_type = PFImporter::ROUTE_TO;
|
||||
|
||||
@ -2500,7 +2500,7 @@ void PFCfgParser::reply_to() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 675 "pf.g"
|
||||
#line 676 "pf.g"
|
||||
|
||||
importer->route_type = PFImporter::REPLY_TO;
|
||||
|
||||
@ -2518,14 +2518,14 @@ void PFCfgParser::routehost() {
|
||||
ANTLR_USE_NAMESPACE(antlr)RefToken v6 = ANTLR_USE_NAMESPACE(antlr)nullToken;
|
||||
ANTLR_USE_NAMESPACE(antlr)RefToken nm = ANTLR_USE_NAMESPACE(antlr)nullToken;
|
||||
ANTLR_USE_NAMESPACE(antlr)RefToken nm6 = ANTLR_USE_NAMESPACE(antlr)nullToken;
|
||||
#line 680 "pf.g"
|
||||
#line 681 "pf.g"
|
||||
RouteSpec rs;
|
||||
#line 2524 "PFCfgParser.cpp"
|
||||
|
||||
try { // for error handling
|
||||
match(OPENING_PAREN);
|
||||
match(WORD);
|
||||
#line 682 "pf.g"
|
||||
#line 683 "pf.g"
|
||||
rs.iface = LT(0)->getText();
|
||||
#line 2531 "PFCfgParser.cpp"
|
||||
{
|
||||
@ -2585,7 +2585,7 @@ void PFCfgParser::routehost() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 684 "pf.g"
|
||||
#line 685 "pf.g"
|
||||
|
||||
if (v6)
|
||||
{
|
||||
@ -2723,7 +2723,7 @@ void PFCfgParser::tcp_flags() {
|
||||
case ANY:
|
||||
{
|
||||
match(ANY);
|
||||
#line 740 "pf.g"
|
||||
#line 741 "pf.g"
|
||||
|
||||
importer->flags_check = "none";
|
||||
importer->flags_mask = "none";
|
||||
@ -2784,7 +2784,7 @@ void PFCfgParser::tcp_flags() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 746 "pf.g"
|
||||
#line 747 "pf.g"
|
||||
|
||||
if (check)
|
||||
importer->flags_check = check->getText();
|
||||
@ -2847,7 +2847,7 @@ void PFCfgParser::icmp6_type() {
|
||||
|
||||
try { // for error handling
|
||||
match(ICMP6_TYPE);
|
||||
#line 800 "pf.g"
|
||||
#line 801 "pf.g"
|
||||
|
||||
importer->addMessageToLog(QString("ICMP6 import is not supported. "));
|
||||
consumeUntil(NEWLINE);
|
||||
@ -2869,7 +2869,7 @@ void PFCfgParser::tagged() {
|
||||
case EXLAMATION:
|
||||
{
|
||||
match(EXLAMATION);
|
||||
#line 807 "pf.g"
|
||||
#line 808 "pf.g"
|
||||
importer->tagged_neg = true;
|
||||
#line 2875 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -2886,7 +2886,7 @@ void PFCfgParser::tagged() {
|
||||
}
|
||||
match(TAGGED);
|
||||
match(WORD);
|
||||
#line 809 "pf.g"
|
||||
#line 810 "pf.g"
|
||||
|
||||
importer->tagged = LT(0)->getText();
|
||||
|
||||
@ -2904,7 +2904,7 @@ void PFCfgParser::tag_clause() {
|
||||
try { // for error handling
|
||||
match(TAG);
|
||||
match(WORD);
|
||||
#line 816 "pf.g"
|
||||
#line 817 "pf.g"
|
||||
|
||||
importer->tag = LT(0)->getText();
|
||||
|
||||
@ -2948,7 +2948,7 @@ void PFCfgParser::state() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 831 "pf.g"
|
||||
#line 832 "pf.g"
|
||||
|
||||
importer->state_op = LT(0)->getText();
|
||||
|
||||
@ -2971,7 +2971,7 @@ void PFCfgParser::queue() {
|
||||
case WORD:
|
||||
{
|
||||
match(WORD);
|
||||
#line 840 "pf.g"
|
||||
#line 841 "pf.g"
|
||||
importer->queue += LT(0)->getText();
|
||||
#line 2977 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -2980,18 +2980,18 @@ void PFCfgParser::queue() {
|
||||
{
|
||||
match(OPENING_PAREN);
|
||||
match(WORD);
|
||||
#line 843 "pf.g"
|
||||
#line 844 "pf.g"
|
||||
importer->queue += LT(0)->getText();
|
||||
#line 2986 "PFCfgParser.cpp"
|
||||
{ // ( ... )*
|
||||
for (;;) {
|
||||
if ((LA(1) == COMMA)) {
|
||||
match(COMMA);
|
||||
#line 845 "pf.g"
|
||||
#line 846 "pf.g"
|
||||
importer->queue += ",";
|
||||
#line 2993 "PFCfgParser.cpp"
|
||||
match(WORD);
|
||||
#line 846 "pf.g"
|
||||
#line 847 "pf.g"
|
||||
importer->queue += LT(0)->getText();
|
||||
#line 2997 "PFCfgParser.cpp"
|
||||
}
|
||||
@ -3033,7 +3033,7 @@ void PFCfgParser::label() {
|
||||
|
||||
void PFCfgParser::icmp_type_code() {
|
||||
Tracer traceInOut(this, "icmp_type_code");
|
||||
#line 768 "pf.g"
|
||||
#line 769 "pf.g"
|
||||
IcmpSpec is;
|
||||
#line 3039 "PFCfgParser.cpp"
|
||||
|
||||
@ -3043,7 +3043,7 @@ void PFCfgParser::icmp_type_code() {
|
||||
case WORD:
|
||||
{
|
||||
match(WORD);
|
||||
#line 770 "pf.g"
|
||||
#line 771 "pf.g"
|
||||
is.icmp_type_name = LT(0)->getText();
|
||||
#line 3049 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3051,7 +3051,7 @@ void PFCfgParser::icmp_type_code() {
|
||||
case INT_CONST:
|
||||
{
|
||||
match(INT_CONST);
|
||||
#line 772 "pf.g"
|
||||
#line 773 "pf.g"
|
||||
is.icmp_type_int = LT(0)->getText();
|
||||
#line 3057 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3072,7 +3072,7 @@ void PFCfgParser::icmp_type_code() {
|
||||
case WORD:
|
||||
{
|
||||
match(WORD);
|
||||
#line 777 "pf.g"
|
||||
#line 778 "pf.g"
|
||||
is.icmp_code_name = LT(0)->getText();
|
||||
#line 3078 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3080,7 +3080,7 @@ void PFCfgParser::icmp_type_code() {
|
||||
case INT_CONST:
|
||||
{
|
||||
match(INT_CONST);
|
||||
#line 779 "pf.g"
|
||||
#line 780 "pf.g"
|
||||
is.icmp_code_int = LT(0)->getText();
|
||||
#line 3086 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3119,7 +3119,7 @@ void PFCfgParser::icmp_type_code() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 782 "pf.g"
|
||||
#line 783 "pf.g"
|
||||
|
||||
importer->icmp_type_code_group.push_back(is);
|
||||
|
||||
@ -3177,7 +3177,7 @@ void PFCfgParser::icmp_list() {
|
||||
|
||||
void PFCfgParser::port_op() {
|
||||
Tracer traceInOut(this, "port_op");
|
||||
#line 900 "pf.g"
|
||||
#line 901 "pf.g"
|
||||
PortSpec ps;
|
||||
#line 3183 "PFCfgParser.cpp"
|
||||
|
||||
@ -3190,11 +3190,11 @@ void PFCfgParser::port_op() {
|
||||
case EXLAMATION:
|
||||
{
|
||||
unary_port_op();
|
||||
#line 902 "pf.g"
|
||||
#line 903 "pf.g"
|
||||
ps.port_op = importer->tmp_port_op;
|
||||
#line 3196 "PFCfgParser.cpp"
|
||||
port_def();
|
||||
#line 904 "pf.g"
|
||||
#line 905 "pf.g"
|
||||
|
||||
ps.port1 = importer->tmp_port_def;
|
||||
ps.port2 = importer->tmp_port_def;
|
||||
@ -3206,7 +3206,7 @@ void PFCfgParser::port_op() {
|
||||
case INT_CONST:
|
||||
{
|
||||
port_def();
|
||||
#line 910 "pf.g"
|
||||
#line 911 "pf.g"
|
||||
|
||||
ps.port1 = importer->tmp_port_def;
|
||||
ps.port2 = ps.port1;
|
||||
@ -3216,11 +3216,11 @@ void PFCfgParser::port_op() {
|
||||
{
|
||||
if ((LA(1) == LESS_THAN || LA(1) == GREATER_THAN || LA(1) == COLON) && (_tokenSet_33.member(LA(2)))) {
|
||||
binary_port_op();
|
||||
#line 916 "pf.g"
|
||||
#line 917 "pf.g"
|
||||
ps.port_op = importer->tmp_port_op;
|
||||
#line 3222 "PFCfgParser.cpp"
|
||||
port_def();
|
||||
#line 917 "pf.g"
|
||||
#line 918 "pf.g"
|
||||
ps.port2 = LT(0)->getText();
|
||||
#line 3226 "PFCfgParser.cpp"
|
||||
}
|
||||
@ -3239,7 +3239,7 @@ void PFCfgParser::port_op() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 920 "pf.g"
|
||||
#line 921 "pf.g"
|
||||
|
||||
importer->tmp_port_group.push_back(ps);
|
||||
|
||||
@ -3285,11 +3285,11 @@ void PFCfgParser::port_op_list() {
|
||||
port_op();
|
||||
}
|
||||
else {
|
||||
goto _loop152;
|
||||
goto _loop153;
|
||||
}
|
||||
|
||||
}
|
||||
_loop152:;
|
||||
_loop153:;
|
||||
} // ( ... )*
|
||||
match(CLOSING_BRACE);
|
||||
}
|
||||
@ -3308,7 +3308,7 @@ void PFCfgParser::unary_port_op() {
|
||||
case EQUAL:
|
||||
{
|
||||
match(EQUAL);
|
||||
#line 876 "pf.g"
|
||||
#line 877 "pf.g"
|
||||
importer->tmp_port_op = "=";
|
||||
#line 3314 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3317,7 +3317,7 @@ void PFCfgParser::unary_port_op() {
|
||||
{
|
||||
match(EXLAMATION);
|
||||
match(EQUAL);
|
||||
#line 878 "pf.g"
|
||||
#line 879 "pf.g"
|
||||
importer->tmp_port_op = "!=";
|
||||
#line 3323 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3325,27 +3325,27 @@ void PFCfgParser::unary_port_op() {
|
||||
default:
|
||||
if ((LA(1) == LESS_THAN) && (LA(2) == WORD || LA(2) == INT_CONST)) {
|
||||
match(LESS_THAN);
|
||||
#line 880 "pf.g"
|
||||
#line 881 "pf.g"
|
||||
importer->tmp_port_op = "<";
|
||||
#line 3331 "PFCfgParser.cpp"
|
||||
}
|
||||
else if ((LA(1) == LESS_THAN) && (LA(2) == EQUAL)) {
|
||||
match(LESS_THAN);
|
||||
match(EQUAL);
|
||||
#line 882 "pf.g"
|
||||
#line 883 "pf.g"
|
||||
importer->tmp_port_op = "<=";
|
||||
#line 3338 "PFCfgParser.cpp"
|
||||
}
|
||||
else if ((LA(1) == GREATER_THAN) && (LA(2) == WORD || LA(2) == INT_CONST)) {
|
||||
match(GREATER_THAN);
|
||||
#line 884 "pf.g"
|
||||
#line 885 "pf.g"
|
||||
importer->tmp_port_op = ">";
|
||||
#line 3344 "PFCfgParser.cpp"
|
||||
}
|
||||
else if ((LA(1) == GREATER_THAN) && (LA(2) == EQUAL)) {
|
||||
match(GREATER_THAN);
|
||||
match(EQUAL);
|
||||
#line 886 "pf.g"
|
||||
#line 887 "pf.g"
|
||||
importer->tmp_port_op = ">=";
|
||||
#line 3351 "PFCfgParser.cpp"
|
||||
}
|
||||
@ -3371,7 +3371,7 @@ void PFCfgParser::binary_port_op() {
|
||||
{
|
||||
match(LESS_THAN);
|
||||
match(GREATER_THAN);
|
||||
#line 892 "pf.g"
|
||||
#line 893 "pf.g"
|
||||
importer->tmp_port_op = "<>";
|
||||
#line 3377 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3380,7 +3380,7 @@ void PFCfgParser::binary_port_op() {
|
||||
{
|
||||
match(GREATER_THAN);
|
||||
match(LESS_THAN);
|
||||
#line 894 "pf.g"
|
||||
#line 895 "pf.g"
|
||||
importer->tmp_port_op = "><";
|
||||
#line 3386 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3388,7 +3388,7 @@ void PFCfgParser::binary_port_op() {
|
||||
case COLON:
|
||||
{
|
||||
match(COLON);
|
||||
#line 896 "pf.g"
|
||||
#line 897 "pf.g"
|
||||
importer->tmp_port_op = ":";
|
||||
#line 3394 "PFCfgParser.cpp"
|
||||
break;
|
||||
@ -3410,6 +3410,7 @@ void PFCfgParser::port_def() {
|
||||
Tracer traceInOut(this, "port_def");
|
||||
|
||||
try { // for error handling
|
||||
{
|
||||
switch ( LA(1)) {
|
||||
case WORD:
|
||||
{
|
||||
@ -3419,11 +3420,6 @@ void PFCfgParser::port_def() {
|
||||
case INT_CONST:
|
||||
{
|
||||
match(INT_CONST);
|
||||
#line 927 "pf.g"
|
||||
|
||||
importer->tmp_port_def = LT(0)->getText();
|
||||
|
||||
#line 3427 "PFCfgParser.cpp"
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -3431,6 +3427,12 @@ void PFCfgParser::port_def() {
|
||||
throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
|
||||
}
|
||||
}
|
||||
}
|
||||
#line 928 "pf.g"
|
||||
|
||||
importer->tmp_port_def = LT(0)->getText();
|
||||
|
||||
#line 3436 "PFCfgParser.cpp"
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
|
||||
reportError(ex);
|
||||
|
||||
@ -20,20 +20,21 @@
|
||||
// gets inserted after antlr generated includes in the header file
|
||||
// outside any generated namespace specifications
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
class PFImporter;
|
||||
|
||||
#line 28 "PFCfgParser.hpp"
|
||||
#line 56 "pf.g"
|
||||
#line 29 "PFCfgParser.hpp"
|
||||
#line 57 "pf.g"
|
||||
|
||||
// gets inserted after generated namespace specifications in the
|
||||
// header file. But outside the generated class.
|
||||
|
||||
#line 34 "PFCfgParser.hpp"
|
||||
#line 35 "PFCfgParser.hpp"
|
||||
class CUSTOM_API PFCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PFCfgParserTokenTypes
|
||||
{
|
||||
#line 81 "pf.g"
|
||||
#line 82 "pf.g"
|
||||
|
||||
// additional methods and members
|
||||
|
||||
@ -63,7 +64,7 @@ class CUSTOM_API PFCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, publi
|
||||
std::cerr << s << std::endl;
|
||||
}
|
||||
|
||||
#line 38 "PFCfgParser.hpp"
|
||||
#line 39 "PFCfgParser.hpp"
|
||||
public:
|
||||
void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory );
|
||||
protected:
|
||||
|
||||
@ -33,6 +33,7 @@ header "post_include_hpp"
|
||||
// gets inserted after antlr generated includes in the header file
|
||||
// outside any generated namespace specifications
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
class PFImporter;
|
||||
@ -776,7 +777,7 @@ icmp_type_code { IcmpSpec is; } :
|
||||
(
|
||||
WORD { is.icmp_code_name = LT(0)->getText(); }
|
||||
|
|
||||
INT_CONST { is.icmp_code_int = LT(0)->getText(); }
|
||||
INT_CONST { is.icmp_code_int = LT(0)->getText(); }
|
||||
)
|
||||
)?
|
||||
{
|
||||
@ -923,7 +924,7 @@ port_op { PortSpec ps; } :
|
||||
;
|
||||
|
||||
port_def :
|
||||
WORD | INT_CONST
|
||||
( WORD | INT_CONST )
|
||||
{
|
||||
importer->tmp_port_def = LT(0)->getText();
|
||||
}
|
||||
|
||||
@ -14,3 +14,13 @@ pass in quick proto tcp from any to self port 1000:1010
|
||||
pass in quick proto tcp from any to self port 1000><1010
|
||||
pass in quick proto tcp from any to self port 1000<>1010
|
||||
|
||||
# ports by names
|
||||
pass in quick proto tcp from any to self port ssh
|
||||
pass in quick proto tcp from any to self port smtp
|
||||
pass in quick proto tcp from any to self port www
|
||||
pass in quick proto tcp from any to self port https
|
||||
pass in quick proto tcp from any to self port ntp
|
||||
pass in quick proto tcp from any to self port ftp
|
||||
pass in quick proto tcp from any to self port ftp-data
|
||||
pass in quick proto udp from any to self port domain
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user