mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-15 01:19:29 +02:00
see #2394 creating policy rules with src and dst populated; parsing and creating address tables and groups of addresses
This commit is contained in:
+17
-27
@@ -586,48 +586,38 @@ void Importer::setDstSelf()
|
||||
dst_a = "self";
|
||||
}
|
||||
|
||||
FWObject* Importer::makeSrcObj()
|
||||
FWObject* Importer::makeAddressObj(const std::string addr, const std::string netm)
|
||||
{
|
||||
if (src_a == "self")
|
||||
if (addr == "self")
|
||||
{
|
||||
return getFirewallObject();
|
||||
}
|
||||
|
||||
if ( (src_a=="" && src_nm=="") ||
|
||||
(src_a==InetAddr::getAny().toString() &&
|
||||
src_nm==InetAddr::getAny().toString()))
|
||||
if ( (addr=="" && netm=="") ||
|
||||
(addr==InetAddr::getAny().toString() &&
|
||||
netm==InetAddr::getAny().toString()))
|
||||
return NULL; // this is 'any'
|
||||
|
||||
if (src_nm=="") src_nm = InetAddr::getAllOnes().toString();
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = Address::TYPENAME;
|
||||
sig.setAddress(src_a.c_str());
|
||||
sig.setNetmask(src_nm.c_str(), address_maker->getInvertedNetmasks());
|
||||
sig.setAddress(addr.c_str());
|
||||
if (netm=="")
|
||||
sig.setNetmask(InetAddr::getAllOnes().toString().c_str(),
|
||||
address_maker->getInvertedNetmasks());
|
||||
else
|
||||
sig.setNetmask(netm.c_str(), address_maker->getInvertedNetmasks());
|
||||
|
||||
return commitObject(address_maker->createObject(sig));
|
||||
}
|
||||
|
||||
FWObject* Importer::makeSrcObj()
|
||||
{
|
||||
return makeAddressObj(src_a, src_nm);
|
||||
}
|
||||
|
||||
FWObject* Importer::makeDstObj()
|
||||
{
|
||||
if (dst_a == "self")
|
||||
{
|
||||
return getFirewallObject();
|
||||
}
|
||||
|
||||
if ( (dst_a=="" && dst_nm=="") ||
|
||||
(dst_a==InetAddr::getAny().toString() &&
|
||||
dst_nm==InetAddr::getAny().toString()))
|
||||
return NULL; // this is 'any'
|
||||
|
||||
if (dst_nm=="") dst_nm=InetAddr::getAllOnes().toString();
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = Address::TYPENAME;
|
||||
sig.setAddress(dst_a.c_str());
|
||||
sig.setNetmask(dst_nm.c_str(), address_maker->getInvertedNetmasks());
|
||||
|
||||
return commitObject(address_maker->createObject(sig));
|
||||
return makeAddressObj(dst_a, dst_nm);
|
||||
}
|
||||
|
||||
FWObject* Importer::makeSrvObj()
|
||||
|
||||
@@ -182,6 +182,9 @@ protected:
|
||||
virtual libfwbuilder::FWObject* createGroupOfInterfaces(
|
||||
const std::string &ruleset_name, std::list<std::string> &interfaces);
|
||||
|
||||
virtual libfwbuilder::FWObject* makeAddressObj(const std::string addr,
|
||||
const std::string netm);
|
||||
|
||||
virtual libfwbuilder::FWObject* makeSrcObj();
|
||||
virtual libfwbuilder::FWObject* makeDstObj();
|
||||
virtual libfwbuilder::FWObject* makeSrvObj();
|
||||
|
||||
+141
-27
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
#include "fwbuilder/AddressRange.h"
|
||||
#include "fwbuilder/AddressTable.h"
|
||||
#include "fwbuilder/Resources.h"
|
||||
#include "fwbuilder/Network.h"
|
||||
#include "fwbuilder/Address.h"
|
||||
@@ -90,6 +91,7 @@ void PFImporter::clear()
|
||||
|
||||
iface_group.clear();
|
||||
proto_list.clear();
|
||||
tmp_group.clear();
|
||||
src_group.clear();
|
||||
dst_group.clear();
|
||||
|
||||
@@ -124,35 +126,81 @@ void PFImporter::clearTempVars()
|
||||
Importer::clear();
|
||||
}
|
||||
|
||||
FWObject* PFImporter::makeSrcObj()
|
||||
void PFImporter::addSrc()
|
||||
{
|
||||
if (src_nm == "interface")
|
||||
{
|
||||
Interface *intf = getInterfaceByName(src_a);
|
||||
if (intf) return intf;
|
||||
reportError(
|
||||
QString("Cannot find interface with label '%1'").arg(src_a.c_str()));
|
||||
}
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElement *re = rule->getSrc();
|
||||
|
||||
return Importer::makeSrcObj();
|
||||
list<AddressSpec>::iterator it;
|
||||
for (it=src_group.begin(); it!=src_group.end(); ++it)
|
||||
{
|
||||
FWObject *obj = makeAddressObj(*it);
|
||||
if (obj) re->addRef(obj);
|
||||
}
|
||||
}
|
||||
|
||||
FWObject* PFImporter::makeDstObj()
|
||||
void PFImporter::addDst()
|
||||
{
|
||||
if (dst_nm == "interface")
|
||||
{
|
||||
Interface *intf = getInterfaceByName(dst_a);
|
||||
if (intf) return intf;
|
||||
reportError(
|
||||
QString("Cannot find interface with label '%1'").arg(dst_a.c_str()));
|
||||
}
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElement *re = rule->getDst();
|
||||
|
||||
return Importer::makeDstObj();
|
||||
list<AddressSpec>::iterator it;
|
||||
for (it=dst_group.begin(); it!=dst_group.end(); ++it)
|
||||
{
|
||||
FWObject *obj = makeAddressObj(*it);
|
||||
if (obj) re->addRef(obj);
|
||||
}
|
||||
}
|
||||
|
||||
FWObject* PFImporter::makeSrvObj()
|
||||
void PFImporter::addSrv()
|
||||
{
|
||||
return Importer::makeSrvObj();
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElement *re = rule->getSrv();
|
||||
|
||||
// list<AddressSpec>::iterator it;
|
||||
// for (it=dst_group.begin(); it!=dst_group.end(); ++it)
|
||||
// {
|
||||
// FWObject *obj = makeAddressObj(*it);
|
||||
// if (obj) re->addRef(obj);
|
||||
// }
|
||||
}
|
||||
|
||||
FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
{
|
||||
if (as.at == AddressSpec::ANY) return NULL;
|
||||
|
||||
if (as.at == AddressSpec::INTERFACE_NAME)
|
||||
{
|
||||
Interface *intf = getInterfaceByName(as.address);
|
||||
assert(intf!=NULL);
|
||||
return intf;
|
||||
}
|
||||
|
||||
if (as.at == AddressSpec::HOST_ADDRESS)
|
||||
{
|
||||
return Importer::makeAddressObj(as.address, "");
|
||||
}
|
||||
|
||||
if (as.at == AddressSpec::NETWORK_ADDRESS)
|
||||
{
|
||||
return Importer::makeAddressObj(as.address, as.netmask);
|
||||
}
|
||||
|
||||
if (as.at == AddressSpec::SPECIAL_ADDRESS)
|
||||
{
|
||||
if (as.address == "self") return getFirewallObject();
|
||||
{
|
||||
addMessageToLog(
|
||||
QObject::tr("Warning: matching '%1' is not supported")
|
||||
.arg(as.address.c_str()));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (as.at == AddressSpec::TABLE)
|
||||
{
|
||||
return address_table_registry[as.address.c_str()];
|
||||
}
|
||||
}
|
||||
|
||||
void PFImporter::addLogging()
|
||||
@@ -260,10 +308,8 @@ void PFImporter::pushPolicyRule()
|
||||
// importer->setInterfaceAndDirectionForRuleSet(
|
||||
// "", importer->iface, importer->direction);
|
||||
|
||||
|
||||
addMessageToLog(
|
||||
QString("filtering rule: action %1")
|
||||
.arg(action.c_str()));
|
||||
QString message_str =
|
||||
QString("filtering rule: action %1; interfaces: %2");
|
||||
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
|
||||
@@ -272,7 +318,10 @@ void PFImporter::pushPolicyRule()
|
||||
|
||||
if (action=="pass")
|
||||
{
|
||||
rule->setAction(PolicyRule::Accept);
|
||||
if (quick)
|
||||
rule->setAction(PolicyRule::Accept);
|
||||
else
|
||||
rule->setAction(PolicyRule::Continue);
|
||||
ropt->setBool("stateless", false);
|
||||
}
|
||||
|
||||
@@ -282,7 +331,35 @@ void PFImporter::pushPolicyRule()
|
||||
ropt->setBool("stateless", true);
|
||||
}
|
||||
|
||||
rule->setDirection(PolicyRule::Both);
|
||||
if (direction == "in") rule->setDirection(PolicyRule::Inbound);
|
||||
if (direction == "out") rule->setDirection(PolicyRule::Outbound);
|
||||
if (direction == "") rule->setDirection(PolicyRule::Both);
|
||||
|
||||
QStringList interfaces;
|
||||
list<InterfaceSpec>::iterator it;
|
||||
for (it=iface_group.begin(); it!=iface_group.end(); ++it)
|
||||
{
|
||||
Interface *intf = getInterfaceByName(it->name);
|
||||
assert(intf!=NULL);
|
||||
RuleElement *re =rule->getItf();
|
||||
re->addRef(intf);
|
||||
interfaces << it->name.c_str();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set state-related rule options using variable state_op
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Set tagging rule option using variable tag
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set queueing rule option using variable queue
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Protocols are in proto_list
|
||||
@@ -290,17 +367,23 @@ void PFImporter::pushPolicyRule()
|
||||
* Destination addresses are in dst_group
|
||||
*/
|
||||
|
||||
|
||||
addSrc();
|
||||
addDst();
|
||||
addSrv();
|
||||
|
||||
/*
|
||||
* Set logging options using variables logging and logopts
|
||||
*/
|
||||
addLogging();
|
||||
|
||||
// then add it to the current ruleset
|
||||
current_ruleset->ruleset->add(current_rule);
|
||||
addStandardImportComment(
|
||||
current_rule, QString::fromUtf8(rule_comment.c_str()));
|
||||
|
||||
addMessageToLog(message_str.arg(action.c_str()).arg(interfaces.join(",")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
Firewall* PFImporter::finalize()
|
||||
@@ -364,3 +447,34 @@ Interface* PFImporter::getInterfaceByName(const string &name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PFImporter::newAddressTableObject(const string &name, const string &file)
|
||||
{
|
||||
ObjectMaker maker(Library::cast(library), error_tracker);
|
||||
AddressTable *at = AddressTable::cast(
|
||||
commitObject(maker.createObject(AddressTable::TYPENAME, name.c_str())));
|
||||
assert(at!=NULL);
|
||||
at->setRunTime(true);
|
||||
at->setSourceName(file);
|
||||
address_table_registry[name.c_str()] = at;
|
||||
|
||||
addMessageToLog(QString("Address Table: <%1> file %2")
|
||||
.arg(name.c_str()).arg(file.c_str()));
|
||||
}
|
||||
|
||||
void PFImporter::newAddressTableObject(const string &name,
|
||||
list<AddressSpec> &addresses)
|
||||
{
|
||||
ObjectMaker maker(Library::cast(library), error_tracker);
|
||||
FWObject *og =
|
||||
commitObject(maker.createObject(ObjectGroup::TYPENAME, name.c_str()));
|
||||
assert(og!=NULL);
|
||||
address_table_registry[name.c_str()] = og;
|
||||
|
||||
list<AddressSpec>::iterator it;
|
||||
for (it=addresses.begin(); it!=addresses.end(); ++it)
|
||||
{
|
||||
FWObject *obj = makeAddressObj(*it);
|
||||
if (obj) og->addRef(obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-7
@@ -70,28 +70,31 @@ public:
|
||||
typedef enum {
|
||||
UNKNOWN,
|
||||
ANY,
|
||||
HOST_NAME,
|
||||
HOST_ADDRESS,
|
||||
NETWORK_ADDRESS,
|
||||
SPECIAL_ADDRESS,
|
||||
INTERFACE_NAME,
|
||||
TABLE } address_type;
|
||||
|
||||
|
||||
address_type at;
|
||||
bool neg;
|
||||
std::string address;
|
||||
std::string netmask;
|
||||
|
||||
AddressSpec()
|
||||
{ at = UNKNOWN; address = ""; netmask = ""; }
|
||||
{ at = UNKNOWN; neg = false; address = ""; netmask = ""; }
|
||||
|
||||
AddressSpec(const AddressSpec &other)
|
||||
{
|
||||
at = other.at;
|
||||
neg = other.neg;
|
||||
address = other.address;
|
||||
netmask = other.netmask;
|
||||
}
|
||||
|
||||
AddressSpec(address_type _at, const std::string _addr, const std::string _nm)
|
||||
{ at = _at; address = _addr; netmask = _nm; }
|
||||
AddressSpec(address_type _at, bool _neg, const std::string _addr, const std::string _nm)
|
||||
{ at = _at; neg= _neg; address = _addr; netmask = _nm; }
|
||||
};
|
||||
|
||||
|
||||
@@ -154,6 +157,8 @@ public:
|
||||
REPLY_TO,
|
||||
DUP_TO} route_op_type;
|
||||
|
||||
QMap<QString,libfwbuilder::FWObject*> address_table_registry;
|
||||
|
||||
std::string direction;
|
||||
std::string address_family;
|
||||
bool quick;
|
||||
@@ -211,13 +216,19 @@ public:
|
||||
// and does final clean up.
|
||||
virtual libfwbuilder::Firewall* finalize();
|
||||
|
||||
virtual libfwbuilder::FWObject* makeSrcObj();
|
||||
virtual libfwbuilder::FWObject* makeDstObj();
|
||||
virtual libfwbuilder::FWObject* makeSrvObj();
|
||||
virtual libfwbuilder::FWObject* makeAddressObj(AddressSpec &as);
|
||||
|
||||
virtual void addSrc();
|
||||
virtual void addDst();
|
||||
virtual void addSrv();
|
||||
|
||||
virtual void addLogging();
|
||||
|
||||
libfwbuilder::Interface* getInterfaceByName(const std::string &name);
|
||||
|
||||
void newAddressTableObject(const std::string &name, const std::string &file);
|
||||
void newAddressTableObject(const std::string &name,
|
||||
std::list<AddressSpec> &addresses);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+181
-178
@@ -1,4 +1,4 @@
|
||||
/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgLexer.cpp"$ */
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgLexer.cpp"$ */
|
||||
#line 42 "pf.g"
|
||||
|
||||
// gets inserted before the antlr generated includes in the cpp
|
||||
@@ -44,90 +44,93 @@ PFCfgLexer::PFCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& st
|
||||
|
||||
void PFCfgLexer::initLiterals()
|
||||
{
|
||||
literals["vrrp"] = 50;
|
||||
literals["critical"] = 96;
|
||||
literals["ospf"] = 48;
|
||||
literals["rdp"] = 42;
|
||||
literals["disable"] = 103;
|
||||
literals["vrrp"] = 61;
|
||||
literals["critical"] = 100;
|
||||
literals["ospf"] = 59;
|
||||
literals["rdp"] = 53;
|
||||
literals["disable"] = 107;
|
||||
literals["scrub"] = 12;
|
||||
literals["ipsec"] = 86;
|
||||
literals["inet"] = 34;
|
||||
literals["pcp"] = 88;
|
||||
literals["emergencies"] = 98;
|
||||
literals["debugging"] = 97;
|
||||
literals["snp"] = 92;
|
||||
literals["timeout"] = 17;
|
||||
literals["to"] = 28;
|
||||
literals["flags"] = 66;
|
||||
literals["isis"] = 52;
|
||||
literals["icmp6-type"] = 69;
|
||||
literals["pptp"] = 90;
|
||||
literals["pass"] = 18;
|
||||
literals["no"] = 72;
|
||||
literals["from"] = 54;
|
||||
literals["igrp"] = 85;
|
||||
literals["pim"] = 89;
|
||||
literals["tagged"] = 70;
|
||||
literals["rsvp"] = 43;
|
||||
literals["route-to"] = 64;
|
||||
literals["nos"] = 87;
|
||||
literals["quit"] = 82;
|
||||
literals["->"] = 105;
|
||||
literals["icmp-type"] = 67;
|
||||
literals["exit"] = 81;
|
||||
literals["modulate"] = 74;
|
||||
literals["nat"] = 14;
|
||||
literals["range"] = 94;
|
||||
literals["urpf-failed"] = 55;
|
||||
literals["out"] = 21;
|
||||
literals["ipsec"] = 90;
|
||||
literals["inet"] = 45;
|
||||
literals["pcp"] = 92;
|
||||
literals["emergencies"] = 102;
|
||||
literals["debugging"] = 101;
|
||||
literals["persist"] = 16;
|
||||
literals["snp"] = 96;
|
||||
literals["timeout"] = 32;
|
||||
literals["to"] = 42;
|
||||
literals["flags"] = 71;
|
||||
literals["isis"] = 63;
|
||||
literals["icmp6-type"] = 74;
|
||||
literals["const"] = 17;
|
||||
literals["pptp"] = 94;
|
||||
literals["pass"] = 33;
|
||||
literals["no"] = 77;
|
||||
literals["from"] = 64;
|
||||
literals["igrp"] = 89;
|
||||
literals["pim"] = 93;
|
||||
literals["tagged"] = 75;
|
||||
literals["rsvp"] = 54;
|
||||
literals["route-to"] = 69;
|
||||
literals["nos"] = 91;
|
||||
literals["quit"] = 86;
|
||||
literals["->"] = 109;
|
||||
literals["icmp-type"] = 72;
|
||||
literals["exit"] = 85;
|
||||
literals["modulate"] = 79;
|
||||
literals["nat"] = 29;
|
||||
literals["range"] = 98;
|
||||
literals["urpf-failed"] = 65;
|
||||
literals["out"] = 36;
|
||||
literals["queue"] = 10;
|
||||
literals["gre"] = 44;
|
||||
literals["gre"] = 55;
|
||||
literals["set"] = 11;
|
||||
literals["warnings"] = 102;
|
||||
literals["ah"] = 46;
|
||||
literals["host"] = 93;
|
||||
literals["interface"] = 83;
|
||||
literals["rip"] = 91;
|
||||
literals["icmp6"] = 84;
|
||||
literals["notifications"] = 101;
|
||||
literals["synproxy"] = 75;
|
||||
literals["warnings"] = 106;
|
||||
literals["ah"] = 57;
|
||||
literals["host"] = 97;
|
||||
literals["interface"] = 87;
|
||||
literals["rip"] = 95;
|
||||
literals["icmp6"] = 88;
|
||||
literals["notifications"] = 105;
|
||||
literals["file"] = 19;
|
||||
literals["synproxy"] = 80;
|
||||
literals["altq"] = 9;
|
||||
literals["any"] = 56;
|
||||
literals["esp"] = 45;
|
||||
literals["alerts"] = 95;
|
||||
literals["all"] = 26;
|
||||
literals["inet6"] = 35;
|
||||
literals["inactive"] = 104;
|
||||
literals["label"] = 77;
|
||||
literals["udp"] = 41;
|
||||
literals["no-route"] = 58;
|
||||
literals["reply-to"] = 65;
|
||||
literals["tag"] = 71;
|
||||
literals["port"] = 79;
|
||||
literals["code"] = 68;
|
||||
literals["ip"] = 37;
|
||||
literals["any"] = 66;
|
||||
literals["esp"] = 56;
|
||||
literals["alerts"] = 99;
|
||||
literals["all"] = 40;
|
||||
literals["inet6"] = 46;
|
||||
literals["inactive"] = 108;
|
||||
literals["label"] = 82;
|
||||
literals["no-route"] = 67;
|
||||
literals["udp"] = 52;
|
||||
literals["reply-to"] = 70;
|
||||
literals["tag"] = 76;
|
||||
literals["port"] = 83;
|
||||
literals["code"] = 73;
|
||||
literals["ip"] = 48;
|
||||
literals["table"] = 13;
|
||||
literals["eigrp"] = 47;
|
||||
literals["errors"] = 99;
|
||||
literals["ipip"] = 49;
|
||||
literals["eigrp"] = 58;
|
||||
literals["errors"] = 103;
|
||||
literals["ipip"] = 60;
|
||||
literals["antispoof"] = 8;
|
||||
literals["binat"] = 15;
|
||||
literals["igmp"] = 39;
|
||||
literals["on"] = 30;
|
||||
literals["state"] = 76;
|
||||
literals["proto"] = 36;
|
||||
literals["log"] = 22;
|
||||
literals["rdr"] = 16;
|
||||
literals["informational"] = 100;
|
||||
literals["in"] = 20;
|
||||
literals["self"] = 57;
|
||||
literals["keep"] = 73;
|
||||
literals["block"] = 19;
|
||||
literals["l2tp"] = 51;
|
||||
literals["quick"] = 29;
|
||||
literals["user"] = 27;
|
||||
literals["icmp"] = 38;
|
||||
literals["tcp"] = 40;
|
||||
literals["binat"] = 30;
|
||||
literals["igmp"] = 50;
|
||||
literals["on"] = 44;
|
||||
literals["state"] = 81;
|
||||
literals["proto"] = 47;
|
||||
literals["log"] = 37;
|
||||
literals["rdr"] = 31;
|
||||
literals["informational"] = 104;
|
||||
literals["self"] = 25;
|
||||
literals["in"] = 35;
|
||||
literals["keep"] = 78;
|
||||
literals["block"] = 34;
|
||||
literals["l2tp"] = 62;
|
||||
literals["quick"] = 43;
|
||||
literals["user"] = 41;
|
||||
literals["icmp"] = 49;
|
||||
literals["tcp"] = 51;
|
||||
}
|
||||
|
||||
ANTLR_USE_NAMESPACE(antlr)RefToken PFCfgLexer::nextToken()
|
||||
@@ -435,11 +438,11 @@ void PFCfgLexer::mLINE_COMMENT(bool _createToken) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
goto _loop140;
|
||||
goto _loop152;
|
||||
}
|
||||
|
||||
}
|
||||
_loop140:;
|
||||
_loop152:;
|
||||
} // ( ... )*
|
||||
mNEWLINE(false);
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@@ -471,9 +474,9 @@ void PFCfgLexer::mNEWLINE(bool _createToken) {
|
||||
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 958 "pf.g"
|
||||
#line 1010 "pf.g"
|
||||
newline();
|
||||
#line 477 "PFCfgLexer.cpp"
|
||||
#line 480 "PFCfgLexer.cpp"
|
||||
}
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
_token = makeToken(_ttype);
|
||||
@@ -552,9 +555,9 @@ void PFCfgLexer::mWhitespace(bool _createToken) {
|
||||
}
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 953 "pf.g"
|
||||
#line 1005 "pf.g"
|
||||
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
|
||||
#line 558 "PFCfgLexer.cpp"
|
||||
#line 561 "PFCfgLexer.cpp"
|
||||
}
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
_token = makeToken(_ttype);
|
||||
@@ -739,10 +742,10 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
_ttype = NUMBER_ADDRESS_OR_WORD;
|
||||
ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex;
|
||||
|
||||
bool synPredMatched165 = false;
|
||||
bool synPredMatched177 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) {
|
||||
int _m165 = mark();
|
||||
synPredMatched165 = true;
|
||||
int _m177 = mark();
|
||||
synPredMatched177 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@@ -753,12 +756,12 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched165 = false;
|
||||
synPredMatched177 = false;
|
||||
}
|
||||
rewind(_m165);
|
||||
rewind(_m177);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched165 ) {
|
||||
if ( synPredMatched177 ) {
|
||||
{
|
||||
mNUM_3DIGIT(false);
|
||||
match('.' /* charlit */ );
|
||||
@@ -769,99 +772,99 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_3DIGIT(false);
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 995 "pf.g"
|
||||
#line 1047 "pf.g"
|
||||
_ttype = IPV4;
|
||||
#line 775 "PFCfgLexer.cpp"
|
||||
#line 778 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched172 = false;
|
||||
bool synPredMatched184 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))))) {
|
||||
int _m172 = mark();
|
||||
synPredMatched172 = true;
|
||||
int _m184 = mark();
|
||||
synPredMatched184 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt169=0;
|
||||
int _cnt181=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt169>=1 ) { goto _loop169; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt181>=1 ) { goto _loop181; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt169++;
|
||||
_cnt181++;
|
||||
}
|
||||
_loop169:;
|
||||
_loop181:;
|
||||
} // ( ... )+
|
||||
match('.' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt171=0;
|
||||
int _cnt183=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt171>=1 ) { goto _loop171; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt183>=1 ) { goto _loop183; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt171++;
|
||||
_cnt183++;
|
||||
}
|
||||
_loop171:;
|
||||
_loop183:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched172 = false;
|
||||
synPredMatched184 = false;
|
||||
}
|
||||
rewind(_m172);
|
||||
rewind(_m184);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched172 ) {
|
||||
if ( synPredMatched184 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt175=0;
|
||||
int _cnt187=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt175>=1 ) { goto _loop175; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt187>=1 ) { goto _loop187; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt175++;
|
||||
_cnt187++;
|
||||
}
|
||||
_loop175:;
|
||||
_loop187:;
|
||||
} // ( ... )+
|
||||
match('.' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt177=0;
|
||||
int _cnt189=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt177>=1 ) { goto _loop177; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt189>=1 ) { goto _loop189; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt177++;
|
||||
_cnt189++;
|
||||
}
|
||||
_loop177:;
|
||||
_loop189:;
|
||||
} // ( ... )+
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 998 "pf.g"
|
||||
#line 1050 "pf.g"
|
||||
_ttype = NUMBER;
|
||||
#line 858 "PFCfgLexer.cpp"
|
||||
#line 861 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched196 = false;
|
||||
bool synPredMatched208 = false;
|
||||
if (((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && ((LA(3) >= 0x30 /* '0' */ && LA(3) <= 0x39 /* '9' */ )))) {
|
||||
int _m196 = mark();
|
||||
synPredMatched196 = true;
|
||||
int _m208 = mark();
|
||||
synPredMatched208 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@@ -871,12 +874,12 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched196 = false;
|
||||
synPredMatched208 = false;
|
||||
}
|
||||
rewind(_m196);
|
||||
rewind(_m208);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched196 ) {
|
||||
if ( synPredMatched208 ) {
|
||||
match(':' /* charlit */ );
|
||||
match(':' /* charlit */ );
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
@@ -887,23 +890,23 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
goto _loop198;
|
||||
goto _loop210;
|
||||
}
|
||||
|
||||
}
|
||||
_loop198:;
|
||||
_loop210:;
|
||||
} // ( ... )*
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1021 "pf.g"
|
||||
#line 1073 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 900 "PFCfgLexer.cpp"
|
||||
#line 903 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched181 = false;
|
||||
bool synPredMatched193 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && ((LA(2) >= 0x61 /* 'a' */ && LA(2) <= 0x66 /* 'f' */ )))) {
|
||||
int _m181 = mark();
|
||||
synPredMatched181 = true;
|
||||
int _m193 = mark();
|
||||
synPredMatched193 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
@@ -912,60 +915,60 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched181 = false;
|
||||
synPredMatched193 = false;
|
||||
}
|
||||
rewind(_m181);
|
||||
rewind(_m193);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched181 ) {
|
||||
if ( synPredMatched193 ) {
|
||||
{
|
||||
bool synPredMatched186 = false;
|
||||
bool synPredMatched198 = 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 _m186 = mark();
|
||||
synPredMatched186 = true;
|
||||
int _m198 = mark();
|
||||
synPredMatched198 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt185=0;
|
||||
int _cnt197=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
if ( _cnt185>=1 ) { goto _loop185; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt197>=1 ) { goto _loop197; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt185++;
|
||||
_cnt197++;
|
||||
}
|
||||
_loop185:;
|
||||
_loop197:;
|
||||
} // ( ... )+
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched186 = false;
|
||||
synPredMatched198 = false;
|
||||
}
|
||||
rewind(_m186);
|
||||
rewind(_m198);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched186 ) {
|
||||
if ( synPredMatched198 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt189=0;
|
||||
int _cnt201=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
match(':' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
if ( _cnt189>=1 ) { goto _loop189; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt201>=1 ) { goto _loop201; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt189++;
|
||||
_cnt201++;
|
||||
}
|
||||
_loop189:;
|
||||
_loop201:;
|
||||
} // ( ... )+
|
||||
match(':' /* charlit */ );
|
||||
{
|
||||
@@ -978,11 +981,11 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
goto _loop192;
|
||||
goto _loop204;
|
||||
}
|
||||
|
||||
}
|
||||
_loop192:;
|
||||
_loop204:;
|
||||
} // ( ... )*
|
||||
}
|
||||
else {
|
||||
@@ -991,32 +994,32 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1012 "pf.g"
|
||||
#line 1064 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 997 "PFCfgLexer.cpp"
|
||||
#line 1000 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
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 _cnt194=0;
|
||||
int _cnt206=0;
|
||||
for (;;) {
|
||||
if ((LA(1) == 0x3a /* ':' */ )) {
|
||||
match(':' /* charlit */ );
|
||||
mNUM_HEX_4DIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt194>=1 ) { goto _loop194; } 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());}
|
||||
}
|
||||
|
||||
_cnt194++;
|
||||
_cnt206++;
|
||||
}
|
||||
_loop194:;
|
||||
_loop206:;
|
||||
} // ( ... )+
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1015 "pf.g"
|
||||
#line 1067 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1020 "PFCfgLexer.cpp"
|
||||
#line 1023 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1025,47 +1028,47 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1017 "pf.g"
|
||||
#line 1069 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1031 "PFCfgLexer.cpp"
|
||||
#line 1034 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if ((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3a /* ':' */ ) && (true)) {
|
||||
match(':' /* charlit */ );
|
||||
match(':' /* charlit */ );
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1024 "pf.g"
|
||||
#line 1076 "pf.g"
|
||||
_ttype = IPV6;
|
||||
#line 1040 "PFCfgLexer.cpp"
|
||||
#line 1043 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true)) {
|
||||
{ // ( ... )+
|
||||
int _cnt179=0;
|
||||
int _cnt191=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt179>=1 ) { goto _loop179; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
if ( _cnt191>=1 ) { goto _loop191; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt179++;
|
||||
_cnt191++;
|
||||
}
|
||||
_loop179:;
|
||||
_loop191:;
|
||||
} // ( ... )+
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1003 "pf.g"
|
||||
#line 1055 "pf.g"
|
||||
_ttype = INT_CONST;
|
||||
#line 1061 "PFCfgLexer.cpp"
|
||||
#line 1064 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if ((LA(1) == 0x3a /* ':' */ ) && (true)) {
|
||||
match(':' /* charlit */ );
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1027 "pf.g"
|
||||
#line 1079 "pf.g"
|
||||
_ttype = COLON;
|
||||
#line 1069 "PFCfgLexer.cpp"
|
||||
#line 1072 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if ((_tokenSet_3.member(LA(1)))) {
|
||||
@@ -1276,16 +1279,16 @@ void PFCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) {
|
||||
}
|
||||
default:
|
||||
{
|
||||
goto _loop201;
|
||||
goto _loop213;
|
||||
}
|
||||
}
|
||||
}
|
||||
_loop201:;
|
||||
_loop213:;
|
||||
} // ( ... )*
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1039 "pf.g"
|
||||
#line 1091 "pf.g"
|
||||
_ttype = WORD;
|
||||
#line 1289 "PFCfgLexer.cpp"
|
||||
#line 1292 "PFCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1313,11 +1316,11 @@ void PFCfgLexer::mSTRING(bool _createToken) {
|
||||
matchNot('\"' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
goto _loop204;
|
||||
goto _loop216;
|
||||
}
|
||||
|
||||
}
|
||||
_loop204:;
|
||||
_loop216:;
|
||||
} // ( ... )*
|
||||
match('\"' /* charlit */ );
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@@ -1724,7 +1727,7 @@ void PFCfgLexer::mDOUBLE_QUOTE(bool _createToken) {
|
||||
const unsigned long PFCfgLexer::_tokenSet_0_data_[] = { 4294958072UL, 1UL, 0UL, 2147483648UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
|
||||
// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14
|
||||
// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x7f 0x80 0x81
|
||||
// 0x82 0x83 0x84
|
||||
// 0x82 0x83 0x84 0x85 0x86 0x87 0x88
|
||||
const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_0(_tokenSet_0_data_,16);
|
||||
const unsigned long PFCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
|
||||
// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14
|
||||
@@ -1732,7 +1735,7 @@ const unsigned long PFCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 4294967295
|
||||
// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G
|
||||
// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h
|
||||
// i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83
|
||||
// 0x84
|
||||
// 0x84 0x85 0x86 0x87 0x88
|
||||
const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_1(_tokenSet_1_data_,16);
|
||||
const unsigned long PFCfgLexer::_tokenSet_2_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
|
||||
// . 0 1 2 3 4 5 6 7 8 9
|
||||
@@ -1747,6 +1750,6 @@ const unsigned long PFCfgLexer::_tokenSet_4_data_[] = { 4294967288UL, 4294967291
|
||||
// % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F
|
||||
// G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g
|
||||
// h i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83
|
||||
// 0x84
|
||||
// 0x84 0x85 0x86 0x87 0x88
|
||||
const ANTLR_USE_NAMESPACE(antlr)BitSet PFCfgLexer::_tokenSet_4(_tokenSet_4_data_,16);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#line 11 "PFCfgLexer.hpp"
|
||||
#include <antlr/config.hpp>
|
||||
/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgLexer.hpp"$ */
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgLexer.hpp"$ */
|
||||
#include <antlr/CommonToken.hpp>
|
||||
#include <antlr/InputBuffer.hpp>
|
||||
#include <antlr/BitSet.hpp>
|
||||
|
||||
+611
-351
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
|
||||
#line 11 "PFCfgParser.hpp"
|
||||
#include <antlr/config.hpp>
|
||||
/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgParser.hpp"$ */
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParser.hpp"$ */
|
||||
#include <antlr/TokenStream.hpp>
|
||||
#include <antlr/TokenBuffer.hpp>
|
||||
#include "PFCfgParserTokenTypes.hpp"
|
||||
@@ -104,6 +104,7 @@ public:
|
||||
public: void block_command();
|
||||
public: void timeout_command();
|
||||
public: void unknown_command();
|
||||
public: void tableaddr_spec();
|
||||
public: void rule_extended();
|
||||
public: void direction();
|
||||
public: void logging();
|
||||
@@ -162,10 +163,10 @@ protected:
|
||||
private:
|
||||
static const char* tokenNames[];
|
||||
#ifndef NO_STATIC_CONSTS
|
||||
static const int NUM_TOKENS = 133;
|
||||
static const int NUM_TOKENS = 137;
|
||||
#else
|
||||
enum {
|
||||
NUM_TOKENS = 133
|
||||
NUM_TOKENS = 137
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -231,6 +232,10 @@ private:
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29;
|
||||
static const unsigned long _tokenSet_30_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30;
|
||||
static const unsigned long _tokenSet_31_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31;
|
||||
static const unsigned long _tokenSet_32_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32;
|
||||
};
|
||||
|
||||
#endif /*INC_PFCfgParser_hpp_*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef INC_PFCfgParserTokenTypes_hpp_
|
||||
#define INC_PFCfgParserTokenTypes_hpp_
|
||||
|
||||
/* $ANTLR 2.7.7 (20100319): "pf.g" -> "PFCfgParserTokenTypes.hpp"$ */
|
||||
/* $ANTLR 2.7.7 (20090306): "pf.g" -> "PFCfgParserTokenTypes.hpp"$ */
|
||||
|
||||
#ifndef CUSTOM_API
|
||||
# define CUSTOM_API
|
||||
@@ -22,125 +22,129 @@ struct CUSTOM_API PFCfgParserTokenTypes {
|
||||
SET = 11,
|
||||
SCRUB = 12,
|
||||
TABLE = 13,
|
||||
NAT = 14,
|
||||
BINAT = 15,
|
||||
RDR = 16,
|
||||
TIMEOUT = 17,
|
||||
PASS = 18,
|
||||
BLOCK = 19,
|
||||
IN = 20,
|
||||
OUT = 21,
|
||||
LOG = 22,
|
||||
OPENING_PAREN = 23,
|
||||
COMMA = 24,
|
||||
CLOSING_PAREN = 25,
|
||||
ALL = 26,
|
||||
USER = 27,
|
||||
TO = 28,
|
||||
QUICK = 29,
|
||||
ON = 30,
|
||||
EXLAMATION = 31,
|
||||
OPENING_BRACE = 32,
|
||||
CLOSING_BRACE = 33,
|
||||
INET = 34,
|
||||
INET6 = 35,
|
||||
PROTO = 36,
|
||||
IP = 37,
|
||||
ICMP = 38,
|
||||
IGMP = 39,
|
||||
TCP = 40,
|
||||
UDP = 41,
|
||||
RDP = 42,
|
||||
RSVP = 43,
|
||||
GRE = 44,
|
||||
ESP = 45,
|
||||
AH = 46,
|
||||
EIGRP = 47,
|
||||
OSPF = 48,
|
||||
IPIP = 49,
|
||||
VRRP = 50,
|
||||
L2TP = 51,
|
||||
ISIS = 52,
|
||||
INT_CONST = 53,
|
||||
FROM = 54,
|
||||
URPF_FAILED = 55,
|
||||
ANY = 56,
|
||||
SELF = 57,
|
||||
NO_ROUTE = 58,
|
||||
IPV4 = 59,
|
||||
IPV6 = 60,
|
||||
SLASH = 61,
|
||||
LESS_THAN = 62,
|
||||
GREATER_THAN = 63,
|
||||
ROUTE_TO = 64,
|
||||
REPLY_TO = 65,
|
||||
FLAGS = 66,
|
||||
ICMP_TYPE = 67,
|
||||
ICMP_CODE = 68,
|
||||
ICMP6_TYPE = 69,
|
||||
TAGGED = 70,
|
||||
TAG = 71,
|
||||
NO = 72,
|
||||
KEEP = 73,
|
||||
MODULATE = 74,
|
||||
SYNPROXY = 75,
|
||||
STATE = 76,
|
||||
LABEL = 77,
|
||||
STRING = 78,
|
||||
PORT = 79,
|
||||
COLON = 80,
|
||||
EXIT = 81,
|
||||
QUIT = 82,
|
||||
INTRFACE = 83,
|
||||
ICMP6 = 84,
|
||||
IGRP = 85,
|
||||
IPSEC = 86,
|
||||
NOS = 87,
|
||||
PCP = 88,
|
||||
PIM = 89,
|
||||
PPTP = 90,
|
||||
RIP = 91,
|
||||
SNP = 92,
|
||||
HOST = 93,
|
||||
RANGE = 94,
|
||||
LOG_LEVEL_ALERTS = 95,
|
||||
LOG_LEVEL_CRITICAL = 96,
|
||||
LOG_LEVEL_DEBUGGING = 97,
|
||||
LOG_LEVEL_EMERGENCIES = 98,
|
||||
LOG_LEVEL_ERRORS = 99,
|
||||
LOG_LEVEL_INFORMATIONAL = 100,
|
||||
LOG_LEVEL_NOTIFICATIONS = 101,
|
||||
LOG_LEVEL_WARNINGS = 102,
|
||||
LOG_LEVEL_DISABLE = 103,
|
||||
LOG_LEVEL_INACTIVE = 104,
|
||||
TRANSLATE_TO = 105,
|
||||
Whitespace = 106,
|
||||
HEX_CONST = 107,
|
||||
NUMBER = 108,
|
||||
NEG_INT_CONST = 109,
|
||||
HEX_DIGIT = 110,
|
||||
DIGIT = 111,
|
||||
NUM_3DIGIT = 112,
|
||||
NUM_HEX_4DIGIT = 113,
|
||||
NUMBER_ADDRESS_OR_WORD = 114,
|
||||
PIPE_CHAR = 115,
|
||||
NUMBER_SIGN = 116,
|
||||
PERCENT = 117,
|
||||
AMPERSAND = 118,
|
||||
APOSTROPHE = 119,
|
||||
STAR = 120,
|
||||
PLUS = 121,
|
||||
MINUS = 122,
|
||||
DOT = 123,
|
||||
SEMICOLON = 124,
|
||||
QUESTION = 125,
|
||||
COMMERCIAL_AT = 126,
|
||||
OPENING_SQUARE = 127,
|
||||
CLOSING_SQUARE = 128,
|
||||
CARET = 129,
|
||||
UNDERLINE = 130,
|
||||
TILDE = 131,
|
||||
DOUBLE_QUOTE = 132,
|
||||
LESS_THAN = 14,
|
||||
GREATER_THAN = 15,
|
||||
PERSIST = 16,
|
||||
CONST = 17,
|
||||
COUNTERS = 18,
|
||||
FILE = 19,
|
||||
STRING = 20,
|
||||
OPENING_BRACE = 21,
|
||||
COMMA = 22,
|
||||
CLOSING_BRACE = 23,
|
||||
EXLAMATION = 24,
|
||||
SELF = 25,
|
||||
IPV4 = 26,
|
||||
SLASH = 27,
|
||||
INT_CONST = 28,
|
||||
NAT = 29,
|
||||
BINAT = 30,
|
||||
RDR = 31,
|
||||
TIMEOUT = 32,
|
||||
PASS = 33,
|
||||
BLOCK = 34,
|
||||
IN = 35,
|
||||
OUT = 36,
|
||||
LOG = 37,
|
||||
OPENING_PAREN = 38,
|
||||
CLOSING_PAREN = 39,
|
||||
ALL = 40,
|
||||
USER = 41,
|
||||
TO = 42,
|
||||
QUICK = 43,
|
||||
ON = 44,
|
||||
INET = 45,
|
||||
INET6 = 46,
|
||||
PROTO = 47,
|
||||
IP = 48,
|
||||
ICMP = 49,
|
||||
IGMP = 50,
|
||||
TCP = 51,
|
||||
UDP = 52,
|
||||
RDP = 53,
|
||||
RSVP = 54,
|
||||
GRE = 55,
|
||||
ESP = 56,
|
||||
AH = 57,
|
||||
EIGRP = 58,
|
||||
OSPF = 59,
|
||||
IPIP = 60,
|
||||
VRRP = 61,
|
||||
L2TP = 62,
|
||||
ISIS = 63,
|
||||
FROM = 64,
|
||||
URPF_FAILED = 65,
|
||||
ANY = 66,
|
||||
NO_ROUTE = 67,
|
||||
IPV6 = 68,
|
||||
ROUTE_TO = 69,
|
||||
REPLY_TO = 70,
|
||||
FLAGS = 71,
|
||||
ICMP_TYPE = 72,
|
||||
ICMP_CODE = 73,
|
||||
ICMP6_TYPE = 74,
|
||||
TAGGED = 75,
|
||||
TAG = 76,
|
||||
NO = 77,
|
||||
KEEP = 78,
|
||||
MODULATE = 79,
|
||||
SYNPROXY = 80,
|
||||
STATE = 81,
|
||||
LABEL = 82,
|
||||
PORT = 83,
|
||||
COLON = 84,
|
||||
EXIT = 85,
|
||||
QUIT = 86,
|
||||
INTRFACE = 87,
|
||||
ICMP6 = 88,
|
||||
IGRP = 89,
|
||||
IPSEC = 90,
|
||||
NOS = 91,
|
||||
PCP = 92,
|
||||
PIM = 93,
|
||||
PPTP = 94,
|
||||
RIP = 95,
|
||||
SNP = 96,
|
||||
HOST = 97,
|
||||
RANGE = 98,
|
||||
LOG_LEVEL_ALERTS = 99,
|
||||
LOG_LEVEL_CRITICAL = 100,
|
||||
LOG_LEVEL_DEBUGGING = 101,
|
||||
LOG_LEVEL_EMERGENCIES = 102,
|
||||
LOG_LEVEL_ERRORS = 103,
|
||||
LOG_LEVEL_INFORMATIONAL = 104,
|
||||
LOG_LEVEL_NOTIFICATIONS = 105,
|
||||
LOG_LEVEL_WARNINGS = 106,
|
||||
LOG_LEVEL_DISABLE = 107,
|
||||
LOG_LEVEL_INACTIVE = 108,
|
||||
TRANSLATE_TO = 109,
|
||||
Whitespace = 110,
|
||||
HEX_CONST = 111,
|
||||
NUMBER = 112,
|
||||
NEG_INT_CONST = 113,
|
||||
HEX_DIGIT = 114,
|
||||
DIGIT = 115,
|
||||
NUM_3DIGIT = 116,
|
||||
NUM_HEX_4DIGIT = 117,
|
||||
NUMBER_ADDRESS_OR_WORD = 118,
|
||||
PIPE_CHAR = 119,
|
||||
NUMBER_SIGN = 120,
|
||||
PERCENT = 121,
|
||||
AMPERSAND = 122,
|
||||
APOSTROPHE = 123,
|
||||
STAR = 124,
|
||||
PLUS = 125,
|
||||
MINUS = 126,
|
||||
DOT = 127,
|
||||
SEMICOLON = 128,
|
||||
QUESTION = 129,
|
||||
COMMERCIAL_AT = 130,
|
||||
OPENING_SQUARE = 131,
|
||||
CLOSING_SQUARE = 132,
|
||||
CARET = 133,
|
||||
UNDERLINE = 134,
|
||||
TILDE = 135,
|
||||
DOUBLE_QUOTE = 136,
|
||||
NULL_TREE_LOOKAHEAD = 3
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// $ANTLR 2.7.7 (20100319): pf.g -> PFCfgParserTokenTypes.txt$
|
||||
// $ANTLR 2.7.7 (20090306): pf.g -> PFCfgParserTokenTypes.txt$
|
||||
PFCfgParser // output token vocab name
|
||||
NEWLINE=4
|
||||
LINE_COMMENT=5
|
||||
@@ -10,122 +10,126 @@ QUEUE="queue"=10
|
||||
SET="set"=11
|
||||
SCRUB="scrub"=12
|
||||
TABLE="table"=13
|
||||
NAT="nat"=14
|
||||
BINAT="binat"=15
|
||||
RDR="rdr"=16
|
||||
TIMEOUT="timeout"=17
|
||||
PASS="pass"=18
|
||||
BLOCK="block"=19
|
||||
IN="in"=20
|
||||
OUT="out"=21
|
||||
LOG="log"=22
|
||||
OPENING_PAREN=23
|
||||
COMMA=24
|
||||
CLOSING_PAREN=25
|
||||
ALL="all"=26
|
||||
USER="user"=27
|
||||
TO="to"=28
|
||||
QUICK="quick"=29
|
||||
ON="on"=30
|
||||
EXLAMATION=31
|
||||
OPENING_BRACE=32
|
||||
CLOSING_BRACE=33
|
||||
INET="inet"=34
|
||||
INET6="inet6"=35
|
||||
PROTO="proto"=36
|
||||
IP="ip"=37
|
||||
ICMP="icmp"=38
|
||||
IGMP="igmp"=39
|
||||
TCP="tcp"=40
|
||||
UDP="udp"=41
|
||||
RDP="rdp"=42
|
||||
RSVP="rsvp"=43
|
||||
GRE="gre"=44
|
||||
ESP="esp"=45
|
||||
AH="ah"=46
|
||||
EIGRP="eigrp"=47
|
||||
OSPF="ospf"=48
|
||||
IPIP="ipip"=49
|
||||
VRRP="vrrp"=50
|
||||
L2TP="l2tp"=51
|
||||
ISIS="isis"=52
|
||||
INT_CONST=53
|
||||
FROM="from"=54
|
||||
URPF_FAILED="urpf-failed"=55
|
||||
ANY="any"=56
|
||||
SELF="self"=57
|
||||
NO_ROUTE="no-route"=58
|
||||
IPV4=59
|
||||
IPV6=60
|
||||
SLASH=61
|
||||
LESS_THAN=62
|
||||
GREATER_THAN=63
|
||||
ROUTE_TO="route-to"=64
|
||||
REPLY_TO="reply-to"=65
|
||||
FLAGS="flags"=66
|
||||
ICMP_TYPE="icmp-type"=67
|
||||
ICMP_CODE="code"=68
|
||||
ICMP6_TYPE="icmp6-type"=69
|
||||
TAGGED="tagged"=70
|
||||
TAG="tag"=71
|
||||
NO="no"=72
|
||||
KEEP="keep"=73
|
||||
MODULATE="modulate"=74
|
||||
SYNPROXY="synproxy"=75
|
||||
STATE="state"=76
|
||||
LABEL="label"=77
|
||||
STRING=78
|
||||
PORT="port"=79
|
||||
COLON=80
|
||||
EXIT="exit"=81
|
||||
QUIT="quit"=82
|
||||
INTRFACE="interface"=83
|
||||
ICMP6="icmp6"=84
|
||||
IGRP="igrp"=85
|
||||
IPSEC="ipsec"=86
|
||||
NOS="nos"=87
|
||||
PCP="pcp"=88
|
||||
PIM="pim"=89
|
||||
PPTP="pptp"=90
|
||||
RIP="rip"=91
|
||||
SNP="snp"=92
|
||||
HOST="host"=93
|
||||
RANGE="range"=94
|
||||
LOG_LEVEL_ALERTS="alerts"=95
|
||||
LOG_LEVEL_CRITICAL="critical"=96
|
||||
LOG_LEVEL_DEBUGGING="debugging"=97
|
||||
LOG_LEVEL_EMERGENCIES="emergencies"=98
|
||||
LOG_LEVEL_ERRORS="errors"=99
|
||||
LOG_LEVEL_INFORMATIONAL="informational"=100
|
||||
LOG_LEVEL_NOTIFICATIONS="notifications"=101
|
||||
LOG_LEVEL_WARNINGS="warnings"=102
|
||||
LOG_LEVEL_DISABLE="disable"=103
|
||||
LOG_LEVEL_INACTIVE="inactive"=104
|
||||
TRANSLATE_TO="->"=105
|
||||
Whitespace=106
|
||||
HEX_CONST=107
|
||||
NUMBER=108
|
||||
NEG_INT_CONST=109
|
||||
HEX_DIGIT=110
|
||||
DIGIT=111
|
||||
NUM_3DIGIT=112
|
||||
NUM_HEX_4DIGIT=113
|
||||
NUMBER_ADDRESS_OR_WORD=114
|
||||
PIPE_CHAR=115
|
||||
NUMBER_SIGN=116
|
||||
PERCENT=117
|
||||
AMPERSAND=118
|
||||
APOSTROPHE=119
|
||||
STAR=120
|
||||
PLUS=121
|
||||
MINUS=122
|
||||
DOT=123
|
||||
SEMICOLON=124
|
||||
QUESTION=125
|
||||
COMMERCIAL_AT=126
|
||||
OPENING_SQUARE=127
|
||||
CLOSING_SQUARE=128
|
||||
CARET=129
|
||||
UNDERLINE=130
|
||||
TILDE=131
|
||||
DOUBLE_QUOTE=132
|
||||
LESS_THAN=14
|
||||
GREATER_THAN=15
|
||||
PERSIST="persist"=16
|
||||
CONST="const"=17
|
||||
COUNTERS=18
|
||||
FILE="file"=19
|
||||
STRING=20
|
||||
OPENING_BRACE=21
|
||||
COMMA=22
|
||||
CLOSING_BRACE=23
|
||||
EXLAMATION=24
|
||||
SELF="self"=25
|
||||
IPV4=26
|
||||
SLASH=27
|
||||
INT_CONST=28
|
||||
NAT="nat"=29
|
||||
BINAT="binat"=30
|
||||
RDR="rdr"=31
|
||||
TIMEOUT="timeout"=32
|
||||
PASS="pass"=33
|
||||
BLOCK="block"=34
|
||||
IN="in"=35
|
||||
OUT="out"=36
|
||||
LOG="log"=37
|
||||
OPENING_PAREN=38
|
||||
CLOSING_PAREN=39
|
||||
ALL="all"=40
|
||||
USER="user"=41
|
||||
TO="to"=42
|
||||
QUICK="quick"=43
|
||||
ON="on"=44
|
||||
INET="inet"=45
|
||||
INET6="inet6"=46
|
||||
PROTO="proto"=47
|
||||
IP="ip"=48
|
||||
ICMP="icmp"=49
|
||||
IGMP="igmp"=50
|
||||
TCP="tcp"=51
|
||||
UDP="udp"=52
|
||||
RDP="rdp"=53
|
||||
RSVP="rsvp"=54
|
||||
GRE="gre"=55
|
||||
ESP="esp"=56
|
||||
AH="ah"=57
|
||||
EIGRP="eigrp"=58
|
||||
OSPF="ospf"=59
|
||||
IPIP="ipip"=60
|
||||
VRRP="vrrp"=61
|
||||
L2TP="l2tp"=62
|
||||
ISIS="isis"=63
|
||||
FROM="from"=64
|
||||
URPF_FAILED="urpf-failed"=65
|
||||
ANY="any"=66
|
||||
NO_ROUTE="no-route"=67
|
||||
IPV6=68
|
||||
ROUTE_TO="route-to"=69
|
||||
REPLY_TO="reply-to"=70
|
||||
FLAGS="flags"=71
|
||||
ICMP_TYPE="icmp-type"=72
|
||||
ICMP_CODE="code"=73
|
||||
ICMP6_TYPE="icmp6-type"=74
|
||||
TAGGED="tagged"=75
|
||||
TAG="tag"=76
|
||||
NO="no"=77
|
||||
KEEP="keep"=78
|
||||
MODULATE="modulate"=79
|
||||
SYNPROXY="synproxy"=80
|
||||
STATE="state"=81
|
||||
LABEL="label"=82
|
||||
PORT="port"=83
|
||||
COLON=84
|
||||
EXIT="exit"=85
|
||||
QUIT="quit"=86
|
||||
INTRFACE="interface"=87
|
||||
ICMP6="icmp6"=88
|
||||
IGRP="igrp"=89
|
||||
IPSEC="ipsec"=90
|
||||
NOS="nos"=91
|
||||
PCP="pcp"=92
|
||||
PIM="pim"=93
|
||||
PPTP="pptp"=94
|
||||
RIP="rip"=95
|
||||
SNP="snp"=96
|
||||
HOST="host"=97
|
||||
RANGE="range"=98
|
||||
LOG_LEVEL_ALERTS="alerts"=99
|
||||
LOG_LEVEL_CRITICAL="critical"=100
|
||||
LOG_LEVEL_DEBUGGING="debugging"=101
|
||||
LOG_LEVEL_EMERGENCIES="emergencies"=102
|
||||
LOG_LEVEL_ERRORS="errors"=103
|
||||
LOG_LEVEL_INFORMATIONAL="informational"=104
|
||||
LOG_LEVEL_NOTIFICATIONS="notifications"=105
|
||||
LOG_LEVEL_WARNINGS="warnings"=106
|
||||
LOG_LEVEL_DISABLE="disable"=107
|
||||
LOG_LEVEL_INACTIVE="inactive"=108
|
||||
TRANSLATE_TO="->"=109
|
||||
Whitespace=110
|
||||
HEX_CONST=111
|
||||
NUMBER=112
|
||||
NEG_INT_CONST=113
|
||||
HEX_DIGIT=114
|
||||
DIGIT=115
|
||||
NUM_3DIGIT=116
|
||||
NUM_HEX_4DIGIT=117
|
||||
NUMBER_ADDRESS_OR_WORD=118
|
||||
PIPE_CHAR=119
|
||||
NUMBER_SIGN=120
|
||||
PERCENT=121
|
||||
AMPERSAND=122
|
||||
APOSTROPHE=123
|
||||
STAR=124
|
||||
PLUS=125
|
||||
MINUS=126
|
||||
DOT=127
|
||||
SEMICOLON=128
|
||||
QUESTION=129
|
||||
COMMERCIAL_AT=130
|
||||
OPENING_SQUARE=131
|
||||
CLOSING_SQUARE=132
|
||||
CARET=133
|
||||
UNDERLINE=134
|
||||
TILDE=135
|
||||
DOUBLE_QUOTE=136
|
||||
|
||||
+65
-13
@@ -213,13 +213,62 @@ scrub_command : SCRUB
|
||||
;
|
||||
|
||||
//****************************************************************
|
||||
table_command : TABLE
|
||||
table_command :
|
||||
TABLE
|
||||
{
|
||||
importer->clear();
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
importer->addMessageToLog(
|
||||
QString("Warning: import of 'table' commands has not been implemented yet."));
|
||||
consumeUntil(NEWLINE);
|
||||
}
|
||||
LESS_THAN
|
||||
name:WORD
|
||||
GREATER_THAN
|
||||
( PERSIST ) ?
|
||||
( CONST ) ?
|
||||
( COUNTERS )?
|
||||
(
|
||||
FILE file:STRING
|
||||
{
|
||||
importer->newAddressTableObject(name->getText(), file->getText());
|
||||
}
|
||||
|
|
||||
OPENING_BRACE
|
||||
tableaddr_spec
|
||||
(
|
||||
( COMMA )?
|
||||
tableaddr_spec
|
||||
)*
|
||||
CLOSING_BRACE
|
||||
{
|
||||
importer->newAddressTableObject(name->getText(), importer->tmp_group);
|
||||
}
|
||||
)
|
||||
;
|
||||
|
||||
tableaddr_spec { AddressSpec as; } :
|
||||
( EXLAMATION { as.neg = true; } )?
|
||||
(
|
||||
WORD { as.at = AddressSpec::INTERFACE_NAME; as.address = LT(0)->getText(); }
|
||||
|
|
||||
SELF { as.at = AddressSpec::SPECIAL_ADDRESS; as.address = "self"; }
|
||||
|
|
||||
IPV4
|
||||
{
|
||||
as.at = AddressSpec::HOST_ADDRESS;
|
||||
as.address = LT(0)->getText();
|
||||
}
|
||||
(
|
||||
SLASH
|
||||
{
|
||||
as.at = AddressSpec::NETWORK_ADDRESS;
|
||||
}
|
||||
( IPV4 | INT_CONST )
|
||||
{
|
||||
as.netmask = LT(0)->getText();
|
||||
}
|
||||
)?
|
||||
)
|
||||
{
|
||||
importer->tmp_group.push_back(as);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -425,9 +474,9 @@ hosts :
|
||||
ALL
|
||||
{
|
||||
importer->src_group.push_back(
|
||||
AddressSpec(AddressSpec::ANY, "0.0.0.0", "0.0.0.0"));
|
||||
AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0"));
|
||||
importer->dst_group.push_back(
|
||||
AddressSpec(AddressSpec::ANY, "0.0.0.0", "0.0.0.0"));
|
||||
AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0"));
|
||||
}
|
||||
|
|
||||
( hosts_from )? ( hosts_to )?
|
||||
@@ -448,7 +497,7 @@ src_hosts_part :
|
||||
URPF_FAILED
|
||||
{
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS,
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, false,
|
||||
"urpf-failed", ""));
|
||||
}
|
||||
)
|
||||
@@ -472,19 +521,19 @@ common_hosts_part :
|
||||
ANY
|
||||
{
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::ANY, "0.0.0.0", "0.0.0.0"));
|
||||
AddressSpec(AddressSpec::ANY, false, "0.0.0.0", "0.0.0.0"));
|
||||
}
|
||||
|
|
||||
SELF
|
||||
{
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, "self", ""));
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, false, "self", ""));
|
||||
}
|
||||
|
|
||||
NO_ROUTE
|
||||
{
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, "no-route", ""));
|
||||
AddressSpec(AddressSpec::SPECIAL_ADDRESS, false, "no-route", ""));
|
||||
}
|
||||
|
|
||||
host
|
||||
@@ -514,7 +563,7 @@ host :
|
||||
if (h) addr = h->getText();
|
||||
if (nm) netm = nm->getText();
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::NETWORK_ADDRESS,
|
||||
AddressSpec(AddressSpec::NETWORK_ADDRESS, false,
|
||||
addr, netm));
|
||||
}
|
||||
}
|
||||
@@ -523,14 +572,14 @@ host :
|
||||
{
|
||||
// This should be an interface name
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::INTERFACE_NAME,
|
||||
AddressSpec(AddressSpec::INTERFACE_NAME, false,
|
||||
LT(0)->getText(), ""));
|
||||
}
|
||||
|
|
||||
LESS_THAN tn:WORD GREATER_THAN
|
||||
{
|
||||
importer->tmp_group.push_back(
|
||||
AddressSpec(AddressSpec::TABLE, tn->getText(), ""));
|
||||
AddressSpec(AddressSpec::TABLE, false, tn->getText(), ""));
|
||||
}
|
||||
)
|
||||
;
|
||||
@@ -923,6 +972,9 @@ tokens
|
||||
RDR = "rdr";
|
||||
BINAT = "binat";
|
||||
TABLE = "table";
|
||||
CONST = "const";
|
||||
PERSIST = "persist";
|
||||
FILE = "file";
|
||||
|
||||
QUEUE = "queue";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user