mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-25 04:37:22 +01:00
fixes #1923 rename class ASA8Object to NamedObject
This commit is contained in:
parent
63257170e8
commit
b21bf113f8
@ -43,7 +43,7 @@ using namespace fwcompiler;
|
||||
|
||||
const char *ASA8ObjectGroup::TYPENAME={"ASA8ObjectGroup"};
|
||||
|
||||
string ASA8ObjectGroup::toString(std::map<int, ASA8Object*> &named_objects_registry)
|
||||
string ASA8ObjectGroup::toString(std::map<int, NamedObject*> &named_objects_registry)
|
||||
throw(FWException)
|
||||
{
|
||||
ostringstream ostr;
|
||||
@ -58,7 +58,7 @@ string ASA8ObjectGroup::toString(std::map<int, ASA8Object*> &named_objects_regis
|
||||
FWObject *obj = o;
|
||||
if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer();
|
||||
|
||||
ASA8Object *named_object = named_objects_registry[obj->getId()];
|
||||
NamedObject *named_object = named_objects_registry[obj->getId()];
|
||||
if (named_object)
|
||||
{
|
||||
ostr << " "
|
||||
|
||||
@ -40,7 +40,7 @@ public:
|
||||
|
||||
virtual std::string getObjectGroupClass();
|
||||
virtual std::string getObjectGroupHeader();
|
||||
virtual std::string toString(std::map<int, ASA8Object*> &named_objects_registry)
|
||||
virtual std::string toString(std::map<int, NamedObject*> &named_objects_registry)
|
||||
throw(libfwbuilder::FWException);
|
||||
|
||||
};
|
||||
|
||||
@ -132,7 +132,7 @@ string BaseObjectGroup::getObjectGroupClass()
|
||||
return "";
|
||||
}
|
||||
|
||||
string BaseObjectGroup::toString(std::map<int, ASA8Object*>&) throw(FWException)
|
||||
string BaseObjectGroup::toString(std::map<int, NamedObject*>&) throw(FWException)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#ifndef __BASEOBJECTGROUP_HH
|
||||
#define __BASEOBJECTGROUP_HH
|
||||
|
||||
#include "ASA8Object.h"
|
||||
#include "NamedObject.h"
|
||||
|
||||
#include "fwbuilder/FWObject.h"
|
||||
#include "fwbuilder/ObjectGroup.h"
|
||||
@ -76,7 +76,7 @@ BaseObjectGroup(object_group_type _gt=UNKNOWN) : libfwbuilder::Group() {
|
||||
|
||||
virtual std::string getObjectGroupClass();
|
||||
virtual std::string getObjectGroupHeader();
|
||||
virtual std::string toString(std::map<int, ASA8Object*> &named_objects_registry)
|
||||
virtual std::string toString(std::map<int, NamedObject*> &named_objects_registry)
|
||||
throw(libfwbuilder::FWException);
|
||||
};
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ using namespace std;
|
||||
|
||||
const char *IOSObjectGroup::TYPENAME={"IOSObjectGroup"};
|
||||
|
||||
string IOSObjectGroup::toString(std::map<int, ASA8Object*>&) throw(FWException)
|
||||
string IOSObjectGroup::toString(std::map<int, NamedObject*>&) throw(FWException)
|
||||
{
|
||||
ostringstream ostr;
|
||||
|
||||
|
||||
@ -30,16 +30,17 @@
|
||||
|
||||
namespace fwcompiler {
|
||||
|
||||
class IOSObjectGroup : public BaseObjectGroup {
|
||||
class IOSObjectGroup : public BaseObjectGroup
|
||||
{
|
||||
|
||||
public:
|
||||
IOSObjectGroup(object_group_type _gt=UNKNOWN) : BaseObjectGroup(_gt) { }
|
||||
IOSObjectGroup(object_group_type _gt=UNKNOWN) : BaseObjectGroup(_gt) { }
|
||||
virtual ~IOSObjectGroup() {};
|
||||
DECLARE_FWOBJECT_SUBTYPE(IOSObjectGroup);
|
||||
|
||||
virtual std::string getObjectGroupClass();
|
||||
virtual std::string getObjectGroupHeader();
|
||||
virtual std::string toString(std::map<int, ASA8Object*> &named_objects_registry)
|
||||
virtual std::string toString(std::map<int, NamedObject*> &named_objects_registry)
|
||||
throw(libfwbuilder::FWException);
|
||||
|
||||
};
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "NATCompiler_asa8.h"
|
||||
#include "ASA8Object.h"
|
||||
#include "NamedObject.h"
|
||||
#include "ASA8ObjectGroup.h"
|
||||
#include "ObjectGroupsSupport.h"
|
||||
|
||||
|
||||
@ -33,15 +33,15 @@
|
||||
|
||||
namespace fwcompiler {
|
||||
|
||||
class ASA8Object;
|
||||
class NamedObject;
|
||||
class ASA8ObjectGroup;
|
||||
|
||||
class NATCompiler_asa8 : public NATCompiler_pix
|
||||
{
|
||||
public:
|
||||
|
||||
void addASA8Object(const libfwbuilder::FWObject *obj);
|
||||
ASA8Object* getASA8Object(const libfwbuilder::FWObject *obj);
|
||||
void addNamedObject(const libfwbuilder::FWObject *obj);
|
||||
NamedObject* getNamedObject(const libfwbuilder::FWObject *obj);
|
||||
|
||||
QString sanitizeObjectName(const QString &name);
|
||||
std::string createNetworkObjectCommand(libfwbuilder::Address *addr);
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "NATCompiler_asa8.h"
|
||||
#include "ASA8Object.h"
|
||||
#include "NamedObject.h"
|
||||
#include "ASA8TwiceNatLogic.h"
|
||||
#include "ObjectGroupsSupport.h"
|
||||
|
||||
@ -50,24 +50,24 @@ using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
void NATCompiler_asa8::addASA8Object(const FWObject *obj)
|
||||
void NATCompiler_asa8::addNamedObject(const FWObject *obj)
|
||||
{
|
||||
if (BaseObjectGroup::constcast(obj)!=NULL)
|
||||
{
|
||||
for (FWObject::const_iterator i=obj->begin(); i!=obj->end(); ++i)
|
||||
{
|
||||
addASA8Object(FWReference::getObject(*i));
|
||||
addNamedObject(FWReference::getObject(*i));
|
||||
}
|
||||
}
|
||||
if (CreateObjectGroups::named_objects[obj->getId()] == NULL)
|
||||
{
|
||||
ASA8Object *asa8obj = new ASA8Object(obj);
|
||||
NamedObject *asa8obj = new NamedObject(obj);
|
||||
output << asa8obj->getCommand().toStdString();
|
||||
CreateObjectGroups::named_objects[obj->getId()] = asa8obj;
|
||||
}
|
||||
}
|
||||
|
||||
ASA8Object* NATCompiler_asa8::getASA8Object(const FWObject *obj)
|
||||
NamedObject* NATCompiler_asa8::getNamedObject(const FWObject *obj)
|
||||
{
|
||||
return CreateObjectGroups::named_objects[obj->getId()];
|
||||
}
|
||||
@ -90,22 +90,22 @@ bool NATCompiler_asa8::PrintObjectsForNat::processNext()
|
||||
// definitions in rule processor printObjectGroups
|
||||
|
||||
Address *osrc = compiler->getFirstOSrc(rule);
|
||||
if (osrc) pix_comp->addASA8Object(osrc);
|
||||
if (osrc) pix_comp->addNamedObject(osrc);
|
||||
|
||||
Address *odst = compiler->getFirstODst(rule);
|
||||
if (odst) pix_comp->addASA8Object(odst);
|
||||
if (odst) pix_comp->addNamedObject(odst);
|
||||
|
||||
Service *osrv = compiler->getFirstOSrv(rule);
|
||||
if (osrv) pix_comp->addASA8Object(osrv);
|
||||
if (osrv) pix_comp->addNamedObject(osrv);
|
||||
|
||||
// Address *tsrc = compiler->getFirstTSrc(rule);
|
||||
// if (tsrc) pix_comp->addASA8Object(tsrc);
|
||||
// if (tsrc) pix_comp->addNamedObject(tsrc);
|
||||
|
||||
Address *tdst = compiler->getFirstTDst(rule); assert(tdst);
|
||||
pix_comp->addASA8Object(tdst);
|
||||
pix_comp->addNamedObject(tdst);
|
||||
|
||||
Service *tsrv = compiler->getFirstTSrv(rule); assert(tsrv);
|
||||
pix_comp->addASA8Object(tsrv);
|
||||
pix_comp->addNamedObject(tsrv);
|
||||
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ bool NATCompiler_asa8::PrintObjectsForTSrc::processNext()
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*it);
|
||||
if (Interface::isA(obj)) continue;
|
||||
pix_comp->addASA8Object(obj);
|
||||
pix_comp->addNamedObject(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void NATCompiler_asa8::PrintRule::printDNAT(libfwbuilder::NATRule *rule)
|
||||
QString NATCompiler_asa8::PrintRule::printSingleObject(FWObject *obj)
|
||||
{
|
||||
NATCompiler_asa8 *pix_comp = dynamic_cast<NATCompiler_asa8*>(compiler);
|
||||
ASA8Object* asa8_object = pix_comp->getASA8Object(obj);
|
||||
NamedObject* asa8_object = pix_comp->getNamedObject(obj);
|
||||
if (asa8_object) return asa8_object->getCommandWord();
|
||||
|
||||
for (FWObject::iterator i=CreateObjectGroups::object_groups->begin();
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "ASA8Object.h"
|
||||
#include "NamedObject.h"
|
||||
|
||||
#include "fwbuilder/AddressRange.h"
|
||||
#include "fwbuilder/ICMPService.h"
|
||||
@ -45,13 +45,13 @@ using namespace fwcompiler;
|
||||
using namespace std;
|
||||
|
||||
|
||||
ASA8Object::ASA8Object(const FWObject *_obj)
|
||||
NamedObject::NamedObject(const FWObject *_obj)
|
||||
{
|
||||
obj = _obj;
|
||||
name = sanitizeObjectName(obj->getName().c_str());
|
||||
}
|
||||
|
||||
QString ASA8Object::getCommandWord()
|
||||
QString NamedObject::getCommandWord()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL && Address::constcast(obj)->isAny())
|
||||
return "any";
|
||||
@ -65,13 +65,13 @@ QString ASA8Object::getCommandWord()
|
||||
return name;
|
||||
}
|
||||
|
||||
QString ASA8Object::sanitizeObjectName(const QString &name)
|
||||
QString NamedObject::sanitizeObjectName(const QString &name)
|
||||
{
|
||||
QString qs = name;
|
||||
return qs.replace(" ", "_").replace("/", "_").left(64);
|
||||
}
|
||||
|
||||
QString ASA8Object::createNetworkObjectCommand(const Address *addr_obj)
|
||||
QString NamedObject::createNetworkObjectCommand(const Address *addr_obj)
|
||||
{
|
||||
if (addr_obj == NULL) return "";
|
||||
if (addr_obj->isAny()) return "";
|
||||
@ -111,7 +111,7 @@ QString ASA8Object::createNetworkObjectCommand(const Address *addr_obj)
|
||||
return res.join("\n");
|
||||
}
|
||||
|
||||
QString ASA8Object::printPorts(int rs, int re)
|
||||
QString NamedObject::printPorts(int rs, int re)
|
||||
{
|
||||
QStringList res;
|
||||
|
||||
@ -132,7 +132,7 @@ QString ASA8Object::printPorts(int rs, int re)
|
||||
return res.join(" ");
|
||||
}
|
||||
|
||||
QString ASA8Object::createServiceObjectCommand(const Service *serv_obj)
|
||||
QString NamedObject::createServiceObjectCommand(const Service *serv_obj)
|
||||
{
|
||||
if (serv_obj == NULL) return "";
|
||||
if (serv_obj->isAny()) return "";
|
||||
@ -176,7 +176,7 @@ QString ASA8Object::createServiceObjectCommand(const Service *serv_obj)
|
||||
}
|
||||
|
||||
|
||||
QString ASA8Object::getCommand()
|
||||
QString NamedObject::getCommand()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL)
|
||||
return createNetworkObjectCommand(Address::constcast(obj));
|
||||
@ -187,7 +187,7 @@ QString ASA8Object::getCommand()
|
||||
return "";
|
||||
}
|
||||
|
||||
QString ASA8Object::getCommandWhenObjectGroupMember()
|
||||
QString NamedObject::getCommandWhenObjectGroupMember()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL) return "network-object object " + name;
|
||||
if (Service::constcast(obj)!=NULL) return "service-object object " + name;
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
namespace fwcompiler {
|
||||
|
||||
class ASA8Object
|
||||
class NamedObject
|
||||
{
|
||||
const libfwbuilder::FWObject *obj;
|
||||
QString name;
|
||||
@ -45,7 +45,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
ASA8Object(const libfwbuilder::FWObject *obj);
|
||||
NamedObject(const libfwbuilder::FWObject *obj);
|
||||
virtual QString getCommand();
|
||||
virtual QString getCommandWhenObjectGroupMember();
|
||||
QString getName() { return name; }
|
||||
@ -59,7 +59,7 @@ using namespace std;
|
||||
|
||||
|
||||
Group* CreateObjectGroups::object_groups = NULL;
|
||||
map<int, ASA8Object*> CreateObjectGroups::named_objects;
|
||||
map<int, NamedObject*> CreateObjectGroups::named_objects;
|
||||
|
||||
|
||||
void CreateObjectGroups::init(FWObjectDatabase *db)
|
||||
@ -71,7 +71,7 @@ void CreateObjectGroups::init(FWObjectDatabase *db)
|
||||
|
||||
void CreateObjectGroups::clearNamedObjectsRegistry()
|
||||
{
|
||||
std::map<int, ASA8Object*>::iterator it1;
|
||||
std::map<int, NamedObject*>::iterator it1;
|
||||
for (it1=named_objects.begin(); it1!=named_objects.end(); ++it1)
|
||||
{
|
||||
delete it1->second;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "BaseObjectGroup.h"
|
||||
#include "ASA8Object.h"
|
||||
#include "NamedObject.h"
|
||||
|
||||
#include "fwbuilder/Group.h"
|
||||
#include "fwbuilder/RuleElement.h"
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
public:
|
||||
// storage for object groups created to be used with PIX command object-group
|
||||
static libfwbuilder::Group *object_groups;
|
||||
static std::map<int, ASA8Object*> named_objects;
|
||||
static std::map<int, NamedObject*> named_objects;
|
||||
|
||||
|
||||
CreateObjectGroups(const std::string &name,
|
||||
|
||||
@ -43,7 +43,7 @@ using namespace std;
|
||||
|
||||
const char *PIXObjectGroup::TYPENAME={"PIXObjectGroup"};
|
||||
|
||||
string PIXObjectGroup::toString(std::map<int, ASA8Object*>&) throw(FWException)
|
||||
string PIXObjectGroup::toString(std::map<int, NamedObject*>&) throw(FWException)
|
||||
{
|
||||
ostringstream ostr;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual std::string getObjectGroupClass();
|
||||
virtual std::string getObjectGroupHeader();
|
||||
virtual std::string toString(std::map<int, ASA8Object*> &named_objects_registry)
|
||||
virtual std::string toString(std::map<int, NamedObject*> &named_objects_registry)
|
||||
throw(libfwbuilder::FWException);
|
||||
|
||||
};
|
||||
|
||||
@ -10,7 +10,7 @@ SOURCES = PolicyCompiler_cisco.cpp \
|
||||
RoutingCompiler_cisco.cpp \
|
||||
RoutingCompiler_cisco_writers.cpp \
|
||||
ACL.cpp \
|
||||
ASA8Object.cpp \
|
||||
NamedObject.cpp \
|
||||
ASA8TwiceNatLogic.cpp \
|
||||
Helper.cpp \
|
||||
inspectionProtocol.cpp \
|
||||
@ -54,7 +54,7 @@ SOURCES = PolicyCompiler_cisco.cpp \
|
||||
HEADERS = ../../config.h \
|
||||
ACL.h \
|
||||
Helper.h \
|
||||
ASA8Object.h \
|
||||
NamedObject.h \
|
||||
ASA8TwiceNatLogic.h \
|
||||
ObjectGroupsSupport.h \
|
||||
inspectionProtocol.h \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user