mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-11-06 18:52:58 +01:00
feat: Apply modernize-use-nullptr
This commit is contained in:
parent
defc5c7b63
commit
7824066a96
@ -71,7 +71,7 @@ void ASTFactory::registerFactory( int type, const char* ast_name, factory_type f
|
||||
// check validity of arguments...
|
||||
if( type < Token::MIN_USER_TYPE )
|
||||
throw ANTLRException("Internal parser error invalid type passed to RegisterFactory");
|
||||
if( factory == 0 )
|
||||
if( factory == nullptr )
|
||||
throw ANTLRException("Internal parser error 0 factory passed to RegisterFactory");
|
||||
|
||||
// resize up to and including 'type' and initalize any gaps to default
|
||||
@ -243,12 +243,12 @@ RefAST ASTFactory::make(ANTLR_USE_NAMESPACE(std)vector<RefAST>& nodes)
|
||||
// link in children;
|
||||
for( unsigned int i = 1; i < nodes.size(); i++ )
|
||||
{
|
||||
if ( nodes[i] == 0 ) // ignore null nodes
|
||||
if ( nodes[i] == nullptr ) // ignore null nodes
|
||||
continue;
|
||||
|
||||
if ( root == 0 ) // Set the root and set it up for a flat list
|
||||
if ( root == nullptr ) // Set the root and set it up for a flat list
|
||||
root = tail = nodes[i];
|
||||
else if ( tail == 0 )
|
||||
else if ( tail == nullptr )
|
||||
{
|
||||
root->setFirstChild(nodes[i]);
|
||||
tail = root->getFirstChild();
|
||||
|
||||
@ -32,7 +32,7 @@ ASTRef* ASTRef::getRef(const AST* p)
|
||||
else
|
||||
return new ASTRef(pp);
|
||||
} else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
|
||||
|
||||
@ -273,7 +273,7 @@ ANTLR_API RefAST nullAST;
|
||||
#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++
|
||||
extern ANTLR_API AST* const nullASTptr = 0;
|
||||
#else
|
||||
ANTLR_API AST* const nullASTptr = 0;
|
||||
ANTLR_API AST* const nullASTptr = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
|
||||
|
||||
@ -83,7 +83,7 @@ void LLkParser::traceOut(const char* rname)
|
||||
RefToken LLkParser::LT(unsigned int i)
|
||||
{
|
||||
//assert(this!=NULL); //clang error: 'this' pointer cannot be null in well-defined C++ code;
|
||||
assert(inputState!=NULL);
|
||||
assert(inputState!=nullptr);
|
||||
TokenBuffer &tb = inputState->getInput();
|
||||
//assert(&tb!=NULL); //clang error: reference cannot be bound to dereferenced null pointer in well-defined C++ code;
|
||||
return tb.LT(i);
|
||||
|
||||
@ -14,9 +14,9 @@ namespace antlr {
|
||||
|
||||
MismatchedTokenException::MismatchedTokenException()
|
||||
: RecognitionException("Mismatched Token: expecting any AST node","<AST>",-1,-1)
|
||||
, token(0)
|
||||
, token(nullptr)
|
||||
, node(nullASTptr)
|
||||
, tokenNames(0)
|
||||
, tokenNames(nullptr)
|
||||
, numTokens(0)
|
||||
{
|
||||
}
|
||||
@ -30,7 +30,7 @@ MismatchedTokenException::MismatchedTokenException(
|
||||
int upper_,
|
||||
bool matchNot
|
||||
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
|
||||
, token(0)
|
||||
, token(nullptr)
|
||||
, node(node_)
|
||||
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
|
||||
, mismatchType(matchNot ? NOT_RANGE : RANGE)
|
||||
@ -49,7 +49,7 @@ MismatchedTokenException::MismatchedTokenException(
|
||||
int expecting_,
|
||||
bool matchNot
|
||||
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
|
||||
, token(0)
|
||||
, token(nullptr)
|
||||
, node(node_)
|
||||
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
|
||||
, mismatchType(matchNot ? NOT_TOKEN : TOKEN)
|
||||
@ -67,7 +67,7 @@ MismatchedTokenException::MismatchedTokenException(
|
||||
BitSet set_,
|
||||
bool matchNot
|
||||
) : RecognitionException("Mismatched Token","<AST>",-1,-1)
|
||||
, token(0)
|
||||
, token(nullptr)
|
||||
, node(node_)
|
||||
, tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("<empty tree>")) )
|
||||
, mismatchType(matchNot ? NOT_SET : SET)
|
||||
|
||||
@ -16,7 +16,7 @@ ANTLR_USING_NAMESPACE(std)
|
||||
|
||||
NoViableAltException::NoViableAltException(RefAST t)
|
||||
: RecognitionException("NoViableAlt","<AST>",-1,-1),
|
||||
token(0), node(t)
|
||||
token(nullptr), node(t)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ TokenRef* TokenRef::getRef(const Token* p)
|
||||
else
|
||||
return new TokenRef(pp);
|
||||
} else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
|
||||
|
||||
@ -20,7 +20,7 @@ namespace antlr {
|
||||
*/
|
||||
|
||||
TokenStreamSelector::TokenStreamSelector()
|
||||
: input(0)
|
||||
: input(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ using namespace std;
|
||||
|
||||
static unsigned long calculateDimension(FWObject* obj)
|
||||
{
|
||||
if (Group::cast(obj)!=NULL)
|
||||
if (Group::cast(obj)!=nullptr)
|
||||
{
|
||||
unsigned long res=0;
|
||||
for (FWObject::iterator i1=obj->begin(); i1!=obj->end(); ++i1)
|
||||
@ -68,7 +68,7 @@ static unsigned long calculateDimension(FWObject* obj)
|
||||
} else
|
||||
{
|
||||
Address *a=Address::cast(obj);
|
||||
if (a!=NULL)
|
||||
if (a!=nullptr)
|
||||
{
|
||||
if (a->isAny()) return LONG_MAX;
|
||||
return a->dimension();
|
||||
@ -79,12 +79,12 @@ static unsigned long calculateDimension(FWObject* obj)
|
||||
|
||||
void Helper::expand_group_recursive(FWObject *o,list<FWObject*> &ol)
|
||||
{
|
||||
if (Group::cast( o )!=NULL)
|
||||
if (Group::cast( o )!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator i2=o->begin(); i2!=o->end(); ++i2)
|
||||
{
|
||||
FWObject *o1= *i2;
|
||||
if (FWReference::cast(o1)!=NULL) o1=FWReference::cast(o1)->getPointer();
|
||||
if (FWReference::cast(o1)!=nullptr) o1=FWReference::cast(o1)->getPointer();
|
||||
assert(o1);
|
||||
|
||||
expand_group_recursive(o1,ol);
|
||||
@ -112,7 +112,7 @@ int Helper::findInterfaceByAddress(Address *obj)
|
||||
int Helper::findInterfaceByAddress(const InetAddr *addr,
|
||||
const InetAddr *nm)
|
||||
{
|
||||
if (addr==NULL) return -1;
|
||||
if (addr==nullptr) return -1;
|
||||
|
||||
#if DEBUG_NETZONE_OPS
|
||||
cerr << "Helper::findInterfaceByAddress";
|
||||
@ -150,7 +150,7 @@ int Helper::findInterfaceByAddress(const InetAddr *addr,
|
||||
cerr << endl;
|
||||
#endif
|
||||
|
||||
if (nm != NULL)
|
||||
if (nm != nullptr)
|
||||
{
|
||||
InetAddrMask interface_subnet(*(i_addr->getAddressPtr()),
|
||||
*(i_addr->getNetmaskPtr()));
|
||||
@ -254,7 +254,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
|
||||
{
|
||||
Address *netzone_addr = Address::cast(*j);
|
||||
|
||||
if (netzone_addr == NULL) continue;
|
||||
if (netzone_addr == nullptr) continue;
|
||||
|
||||
#if DEBUG_NETZONE_OPS
|
||||
cerr << "Helper::findInterfaceByNetzone";
|
||||
@ -265,7 +265,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
|
||||
|
||||
// if addr==NULL, return id of the interfacce that has
|
||||
// net_zone=="any"
|
||||
if (addr==NULL)
|
||||
if (addr==nullptr)
|
||||
{
|
||||
if (netzone_addr->getId()==FWObjectDatabase::ANY_ADDRESS_ID)
|
||||
return iface->getId(); // id of the interface
|
||||
@ -278,7 +278,7 @@ int Helper::findInterfaceByNetzone(const InetAddr *addr, const InetAddr *nm)
|
||||
|
||||
const InetAddr *nz_addr = netzone_addr->getAddressPtr();
|
||||
const InetAddr *nz_netm = netzone_addr->getNetmaskPtr();
|
||||
if (nm != NULL && nz_netm != NULL)
|
||||
if (nm != nullptr && nz_netm != nullptr)
|
||||
{
|
||||
InetAddrMask nz_subnet(*nz_addr, *nz_netm);
|
||||
InetAddrMask other_subnet(*addr, *nm);
|
||||
@ -408,9 +408,9 @@ list<int> Helper::findInterfaceByNetzoneOrAll(RuleElement *re)
|
||||
} else
|
||||
{
|
||||
FWObject *fo = re->front();
|
||||
if (FWReference::cast(fo)!=NULL) fo=FWReference::cast(fo)->getPointer();
|
||||
if (FWReference::cast(fo)!=nullptr) fo=FWReference::cast(fo)->getPointer();
|
||||
Address *a = Address::cast(fo);
|
||||
if (a==NULL)
|
||||
if (a==nullptr)
|
||||
{
|
||||
Rule *rule = Rule::cast(re->getParent());
|
||||
Q_UNUSED(rule);
|
||||
|
||||
@ -206,7 +206,7 @@ const char* rw[] = {
|
||||
"icmp-traceroute",
|
||||
"icmp-conversion-error",
|
||||
"icmp-mobile-redirect",
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
QSet<QString> NamedObject::reserved_words;
|
||||
@ -220,7 +220,7 @@ NamedObject::NamedObject(const FWObject *_obj, const QString &_platform)
|
||||
if (reserved_words.empty())
|
||||
{
|
||||
const char** cptr = rw;
|
||||
while (*cptr!=NULL)
|
||||
while (*cptr!=nullptr)
|
||||
{
|
||||
reserved_words.insert(QString(*cptr));
|
||||
cptr++;
|
||||
@ -231,10 +231,10 @@ NamedObject::NamedObject(const FWObject *_obj, const QString &_platform)
|
||||
|
||||
QString NamedObject::getCommandWord()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL && Address::constcast(obj)->isAny())
|
||||
if (Address::constcast(obj)!=nullptr && Address::constcast(obj)->isAny())
|
||||
return "any";
|
||||
|
||||
if (Service::constcast(obj)!=NULL && Service::constcast(obj)->isAny())
|
||||
if (Service::constcast(obj)!=nullptr && Service::constcast(obj)->isAny())
|
||||
return "any";
|
||||
|
||||
if (Interface::constcast(obj))
|
||||
@ -262,7 +262,7 @@ QString NamedObject::sanitizeObjectName(const QString &name)
|
||||
|
||||
QString NamedObject::createNetworkObjectCommand(const Address *addr_obj)
|
||||
{
|
||||
if (addr_obj == NULL) return "";
|
||||
if (addr_obj == nullptr) return "";
|
||||
if (addr_obj->isAny()) return "";
|
||||
if (Interface::constcast(obj)) return "";
|
||||
|
||||
@ -323,7 +323,7 @@ QString NamedObject::printPorts(int rs, int re)
|
||||
|
||||
QString NamedObject::createServiceObjectCommand(const Service *serv_obj)
|
||||
{
|
||||
if (serv_obj == NULL) return "";
|
||||
if (serv_obj == nullptr) return "";
|
||||
if (serv_obj->isAny()) return "";
|
||||
|
||||
QStringList res;
|
||||
@ -377,10 +377,10 @@ QString NamedObject::createServiceObjectCommand(const Service *serv_obj)
|
||||
|
||||
QString NamedObject::getCommand()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL)
|
||||
if (Address::constcast(obj)!=nullptr)
|
||||
return createNetworkObjectCommand(Address::constcast(obj));
|
||||
|
||||
if (Service::constcast(obj)!=NULL)
|
||||
if (Service::constcast(obj)!=nullptr)
|
||||
return createServiceObjectCommand(Service::constcast(obj));
|
||||
|
||||
return "";
|
||||
@ -388,8 +388,8 @@ QString NamedObject::getCommand()
|
||||
|
||||
QString NamedObject::getCommandWhenObjectGroupMember()
|
||||
{
|
||||
if (Address::constcast(obj)!=NULL) return "network-object object " + name;
|
||||
if (Service::constcast(obj)!=NULL) return "service-object object " + name;
|
||||
if (Address::constcast(obj)!=nullptr) return "network-object object " + name;
|
||||
if (Service::constcast(obj)!=nullptr) return "service-object object " + name;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@ -51,10 +51,10 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
|
||||
if (this->getObjectGroupType() == NETWORK)
|
||||
{
|
||||
Address *a = Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
const InetAddr *addr = a->getAddressPtr();
|
||||
ostr << "network-object ";
|
||||
if (Network::cast(obj)!=NULL)
|
||||
if (Network::cast(obj)!=nullptr)
|
||||
{
|
||||
const InetAddr *mask = a->getNetmaskPtr();
|
||||
ostr << addr->toString() << " ";
|
||||
@ -72,7 +72,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
|
||||
{
|
||||
ostr << "protocol-object ";
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
ostr << s->getProtocolName();
|
||||
return ostr.str().c_str();
|
||||
}
|
||||
@ -81,7 +81,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
|
||||
{
|
||||
ostr << "icmp-object ";
|
||||
ICMPService *s=ICMPService::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
if ( s->getInt("type")== -1)
|
||||
ostr << "any";
|
||||
else
|
||||
@ -93,7 +93,7 @@ QString PIXObjectGroup::groupMemberToString(FWObject *obj,
|
||||
{
|
||||
ostr << "port-object ";
|
||||
Service *s=Service::cast(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
int rs=TCPUDPService::cast(s)->getDstRangeStart();
|
||||
int re=TCPUDPService::cast(s)->getDstRangeEnd();
|
||||
|
||||
@ -57,7 +57,7 @@ void init(char * const*)
|
||||
userDataDir = string(getenv("HOME"));
|
||||
|
||||
char *lname = getenv("LOGNAME");
|
||||
if (lname!=NULL)
|
||||
if (lname!=nullptr)
|
||||
user_name = QString(lname);
|
||||
else
|
||||
{
|
||||
|
||||
@ -92,7 +92,7 @@ void CompilerDriver::assembleFwScriptInternal(Cluster *cluster,
|
||||
time_t tm;
|
||||
struct tm *stm;
|
||||
|
||||
tm = time(NULL);
|
||||
tm = time(nullptr);
|
||||
stm = localtime(&tm);
|
||||
timestr = strdup(ctime(&tm));
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
|
||||
@ -103,9 +103,9 @@ using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
|
||||
|
||||
FWWindow *mw = NULL;
|
||||
FWBSettings *st = NULL;
|
||||
FWBApplication *app = NULL;
|
||||
FWWindow *mw = nullptr;
|
||||
FWBSettings *st = nullptr;
|
||||
FWBApplication *app = nullptr;
|
||||
|
||||
string cmd_str = "";
|
||||
command cmd = NONE;
|
||||
@ -117,7 +117,7 @@ int conflict_res = 1;
|
||||
|
||||
vector<string> platforms;
|
||||
|
||||
FWObjectDatabase *objdb = NULL;
|
||||
FWObjectDatabase *objdb = nullptr;
|
||||
|
||||
int fwbdebug = 0;
|
||||
|
||||
@ -493,7 +493,7 @@ int main(int argc, char * const *argv)
|
||||
case 'a':
|
||||
int num=0;
|
||||
Q_UNUSED(num);
|
||||
if (optarg!=NULL)
|
||||
if (optarg!=nullptr)
|
||||
{
|
||||
string str = optarg;
|
||||
num = splitStr(',', str, &ops);
|
||||
@ -544,7 +544,7 @@ int main(int argc, char * const *argv)
|
||||
case 'a':
|
||||
int num=0;
|
||||
Q_UNUSED(num);
|
||||
if (optarg!=NULL)
|
||||
if (optarg!=nullptr)
|
||||
{
|
||||
string str = optarg;
|
||||
num = splitStr(',', str, &ops);
|
||||
@ -738,8 +738,8 @@ int main(int argc, char * const *argv)
|
||||
.split("/", QString::SkipEmptyParts);
|
||||
string fw_name = components.last().toUtf8().constData();
|
||||
|
||||
Library *library = NULL;
|
||||
while (library == NULL)
|
||||
Library *library = nullptr;
|
||||
while (library == nullptr)
|
||||
{
|
||||
components.pop_back();
|
||||
string library_path = components.join("/").toUtf8().constData();
|
||||
|
||||
@ -59,7 +59,7 @@ void importConfig(const string &import_config,
|
||||
std::istringstream instream(buffer);
|
||||
QueueLogger *logger = new QueueLogger();
|
||||
logger->copyToStderr();
|
||||
Importer* imp = NULL;
|
||||
Importer* imp = nullptr;
|
||||
|
||||
QStringList sl_buf = QString::fromUtf8(buffer.c_str()).split("\n");
|
||||
PreImport pi(&sl_buf);
|
||||
|
||||
@ -147,7 +147,7 @@ string getAttributeValue(FWObject *obj, const string &attr_name)
|
||||
return DNSName::cast(obj)->getSourceName();
|
||||
}
|
||||
|
||||
if (TCPUDPService::cast(obj)!=NULL)
|
||||
if (TCPUDPService::cast(obj)!=nullptr)
|
||||
{
|
||||
ostringstream str;
|
||||
if (attr_name=="src_range_start")
|
||||
@ -161,7 +161,7 @@ string getAttributeValue(FWObject *obj, const string &attr_name)
|
||||
if (str.tellp()>0) return str.str();
|
||||
}
|
||||
|
||||
if (ICMPService::cast(obj)!=NULL)
|
||||
if (ICMPService::cast(obj)!=nullptr)
|
||||
{
|
||||
if (attr_name=="icmp_type") return obj->getStr("type");
|
||||
if (attr_name=="icmp_code") return obj->getStr("code");
|
||||
|
||||
@ -248,7 +248,7 @@ bool testPlatform(const string &pl, const string &os)
|
||||
FWObject* createObject(FWObjectDatabase *objdb,
|
||||
const string &type, const string &parent)
|
||||
{
|
||||
FWObject* obj = NULL;
|
||||
FWObject* obj = nullptr;
|
||||
string path;
|
||||
|
||||
obj = objdb->create(type);
|
||||
|
||||
@ -182,8 +182,8 @@ FWObject* IOSImporter::createTCPUDPNeqObject(const QString &proto,
|
||||
if ( ! name.isEmpty()) sig.object_name = name;
|
||||
|
||||
QString group_name;
|
||||
FWObject *srv1 = NULL;
|
||||
FWObject *srv2 = NULL;
|
||||
FWObject *srv1 = nullptr;
|
||||
FWObject *srv2 = nullptr;
|
||||
|
||||
if (src_port_op == "neq")
|
||||
{
|
||||
@ -221,7 +221,7 @@ FWObject* IOSImporter::createTCPUDPNeqObject(const QString &proto,
|
||||
srv2 = service_maker->createObject(sig);
|
||||
}
|
||||
|
||||
assert(srv1 != NULL && srv2 != NULL);
|
||||
assert(srv1 != nullptr && srv2 != nullptr);
|
||||
|
||||
ObjectMaker maker(Library::cast(library), error_tracker);
|
||||
FWObject *grp =
|
||||
@ -250,8 +250,8 @@ void IOSImporter::ignoreCurrentInterface()
|
||||
|
||||
void IOSImporter::pushRule()
|
||||
{
|
||||
assert(current_ruleset!=NULL);
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_ruleset!=nullptr);
|
||||
assert(current_rule!=nullptr);
|
||||
// populate all elements of the rule
|
||||
|
||||
addMessageToLog(
|
||||
@ -270,7 +270,7 @@ void IOSImporter::MergeRules::move(FWObject* r)
|
||||
// classes PolicyRule and RuleSetOptions. If r does not cast to
|
||||
// PolicyRule, then it must be RuleSetOptions and we should just
|
||||
// skip it.
|
||||
if (rule==NULL)
|
||||
if (rule==nullptr)
|
||||
{
|
||||
r->getParent()->remove(r);
|
||||
return;
|
||||
@ -310,7 +310,7 @@ Firewall* IOSImporter::finalize()
|
||||
fw->getManagementObject(); // creates management obj
|
||||
|
||||
FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME);
|
||||
assert( policy!=NULL );
|
||||
assert( policy!=nullptr );
|
||||
|
||||
if (all_rulesets.size()!=0)
|
||||
{
|
||||
@ -401,7 +401,7 @@ Firewall* IOSImporter::finalize()
|
||||
if (_dir=="out") direction = PolicyRule::Outbound;
|
||||
|
||||
// not all access lists are associated with interfaces
|
||||
if (intf!=NULL)
|
||||
if (intf!=nullptr)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug() << " interface="
|
||||
@ -434,6 +434,6 @@ Firewall* IOSImporter::finalize()
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,9 +75,9 @@ IPTImporter::IPTImporter(FWObject *lib,
|
||||
current_table = "";
|
||||
current_chain = "";
|
||||
current_state = "";
|
||||
current_ruleset = NULL;
|
||||
current_rule = NULL;
|
||||
last_mark_rule = NULL;
|
||||
current_ruleset = nullptr;
|
||||
current_rule = nullptr;
|
||||
last_mark_rule = nullptr;
|
||||
|
||||
clear();
|
||||
|
||||
@ -397,13 +397,13 @@ void IPTImporter::processModuleMatches()
|
||||
{
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
|
||||
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
|
||||
assert(fwopt!=NULL);
|
||||
assert(fwopt!=nullptr);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
addAllModuleMatches(rule);
|
||||
|
||||
@ -459,7 +459,7 @@ void IPTImporter::addAllModuleMatches(PolicyRule *rule)
|
||||
void IPTImporter::addMarkMatch(PolicyRule *rule)
|
||||
{
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
if (rule->getSrv()->isAny() && !match_mark.empty())
|
||||
{
|
||||
ObjectSignature sig(error_tracker);
|
||||
@ -474,7 +474,7 @@ void IPTImporter::addMarkMatch(PolicyRule *rule)
|
||||
void IPTImporter::addLengthMatch(PolicyRule *rule)
|
||||
{
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
if (rule->getSrv()->isAny() && !length_spec.empty())
|
||||
{
|
||||
// create custom service with module "length"
|
||||
@ -491,7 +491,7 @@ void IPTImporter::addLengthMatch(PolicyRule *rule)
|
||||
void IPTImporter::addPktTypeMatch(PolicyRule *rule)
|
||||
{
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
if (rule->getSrv()->isAny() && !pkt_type_spec.empty())
|
||||
{
|
||||
// create custom service with module "pkttype"
|
||||
@ -508,7 +508,7 @@ void IPTImporter::addPktTypeMatch(PolicyRule *rule)
|
||||
void IPTImporter::addLimitMatch(PolicyRule *rule)
|
||||
{
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
if (target!="LOG" && !limit_val.empty())
|
||||
{
|
||||
// TODO: this is where we should add support for hashlimit
|
||||
@ -523,7 +523,7 @@ void IPTImporter::addLimitMatch(PolicyRule *rule)
|
||||
void IPTImporter::addRecentMatch(PolicyRule *rule)
|
||||
{
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
if (rule->getSrv()->isAny() && !recent_match.empty())
|
||||
{
|
||||
// create custom service with module "recent"
|
||||
@ -541,7 +541,7 @@ void IPTImporter::addRecentMatch(PolicyRule *rule)
|
||||
void IPTImporter::addStateMatch(libfwbuilder::PolicyRule *rule, const string &state)
|
||||
{
|
||||
RuleElementSrv* srv = rule->getSrv();
|
||||
assert(srv!=NULL);
|
||||
assert(srv!=nullptr);
|
||||
if (rule->getSrv()->isAny() && !state.empty())
|
||||
{
|
||||
// create custom service with module "state"
|
||||
@ -569,7 +569,7 @@ PolicyRule* IPTImporter::createPolicyBranch(
|
||||
bool clear_rule_elements, bool make_stateless)
|
||||
{
|
||||
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
|
||||
if (rs==NULL)
|
||||
if (rs==nullptr)
|
||||
rs = getUnidirRuleSet(branch_ruleset_name, Policy::TYPENAME);
|
||||
branch_rulesets[branch_ruleset_name] = rs;
|
||||
rs->ruleset->setName(branch_ruleset_name);
|
||||
@ -584,10 +584,10 @@ PolicyRule* IPTImporter::createPolicyBranch(
|
||||
rule->setBranch(rs->ruleset);
|
||||
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
ropt->setBool("stateless", true);
|
||||
|
||||
if (rule->getParent() != NULL)
|
||||
if (rule->getParent() != nullptr)
|
||||
{
|
||||
ostringstream str1;
|
||||
str1 << "Called from ruleset " << rule->getParent()->getName()
|
||||
@ -607,7 +607,7 @@ PolicyRule* IPTImporter::createPolicyBranch(
|
||||
if (make_stateless)
|
||||
{
|
||||
FWOptions *ropt = new_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
ropt->setBool("stateless", true);
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ NATRule* IPTImporter::createNATBranch(
|
||||
bool clear_rule_elements)
|
||||
{
|
||||
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
|
||||
if (rs==NULL)
|
||||
if (rs==nullptr)
|
||||
rs = getUnidirRuleSet(branch_ruleset_name, NAT::TYPENAME);
|
||||
branch_rulesets[branch_ruleset_name] = rs;
|
||||
rs->ruleset->setName(branch_ruleset_name);
|
||||
@ -636,7 +636,7 @@ NATRule* IPTImporter::createNATBranch(
|
||||
rule->setRuleType(NATRule::NATBranch);
|
||||
rule->setBranch(rs->ruleset);
|
||||
|
||||
if (rule->getParent() != NULL)
|
||||
if (rule->getParent() != nullptr)
|
||||
{
|
||||
ostringstream str1;
|
||||
str1 << "Called from ruleset " << rule->getParent()->getName()
|
||||
@ -670,7 +670,7 @@ NATRule* IPTImporter::createNATBranch(
|
||||
void IPTImporter::pushRule()
|
||||
{
|
||||
// assert(current_ruleset!=NULL);
|
||||
if (current_rule==NULL) return;
|
||||
if (current_rule==nullptr) return;
|
||||
|
||||
if (current_table=="nat") pushNATRule();
|
||||
else pushPolicyRule();
|
||||
@ -684,10 +684,10 @@ void IPTImporter::pushPolicyRule()
|
||||
rule->setLogging(false);
|
||||
|
||||
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
|
||||
assert(fwopt!=NULL);
|
||||
assert(fwopt!=nullptr);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
bool skip_rule = false;
|
||||
|
||||
@ -879,7 +879,7 @@ void IPTImporter::pushPolicyRule()
|
||||
std::string branch_ruleset_name = target;
|
||||
action = PolicyRule::Branch;
|
||||
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
|
||||
if (rs==NULL)
|
||||
if (rs==nullptr)
|
||||
rs = getUnidirRuleSet(branch_ruleset_name, Policy::TYPENAME);
|
||||
|
||||
branch_rulesets[branch_ruleset_name] = rs;
|
||||
@ -917,12 +917,12 @@ void IPTImporter::pushPolicyRule()
|
||||
{
|
||||
RuleElementSrv *srv = rule->getSrv();
|
||||
std::string protocol = "";
|
||||
FWObject *estab = NULL;
|
||||
FWObject *estab = nullptr;
|
||||
|
||||
FWObjectDatabase *dbroot = getFirewallObject()->getRoot();
|
||||
FWObject *std_obj = dbroot->findInIndex(FWObjectDatabase::STANDARD_LIB_ID);
|
||||
estab = std_obj->findObjectByName(CustomService::TYPENAME, "ESTABLISHED");
|
||||
if (estab == NULL)
|
||||
if (estab == nullptr)
|
||||
{
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = CustomService::TYPENAME;
|
||||
@ -1034,11 +1034,11 @@ void IPTImporter::pushPolicyRule()
|
||||
|
||||
|
||||
if (target=="CONNMARK" &&
|
||||
last_mark_rule != NULL &&
|
||||
last_mark_rule != nullptr &&
|
||||
!action_params["connmark_save_mark"].empty())
|
||||
{
|
||||
FWOptions *lmr_ropt = last_mark_rule->getOptionsObject();
|
||||
assert(lmr_ropt!=NULL);
|
||||
assert(lmr_ropt!=nullptr);
|
||||
lmr_ropt->setBool("ipt_mark_connections", true);
|
||||
skip_rule = true;
|
||||
addMessageToLog(
|
||||
@ -1097,7 +1097,7 @@ void IPTImporter::pushPolicyRule()
|
||||
}
|
||||
|
||||
// add rule to the right ruleset
|
||||
RuleSet *ruleset = NULL;
|
||||
RuleSet *ruleset = nullptr;
|
||||
std::string ruleset_name = "";
|
||||
|
||||
// if (isStandardChain(current_chain))
|
||||
@ -1115,7 +1115,7 @@ void IPTImporter::pushPolicyRule()
|
||||
|
||||
UnidirectionalRuleSet *rs = getUnidirRuleSet(current_chain,
|
||||
Policy::TYPENAME);
|
||||
assert(rs!=NULL);
|
||||
assert(rs!=nullptr);
|
||||
ruleset = rs->ruleset;
|
||||
|
||||
ruleset->add(current_rule);
|
||||
@ -1238,7 +1238,7 @@ void IPTImporter::pushPolicyRule()
|
||||
markCurrentRuleBad();
|
||||
}
|
||||
|
||||
current_rule = NULL;
|
||||
current_rule = nullptr;
|
||||
rule_comment = "";
|
||||
|
||||
clear();
|
||||
@ -1251,10 +1251,10 @@ void IPTImporter::pushNATRule()
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
|
||||
FWOptions *fwopt = getFirewallObject()->getOptionsObject();
|
||||
assert(fwopt!=NULL);
|
||||
assert(fwopt!=nullptr);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
addOSrc();
|
||||
addODst();
|
||||
@ -1276,7 +1276,7 @@ void IPTImporter::pushNATRule()
|
||||
rule_type = NATRule::Masq;
|
||||
|
||||
RuleElementTSrc *re = rule->getTSrc();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
if ( !o_intf.empty() )
|
||||
{
|
||||
newInterface(o_intf);
|
||||
@ -1292,7 +1292,7 @@ void IPTImporter::pushNATRule()
|
||||
{
|
||||
rule_type = NATRule::SNAT;
|
||||
|
||||
FWObject *tsrc = NULL;
|
||||
FWObject *tsrc = nullptr;
|
||||
if (nat_addr1!=nat_addr2)
|
||||
{
|
||||
ObjectSignature sig(error_tracker);
|
||||
@ -1310,7 +1310,7 @@ void IPTImporter::pushNATRule()
|
||||
}
|
||||
|
||||
RuleElementTSrc *re = rule->getTSrc();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(tsrc);
|
||||
|
||||
if (!nat_port_range_start.empty())
|
||||
@ -1319,14 +1319,14 @@ void IPTImporter::pushNATRule()
|
||||
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
|
||||
FWObject *s = createTCPUDPService(nat_port_range, empty_range, protocol);
|
||||
RuleElementTSrv *re = rule->getTSrv();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(s);
|
||||
}
|
||||
|
||||
if (!o_intf.empty())
|
||||
{
|
||||
RuleElement *itf_o_re = rule->getItfOutb();
|
||||
assert(itf_o_re!=NULL);
|
||||
assert(itf_o_re!=nullptr);
|
||||
newInterface(o_intf);
|
||||
Interface *intf = all_interfaces[o_intf];
|
||||
itf_o_re->addRef(intf);
|
||||
@ -1342,11 +1342,11 @@ void IPTImporter::pushNATRule()
|
||||
if (current_chain == "OUTPUT")
|
||||
{
|
||||
RuleElementOSrc *re = rule->getOSrc();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(getFirewallObject());
|
||||
}
|
||||
|
||||
FWObject *tdst = NULL;
|
||||
FWObject *tdst = nullptr;
|
||||
if (nat_addr1!=nat_addr2)
|
||||
{
|
||||
ObjectSignature sig(error_tracker);
|
||||
@ -1364,7 +1364,7 @@ void IPTImporter::pushNATRule()
|
||||
}
|
||||
|
||||
RuleElementTDst *re = rule->getTDst();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(tdst);
|
||||
|
||||
if (!nat_port_range_start.empty())
|
||||
@ -1373,14 +1373,14 @@ void IPTImporter::pushNATRule()
|
||||
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
|
||||
FWObject *s = createTCPUDPService(empty_range, nat_port_range, protocol);
|
||||
RuleElementTSrv *re = rule->getTSrv();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(s);
|
||||
}
|
||||
|
||||
if (!i_intf.empty())
|
||||
{
|
||||
RuleElement *itf_i_re = rule->getItfInb();
|
||||
assert(itf_i_re!=NULL);
|
||||
assert(itf_i_re!=nullptr);
|
||||
newInterface(i_intf);
|
||||
Interface *intf = all_interfaces[i_intf];
|
||||
itf_i_re->addRef(intf);
|
||||
@ -1392,7 +1392,7 @@ void IPTImporter::pushNATRule()
|
||||
rule_type = NATRule::Redirect;
|
||||
|
||||
RuleElementTDst *re = rule->getTDst();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(getFirewallObject());
|
||||
|
||||
if (!nat_port_range_start.empty())
|
||||
@ -1401,14 +1401,14 @@ void IPTImporter::pushNATRule()
|
||||
str_tuple nat_port_range(nat_port_range_start, nat_port_range_end);
|
||||
FWObject *s = createTCPUDPService(empty_range, nat_port_range, protocol);
|
||||
RuleElementTSrv *re = rule->getTSrv();
|
||||
assert(re!=NULL);
|
||||
assert(re!=nullptr);
|
||||
re->addRef(s);
|
||||
}
|
||||
|
||||
if ( ! o_intf.empty())
|
||||
{
|
||||
RuleElement *itf_o_re = rule->getItfOutb();
|
||||
assert(itf_o_re!=NULL);
|
||||
assert(itf_o_re!=nullptr);
|
||||
newInterface(o_intf);
|
||||
Interface *intf = all_interfaces[o_intf];
|
||||
itf_o_re->addRef(intf);
|
||||
@ -1417,14 +1417,14 @@ void IPTImporter::pushNATRule()
|
||||
|
||||
if (target=="NETMAP")
|
||||
{
|
||||
FWObject *o = NULL;
|
||||
FWObject *o = nullptr;
|
||||
|
||||
if (!src_a.empty())
|
||||
{
|
||||
rule_type = NATRule::SNetnat;
|
||||
|
||||
RuleElementTSrc *tsrc = rule->getTSrc();
|
||||
assert(tsrc!=NULL);
|
||||
assert(tsrc!=nullptr);
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = Address::TYPENAME;
|
||||
@ -1439,7 +1439,7 @@ void IPTImporter::pushNATRule()
|
||||
rule_type = NATRule::DNetnat;
|
||||
|
||||
RuleElementTDst *tdst = rule->getTDst();
|
||||
assert(tdst!=NULL);
|
||||
assert(tdst!=nullptr);
|
||||
|
||||
ObjectSignature sig(error_tracker);
|
||||
sig.type_name = Address::TYPENAME;
|
||||
@ -1463,7 +1463,7 @@ void IPTImporter::pushNATRule()
|
||||
rule->setAction(NATRule::Branch);
|
||||
|
||||
UnidirectionalRuleSet *rs = branch_rulesets[branch_ruleset_name];
|
||||
if (rs==NULL)
|
||||
if (rs==nullptr)
|
||||
{
|
||||
rs = getUnidirRuleSet(branch_ruleset_name, NAT::TYPENAME);
|
||||
branch_rulesets[branch_ruleset_name] = rs;
|
||||
@ -1477,18 +1477,18 @@ void IPTImporter::pushNATRule()
|
||||
rule->setRuleType(rule_type);
|
||||
|
||||
// add rule to the right ruleset
|
||||
RuleSet *ruleset = NULL;
|
||||
RuleSet *ruleset = nullptr;
|
||||
std::string ruleset_name = "";
|
||||
if (isStandardChain(current_chain))
|
||||
{
|
||||
ruleset = RuleSet::cast(
|
||||
getFirewallObject()->getFirstByType(NAT::TYPENAME));
|
||||
assert(ruleset!=NULL);
|
||||
assert(ruleset!=nullptr);
|
||||
ruleset->add(current_rule);
|
||||
} else
|
||||
{
|
||||
UnidirectionalRuleSet *rs = getUnidirRuleSet(current_chain, NAT::TYPENAME);
|
||||
assert(rs!=NULL);
|
||||
assert(rs!=nullptr);
|
||||
rs->ruleset->add(current_rule);
|
||||
ruleset = rs->ruleset;
|
||||
}
|
||||
@ -1505,7 +1505,7 @@ void IPTImporter::pushNATRule()
|
||||
// assert( nat!=NULL );
|
||||
// nat->add(current_rule);
|
||||
|
||||
current_rule = NULL;
|
||||
current_rule = nullptr;
|
||||
rule_comment = "";
|
||||
|
||||
clear();
|
||||
@ -1540,7 +1540,7 @@ Firewall* IPTImporter::finalize()
|
||||
fw->getManagementObject(); // creates management obj
|
||||
|
||||
FWOptions *fwopt = fw->getOptionsObject();
|
||||
assert(fwopt!=NULL);
|
||||
assert(fwopt!=nullptr);
|
||||
|
||||
fwopt->setBool("firewall_is_part_of_any_and_networks", false);
|
||||
|
||||
@ -1562,7 +1562,7 @@ Firewall* IPTImporter::finalize()
|
||||
|
||||
// check if all child objects were populated properly
|
||||
FWOptions *ropt = rule->getOptionsObject();
|
||||
assert(ropt != NULL);
|
||||
assert(ropt != nullptr);
|
||||
ropt->setBool("stateless", true);
|
||||
|
||||
rule->setAction(PolicyRule::Accept);
|
||||
@ -1597,7 +1597,7 @@ Firewall* IPTImporter::finalize()
|
||||
if (rs->name == "INPUT")
|
||||
{
|
||||
RuleElementDst* dst = rule->getDst();
|
||||
assert(dst!=NULL);
|
||||
assert(dst!=nullptr);
|
||||
dst->addRef(fw);
|
||||
rule->setDirection(PolicyRule::Inbound);
|
||||
|
||||
@ -1622,7 +1622,7 @@ Firewall* IPTImporter::finalize()
|
||||
if (rs->name == "OUTPUT")
|
||||
{
|
||||
RuleElementSrc* src = rule->getSrc();
|
||||
assert(src!=NULL);
|
||||
assert(src!=nullptr);
|
||||
src->addRef(fw);
|
||||
rule->setDirection(PolicyRule::Outbound);
|
||||
}
|
||||
@ -1665,7 +1665,7 @@ Firewall* IPTImporter::finalize()
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1681,9 +1681,9 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
|
||||
{
|
||||
string all_rulesets_index = current_table + "/" + ruleset_name;
|
||||
UnidirectionalRuleSet *rs = all_rulesets[all_rulesets_index];
|
||||
if (rs == NULL)
|
||||
if (rs == nullptr)
|
||||
{
|
||||
RuleSet *ruleset = NULL;
|
||||
RuleSet *ruleset = nullptr;
|
||||
FWObjectDatabase *dbroot = getFirewallObject()->getRoot();
|
||||
|
||||
if (isStandardChain(ruleset_name))
|
||||
@ -1709,7 +1709,7 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ruleset == NULL)
|
||||
if (ruleset == nullptr)
|
||||
{
|
||||
ruleset = RuleSet::cast(dbroot->create(Policy::TYPENAME));
|
||||
FWOptions *rulesetopt = ruleset->getOptionsObject();
|
||||
@ -1733,7 +1733,7 @@ UnidirectionalRuleSet* IPTImporter::getUnidirRuleSet(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ruleset == NULL)
|
||||
if (ruleset == nullptr)
|
||||
{
|
||||
ruleset = RuleSet::cast(dbroot->create(Policy::TYPENAME));
|
||||
FWOptions *rulesetopt = ruleset->getOptionsObject();
|
||||
|
||||
@ -487,7 +487,7 @@ void PFImporter::convertTcpFlags(QList<int> &flags_list,
|
||||
|
||||
FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
{
|
||||
if (as.at == AddressSpec::ANY) return NULL;
|
||||
if (as.at == AddressSpec::ANY) return nullptr;
|
||||
|
||||
if (as.at == AddressSpec::INTERFACE_OR_HOST_NAME)
|
||||
{
|
||||
@ -497,7 +497,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
if (int_prop->looksLikeInterface(as.address.c_str()))
|
||||
{
|
||||
Interface *intf = getInterfaceByName(as.address);
|
||||
if (intf == NULL)
|
||||
if (intf == nullptr)
|
||||
{
|
||||
// this interface was never used in "on <intf>" clause before
|
||||
newInterface(as.address);
|
||||
@ -532,7 +532,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
if (as.at == AddressSpec::INTERFACE_NETWORK)
|
||||
{
|
||||
Interface *intf = getInterfaceByName(as.address);
|
||||
if (intf == NULL)
|
||||
if (intf == nullptr)
|
||||
{
|
||||
// this interface was never used in "on <intf>" clause before
|
||||
newInterface(as.address);
|
||||
@ -540,7 +540,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
}
|
||||
|
||||
FWObject *o = intf->getFirstByType(AttachedNetworks::TYPENAME);
|
||||
if ( o != NULL )
|
||||
if ( o != nullptr )
|
||||
{
|
||||
return o;
|
||||
} else {
|
||||
@ -560,7 +560,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
{
|
||||
error_tracker->registerError(
|
||||
QObject::tr("import of 'interface:broadcast' is not supported."));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (as.at == AddressSpec::HOST_ADDRESS)
|
||||
@ -580,7 +580,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
error_tracker->registerError(
|
||||
QObject::tr("Warning: matching '%1' is not supported")
|
||||
.arg(as.address.c_str()));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ FWObject* PFImporter::makeAddressObj(AddressSpec &as)
|
||||
return at;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PFImporter::addLogging()
|
||||
@ -667,7 +667,7 @@ void PFImporter::pushRule()
|
||||
else
|
||||
pushNATRule();
|
||||
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_rule!=nullptr);
|
||||
|
||||
if (error_tracker->hasWarnings())
|
||||
{
|
||||
@ -692,7 +692,7 @@ void PFImporter::pushRule()
|
||||
markCurrentRuleBad();
|
||||
}
|
||||
|
||||
current_rule = NULL;
|
||||
current_rule = nullptr;
|
||||
rule_comment = "";
|
||||
|
||||
clear();
|
||||
@ -708,7 +708,7 @@ void PFImporter::pushPolicyRule()
|
||||
// base class uses dictionary all_rulesets to do some checks (e.g.
|
||||
// countRules()) so we'll create one dummy UnidirectionalRuleSet object
|
||||
string ruleset_name = ruleset->getName();
|
||||
if (checkUnidirRuleSet(ruleset_name) == NULL)
|
||||
if (checkUnidirRuleSet(ruleset_name) == nullptr)
|
||||
{
|
||||
UnidirectionalRuleSet *rs = new UnidirectionalRuleSet();
|
||||
rs->name = ruleset_name;
|
||||
@ -716,7 +716,7 @@ void PFImporter::pushPolicyRule()
|
||||
all_rulesets[ruleset_name] = rs;
|
||||
}
|
||||
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_rule!=nullptr);
|
||||
// populate all elements of the rule
|
||||
|
||||
// Note that standard function
|
||||
@ -734,7 +734,7 @@ void PFImporter::pushPolicyRule()
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
if (action=="pass")
|
||||
{
|
||||
@ -811,7 +811,7 @@ void PFImporter::pushPolicyRule()
|
||||
for (it=iface_group.begin(); it!=iface_group.end(); ++it)
|
||||
{
|
||||
Interface *intf = getInterfaceByName(it->name);
|
||||
assert(intf!=NULL);
|
||||
assert(intf!=nullptr);
|
||||
RuleElement *re =rule->getItf();
|
||||
re->addRef(intf);
|
||||
if (it->neg) re->setNeg(true);
|
||||
@ -853,7 +853,7 @@ void PFImporter::pushPolicyRule()
|
||||
sig.type_name = TagService::TYPENAME;
|
||||
sig.tag = tag.c_str();
|
||||
FWObject *tobj = commitObject(service_maker->createObject(sig));
|
||||
rule->setTagging(tobj != NULL);
|
||||
rule->setTagging(tobj != nullptr);
|
||||
rule->setTagObject(tobj);
|
||||
}
|
||||
|
||||
@ -911,7 +911,7 @@ void PFImporter::pushPolicyRule()
|
||||
RouteSpec &rs = *it;
|
||||
|
||||
Interface *intf = getInterfaceByName(rs.iface);
|
||||
if (intf == NULL)
|
||||
if (intf == nullptr)
|
||||
{
|
||||
// this interface was never used in "on <intf>" clause before
|
||||
intf = newInterface(rs.iface);
|
||||
@ -990,7 +990,7 @@ void PFImporter::pushNATRule()
|
||||
// base class uses dictionary all_rulesets to do some checks (e.g.
|
||||
// countRules()) so we'll create one dummy UnidirectionalRuleSet object
|
||||
string ruleset_name = ruleset->getName();
|
||||
if (checkUnidirRuleSet(ruleset_name) == NULL)
|
||||
if (checkUnidirRuleSet(ruleset_name) == nullptr)
|
||||
{
|
||||
UnidirectionalRuleSet *rs = new UnidirectionalRuleSet();
|
||||
rs->name = ruleset_name;
|
||||
@ -998,7 +998,7 @@ void PFImporter::pushNATRule()
|
||||
all_rulesets[ruleset_name] = rs;
|
||||
}
|
||||
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_rule!=nullptr);
|
||||
|
||||
QString message_str =
|
||||
QString("nat rule: action %1; interfaces: %2");
|
||||
@ -1006,7 +1006,7 @@ void PFImporter::pushNATRule()
|
||||
NATRule *rule = NATRule::cast(current_rule);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
if (action=="nat") rule->setRuleType(NATRule::SNAT);
|
||||
if (action=="rdr") rule->setRuleType(NATRule::DNAT);
|
||||
@ -1021,7 +1021,7 @@ void PFImporter::pushNATRule()
|
||||
for (it=iface_group.begin(); it!=iface_group.end(); ++it)
|
||||
{
|
||||
Interface *intf = getInterfaceByName(it->name);
|
||||
assert(intf!=NULL);
|
||||
assert(intf!=nullptr);
|
||||
RuleElement *re =rule->getItfOutb();
|
||||
re->addRef(intf);
|
||||
if (it->neg) re->setNeg(true);
|
||||
@ -1300,7 +1300,7 @@ Firewall* PFImporter::finalize()
|
||||
if (int_prop->looksLikeInterface(skip_interface_name.c_str()))
|
||||
{
|
||||
Interface *intf = getInterfaceByName(skip_interface_name);
|
||||
if (intf == NULL)
|
||||
if (intf == nullptr)
|
||||
{
|
||||
// this interface was never used in "on
|
||||
// <intf>" clause before
|
||||
@ -1377,7 +1377,7 @@ Firewall* PFImporter::finalize()
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1392,7 +1392,7 @@ Interface* PFImporter::getInterfaceByName(const string &name)
|
||||
return intf;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PFImporter::newAddressTableObject(const string &name, const string &file)
|
||||
@ -1437,7 +1437,7 @@ void PFImporter::newAddressTableObject(const string &name,
|
||||
ObjectMaker maker(Library::cast(library), error_tracker);
|
||||
FWObject *og =
|
||||
commitObject(maker.createObject(ObjectGroup::TYPENAME, name.c_str()));
|
||||
assert(og!=NULL);
|
||||
assert(og!=nullptr);
|
||||
address_table_registry[name.c_str()] = og;
|
||||
|
||||
if (has_negations)
|
||||
|
||||
@ -91,11 +91,11 @@ void PIXImporter::clear()
|
||||
{
|
||||
Importer::clear();
|
||||
|
||||
current_named_object = NULL;
|
||||
current_named_object = nullptr;
|
||||
named_object_name = "";
|
||||
named_object_comment = "";
|
||||
|
||||
current_object_group = NULL;
|
||||
current_object_group = nullptr;
|
||||
object_group_name = "";
|
||||
object_group_comment = "";
|
||||
object_group_service_protocol = "";
|
||||
@ -142,7 +142,7 @@ Interface* PIXImporter::getInterfaceByLabel(const string &label)
|
||||
return intf;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -251,8 +251,8 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
|
||||
// named object/object group)
|
||||
if (src_port_spec.empty() || dst_port_spec.empty()) return;
|
||||
|
||||
FWObject *src_port_obj = NULL;
|
||||
FWObject *dst_port_obj = NULL;
|
||||
FWObject *src_port_obj = nullptr;
|
||||
FWObject *dst_port_obj = nullptr;
|
||||
|
||||
if (!src_port_spec.empty() &&
|
||||
named_objects_registry.count(src_port_spec.c_str()) > 0)
|
||||
@ -265,11 +265,11 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
|
||||
// if both src_port_obj and dst_port_obj are NULL, this means
|
||||
// both port operations are in-line port matches that will be
|
||||
// taken are of in the base class functions
|
||||
if (src_port_obj == NULL && dst_port_obj == NULL) return;
|
||||
if (src_port_obj == nullptr && dst_port_obj == nullptr) return;
|
||||
|
||||
// If only one of the two is NULL, use base class functions to
|
||||
// fill it in from its port_op and port_spec variables
|
||||
if (dst_port_obj == NULL)
|
||||
if (dst_port_obj == nullptr)
|
||||
{
|
||||
src_port_spec = "";
|
||||
src_port_op = "";
|
||||
@ -278,7 +278,7 @@ void PIXImporter::fixServiceObjectUsedForBothSrcAndDstPorts()
|
||||
else dst_port_obj = createUDPService();
|
||||
}
|
||||
|
||||
if (src_port_obj == NULL)
|
||||
if (src_port_obj == nullptr)
|
||||
{
|
||||
dst_port_spec = "";
|
||||
dst_port_op = "";
|
||||
@ -307,7 +307,7 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
|
||||
FWObject *dst_ports,
|
||||
FWObject *service_group)
|
||||
{
|
||||
if (Group::cast(src_ports)!=NULL)
|
||||
if (Group::cast(src_ports)!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator i1=src_ports->begin(); i1!=src_ports->end(); ++i1)
|
||||
{
|
||||
@ -317,7 +317,7 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
|
||||
return;
|
||||
}
|
||||
|
||||
if (Group::cast(dst_ports)!=NULL)
|
||||
if (Group::cast(dst_ports)!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator i1=dst_ports->begin(); i1!=dst_ports->end(); ++i1)
|
||||
{
|
||||
@ -354,10 +354,10 @@ void PIXImporter::mixServiceObjects(FWObject *src_ports,
|
||||
|
||||
FWObject* PIXImporter::mirrorServiceObjectRecursively(FWObject *obj)
|
||||
{
|
||||
FWObject *res = NULL;
|
||||
FWObject *res = nullptr;
|
||||
string new_name = obj->getName() + "-mirror";
|
||||
|
||||
if (Service::cast(obj) != NULL)
|
||||
if (Service::cast(obj) != nullptr)
|
||||
{
|
||||
FWObject *new_obj = service_maker->getMirroredServiceObject(obj);
|
||||
if (new_obj)
|
||||
@ -477,7 +477,7 @@ void PIXImporter::pushRule()
|
||||
else
|
||||
pushNATRule();
|
||||
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_rule!=nullptr);
|
||||
|
||||
if (error_tracker->hasWarnings())
|
||||
{
|
||||
@ -502,7 +502,7 @@ void PIXImporter::pushRule()
|
||||
markCurrentRuleBad();
|
||||
}
|
||||
|
||||
current_rule = NULL;
|
||||
current_rule = nullptr;
|
||||
rule_comment = "";
|
||||
|
||||
clear();
|
||||
@ -511,8 +511,8 @@ void PIXImporter::pushRule()
|
||||
|
||||
void PIXImporter::pushPolicyRule()
|
||||
{
|
||||
assert(current_ruleset!=NULL);
|
||||
assert(current_rule!=NULL);
|
||||
assert(current_ruleset!=nullptr);
|
||||
assert(current_rule!=nullptr);
|
||||
// populate all elements of the rule
|
||||
|
||||
addMessageToLog(
|
||||
@ -523,7 +523,7 @@ void PIXImporter::pushPolicyRule()
|
||||
PolicyRule *rule = PolicyRule::cast(current_rule);
|
||||
|
||||
FWOptions *ropt = current_rule->getOptionsObject();
|
||||
assert(ropt!=NULL);
|
||||
assert(ropt!=nullptr);
|
||||
|
||||
if (action=="permit")
|
||||
{
|
||||
@ -678,10 +678,10 @@ Firewall* PIXImporter::finalize()
|
||||
rearrangeVlanInterfaces();
|
||||
|
||||
FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME);
|
||||
assert( policy!=NULL );
|
||||
assert( policy!=nullptr );
|
||||
|
||||
FWObject *nat = getFirewallObject()->getFirstByType(NAT::TYPENAME);
|
||||
assert( nat!=NULL );
|
||||
assert( nat!=nullptr );
|
||||
|
||||
if (all_rulesets.size()!=0)
|
||||
{
|
||||
@ -816,7 +816,7 @@ Firewall* PIXImporter::finalize()
|
||||
<< "dir: " << _dir.c_str();
|
||||
|
||||
// not all access lists are associated with interfaces
|
||||
if (intf != NULL)
|
||||
if (intf != nullptr)
|
||||
{
|
||||
if (fwbdebug)
|
||||
qDebug() << " interface: "
|
||||
@ -867,7 +867,7 @@ Firewall* PIXImporter::finalize()
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1001,7 +1001,7 @@ void PIXImporter::setNamedObjectDescription(const std::string &txt)
|
||||
{
|
||||
named_object_comment = QString::fromUtf8(txt.c_str());
|
||||
|
||||
if (current_named_object != NULL && ! named_object_name.isEmpty())
|
||||
if (current_named_object != nullptr && ! named_object_name.isEmpty())
|
||||
{
|
||||
current_named_object->setBool(".import-commited", false);
|
||||
current_named_object->setComment("");
|
||||
@ -1089,7 +1089,7 @@ void PIXImporter::newObjectGroupICMP(const string &name)
|
||||
void PIXImporter::setObjectGroupDescription(const std::string &descr)
|
||||
{
|
||||
object_group_comment = QString::fromUtf8(descr.c_str());
|
||||
if (current_object_group != NULL && ! object_group_name.isEmpty())
|
||||
if (current_object_group != nullptr && ! object_group_name.isEmpty())
|
||||
{
|
||||
current_object_group->setBool(".import-commited", false);
|
||||
current_object_group->setComment("");
|
||||
@ -1132,7 +1132,7 @@ void PIXImporter::addIPServiceToObjectGroup()
|
||||
|
||||
void PIXImporter::addTCPUDPServiceToObjectGroup()
|
||||
{
|
||||
FWObject *new_obj = NULL;
|
||||
FWObject *new_obj = nullptr;
|
||||
if (protocol.empty() && ! object_group_service_protocol.isEmpty())
|
||||
protocol = object_group_service_protocol.toStdString();
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ int GetProtoByName::getProtocolByName(const QString &name)
|
||||
if (protocols.contains(name)) return protocols[name];
|
||||
struct protoent *pe = getprotobyname(name.toLatin1().constData());
|
||||
|
||||
if (pe!=NULL)
|
||||
if (pe!=nullptr)
|
||||
return pe->p_proto;
|
||||
|
||||
return -1;
|
||||
|
||||
@ -684,7 +684,7 @@ int GetServByName::getPortByName(const QString &name, const QString &proto)
|
||||
struct servent *se = getservbyname(name.toLatin1().constData(),
|
||||
proto.toLatin1().constData());
|
||||
|
||||
if (se!=NULL)
|
||||
if (se!=nullptr)
|
||||
{
|
||||
int port = ntohs(se->s_port);
|
||||
//free(se);
|
||||
|
||||
@ -79,7 +79,7 @@ void ObjectMakerErrorTracker::registerWarning(const string &msg)
|
||||
|
||||
void ObjectMaker::clear()
|
||||
{
|
||||
last_created = NULL;
|
||||
last_created = nullptr;
|
||||
named_object_registry.clear();
|
||||
anon_object_registry.clear();
|
||||
}
|
||||
@ -93,13 +93,13 @@ FWObject* ObjectMaker::findMatchingObject(const ObjectSignature &sig)
|
||||
if (named_object_registry.count(sig_str) > 0)
|
||||
return library->getRoot()->findInIndex(
|
||||
named_object_registry[sig_str]);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (anon_object_registry.count(sig_str) > 0)
|
||||
return library->getRoot()->findInIndex(anon_object_registry[sig_str]);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ObjectMaker::registerNamedObject(const ObjectSignature &sig,
|
||||
@ -110,7 +110,7 @@ void ObjectMaker::registerNamedObject(const ObjectSignature &sig,
|
||||
QString as = anon_sig.toString();
|
||||
if (anon_object_registry.count(as) > 0) anon_object_registry.remove(as);
|
||||
|
||||
named_object_registry[sig.toString()] = (obj!=NULL) ? obj->getId() : -1;
|
||||
named_object_registry[sig.toString()] = (obj!=nullptr) ? obj->getId() : -1;
|
||||
}
|
||||
|
||||
void ObjectMaker::registerAnonymousObject(const ObjectSignature &sig,
|
||||
@ -118,7 +118,7 @@ void ObjectMaker::registerAnonymousObject(const ObjectSignature &sig,
|
||||
{
|
||||
ObjectSignature anon_sig = sig;
|
||||
anon_sig.object_name = "";
|
||||
anon_object_registry[anon_sig.toString()] = (obj!=NULL) ? obj->getId() : -1;
|
||||
anon_object_registry[anon_sig.toString()] = (obj!=nullptr) ? obj->getId() : -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -140,14 +140,14 @@ FWObject* ObjectMaker::promoteToNamedObject(FWObject *obj,
|
||||
new_obj->duplicate(obj);
|
||||
new_obj->setName(objName);
|
||||
ObjectSignature sig(error_tracker);
|
||||
new_obj->dispatch(&sig, (void*)(NULL));
|
||||
new_obj->dispatch(&sig, (void*)nullptr);
|
||||
registerNamedObject(sig, new_obj);
|
||||
return new_obj;
|
||||
} else
|
||||
{
|
||||
obj->setName(objName);
|
||||
ObjectSignature sig(error_tracker);
|
||||
obj->dispatch(&sig, (void*)(NULL));
|
||||
obj->dispatch(&sig, (void*)nullptr);
|
||||
registerNamedObject(sig, obj);
|
||||
return obj;
|
||||
}
|
||||
@ -158,7 +158,7 @@ FWObject* ObjectMaker::promoteToNamedObject(FWObject *obj,
|
||||
FWObject* ObjectMaker::createObject(const std::string &objType,
|
||||
const std::string &objName)
|
||||
{
|
||||
assert(library!=NULL);
|
||||
assert(library!=nullptr);
|
||||
FWBTree tree ;
|
||||
FWObject *slot = tree.getStandardSlotForObject(library,objType.c_str());
|
||||
return createObject(slot, objType, objName);
|
||||
@ -168,9 +168,9 @@ FWObject* ObjectMaker::createObject(FWObject *parent,
|
||||
const std::string &objType,
|
||||
const std::string &objName)
|
||||
{
|
||||
assert(library!=NULL);
|
||||
assert(library!=nullptr);
|
||||
FWObject* o = library->getRoot()->create(objType);
|
||||
if (parent != NULL)
|
||||
if (parent != nullptr)
|
||||
{
|
||||
if (parent->isReadOnly())
|
||||
{
|
||||
@ -201,7 +201,7 @@ FWObject* ObjectMaker::createObject(FWObject *parent,
|
||||
|
||||
FWObject* ObjectMaker::createObject(ObjectSignature &)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//****************************************************************
|
||||
@ -230,7 +230,7 @@ void ObjectMaker::prepareForDeduplication(FWObject *root)
|
||||
{
|
||||
ObjectSignature sig(error_tracker);
|
||||
|
||||
root->dispatch(&sig, (void*)(NULL));
|
||||
root->dispatch(&sig, (void*)nullptr);
|
||||
|
||||
registerNamedObject(sig, root);
|
||||
registerAnonymousObject(sig, root); // this erases sig.object_name
|
||||
|
||||
@ -65,7 +65,7 @@ using namespace libfwbuilder;
|
||||
using namespace fwcompiler;
|
||||
|
||||
|
||||
FWObjectDatabase *objdb = NULL;
|
||||
FWObjectDatabase *objdb = nullptr;
|
||||
|
||||
class UpgradePredicate: public XMLTools::UpgradePredicate
|
||||
{
|
||||
|
||||
@ -117,7 +117,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
|
||||
|
||||
std::list<FWObject*> lipaddr;
|
||||
std::list<FWObject*> lother;
|
||||
physAddress *pa = NULL;
|
||||
physAddress *pa = nullptr;
|
||||
|
||||
for (std::list<FWObject*>::iterator j=ol1.begin(); j!=ol1.end(); j++)
|
||||
{
|
||||
@ -126,7 +126,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
|
||||
lipaddr.push_back(*j);
|
||||
continue;
|
||||
}
|
||||
if (physAddress::cast(*j)!=NULL)
|
||||
if (physAddress::cast(*j)!=nullptr)
|
||||
{
|
||||
pa = physAddress::cast(*j);
|
||||
continue;
|
||||
@ -137,7 +137,7 @@ void expand_interface_with_phys_address(Compiler *compiler,
|
||||
/*
|
||||
* if pa==NULL then this is trivial case: there is no physical address
|
||||
*/
|
||||
if (pa==NULL)
|
||||
if (pa==nullptr)
|
||||
{
|
||||
list_result.insert(list_result.end(), ol1.begin(), ol1.end());
|
||||
return;
|
||||
@ -163,10 +163,10 @@ void expand_interface_with_phys_address(Compiler *compiler,
|
||||
*/
|
||||
FWObject *p = Host::getParentHost(iface);
|
||||
//FWObject *p = iface->getParentHost();
|
||||
assert(p!=NULL);
|
||||
assert(p!=nullptr);
|
||||
|
||||
FWOptions *hopt = Host::cast(p)->getOptionsObject();
|
||||
bool use_mac = (hopt!=NULL && hopt->getBool("use_mac_addr_filter") );
|
||||
bool use_mac = (hopt!=nullptr && hopt->getBool("use_mac_addr_filter") );
|
||||
|
||||
if (lipaddr.empty()) list_result.push_back(pa);
|
||||
else
|
||||
|
||||
@ -78,14 +78,14 @@ bool Address::isAny() const
|
||||
|
||||
const Address* Address::getAddressObject() const
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const InetAddrMask* Address::getInetAddrMaskObjectPtr() const
|
||||
{
|
||||
const Address *addr_obj = getAddressObject();
|
||||
if (addr_obj) return addr_obj->inet_addr_mask;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Address::hasInetAddress() const
|
||||
@ -102,28 +102,28 @@ const InetAddr* Address::getAddressPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getAddressPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const InetAddr* Address::getNetmaskPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getNetmaskPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const InetAddr* Address::getNetworkAddressPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getNetworkAddressPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const InetAddr* Address::getBroadcastAddressPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getBroadcastAddressPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Address::setAddress(const InetAddr& a)
|
||||
@ -147,20 +147,20 @@ void Address::setAddressNetmask(const std::string&)
|
||||
unsigned int Address::dimension() const
|
||||
{
|
||||
const InetAddrMask *addr_obj = getInetAddrMaskObjectPtr();
|
||||
if (addr_obj!=NULL) return addr_obj->dimension();
|
||||
if (addr_obj!=nullptr) return addr_obj->dimension();
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool Address::belongs(const InetAddr &other) const
|
||||
{
|
||||
const InetAddrMask *addr_obj = getInetAddrMaskObjectPtr();
|
||||
if (addr_obj!=NULL) return addr_obj->belongs(other);
|
||||
if (addr_obj!=nullptr) return addr_obj->belongs(other);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Address::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (Address::constcast(obj)==NULL) return false;
|
||||
if (Address::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
if (hasInetAddress()!=Address::constcast(obj)->hasInetAddress()) return false;
|
||||
if (!hasInetAddress()) return true;
|
||||
|
||||
@ -75,7 +75,7 @@ void AddressRange::setNetmask(const InetAddr& ) {}
|
||||
FWObject& AddressRange::shallowDuplicate(const FWObject *o, bool preserve_id)
|
||||
{
|
||||
const AddressRange *n = dynamic_cast<const AddressRange *>(o);
|
||||
if (n==NULL) {
|
||||
if (n==nullptr) {
|
||||
|
||||
std::ostringstream s;
|
||||
s << "Attempt to copy incompatible object to AddressRange: objectID=";
|
||||
@ -91,7 +91,7 @@ FWObject& AddressRange::shallowDuplicate(const FWObject *o, bool preserve_id)
|
||||
|
||||
bool AddressRange::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (AddressRange::constcast(obj)==NULL) return false;
|
||||
if (AddressRange::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
InetAddr o1b;
|
||||
@ -113,12 +113,12 @@ void AddressRange::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("start_address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
start_address = InetAddr(AF_UNSPEC, n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("end_address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
end_address = InetAddr(AF_UNSPEC, n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
|
||||
@ -68,12 +68,12 @@ void AddressTable::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("filename")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("filename", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("run_time")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("run_time", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
@ -156,7 +156,7 @@ void AddressTable::loadFromSource(bool ipv6, FWOptions *options,
|
||||
}
|
||||
if (!buf.empty())
|
||||
{
|
||||
new_addr = NULL;
|
||||
new_addr = nullptr;
|
||||
if (ipv6 && buf.find(":")!=string::npos)
|
||||
{
|
||||
try
|
||||
|
||||
@ -46,7 +46,7 @@ using namespace libfwbuilder;
|
||||
|
||||
BackgroundOp::BackgroundOp():running(false),connected(true)
|
||||
{
|
||||
error = NULL;
|
||||
error = nullptr;
|
||||
stop_program = new SyncFlag(false);
|
||||
iamdead = new SyncFlag(false);
|
||||
pthread_attr_init(&tattr);
|
||||
@ -167,7 +167,7 @@ void *background_thread(void *args)
|
||||
delete logger;
|
||||
delete isdead;
|
||||
delete void_pair;
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
*logger << "Exception: " << ex.toString().c_str() << '\n';
|
||||
bop->error=new FWException(ex);
|
||||
@ -183,7 +183,7 @@ void *background_thread(void *args)
|
||||
delete logger;
|
||||
delete isdead;
|
||||
delete void_pair;
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
/* operation completed - clear "running" flag */
|
||||
@ -213,7 +213,7 @@ void *background_thread(void *args)
|
||||
delete logger;
|
||||
delete void_pair;
|
||||
|
||||
return(NULL);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ void Cluster::init(FWObjectDatabase *root)
|
||||
Firewall::init(root);
|
||||
// create one conntrack member group
|
||||
FWObject *state_sync_members = getFirstByType(StateSyncClusterGroup::TYPENAME);
|
||||
if (state_sync_members == NULL)
|
||||
if (state_sync_members == nullptr)
|
||||
{
|
||||
state_sync_members = root->create(StateSyncClusterGroup::TYPENAME);
|
||||
state_sync_members->setName("State Sync Group");
|
||||
@ -115,7 +115,7 @@ ClusterGroup* Cluster::getStateSyncGroupObject()
|
||||
StateSyncClusterGroup *group = StateSyncClusterGroup::cast(
|
||||
getFirstByType(StateSyncClusterGroup::TYPENAME));
|
||||
|
||||
if (group == NULL)
|
||||
if (group == nullptr)
|
||||
{
|
||||
// create a new ClusterGroup object
|
||||
group = StateSyncClusterGroup::cast(getRoot()->create(
|
||||
@ -159,12 +159,12 @@ FWObject& Cluster::duplicate(const FWObject *obj,
|
||||
|
||||
void Cluster::updateLastInstalledTimestamp()
|
||||
{
|
||||
setInt("lastInstalled", time(NULL));
|
||||
setInt("lastInstalled", time(nullptr));
|
||||
}
|
||||
|
||||
void Cluster::updateLastModifiedTimestamp()
|
||||
{
|
||||
setInt("lastModified", time(NULL));
|
||||
setInt("lastModified", time(nullptr));
|
||||
}
|
||||
|
||||
bool Cluster::needsInstall()
|
||||
@ -199,7 +199,7 @@ time_t Cluster::getLastCompiled()
|
||||
|
||||
void Cluster::updateLastCompiledTimestamp()
|
||||
{
|
||||
setInt("lastCompiled", time(NULL));
|
||||
setInt("lastCompiled", time(nullptr));
|
||||
}
|
||||
|
||||
bool Cluster::getInactive()
|
||||
@ -250,7 +250,7 @@ void Cluster::getMembersList(list<libfwbuilder::Firewall*> &members)
|
||||
{
|
||||
FWObject *member = FWReference::getObject(*j);
|
||||
if (ClusterGroupOptions::isA(member)) continue;
|
||||
Firewall *fw = NULL;
|
||||
Firewall *fw = nullptr;
|
||||
// as of 05/04 members of StateSyncClusterGroup are interfaces. See
|
||||
// tickets #10 and #11
|
||||
if (Interface::cast(member))
|
||||
@ -284,7 +284,7 @@ bool Cluster::hasMember(Firewall *fw)
|
||||
{
|
||||
FWObject *member = FWReference::getObject(*j);
|
||||
if (ClusterGroupOptions::isA(member)) continue;
|
||||
Firewall *member_fw = NULL;
|
||||
Firewall *member_fw = nullptr;
|
||||
// as of 05/04/2009 members of StateSyncClusterGroup are
|
||||
// interfaces. See tickets #10 and #11
|
||||
if (Interface::cast(member))
|
||||
|
||||
@ -35,7 +35,7 @@ ClusterGroup::ClusterGroup() : ObjectGroup()
|
||||
void ClusterGroup::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *gopt = getFirstByType(ClusterGroupOptions::TYPENAME);
|
||||
if (gopt == NULL)
|
||||
if (gopt == nullptr)
|
||||
{
|
||||
gopt = root->create(ClusterGroupOptions::TYPENAME);
|
||||
add(gopt);
|
||||
@ -76,13 +76,13 @@ void ClusterGroup::fromXML(xmlNodePtr parent)
|
||||
|
||||
const char *n;
|
||||
n = FROMXMLCAST(xmlGetProp(parent, TOXMLCAST("type")));
|
||||
if (n != NULL)
|
||||
if (n != nullptr)
|
||||
{
|
||||
setStr("type", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
n = FROMXMLCAST(xmlGetProp(parent, TOXMLCAST("master_iface")));
|
||||
if (n != NULL)
|
||||
if (n != nullptr)
|
||||
{
|
||||
setStr("master_iface", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -116,7 +116,7 @@ ClusterGroupOptions* ClusterGroup::getOptionsObject()
|
||||
ClusterGroupOptions *gopt = ClusterGroupOptions::cast(
|
||||
getFirstByType(ClusterGroupOptions::TYPENAME));
|
||||
|
||||
if (gopt == NULL)
|
||||
if (gopt == nullptr)
|
||||
{
|
||||
gopt = ClusterGroupOptions::cast(
|
||||
getRoot()->create(ClusterGroupOptions::TYPENAME));
|
||||
@ -127,7 +127,7 @@ ClusterGroupOptions* ClusterGroup::getOptionsObject()
|
||||
|
||||
FWObject& ClusterGroup::duplicateForUndo(const FWObject *obj)
|
||||
{
|
||||
if (ClusterGroup::constcast(obj)==NULL) return *this;
|
||||
if (ClusterGroup::constcast(obj)==nullptr) return *this;
|
||||
|
||||
setRO(false);
|
||||
|
||||
@ -152,7 +152,7 @@ FWObject& ClusterGroup::duplicateForUndo(const FWObject *obj)
|
||||
}
|
||||
}
|
||||
if (their_opts && mine_opts) mine_opts->duplicate(their_opts);
|
||||
if (their_opts && mine_opts==NULL) addCopyOf(their_opts);
|
||||
if (their_opts && mine_opts==nullptr) addCopyOf(their_opts);
|
||||
|
||||
shallowDuplicate(obj);
|
||||
return *this;
|
||||
@ -182,6 +182,6 @@ Interface* ClusterGroup::getInterfaceForMemberFirewall(Firewall *fw)
|
||||
|
||||
if (other_iface->isChildOf(fw)) return other_iface;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ void CustomService::fromXML(xmlNodePtr root)
|
||||
if (cur && !xmlIsBlankNode(cur))
|
||||
{
|
||||
n = FROMXMLCAST(xmlGetProp(cur,TOXMLCAST("platform")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
cont = FROMXMLCAST( xmlNodeGetContent(cur) );
|
||||
if (cont)
|
||||
{
|
||||
@ -138,8 +138,8 @@ xmlNodePtr CustomService::toXML(xmlNodePtr parent)
|
||||
{
|
||||
const string &platform = (*i).first;
|
||||
const string &code = (*i).second;
|
||||
xmlChar *codebuf = xmlEncodeSpecialChars(NULL, STRTOXMLCAST(code) );
|
||||
opt=xmlNewChild(me,NULL,TOXMLCAST("CustomServiceCommand"), codebuf);
|
||||
xmlChar *codebuf = xmlEncodeSpecialChars(nullptr, STRTOXMLCAST(code) );
|
||||
opt=xmlNewChild(me,nullptr,TOXMLCAST("CustomServiceCommand"), codebuf);
|
||||
FREEXMLBUFF(codebuf);
|
||||
|
||||
xmlNewProp(opt, TOXMLCAST("platform") , STRTOXMLCAST(platform));
|
||||
@ -149,7 +149,7 @@ xmlNodePtr CustomService::toXML(xmlNodePtr parent)
|
||||
|
||||
bool CustomService::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (CustomService::constcast(obj)==NULL) return false;
|
||||
if (CustomService::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const CustomService *o2 = CustomService::constcast(obj);
|
||||
|
||||
@ -76,12 +76,12 @@ void DNSName::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dnsrec")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("dnsrec", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dnsrectype")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("dnsrectype", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -91,7 +91,7 @@ void DNSName::fromXML(xmlNodePtr root)
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("run_time")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("run_time", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
@ -132,7 +132,7 @@ void DNSName::loadFromSource(bool ipv6, FWOptions *options,
|
||||
//Address *a = Address::cast(
|
||||
// getRoot()->create((ipv6)?IPv6::TYPENAME:IPv4::TYPENAME));
|
||||
int af = AF_INET;
|
||||
Address *a = NULL;
|
||||
Address *a = nullptr;
|
||||
if (ipv6) { a = getRoot()->createIPv6(); af = AF_INET6; }
|
||||
else a = getRoot()->createIPv4();
|
||||
getRoot()->add(a);
|
||||
@ -161,7 +161,7 @@ void DNSName::loadFromSource(bool ipv6, FWOptions *options,
|
||||
{
|
||||
err << " Using dummy address in test mode";
|
||||
int af = AF_INET;
|
||||
Address *a = NULL;
|
||||
Address *a = nullptr;
|
||||
if (ipv6)
|
||||
{
|
||||
a = getRoot()->createIPv6();
|
||||
|
||||
@ -45,7 +45,7 @@ DynamicGroup::~DynamicGroup() {}
|
||||
|
||||
bool DynamicGroup::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
|
||||
return FWObject::validateChild(o);
|
||||
}
|
||||
@ -55,7 +55,7 @@ void DynamicGroup::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
for (xmlNodePtr child = root->xmlChildrenNode;
|
||||
child != 0; child = child->next) {
|
||||
child != nullptr; child = child->next) {
|
||||
if (child->type != XML_ELEMENT_NODE) continue;
|
||||
assert(strcmp(FROMXMLCAST(child->name), "SelectionCriteria") == 0);
|
||||
|
||||
@ -87,8 +87,8 @@ xmlNodePtr DynamicGroup::toXML(xmlNodePtr parent)
|
||||
if (!splitFilter(*iter, type, keyword)) continue;
|
||||
if (!makeFilter(filter, type, keyword)) continue;
|
||||
|
||||
xmlNodePtr item = xmlNewChild(me, NULL,
|
||||
TOXMLCAST("SelectionCriteria"), NULL);
|
||||
xmlNodePtr item = xmlNewChild(me, nullptr,
|
||||
TOXMLCAST("SelectionCriteria"), nullptr);
|
||||
xmlNewProp(item, TOXMLCAST("type"), STRTOXMLCAST(type));
|
||||
xmlNewProp(item, TOXMLCAST("keyword"), STRTOXMLCAST(keyword));
|
||||
}
|
||||
@ -164,22 +164,22 @@ void DynamicGroup::loadFromSource(bool ipv6, FWOptions *options, bool test_mode)
|
||||
static bool isInDeletedObjs(FWObject *obj)
|
||||
{
|
||||
FWObject *lib = obj->getLibrary();
|
||||
return lib == 0 || lib->getId() == FWObjectDatabase::DELETED_OBJECTS_ID;
|
||||
return lib == nullptr || lib->getId() == FWObjectDatabase::DELETED_OBJECTS_ID;
|
||||
}
|
||||
|
||||
|
||||
bool DynamicGroup::isMemberOfGroup(FWObject *obj)
|
||||
{
|
||||
if (obj == this) return false;
|
||||
if (ObjectGroup::cast(obj) == 0 && Address::cast(obj) == 0) return false;
|
||||
if (RuleElement::cast(obj) != 0) return false;
|
||||
if (ObjectGroup::cast(obj) == nullptr && Address::cast(obj) == nullptr) return false;
|
||||
if (RuleElement::cast(obj) != nullptr) return false;
|
||||
if (isInDeletedObjs(obj)) return false;
|
||||
|
||||
/* There's no way to figure out what are the "standard" object
|
||||
groups (like "address tables") from within the fwbuilder
|
||||
library, so we rely on counting how deep we are in the tree
|
||||
instead. */
|
||||
if (ObjectGroup::cast(obj) != 0 &&
|
||||
if (ObjectGroup::cast(obj) != nullptr &&
|
||||
obj->getDistanceFromRoot() <= 3) return false;
|
||||
|
||||
const set<string> &keywords = obj->getKeywords();
|
||||
|
||||
@ -67,7 +67,7 @@ string FWObject::dataDir;
|
||||
|
||||
void FWObject::fromXML(xmlNodePtr root)
|
||||
{
|
||||
assert(root!=NULL);
|
||||
assert(root!=nullptr);
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("name")));
|
||||
@ -92,20 +92,20 @@ void FWObject::fromXML(xmlNodePtr root)
|
||||
}
|
||||
|
||||
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("keywords")));
|
||||
if (n != 0) {
|
||||
if (n != nullptr) {
|
||||
keywords = stringToSet(n);
|
||||
dbroot->keywords.insert(keywords.begin(), keywords.end());
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("subfolders")));
|
||||
if (n != 0) {
|
||||
if (n != nullptr) {
|
||||
setStr("subfolders", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("folder")));
|
||||
if (n != 0) {
|
||||
if (n != nullptr) {
|
||||
setStr("folder", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
@ -125,7 +125,7 @@ void FWObject::fromXML(xmlNodePtr root)
|
||||
if (cur && !xmlIsBlankNode(cur))
|
||||
{
|
||||
FWObject *o = dbr->createFromXML(cur);
|
||||
if (o!=NULL)
|
||||
if (o!=nullptr)
|
||||
{
|
||||
/* Add w/o validation. Trust XML to do that */
|
||||
add(o, false);
|
||||
@ -157,9 +157,9 @@ xmlNodePtr FWObject::toXML(xmlNodePtr parent, bool process_children)
|
||||
|
||||
xmlNodePtr me = xmlNewChild(
|
||||
parent,
|
||||
NULL,
|
||||
nullptr,
|
||||
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
if (id!=-1)
|
||||
{
|
||||
@ -199,8 +199,8 @@ FWObject::FWObject()
|
||||
{
|
||||
busy = false;
|
||||
ref_counter = 0;
|
||||
parent = NULL;
|
||||
dbroot = NULL;
|
||||
parent = nullptr;
|
||||
dbroot = nullptr;
|
||||
name = "";
|
||||
comment = "";
|
||||
id = -1;
|
||||
@ -217,8 +217,8 @@ FWObject::FWObject(bool new_id)
|
||||
{
|
||||
busy = false;
|
||||
ref_counter = 0;
|
||||
parent = NULL;
|
||||
dbroot = NULL;
|
||||
parent = nullptr;
|
||||
dbroot = nullptr;
|
||||
name = "";
|
||||
comment = "";
|
||||
id = -1;
|
||||
@ -261,7 +261,7 @@ void* FWObject::getPrivateData(const string &key) const
|
||||
{
|
||||
map<string, void*>::const_iterator it = private_data.find(key);
|
||||
if(it == private_data.end())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
@ -323,7 +323,7 @@ FWObject* FWObject::findObjectByName(const string &type,
|
||||
if(o) return o;
|
||||
}
|
||||
|
||||
return NULL; // not found
|
||||
return nullptr; // not found
|
||||
}
|
||||
|
||||
FWObject* FWObject::findObjectByAttribute(const std::string &attr,
|
||||
@ -340,7 +340,7 @@ FWObject* FWObject::findObjectByAttribute(const std::string &attr,
|
||||
if(o) return o;
|
||||
}
|
||||
|
||||
return NULL; // not found
|
||||
return nullptr; // not found
|
||||
}
|
||||
|
||||
|
||||
@ -425,10 +425,10 @@ FWObject& FWObject::duplicate(const FWObject *x, bool preserve_id)
|
||||
|
||||
FWObject* FWObject::addCopyOf(const FWObject *x, bool preserve_id)
|
||||
{
|
||||
if (x==NULL) return NULL;
|
||||
if (x==nullptr) return nullptr;
|
||||
FWObject *o1;
|
||||
FWObjectDatabase *root = getRoot();
|
||||
if (root==NULL) root = x->getRoot();
|
||||
if (root==nullptr) root = x->getRoot();
|
||||
// do not prepopulte children for objects that do that automatically
|
||||
// in their constructor
|
||||
o1 = root->create(x->getTypeName(), -1);
|
||||
@ -485,8 +485,8 @@ FWObject& FWObject::shallowDuplicate(const FWObject *x, bool preserve_id)
|
||||
setId(old_id);
|
||||
}
|
||||
|
||||
if (dbroot==NULL) setRoot(x->getRoot());
|
||||
if (dbroot!=NULL) dbroot->addToIndex(this);
|
||||
if (dbroot==nullptr) setRoot(x->getRoot());
|
||||
if (dbroot!=nullptr) dbroot->addToIndex(this);
|
||||
|
||||
setReadOnly(x->ro);
|
||||
setDirty(true);
|
||||
@ -499,7 +499,7 @@ class InheritsFWOptions: public std::unary_function<FWObject*, bool>
|
||||
InheritsFWOptions() {}
|
||||
bool operator()(const FWObject *o) const
|
||||
{
|
||||
return FWOptions::constcast(o)!=NULL;
|
||||
return FWOptions::constcast(o)!=nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@ -540,7 +540,7 @@ const string& FWObject::getLibraryName() const
|
||||
FWObject* FWObject::getLibrary() const
|
||||
{
|
||||
const FWObject *p=this;
|
||||
while (p!=NULL && !Library::isA(p) ) p=p->getParent();
|
||||
while (p!=nullptr && !Library::isA(p) ) p=p->getParent();
|
||||
return (FWObject*)p;
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ FWObjectDatabase* FWObject::getRoot() const
|
||||
int FWObject::getDistanceFromRoot() const
|
||||
{
|
||||
int count = 0;
|
||||
for (FWObject *obj = getParent(); obj != 0; obj = obj->getParent()) {
|
||||
for (FWObject *obj = getParent(); obj != nullptr; obj = obj->getParent()) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
@ -572,9 +572,9 @@ string FWObject::getPath(bool relative, bool detailed) const
|
||||
list<string> res;
|
||||
const FWObject *p = this;
|
||||
|
||||
if (p == NULL) res.push_front("(0x0)");
|
||||
if (p == nullptr) res.push_front("(0x0)");
|
||||
|
||||
while (p!=NULL)
|
||||
while (p!=nullptr)
|
||||
{
|
||||
if (relative && Library::isA(p)) break;
|
||||
ostringstream s;
|
||||
@ -620,7 +620,7 @@ void FWObject::setId(int c)
|
||||
{
|
||||
id = c;
|
||||
setDirty(true);
|
||||
if (dbroot!=NULL) dbroot->addToIndex(this);
|
||||
if (dbroot!=nullptr) dbroot->addToIndex(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
|
||||
{
|
||||
list<FWObject*>::const_iterator m;
|
||||
for (m=begin(); m!=end(); ++m) {
|
||||
if ( (o=(*m))!=NULL) o->dump(f,recursive,brief,offset+2);
|
||||
if ( (o=(*m))!=nullptr) o->dump(f,recursive,brief,offset+2);
|
||||
}
|
||||
}
|
||||
} else
|
||||
@ -764,7 +764,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
|
||||
f << string(offset,' ') << "Type: " << getTypeName() << endl;
|
||||
f << string(offset,' ') << "Library:" << getLibrary() << endl;
|
||||
// f << string(offset,' ') << "Path: " << getPath() << endl;
|
||||
n=(getParent()!=NULL)?getParent()->getName():"";
|
||||
n=(getParent()!=nullptr)?getParent()->getName():"";
|
||||
f << string(offset,' ') << "Parent: " << getParent()
|
||||
<< " name=" << n << endl;
|
||||
f << string(offset,' ') << "Root: " << getRoot() << endl;
|
||||
@ -780,7 +780,7 @@ void FWObject::dump(std::ostream &f,bool recursive,bool brief,int offset) const
|
||||
list<FWObject*>::const_iterator m;
|
||||
for (m=begin(); m!=end(); ++m)
|
||||
{
|
||||
if ( (o=(*m))!=NULL) o->dump(f,recursive,brief,offset+2);
|
||||
if ( (o=(*m))!=nullptr) o->dump(f,recursive,brief,offset+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -807,7 +807,7 @@ void FWObject::_adopt(FWObject *obj)
|
||||
void FWObject::addAt(int where_id, FWObject *obj)
|
||||
{
|
||||
FWObject *p = getRoot()->findInIndex( where_id );
|
||||
assert (p!=NULL);
|
||||
assert (p!=nullptr);
|
||||
p->add(obj);
|
||||
}
|
||||
|
||||
@ -816,7 +816,7 @@ void FWObject::add(FWObject *obj, bool validate)
|
||||
checkReadOnly();
|
||||
|
||||
FWObject *old_parent = obj->getParent();
|
||||
if (old_parent != NULL)
|
||||
if (old_parent != nullptr)
|
||||
{
|
||||
cerr << "WARNING: object " << obj << " "
|
||||
<< "(name: " << obj->getName()
|
||||
@ -829,7 +829,7 @@ void FWObject::add(FWObject *obj, bool validate)
|
||||
<< " type: " << getTypeName() << ") "
|
||||
<< endl;
|
||||
|
||||
assert(old_parent == NULL);
|
||||
assert(old_parent == nullptr);
|
||||
}
|
||||
|
||||
// do not allow to add the same object twice
|
||||
@ -858,7 +858,7 @@ void FWObject::add(FWObject *obj, bool validate)
|
||||
void FWObject::reparent(FWObject *obj, bool validate)
|
||||
{
|
||||
FWObject *old_parent = obj->getParent();
|
||||
if (old_parent != NULL && old_parent != this)
|
||||
if (old_parent != nullptr && old_parent != this)
|
||||
{
|
||||
old_parent->remove(obj, false);
|
||||
add(obj, validate);
|
||||
@ -896,8 +896,8 @@ void FWObject::insert_before(FWObject *o1, FWObject *obj)
|
||||
{
|
||||
checkReadOnly();
|
||||
|
||||
if (obj == NULL) return;
|
||||
if (o1 == NULL)
|
||||
if (obj == nullptr) return;
|
||||
if (o1 == nullptr)
|
||||
{
|
||||
insert(begin(), obj);
|
||||
_adopt(obj);
|
||||
@ -918,7 +918,7 @@ void FWObject::insert_after(FWObject *o1, FWObject *obj)
|
||||
{
|
||||
checkReadOnly();
|
||||
|
||||
if (obj == NULL) return;
|
||||
if (obj == nullptr) return;
|
||||
|
||||
list<FWObject*>::iterator m = find(begin(), end(), o1);
|
||||
if (m != end())
|
||||
@ -964,7 +964,7 @@ void FWObject::remove(FWObject *obj, bool delete_if_last)
|
||||
delete obj;
|
||||
}
|
||||
|
||||
obj->parent = NULL;
|
||||
obj->parent = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1130,7 +1130,7 @@ bool FWObject::verifyTree()
|
||||
FWObject *o_parent = o->getParent();
|
||||
if (o_parent != this)
|
||||
{
|
||||
if (o_parent != NULL)
|
||||
if (o_parent != nullptr)
|
||||
{
|
||||
cerr << "WARNING: Object " << o << " (name: '" << o->getName()
|
||||
<< "' type: " << o->getTypeName() << ")"
|
||||
@ -1264,7 +1264,7 @@ bool FWObject::isChildOf(FWObject *obj)
|
||||
cerr << endl;
|
||||
#endif
|
||||
FWObject *p=this;
|
||||
while (p!=NULL && p!=obj) p=p->getParent();
|
||||
while (p!=nullptr && p!=obj) p=p->getParent();
|
||||
return (p==obj);
|
||||
}
|
||||
|
||||
@ -1289,9 +1289,9 @@ FWObject* FWObject::getById (int id, bool recursive)
|
||||
int oid = o->getId();
|
||||
if(id==oid) return o;
|
||||
|
||||
if(recursive && (o=o->getById(id, true))!=NULL ) return o;
|
||||
if(recursive && (o=o->getById(id, true))!=nullptr ) return o;
|
||||
}
|
||||
return NULL; // not found
|
||||
return nullptr; // not found
|
||||
}
|
||||
|
||||
FWObject* FWObject::getFirstByType(const string &type_name) const
|
||||
@ -1335,7 +1335,7 @@ FWObjectTypedChildIterator FWObject::findByType(const std::string &type_name) co
|
||||
void FWObject::setDirty(bool f)
|
||||
{
|
||||
FWObjectDatabase *dbr = getRoot();
|
||||
if (dbr==NULL) return;
|
||||
if (dbr==nullptr) return;
|
||||
if (dbr==this) dirty = f;
|
||||
else dbr->dirty = f;
|
||||
}
|
||||
@ -1343,7 +1343,7 @@ void FWObject::setDirty(bool f)
|
||||
bool FWObject::isDirty()
|
||||
{
|
||||
FWObjectDatabase *dbr = getRoot();
|
||||
if (dbr==NULL) return false;
|
||||
if (dbr==nullptr) return false;
|
||||
return (dbr->dirty);
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ void FWObject::setReadOnly(bool f)
|
||||
bool FWObject::isReadOnly()
|
||||
{
|
||||
FWObjectDatabase *dbr = getRoot();
|
||||
if (dbr==NULL || dbr->busy) return false;
|
||||
if (dbr==nullptr || dbr->busy) return false;
|
||||
FWObject *p=this;
|
||||
while (p)
|
||||
{
|
||||
@ -1504,7 +1504,7 @@ FWObject::tree_iterator& FWObject::tree_iterator::operator++()
|
||||
}
|
||||
|
||||
FWObject *p = node;
|
||||
while (node->getParent()!=NULL)
|
||||
while (node->getParent()!=nullptr)
|
||||
{
|
||||
p = node->getParent();
|
||||
|
||||
@ -1591,7 +1591,7 @@ void FWObject::replaceReferenceInternal(int old_id, int new_id, int &counter)
|
||||
if (old_id == new_id) return;
|
||||
|
||||
FWReference *ref = FWReference::cast(this);
|
||||
if (ref==NULL)
|
||||
if (ref==nullptr)
|
||||
{
|
||||
for (FWObject::iterator j1=begin(); j1!=end(); ++j1)
|
||||
(*j1)->replaceReferenceInternal(old_id, new_id, counter);
|
||||
@ -1607,7 +1607,7 @@ void FWObject::replaceReferenceInternal(int old_id, int new_id, int &counter)
|
||||
|
||||
void FWObject::findDependencies(list<FWObject*> &deps)
|
||||
{
|
||||
int loop_id = time(NULL);
|
||||
int loop_id = time(nullptr);
|
||||
_findDependencies_internal(this, deps, loop_id);
|
||||
}
|
||||
|
||||
@ -1615,9 +1615,9 @@ void FWObject::_findDependencies_internal(FWObject *obj,
|
||||
list<FWObject*> &deps,
|
||||
int anti_loop_id)
|
||||
{
|
||||
if (obj==NULL) return;
|
||||
if (obj==nullptr) return;
|
||||
if (FWOptions::cast(obj)) return;
|
||||
if (FWReference::cast(obj)!=NULL)
|
||||
if (FWReference::cast(obj)!=nullptr)
|
||||
{
|
||||
_findDependencies_internal(FWReference::cast(obj)->getPointer(),
|
||||
deps, anti_loop_id);
|
||||
|
||||
@ -55,7 +55,7 @@ void FWOptions::fromXML(xmlNodePtr root)
|
||||
if (cur && !xmlIsBlankNode(cur))
|
||||
{
|
||||
n = FROMXMLCAST(xmlGetProp(cur,TOXMLCAST("name")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
cont = FROMXMLCAST( xmlNodeGetContent(cur) );
|
||||
if (cont)
|
||||
{
|
||||
@ -72,9 +72,9 @@ xmlNodePtr FWOptions::toXML(xmlNodePtr root)
|
||||
xmlNodePtr opt;
|
||||
|
||||
xmlNodePtr me = xmlNewChild(
|
||||
root, NULL,
|
||||
root, nullptr,
|
||||
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
for(map<string, string>::const_iterator i=data.begin(); i!=data.end(); ++i)
|
||||
{
|
||||
@ -87,7 +87,7 @@ xmlNodePtr FWOptions::toXML(xmlNodePtr root)
|
||||
STRTOXMLCAST(value) );
|
||||
// xmlChar *valbuf = xmlEncodeEntitiesReentrant(root->doc,
|
||||
// STRTOXMLCAST(value) );
|
||||
opt = xmlNewChild(me, NULL, TOXMLCAST("Option"), valbuf);
|
||||
opt = xmlNewChild(me, nullptr, TOXMLCAST("Option"), valbuf);
|
||||
FREEXMLBUFF(valbuf);
|
||||
|
||||
xmlNewProp(opt, TOXMLCAST("name") , STRTOXMLCAST(name));
|
||||
|
||||
@ -48,7 +48,7 @@ FWReference::FWReference(FWObject *p)
|
||||
|
||||
FWReference::FWReference()
|
||||
{
|
||||
setPointer(NULL);
|
||||
setPointer(nullptr);
|
||||
}
|
||||
|
||||
FWReference::~FWReference() {}
|
||||
@ -56,11 +56,11 @@ FWReference::~FWReference() {}
|
||||
|
||||
void FWReference::fromXML(xmlNodePtr root)
|
||||
{
|
||||
assert(root!=NULL);
|
||||
assert(root!=nullptr);
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ref")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
str_ref = n;
|
||||
//setInt("ref", n);
|
||||
// if object with id str_ref has not been loaded yet,
|
||||
@ -75,9 +75,9 @@ xmlNodePtr FWReference::toXML(xmlNodePtr parent)
|
||||
{
|
||||
xmlNodePtr me = xmlNewChild(
|
||||
parent,
|
||||
NULL,
|
||||
nullptr,
|
||||
xml_name.empty() ? STRTOXMLCAST(getTypeName()) : STRTOXMLCAST(xml_name),
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
if (int_ref == -1 && !str_ref.empty())
|
||||
int_ref = FWObjectDatabase::getIntId(str_ref);
|
||||
@ -102,7 +102,7 @@ FWObject& FWReference::shallowDuplicate(const FWObject *_other,
|
||||
bool FWReference::cmp(const FWObject *obj, bool /* UNUSED recursive */)
|
||||
{
|
||||
const FWReference *rx = FWReference::constcast(obj);
|
||||
if (rx == NULL) return false;
|
||||
if (rx == nullptr) return false;
|
||||
if (int_ref != rx->int_ref || str_ref != rx->str_ref) return false;
|
||||
return true;
|
||||
}
|
||||
@ -167,7 +167,7 @@ void FWReference::dump(std::ostream &f, bool recursive, bool brief, int offset)
|
||||
|
||||
FWObject* FWReference::getObject(FWObject* o)
|
||||
{
|
||||
if (o==NULL) return NULL;
|
||||
if (FWReference::cast(o)!=NULL) return FWReference::cast(o)->getPointer();
|
||||
if (o==nullptr) return nullptr;
|
||||
if (FWReference::cast(o)!=nullptr) return FWReference::cast(o)->getPointer();
|
||||
return o;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ Firewall::Firewall()
|
||||
void Firewall::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *opt = getFirstByType(FirewallOptions::TYPENAME);
|
||||
if (opt == NULL)
|
||||
if (opt == nullptr)
|
||||
{
|
||||
add( root->createFirewallOptions() );
|
||||
RuleSet *p;
|
||||
@ -87,45 +87,45 @@ Firewall::~Firewall() {}
|
||||
void Firewall::fromXML(xmlNodePtr root)
|
||||
{
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("platform")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("platform", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("version")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("version", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("host_OS")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("host_OS", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastModified")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("lastModified", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastInstalled")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("lastInstalled", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lastCompiled")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("lastCompiled", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("inactive")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("inactive", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -344,12 +344,12 @@ FWObject& Firewall::duplicateForUndo(const FWObject *obj)
|
||||
|
||||
void Firewall::updateLastInstalledTimestamp()
|
||||
{
|
||||
setInt("lastInstalled",time(NULL));
|
||||
setInt("lastInstalled",time(nullptr));
|
||||
}
|
||||
|
||||
void Firewall::updateLastModifiedTimestamp()
|
||||
{
|
||||
setInt("lastModified",time(NULL));
|
||||
setInt("lastModified",time(nullptr));
|
||||
}
|
||||
|
||||
bool Firewall::needsInstall()
|
||||
@ -382,7 +382,7 @@ time_t Firewall::getLastCompiled()
|
||||
}
|
||||
void Firewall::updateLastCompiledTimestamp()
|
||||
{
|
||||
setInt("lastCompiled",time(NULL));
|
||||
setInt("lastCompiled",time(nullptr));
|
||||
}
|
||||
|
||||
bool Firewall::getInactive()
|
||||
|
||||
@ -96,8 +96,8 @@ bool Group::hasMember(FWObject *o)
|
||||
FWObject& Group::duplicateForUndo(const FWObject *obj)
|
||||
{
|
||||
setRO(false);
|
||||
if ((obj->size() && FWReference::cast(obj->front())!=NULL) ||
|
||||
(this->size() && FWReference::cast(this->front())!=NULL))
|
||||
if ((obj->size() && FWReference::cast(obj->front())!=nullptr) ||
|
||||
(this->size() && FWReference::cast(this->front())!=nullptr))
|
||||
{
|
||||
destroyChildren();
|
||||
for(list<FWObject*>::const_iterator m=obj->begin(); m!=obj->end(); ++m)
|
||||
|
||||
@ -48,7 +48,7 @@ Host::Host()
|
||||
void Host::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *opt = getFirstByType(HostOptions::TYPENAME);
|
||||
if (opt == NULL)
|
||||
if (opt == nullptr)
|
||||
add( root->createHostOptions() );
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ xmlNodePtr Host::toXML(xmlNodePtr parent)
|
||||
FWObject *o;
|
||||
|
||||
for(FWObjectTypedChildIterator j=findByType(Interface::TYPENAME); j!=j.end(); ++j)
|
||||
if((o=(*j))!=NULL )
|
||||
if((o=(*j))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
o=getFirstByType( Management::TYPENAME );
|
||||
@ -146,13 +146,13 @@ const InetAddr* Host::getManagementAddress()
|
||||
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Address* Host::getAddressObject() const
|
||||
{
|
||||
FWObjectTypedChildIterator j = findByType(Interface::TYPENAME);
|
||||
if (j == j.end()) return NULL;
|
||||
if (j == j.end()) return nullptr;
|
||||
return Interface::cast(*j)->getAddressObject();
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ int Host::countInetAddresses(bool skip_loopback) const
|
||||
FWObject* Host::getParentHost(FWObject *obj)
|
||||
{
|
||||
FWObject *parent_h = obj;
|
||||
while (parent_h != NULL && Host::cast(parent_h) == NULL)
|
||||
while (parent_h != nullptr && Host::cast(parent_h) == nullptr)
|
||||
parent_h = parent_h->getParent();
|
||||
return parent_h;
|
||||
}
|
||||
|
||||
@ -52,12 +52,12 @@ void ICMPService::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("type")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("type", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("code")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("code", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -94,82 +94,82 @@ void IPService::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("protocol_num")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("protocol_num", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("fragm")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("fragm", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("short_fragm")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("short_fragm", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("any_opt")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("any_opt", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("lsrr")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("lsrr", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("ssrr")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("ssrr", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rr")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("rr", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("ts")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("ts", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("tos")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("tos", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dscp")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("dscp", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rtralt")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("rtralt", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("rtralt_value")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("rtralt_value", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -66,7 +66,7 @@ void IPv4::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
|
||||
// strip whitespace and other non-numeric characters at the beginng and end
|
||||
string addr(n);
|
||||
@ -83,7 +83,7 @@ void IPv4::fromXML(xmlNodePtr root)
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
|
||||
string netm(n);
|
||||
first = netm.find_first_of("0123456789");
|
||||
|
||||
@ -81,12 +81,12 @@ void IPv6::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setAddress(InetAddr(AF_INET6, n));
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
if (strlen(n))
|
||||
{
|
||||
if (string(n).find(":")!=string::npos)
|
||||
|
||||
@ -69,11 +69,11 @@ InetAddrMask::InetAddrMask(bool)
|
||||
// variables. This constructor should only be used by classes that
|
||||
// inherit InetAddrMask and create address, netmask themselves,
|
||||
// such as Inet6AddrMask
|
||||
address = NULL;
|
||||
netmask = NULL;
|
||||
broadcast_address = NULL;
|
||||
network_address = NULL;
|
||||
last_host = NULL;
|
||||
address = nullptr;
|
||||
netmask = nullptr;
|
||||
broadcast_address = nullptr;
|
||||
network_address = nullptr;
|
||||
last_host = nullptr;
|
||||
}
|
||||
|
||||
InetAddrMask::InetAddrMask()
|
||||
@ -146,11 +146,11 @@ InetAddrMask::InetAddrMask(const string &s)
|
||||
|
||||
InetAddrMask::~InetAddrMask()
|
||||
{
|
||||
if (address!=NULL) delete address;
|
||||
if (netmask!=NULL) delete netmask;
|
||||
if (network_address!=NULL) delete network_address;
|
||||
if (broadcast_address!=NULL) delete broadcast_address;
|
||||
if (last_host!=NULL) delete last_host;
|
||||
if (address!=nullptr) delete address;
|
||||
if (netmask!=nullptr) delete netmask;
|
||||
if (network_address!=nullptr) delete network_address;
|
||||
if (broadcast_address!=nullptr) delete broadcast_address;
|
||||
if (last_host!=nullptr) delete last_host;
|
||||
}
|
||||
|
||||
bool InetAddrMask::isAny()
|
||||
|
||||
@ -105,7 +105,7 @@ FWObject& Interface::duplicate(const FWObject *x, bool preserve_id)
|
||||
FWObject::duplicate(x, preserve_id);
|
||||
|
||||
const Interface *rx = Interface::constcast(x);
|
||||
if (rx!=NULL)
|
||||
if (rx!=nullptr)
|
||||
{
|
||||
bcast_bits = rx->bcast_bits;
|
||||
ostatus = rx->ostatus;
|
||||
@ -130,7 +130,7 @@ void Interface::duplicateWithIdMapping(const FWObject *src,
|
||||
{
|
||||
FWObject *src_obj = *m;
|
||||
FWObject *dst_obj_copy = addCopyOf(src_obj, preserve_id);
|
||||
if (src_obj!=NULL && dst_obj_copy!=NULL)
|
||||
if (src_obj!=nullptr && dst_obj_copy!=nullptr)
|
||||
id_mapping[src_obj->getId()] = dst_obj_copy->getId();
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ void Interface::duplicateWithIdMapping(const FWObject *src,
|
||||
bool Interface::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
const Interface *rx = Interface::constcast(obj);
|
||||
if (rx == NULL) return false;
|
||||
if (rx == nullptr) return false;
|
||||
if (bcast_bits != rx->bcast_bits ||
|
||||
ostatus != rx->ostatus ||
|
||||
snmp_type != rx->snmp_type) return false;
|
||||
@ -154,56 +154,56 @@ void Interface::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("security_level")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("security_level",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dyn")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("dyn",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("unnum")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("unnum",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("unprotected")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("unprotected",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dedicated_failover")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("dedicated_failover",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("mgmt")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("mgmt",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("label")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("label",n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("network_zone")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("network_zone", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -230,19 +230,19 @@ xmlNodePtr Interface::toXML(xmlNodePtr parent)
|
||||
for(FWObjectTypedChildIterator j1=findByType(IPv4::TYPENAME);
|
||||
j1!=j1.end(); ++j1)
|
||||
{
|
||||
if ((o=(*j1))!=NULL )
|
||||
if ((o=(*j1))!=nullptr )
|
||||
o->toXML(me);
|
||||
}
|
||||
for(FWObjectTypedChildIterator j1=findByType(IPv6::TYPENAME);
|
||||
j1!=j1.end(); ++j1)
|
||||
{
|
||||
if ((o=(*j1))!=NULL )
|
||||
if ((o=(*j1))!=nullptr )
|
||||
o->toXML(me);
|
||||
}
|
||||
for(FWObjectTypedChildIterator j2=findByType(physAddress::TYPENAME);
|
||||
j2!=j2.end(); ++j2)
|
||||
{
|
||||
if ((o=(*j2))!=NULL )
|
||||
if ((o=(*j2))!=nullptr )
|
||||
o->toXML(me);
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ xmlNodePtr Interface::toXML(xmlNodePtr parent)
|
||||
for(FWObjectTypedChildIterator j1=findByType(Interface::TYPENAME);
|
||||
j1!=j1.end(); ++j1)
|
||||
{
|
||||
if((o=(*j1))!=NULL)
|
||||
if((o=(*j1))!=nullptr)
|
||||
o->toXML(me);
|
||||
}
|
||||
|
||||
@ -276,14 +276,14 @@ FWOptions* Interface::getOptionsObject()
|
||||
{
|
||||
FWOptions *iface_opt = FWOptions::cast(getFirstByType(InterfaceOptions::TYPENAME));
|
||||
|
||||
if (iface_opt == NULL)
|
||||
if (iface_opt == nullptr)
|
||||
{
|
||||
iface_opt = FWOptions::cast(getRoot()->create(InterfaceOptions::TYPENAME));
|
||||
add(iface_opt);
|
||||
|
||||
// set default interface options
|
||||
const FWObject *parent_host = Host::getParentHost(this);
|
||||
if (parent_host != NULL)
|
||||
if (parent_host != nullptr)
|
||||
{
|
||||
const string host_OS = parent_host->getStr("host_OS");
|
||||
try
|
||||
@ -303,7 +303,7 @@ FWOptions* Interface::getOptionsObject()
|
||||
FWOptions* Interface::getOptionsObjectConst() const
|
||||
{
|
||||
FWOptions *iface_opt = FWOptions::cast(getFirstByType(InterfaceOptions::TYPENAME));
|
||||
if (iface_opt == NULL)
|
||||
if (iface_opt == nullptr)
|
||||
cerr << "Interface "
|
||||
<< getName()
|
||||
<< " ("
|
||||
@ -437,7 +437,7 @@ physAddress* Interface::getPhysicalAddress () const
|
||||
void Interface::setPhysicalAddress(const std::string &paddr)
|
||||
{
|
||||
physAddress *pa=getPhysicalAddress();
|
||||
if (pa!=NULL)
|
||||
if (pa!=nullptr)
|
||||
{
|
||||
pa->setPhysAddress(paddr);
|
||||
} else
|
||||
@ -461,7 +461,7 @@ void Interface::setLabel(const string& n)
|
||||
const Address* Interface::getAddressObject() const
|
||||
{
|
||||
Address *res = Address::cast(getFirstByType(IPv4::TYPENAME));
|
||||
if (res==NULL)
|
||||
if (res==nullptr)
|
||||
res = Address::cast(getFirstByType(IPv6::TYPENAME));
|
||||
return res;
|
||||
}
|
||||
@ -493,7 +493,7 @@ int Interface::countInetAddresses(bool skip_loopback) const
|
||||
|
||||
bool Interface::isFailoverInterface() const
|
||||
{
|
||||
return getFirstByType(FailoverClusterGroup::TYPENAME) != NULL;
|
||||
return getFirstByType(FailoverClusterGroup::TYPENAME) != nullptr;
|
||||
}
|
||||
|
||||
void Interface::replaceReferenceInternal(int old_id, int new_id, int &counter)
|
||||
|
||||
@ -63,7 +63,7 @@ InterfaceData::InterfaceData(const InterfaceData& other) : addr_mask()
|
||||
InetAddrMask *am;
|
||||
const InetAddr *ad = (*i)->getAddressPtr();
|
||||
const InetAddr *nm = (*i)->getNetmaskPtr();
|
||||
if (ad==NULL) continue;
|
||||
if (ad==nullptr) continue;
|
||||
if (ad->isV6())
|
||||
{
|
||||
am = new Inet6AddrMask();
|
||||
@ -109,7 +109,7 @@ InterfaceData::InterfaceData(const Interface &iface) : addr_mask()
|
||||
isUnnumbered = iface.isUnnumbered();
|
||||
isBridgePort = iface.isBridgePort();
|
||||
libfwbuilder::physAddress *pa = iface.getPhysicalAddress();
|
||||
if (pa!=NULL)
|
||||
if (pa!=nullptr)
|
||||
mac_addr = pa->getPhysAddress();
|
||||
label = iface.getLabel();
|
||||
networkZone = iface.getStr("network_zone");
|
||||
|
||||
@ -184,42 +184,42 @@ void Interval::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_minute")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_minute", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_hour")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_hour", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_day")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_day", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_month")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_month", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_year")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_year", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("from_weekday")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("from_weekday", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -227,49 +227,49 @@ void Interval::fromXML(xmlNodePtr root)
|
||||
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_minute")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_minute", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_hour")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_hour", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_day")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_day", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_month")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_month", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_year")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_year", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("to_weekday")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("to_weekday", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("days_of_week")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
setStr("days_of_week", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -43,7 +43,7 @@ IntervalGroup::~IntervalGroup() {}
|
||||
bool IntervalGroup::validateChild(FWObject *o)
|
||||
{
|
||||
FWObject *oo = o;
|
||||
if (FWObjectReference::cast(o)!=NULL)
|
||||
if (FWObjectReference::cast(o)!=nullptr)
|
||||
oo = FWObjectReference::cast(o)->getPointer();
|
||||
|
||||
string otype = oo->getTypeName();
|
||||
|
||||
@ -49,7 +49,7 @@ bool Library::validateChild(FWObject*)
|
||||
void Library::fromXML(xmlNodePtr root)
|
||||
{
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("color")));
|
||||
if(n!=NULL) // color is not a mandatory attribute
|
||||
if(n!=nullptr) // color is not a mandatory attribute
|
||||
{
|
||||
setStr("color", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -105,7 +105,7 @@ xmlNodePtr Management::toXML(xmlNodePtr parent)
|
||||
|
||||
bool Management::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (Management::constcast(obj)==NULL) return false;
|
||||
if (Management::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const Management *o2=Management::constcast(obj);
|
||||
@ -242,7 +242,7 @@ xmlNodePtr PolicyInstallScript::toXML(xmlNodePtr parent)
|
||||
|
||||
bool PolicyInstallScript::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (PolicyInstallScript::constcast(obj)==NULL) return false;
|
||||
if (PolicyInstallScript::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const PolicyInstallScript *o2=PolicyInstallScript::constcast(obj);
|
||||
@ -348,7 +348,7 @@ xmlNodePtr SNMPManagement::toXML(xmlNodePtr parent)
|
||||
|
||||
bool SNMPManagement::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (SNMPManagement::constcast(obj)==NULL) return false;
|
||||
if (SNMPManagement::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const SNMPManagement *o2=SNMPManagement::constcast(obj);
|
||||
@ -424,12 +424,12 @@ void FWBDManagement::setEnabled(bool v)
|
||||
void FWBDManagement::fromXML(xmlNodePtr parent)
|
||||
{
|
||||
const char *n=FROMXMLCAST(xmlGetProp(parent,TOXMLCAST("identity")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
identity_id = n;
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(parent,TOXMLCAST("port")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
port = atoi(n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -456,7 +456,7 @@ xmlNodePtr FWBDManagement::toXML(xmlNodePtr parent)
|
||||
|
||||
bool FWBDManagement::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (FWBDManagement::constcast(obj)==NULL) return false;
|
||||
if (FWBDManagement::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const FWBDManagement *o2=FWBDManagement::constcast(obj);
|
||||
|
||||
@ -47,7 +47,7 @@ NAT::~NAT() {}
|
||||
Rule* NAT::createRule()
|
||||
{
|
||||
FWObjectDatabase* db=getRoot();
|
||||
assert(db!=NULL);
|
||||
assert(db!=nullptr);
|
||||
return db->createNATRule();
|
||||
}
|
||||
|
||||
|
||||
@ -64,12 +64,12 @@ void Network::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setAddress(InetAddr(n));
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setNetmask(InetAddr(n));
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
@ -120,12 +120,12 @@ const InetAddr* Network::getFirstHostPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getFirstHostPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const InetAddr* Network::getLastHostPtr() const
|
||||
{
|
||||
const InetAddrMask *inet_addr_mask = getInetAddrMaskObjectPtr();
|
||||
if (inet_addr_mask) return inet_addr_mask->getLastHostPtr();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -78,12 +78,12 @@ void NetworkIPv6::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setAddress(InetAddr(AF_INET6, n));
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("netmask")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
if (strlen(n))
|
||||
{
|
||||
if (string(n).find(":")!=string::npos)
|
||||
|
||||
@ -58,14 +58,14 @@ ObjectGroup::~ObjectGroup() {}
|
||||
|
||||
bool ObjectGroup::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
|
||||
return (FWObject::validateChild(o) &&
|
||||
Service::cast(o)==NULL &&
|
||||
ServiceGroup::cast(o)==NULL &&
|
||||
Interval::cast(o)==NULL &&
|
||||
FWServiceReference::cast(o)==NULL &&
|
||||
RuleSet::cast(o)==NULL);
|
||||
Service::cast(o)==nullptr &&
|
||||
ServiceGroup::cast(o)==nullptr &&
|
||||
Interval::cast(o)==nullptr &&
|
||||
FWServiceReference::cast(o)==nullptr &&
|
||||
RuleSet::cast(o)==nullptr);
|
||||
}
|
||||
|
||||
xmlNodePtr ObjectGroup::toXML(xmlNodePtr parent)
|
||||
|
||||
@ -94,7 +94,7 @@ bool ObjectMatcher::complexMatch(Address *obj1, Address *obj2)
|
||||
}
|
||||
|
||||
void* res = obj1->dispatch(this, obj2);
|
||||
return (res != NULL);
|
||||
return (res != nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,11 +279,11 @@ void* ObjectMatcher::dispatch(Interface* obj1, void* _obj2)
|
||||
|
||||
if (obj1->getParent()->getId() == obj2->getId()) return obj1;
|
||||
|
||||
if (!obj1->isRegular()) return NULL;
|
||||
if ((obj1->getByType(IPv4::TYPENAME)).size()>1) return NULL;
|
||||
if ((obj1->getByType(IPv6::TYPENAME)).size()>1) return NULL;
|
||||
if (!obj1->isRegular()) return nullptr;
|
||||
if ((obj1->getByType(IPv4::TYPENAME)).size()>1) return nullptr;
|
||||
if ((obj1->getByType(IPv6::TYPENAME)).size()>1) return nullptr;
|
||||
|
||||
return (checkComplexMatchForSingleAddress(obj1, obj2)) ? obj1 : NULL;
|
||||
return (checkComplexMatchForSingleAddress(obj1, obj2)) ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(Network *obj1, void *_obj2)
|
||||
@ -306,10 +306,10 @@ void* ObjectMatcher::dispatch(Network *obj1, void *_obj2)
|
||||
* ranges, and some often used ranges trigger that (like
|
||||
* "255.255.255.255-255.255.255.255" or "0.0.0.0-0.0.0.0")
|
||||
*/
|
||||
if (!obj1->getNetmaskPtr()->isHostMask()) return NULL;
|
||||
if (!obj1->getNetmaskPtr()->isHostMask()) return nullptr;
|
||||
} else
|
||||
return NULL;
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
|
||||
return nullptr;
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(NetworkIPv6 *obj1, void *_obj2)
|
||||
@ -320,23 +320,23 @@ void* ObjectMatcher::dispatch(NetworkIPv6 *obj1, void *_obj2)
|
||||
{
|
||||
if (recognize_multicasts && inet_addr->isMulticast() &&
|
||||
Firewall::isA(obj2)) return obj1;
|
||||
if (!obj1->getNetmaskPtr()->isHostMask()) return NULL;
|
||||
if (!obj1->getNetmaskPtr()->isHostMask()) return nullptr;
|
||||
} else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(IPv4 *obj1, void *_obj2)
|
||||
{
|
||||
FWObject *obj2 = (FWObject*)(_obj2);
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(IPv6 *obj1, void *_obj2)
|
||||
{
|
||||
FWObject *obj2 = (FWObject*)(_obj2);
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : NULL;
|
||||
return checkComplexMatchForSingleAddress(obj1, obj2) ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(physAddress *obj1, void *_obj2)
|
||||
@ -348,7 +348,7 @@ void* ObjectMatcher::dispatch(physAddress *obj1, void *_obj2)
|
||||
physAddress *iface_pa = physAddress::cast(*i);
|
||||
if (obj1->getPhysAddress() == iface_pa->getPhysAddress()) return obj1;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(AddressRange *obj1, void *_obj2)
|
||||
@ -425,14 +425,14 @@ void* ObjectMatcher::dispatch(AddressRange *obj1, void *_obj2)
|
||||
if (f_b <= 0 && f_e >= 0) return obj1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
bool f_b = checkComplexMatchForSingleAddress(&range_start, obj2);
|
||||
bool f_e = checkComplexMatchForSingleAddress(&range_end, obj2);
|
||||
|
||||
if (address_range_match_mode == EXACT && f_b && f_e) return obj1;
|
||||
if (address_range_match_mode == PARTIAL && (f_b || f_e)) return obj1;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -447,7 +447,7 @@ void* ObjectMatcher::dispatch(MultiAddressRunTime *obj1, void *_obj2)
|
||||
obj1->getSourceName() == "self" && Firewall::isA(obj2))
|
||||
return obj1;
|
||||
|
||||
return NULL; // never matches in this implementation
|
||||
return nullptr; // never matches in this implementation
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(Host *obj1, void *_obj2)
|
||||
@ -464,7 +464,7 @@ void* ObjectMatcher::dispatch(Host *obj1, void *_obj2)
|
||||
{
|
||||
res &= checkComplexMatchForSingleAddress(Interface::cast(*it), obj2);
|
||||
}
|
||||
return res ? obj1 : NULL;
|
||||
return res ? obj1 : nullptr;
|
||||
}
|
||||
|
||||
void* ObjectMatcher::dispatch(Firewall *obj1, void *_obj2)
|
||||
@ -499,7 +499,7 @@ void* ObjectMatcher::dispatch(Cluster *obj1, void *_obj2)
|
||||
list<Firewall*>::iterator it;
|
||||
for (it=members.begin(); it!=members.end(); ++it)
|
||||
{
|
||||
if (dispatch(*it, obj2) != NULL) return obj1;
|
||||
if (dispatch(*it, obj2) != nullptr) return obj1;
|
||||
}
|
||||
/*
|
||||
* match only if all interfaces of obj1 match obj2
|
||||
|
||||
@ -48,7 +48,7 @@ using namespace std;
|
||||
|
||||
Service* ObjectMirror::getMirroredService(Service *obj)
|
||||
{
|
||||
void* res = obj->dispatch(this, (void*)NULL);
|
||||
void* res = obj->dispatch(this, (void*)nullptr);
|
||||
return Service::cast((FWObject*)(res));
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ Policy::~Policy() {}
|
||||
Rule* Policy::createRule()
|
||||
{
|
||||
FWObjectDatabase* db=getRoot();
|
||||
assert(db!=NULL);
|
||||
assert(db!=nullptr);
|
||||
return db->createPolicyRule();
|
||||
}
|
||||
|
||||
|
||||
@ -59,22 +59,22 @@ using namespace std;
|
||||
const string Resources::PLATFORM_RES_DIR_NAME = "platform";
|
||||
const string Resources::OS_RES_DIR_NAME = "os";
|
||||
|
||||
Resources* Resources::global_res = NULL;
|
||||
Resources* Resources::global_res = nullptr;
|
||||
map<string,Resources*> Resources::platform_res;
|
||||
map<string,Resources*> Resources::os_res;
|
||||
|
||||
|
||||
Resources::Resources()
|
||||
{
|
||||
doc=NULL;
|
||||
doc=nullptr;
|
||||
}
|
||||
|
||||
Resources::Resources(const string &_resF)
|
||||
{
|
||||
doc = NULL;
|
||||
doc = nullptr;
|
||||
resfile = _resF;
|
||||
|
||||
if (global_res==NULL)
|
||||
if (global_res==nullptr)
|
||||
{
|
||||
global_res = this;
|
||||
loadRes(_resF);
|
||||
@ -109,7 +109,7 @@ string Resources::getXmlNodeContent(xmlNodePtr node)
|
||||
{
|
||||
string res;
|
||||
char* cptr= (char*)( xmlNodeGetContent(node) );
|
||||
if (cptr!=NULL)
|
||||
if (cptr!=nullptr)
|
||||
{
|
||||
res=cptr;
|
||||
FREEXMLBUFF(cptr);
|
||||
@ -121,7 +121,7 @@ string Resources::getXmlNodeProp(xmlNodePtr node,string prop)
|
||||
{
|
||||
string res;
|
||||
char* cptr=(char*)( xmlGetProp(node,TOXMLCAST(prop.c_str())));
|
||||
if (cptr!=NULL)
|
||||
if (cptr!=nullptr)
|
||||
{
|
||||
res=cptr;
|
||||
FREEXMLBUFF(cptr);
|
||||
@ -394,7 +394,7 @@ string Resources::getRuleElementResourceStr(const string &rel,
|
||||
|
||||
xmlNodePtr dptr=Resources::global_res->getXmlNode("FWBuilderResources/RuleElements");
|
||||
|
||||
assert (dptr!=NULL);
|
||||
assert (dptr!=nullptr);
|
||||
|
||||
for(c=dptr->xmlChildrenNode; c; c=c->next)
|
||||
{
|
||||
@ -463,7 +463,7 @@ string Resources::getTreeIconFileName(const FWObject *o)
|
||||
void Resources::setDefaultOption(FWObject *o,const string &xml_node)
|
||||
{
|
||||
xmlNodePtr pn = XMLTools::getXmlNodeByPath(root,xml_node.c_str());
|
||||
if (pn==NULL) return;
|
||||
if (pn==nullptr) return;
|
||||
|
||||
string optname=FROMXMLCAST(pn->name);
|
||||
string optval =getXmlNodeContent(pn);
|
||||
@ -473,7 +473,7 @@ void Resources::setDefaultOption(FWObject *o,const string &xml_node)
|
||||
void Resources::setDefaultOptionsAll(FWObject *o,const string &xml_node)
|
||||
{
|
||||
xmlNodePtr pn = XMLTools::getXmlNodeByPath(root , xml_node.c_str() );
|
||||
if (pn==NULL) return;
|
||||
if (pn==nullptr) return;
|
||||
|
||||
xmlNodePtr opt;
|
||||
|
||||
@ -488,11 +488,11 @@ void Resources::setDefaultOptionsAll(FWObject *o,const string &xml_node)
|
||||
void Resources::setDefaultTargetOptions(const string &target,Firewall *fw)
|
||||
{
|
||||
FWOptions *opt=fw->getOptionsObject();
|
||||
Resources *r=NULL;
|
||||
Resources *r=nullptr;
|
||||
|
||||
if (platform_res.count(target)!=0) r=platform_res[target];
|
||||
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==NULL)
|
||||
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==nullptr)
|
||||
throw FWException("Support module for target '"+target+"' is not available");
|
||||
|
||||
r->setDefaultOptionsAll(opt,"/FWBuilderResources/Target/options/default");
|
||||
@ -502,16 +502,16 @@ void Resources::setDefaultIfaceOptions(const string &target,Interface *iface)
|
||||
{
|
||||
FWOptions *opt=iface->getOptionsObject();
|
||||
/* if InterfaceOptions object does not yet exist -> create one */
|
||||
if (opt == NULL) {
|
||||
if (opt == nullptr) {
|
||||
iface->add(iface->getRoot()->create(InterfaceOptions::TYPENAME));
|
||||
opt = iface->getOptionsObject();
|
||||
}
|
||||
|
||||
Resources *r=NULL;
|
||||
Resources *r=nullptr;
|
||||
|
||||
if (platform_res.count(target)!=0) r=platform_res[target];
|
||||
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==NULL)
|
||||
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==nullptr)
|
||||
throw FWException("Support module for target '"+target+"' is not available");
|
||||
|
||||
r->setDefaultOptionsAll(opt,"/FWBuilderResources/Target/options/interface");
|
||||
@ -534,11 +534,11 @@ void Resources::setDefaultProperties(FWObject *obj)
|
||||
string Resources::getTargetCapabilityStr(const string &target,
|
||||
const string &cap_name)
|
||||
{
|
||||
Resources *r=NULL;
|
||||
Resources *r=nullptr;
|
||||
|
||||
if (platform_res.count(target)!=0) r=platform_res[target];
|
||||
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==NULL)
|
||||
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==nullptr)
|
||||
throw FWException("Support module for target '"+target+"' is not available");
|
||||
|
||||
return r->getResourceStr("/FWBuilderResources/Target/capabilities/"+cap_name);
|
||||
@ -574,11 +574,11 @@ string Resources::getActionEditor(const string &target, const string &action)
|
||||
string Resources::getTargetOptionStr(const string &target,
|
||||
const string &opt_name)
|
||||
{
|
||||
Resources *r=NULL;
|
||||
Resources *r=nullptr;
|
||||
|
||||
if (platform_res.count(target)!=0) r=platform_res[target];
|
||||
if (r==NULL && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==NULL)
|
||||
if (r==nullptr && os_res.count(target)!=0) r=os_res[target];
|
||||
if (r==nullptr)
|
||||
throw FWException("Support module for target '"+target+"' is not available");
|
||||
|
||||
return r->getResourceStr("/FWBuilderResources/Target/options/"+opt_name);
|
||||
|
||||
@ -50,7 +50,7 @@ Routing::~Routing() {}
|
||||
Rule* Routing::createRule()
|
||||
{
|
||||
FWObjectDatabase* db=getRoot();
|
||||
assert(db!=NULL);
|
||||
assert(db!=nullptr);
|
||||
return db->createRoutingRule();
|
||||
}
|
||||
|
||||
|
||||
@ -63,8 +63,8 @@ void Rule::init(FWObjectDatabase*)
|
||||
{
|
||||
}
|
||||
|
||||
FWOptions* Rule::getOptionsObject() const { return NULL; }
|
||||
RuleSet* Rule::getBranch() { return NULL; }
|
||||
FWOptions* Rule::getOptionsObject() const { return nullptr; }
|
||||
RuleSet* Rule::getBranch() { return nullptr; }
|
||||
void Rule::setPosition(int n) { setInt("position", n); }
|
||||
int Rule::getPosition() const { return getInt("position"); }
|
||||
void Rule::disable() { setBool("disabled",true); }
|
||||
@ -117,33 +117,33 @@ PolicyRule::PolicyRule()
|
||||
// setStr("action","Deny");
|
||||
setAction(PolicyRule::Deny);
|
||||
|
||||
src_re = NULL;
|
||||
dst_re = NULL;
|
||||
srv_re = NULL;
|
||||
itf_re = NULL;
|
||||
when_re = NULL;
|
||||
src_re = nullptr;
|
||||
dst_re = nullptr;
|
||||
srv_re = nullptr;
|
||||
itf_re = nullptr;
|
||||
when_re = nullptr;
|
||||
}
|
||||
|
||||
void PolicyRule::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *re = getFirstByType(RuleElementSrc::TYPENAME);
|
||||
|
||||
if (re == NULL)
|
||||
if (re == nullptr)
|
||||
{
|
||||
// <!ELEMENT PolicyRule (Src,Dst,Srv?,Itf?,When?,PolicyRuleOptions?)>
|
||||
re = root->createRuleElementSrc(); assert(re!=NULL);
|
||||
re = root->createRuleElementSrc(); assert(re!=nullptr);
|
||||
add(re); src_re = RuleElementSrc::cast(re);
|
||||
|
||||
re = root->createRuleElementDst(); assert(re!=NULL);
|
||||
re = root->createRuleElementDst(); assert(re!=nullptr);
|
||||
add(re); dst_re = RuleElementDst::cast(re);
|
||||
|
||||
re = root->createRuleElementSrv(); assert(re!=NULL);
|
||||
re = root->createRuleElementSrv(); assert(re!=nullptr);
|
||||
add(re); srv_re = RuleElementSrv::cast(re);
|
||||
|
||||
re = root->createRuleElementItf(); assert(re!=NULL);
|
||||
re = root->createRuleElementItf(); assert(re!=nullptr);
|
||||
add(re); itf_re = RuleElementItf::cast(re);
|
||||
|
||||
re = root->createRuleElementInterval(); assert(re!=NULL);
|
||||
re = root->createRuleElementInterval(); assert(re!=nullptr);
|
||||
add(re); when_re = RuleElementInterval::cast(re);
|
||||
|
||||
add( root->createPolicyRuleOptions() );
|
||||
@ -158,11 +158,11 @@ FWObject& PolicyRule::shallowDuplicate(const FWObject *x,
|
||||
setAction(rx->getAction());
|
||||
setLogging(rx->getLogging());
|
||||
|
||||
src_re = NULL;
|
||||
dst_re = NULL;
|
||||
srv_re = NULL;
|
||||
itf_re = NULL;
|
||||
when_re = NULL;
|
||||
src_re = nullptr;
|
||||
dst_re = nullptr;
|
||||
srv_re = nullptr;
|
||||
itf_re = nullptr;
|
||||
when_re = nullptr;
|
||||
|
||||
return Rule::shallowDuplicate(x, preserve_id);
|
||||
}
|
||||
@ -170,7 +170,7 @@ FWObject& PolicyRule::shallowDuplicate(const FWObject *x,
|
||||
bool PolicyRule::cmp(const FWObject *x, bool recursive)
|
||||
{
|
||||
const PolicyRule *rx = PolicyRule::constcast(x);
|
||||
if (rx == NULL) return false;
|
||||
if (rx == nullptr) return false;
|
||||
if (getDirection() != rx->getDirection() ||
|
||||
getAction() != rx->getAction() ||
|
||||
getLogging() != rx->getLogging()) return false;
|
||||
@ -436,26 +436,26 @@ xmlNodePtr PolicyRule::toXML(xmlNodePtr parent)
|
||||
*
|
||||
<!ELEMENT PolicyRule (Src,Dst,Srv?,Itf?,When?,PolicyRuleOptions?)>
|
||||
*/
|
||||
if ( (o=getFirstByType( RuleElementSrc::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementSrc::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementDst::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementDst::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementSrv::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementSrv::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementItf::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementItf::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( PolicyRuleOptions::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( PolicyRuleOptions::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
// there should be no children Policy objects in v3
|
||||
if ( (o=getFirstByType( Policy::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( Policy::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
return me;
|
||||
@ -487,10 +487,10 @@ void PolicyRule::updateNonStandardObjectReferences()
|
||||
|
||||
RuleSet* PolicyRule::getBranch()
|
||||
{
|
||||
if (getAction() != PolicyRule::Branch) return NULL;
|
||||
if (getAction() != PolicyRule::Branch) return nullptr;
|
||||
FWObject *fw = this;
|
||||
while (fw && Firewall::cast(fw) == NULL) fw = fw->getParent();
|
||||
assert(fw!=NULL);
|
||||
while (fw && Firewall::cast(fw) == nullptr) fw = fw->getParent();
|
||||
assert(fw!=nullptr);
|
||||
string branch_id = getOptionsObject()->getStr("branch_id");
|
||||
if (!branch_id.empty())
|
||||
{
|
||||
@ -504,7 +504,7 @@ RuleSet* PolicyRule::getBranch()
|
||||
return RuleSet::cast(
|
||||
fw->findObjectByName(Policy::TYPENAME, branch_name));
|
||||
} else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,7 +565,7 @@ FWObject* PolicyRule::getTagObject()
|
||||
FWObjectDatabase::getIntId(tagobj_id));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
string PolicyRule::getTagValue()
|
||||
@ -654,44 +654,44 @@ NATRule::NATRule() : Rule()
|
||||
rule_type = Unknown;
|
||||
setAction(NATRule::Translate);
|
||||
|
||||
osrc_re = NULL;
|
||||
odst_re = NULL;
|
||||
osrv_re = NULL;
|
||||
tsrc_re = NULL;
|
||||
tdst_re = NULL;
|
||||
tsrv_re = NULL;
|
||||
itf_inb_re = NULL;
|
||||
itf_outb_re = NULL;
|
||||
when_re = NULL;
|
||||
osrc_re = nullptr;
|
||||
odst_re = nullptr;
|
||||
osrv_re = nullptr;
|
||||
tsrc_re = nullptr;
|
||||
tdst_re = nullptr;
|
||||
tsrv_re = nullptr;
|
||||
itf_inb_re = nullptr;
|
||||
itf_outb_re = nullptr;
|
||||
when_re = nullptr;
|
||||
}
|
||||
|
||||
void NATRule::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *re = getFirstByType(RuleElementOSrc::TYPENAME);
|
||||
if (re == NULL)
|
||||
if (re == nullptr)
|
||||
{
|
||||
re = root->createRuleElementOSrc(); assert(re!=NULL);
|
||||
re = root->createRuleElementOSrc(); assert(re!=nullptr);
|
||||
add(re); osrc_re = RuleElementOSrc::cast(re);
|
||||
|
||||
re = root->createRuleElementODst(); assert(re!=NULL);
|
||||
re = root->createRuleElementODst(); assert(re!=nullptr);
|
||||
add(re); odst_re = RuleElementODst::cast(re);
|
||||
|
||||
re = root->createRuleElementOSrv(); assert(re!=NULL);
|
||||
re = root->createRuleElementOSrv(); assert(re!=nullptr);
|
||||
add(re); osrv_re = RuleElementOSrv::cast(re);
|
||||
|
||||
re = root->createRuleElementTSrc(); assert(re!=NULL);
|
||||
re = root->createRuleElementTSrc(); assert(re!=nullptr);
|
||||
add(re); tsrc_re = RuleElementTSrc::cast(re);
|
||||
|
||||
re = root->createRuleElementTDst(); assert(re!=NULL);
|
||||
re = root->createRuleElementTDst(); assert(re!=nullptr);
|
||||
add(re); tdst_re = RuleElementTDst::cast(re);
|
||||
|
||||
re = root->createRuleElementTSrv(); assert(re!=NULL);
|
||||
re = root->createRuleElementTSrv(); assert(re!=nullptr);
|
||||
add(re); tsrv_re = RuleElementTSrv::cast(re);
|
||||
|
||||
re = root->createRuleElementItfInb(); assert(re!=NULL);
|
||||
re = root->createRuleElementItfInb(); assert(re!=nullptr);
|
||||
add(re); itf_inb_re = RuleElementItfInb::cast(re);
|
||||
|
||||
re = root->createRuleElementItfOutb(); assert(re!=NULL);
|
||||
re = root->createRuleElementItfOutb(); assert(re!=nullptr);
|
||||
add(re); itf_outb_re = RuleElementItfOutb::cast(re);
|
||||
|
||||
add( root->createNATRuleOptions() );
|
||||
@ -876,37 +876,37 @@ xmlNodePtr NATRule::toXML(xmlNodePtr parent)
|
||||
|
||||
FWObject *o;
|
||||
|
||||
if ( (o=getFirstByType( RuleElementOSrc::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementOSrc::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementODst::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementODst::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementOSrv::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementOSrv::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementTSrc::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementTSrc::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementTDst::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementTDst::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementTSrv::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementTSrv::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementItfInb::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementItfInb::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementItfOutb::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementItfOutb::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementInterval::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( NATRuleOptions::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( NATRuleOptions::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( NAT::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( NAT::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
return me;
|
||||
@ -919,9 +919,9 @@ FWOptions* NATRule::getOptionsObject() const
|
||||
|
||||
RuleSet* NATRule::getBranch()
|
||||
{
|
||||
if (getAction() != NATRule::Branch) return NULL;
|
||||
if (getAction() != NATRule::Branch) return nullptr;
|
||||
FWObject *fw = getParent()->getParent();
|
||||
assert(fw!=NULL);
|
||||
assert(fw!=nullptr);
|
||||
string branch_id = getOptionsObject()->getStr("branch_id");
|
||||
if (!branch_id.empty())
|
||||
{
|
||||
@ -934,7 +934,7 @@ RuleSet* NATRule::getBranch()
|
||||
return RuleSet::cast(fw->findObjectByName(NAT::TYPENAME,
|
||||
branch_name));
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -979,18 +979,18 @@ FWObject& NATRule::shallowDuplicate(const FWObject *x,
|
||||
bool preserve_id)
|
||||
{
|
||||
const NATRule *rx = NATRule::constcast(x);
|
||||
if (rx!=NULL) rule_type = rx->rule_type;
|
||||
if (rx!=nullptr) rule_type = rx->rule_type;
|
||||
setAction(rx->getAction());
|
||||
|
||||
osrc_re = NULL;
|
||||
odst_re = NULL;
|
||||
osrv_re = NULL;
|
||||
tsrc_re = NULL;
|
||||
tdst_re = NULL;
|
||||
tsrv_re = NULL;
|
||||
itf_inb_re = NULL;
|
||||
itf_outb_re = NULL;
|
||||
when_re = NULL;
|
||||
osrc_re = nullptr;
|
||||
odst_re = nullptr;
|
||||
osrv_re = nullptr;
|
||||
tsrc_re = nullptr;
|
||||
tdst_re = nullptr;
|
||||
tsrv_re = nullptr;
|
||||
itf_inb_re = nullptr;
|
||||
itf_outb_re = nullptr;
|
||||
when_re = nullptr;
|
||||
|
||||
return Rule::shallowDuplicate(x, preserve_id);
|
||||
}
|
||||
@ -998,7 +998,7 @@ FWObject& NATRule::shallowDuplicate(const FWObject *x,
|
||||
bool NATRule::cmp(const FWObject *x, bool recursive)
|
||||
{
|
||||
const NATRule *rx = NATRule::constcast(x);
|
||||
if (rx == NULL) return false;
|
||||
if (rx == nullptr) return false;
|
||||
if (getAction() != rx->getAction()) return false;
|
||||
return Rule::cmp(x, recursive);
|
||||
}
|
||||
@ -1017,11 +1017,11 @@ RoutingRule::RoutingRule() : Rule()
|
||||
void RoutingRule::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *re = getFirstByType(RuleElementRDst::TYPENAME);
|
||||
if (re == NULL)
|
||||
if (re == nullptr)
|
||||
{
|
||||
re = root->createRuleElementRDst(); assert(re!=NULL); add(re);
|
||||
re = root->createRuleElementRGtw(); assert(re!=NULL); add(re);
|
||||
re = root->createRuleElementRItf(); assert(re!=NULL); add(re);
|
||||
re = root->createRuleElementRDst(); assert(re!=nullptr); add(re);
|
||||
re = root->createRuleElementRGtw(); assert(re!=nullptr); add(re);
|
||||
re = root->createRuleElementRItf(); assert(re!=nullptr); add(re);
|
||||
add( root->createRoutingRuleOptions() );
|
||||
}
|
||||
}
|
||||
@ -1117,19 +1117,19 @@ xmlNodePtr RoutingRule::toXML(xmlNodePtr parent)
|
||||
|
||||
FWObject *o;
|
||||
|
||||
if ( (o=getFirstByType( RuleElementRDst::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementRDst::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementRGtw::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementRGtw::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RuleElementRItf::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleElementRItf::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( RoutingRuleOptions::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RoutingRuleOptions::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
if ( (o=getFirstByType( Routing::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( Routing::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
return me;
|
||||
@ -1143,7 +1143,7 @@ FWOptions* RoutingRule::getOptionsObject() const
|
||||
RuleSet* RoutingRule::getBranch()
|
||||
{
|
||||
FWObject *fw = getParent()->getParent();
|
||||
assert(fw!=NULL);
|
||||
assert(fw!=nullptr);
|
||||
string branch_id = getOptionsObject()->getStr("branch_id");
|
||||
if (!branch_id.empty())
|
||||
{
|
||||
@ -1156,7 +1156,7 @@ RuleSet* RoutingRule::getBranch()
|
||||
return RuleSet::cast(fw->findObjectByName(Routing::TYPENAME,
|
||||
branch_name));
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1185,7 +1185,7 @@ FWObject& RoutingRule::duplicate(const FWObject *x,
|
||||
{
|
||||
Rule::duplicate(x,preserve_id);
|
||||
const RoutingRule *rx = RoutingRule::constcast(x);
|
||||
if (rx!=NULL)
|
||||
if (rx!=nullptr)
|
||||
{
|
||||
rule_type = rx->rule_type;
|
||||
sorted_dst_ids = rx->sorted_dst_ids;
|
||||
|
||||
@ -73,7 +73,7 @@ void RuleElement::init(FWObjectDatabase *root)
|
||||
*/
|
||||
int any_id = getAnyElementId();
|
||||
FWObject *any_obj = getById(any_id);
|
||||
if (any_obj == NULL)
|
||||
if (any_obj == nullptr)
|
||||
{
|
||||
any_obj = root->checkIndex( any_id );
|
||||
if (any_obj) FWObject::addRef( any_obj );
|
||||
@ -117,14 +117,14 @@ FWObject& RuleElement::shallowDuplicate(const FWObject *other,
|
||||
|
||||
void RuleElement::addRef(FWObject *obj)
|
||||
{
|
||||
FWObject *o=NULL;
|
||||
FWObject *o=nullptr;
|
||||
if (isAny())
|
||||
{
|
||||
o=(*(begin()));
|
||||
o=(FWReference::cast(o))->getPointer();
|
||||
}
|
||||
FWObject::addRef(obj);
|
||||
if (o!=NULL) removeRef(o);
|
||||
if (o!=nullptr) removeRef(o);
|
||||
}
|
||||
|
||||
void RuleElement::removeRef(FWObject *obj)
|
||||
@ -185,7 +185,7 @@ xmlNodePtr RuleElementSrc::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementSrc::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -228,7 +228,7 @@ xmlNodePtr RuleElementDst::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementDst::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -271,7 +271,7 @@ xmlNodePtr RuleElementSrv::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementSrv::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWServiceReference::cast(o)!=NULL) return true;
|
||||
if (FWServiceReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ServiceGroup::validateChild(o);
|
||||
}
|
||||
@ -314,13 +314,13 @@ xmlNodePtr RuleElementItf::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementItf::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
|
||||
if (o->getId() == getAnyElementId()) return true;
|
||||
|
||||
if (Interface::cast(o)!=NULL) return true;
|
||||
if (Interface::cast(o)!=nullptr) return true;
|
||||
|
||||
if (ObjectGroup::cast(o)!=NULL && o->size() > 0)
|
||||
if (ObjectGroup::cast(o)!=nullptr && o->size() > 0)
|
||||
{
|
||||
bool all_intf = true;
|
||||
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
|
||||
@ -376,7 +376,7 @@ bool RuleElementItf::isDummy() const
|
||||
*/
|
||||
bool RuleElementItf::checkItfChildOfThisFw(FWObject *o)
|
||||
{
|
||||
if (Group::cast(o) != NULL)
|
||||
if (Group::cast(o) != nullptr)
|
||||
{
|
||||
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
|
||||
{
|
||||
@ -390,11 +390,11 @@ bool RuleElementItf::checkItfChildOfThisFw(FWObject *o)
|
||||
FWObject* o_tmp2 = getRoot()->findInIndex(this->getId());
|
||||
|
||||
FWObject *fw1 = o_tmp;
|
||||
while (fw1 && Firewall::cast(fw1) == NULL) fw1 = fw1->getParent();
|
||||
while (fw1 && Firewall::cast(fw1) == nullptr) fw1 = fw1->getParent();
|
||||
FWObject *fw2 = o_tmp2;
|
||||
while (fw2 && Firewall::cast(fw2) == NULL) fw2 = fw2->getParent();
|
||||
while (fw2 && Firewall::cast(fw2) == nullptr) fw2 = fw2->getParent();
|
||||
|
||||
return (fw1 != NULL && fw1 == fw2);
|
||||
return (fw1 != nullptr && fw1 == fw2);
|
||||
}
|
||||
|
||||
const char *RuleElementItfInb::TYPENAME={"ItfInb"};
|
||||
@ -425,7 +425,7 @@ xmlNodePtr RuleElementOSrc::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementOSrc::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -452,7 +452,7 @@ xmlNodePtr RuleElementODst::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementODst::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -479,7 +479,7 @@ xmlNodePtr RuleElementOSrv::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementOSrv::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWServiceReference::cast(o)!=NULL) return true;
|
||||
if (FWServiceReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ServiceGroup::validateChild(o);
|
||||
}
|
||||
@ -508,7 +508,7 @@ xmlNodePtr RuleElementTSrc::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementTSrc::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -535,7 +535,7 @@ xmlNodePtr RuleElementTDst::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementTDst::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -562,13 +562,13 @@ xmlNodePtr RuleElementTSrv::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementTSrv::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWServiceReference::cast(o)!=NULL) return true;
|
||||
if (FWServiceReference::cast(o)!=nullptr) return true;
|
||||
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
|
||||
// TagService is not allowed in translated service
|
||||
if (TagService::isA(o)) return false;
|
||||
if (ServiceGroup::cast(o)!=NULL)
|
||||
if (ServiceGroup::cast(o)!=nullptr)
|
||||
{
|
||||
for (FWObject::iterator i=o->begin(); i!=o->end(); ++i)
|
||||
{
|
||||
@ -603,9 +603,9 @@ xmlNodePtr RuleElementInterval::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementInterval::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWIntervalReference::cast(o)!=NULL) return true;
|
||||
if (FWIntervalReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return (Interval::cast(o)!=NULL || IntervalGroup::cast(o)!=NULL);
|
||||
return (Interval::cast(o)!=nullptr || IntervalGroup::cast(o)!=nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -630,7 +630,7 @@ xmlNodePtr RuleElementRDst::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementRDst::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
return ObjectGroup::validateChild(o);
|
||||
}
|
||||
@ -657,7 +657,7 @@ xmlNodePtr RuleElementRGtw::toXML(xmlNodePtr parent)
|
||||
|
||||
bool RuleElementRGtw::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
if( getChildrenCount() > 0 && !isAny()) return false;
|
||||
return checkSingleIPAdress(o);
|
||||
}
|
||||
@ -665,7 +665,7 @@ bool RuleElementRGtw::validateChild(FWObject *o)
|
||||
// check if the gateway has only one interface with only one ipv4 adress
|
||||
bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
|
||||
{
|
||||
if( Host::cast(o) != NULL)
|
||||
if( Host::cast(o) != nullptr)
|
||||
{
|
||||
list<FWObject*> obj_list = o->getByType("Interface");
|
||||
if( obj_list.size() == 1)
|
||||
@ -676,7 +676,7 @@ bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
|
||||
return true;
|
||||
} else return false;
|
||||
} else return false;
|
||||
} else if( Interface::cast(o) != NULL)
|
||||
} else if( Interface::cast(o) != nullptr)
|
||||
{
|
||||
list<FWObject*> obj_list = o->getByType("IPv4");
|
||||
if( obj_list.size() == 1)
|
||||
@ -686,7 +686,7 @@ bool RuleElementRGtw::checkSingleIPAdress(FWObject *o)
|
||||
}
|
||||
return ( o->getId() == getAnyElementId() ||
|
||||
(FWObject::validateChild(o) &&
|
||||
(IPv4::cast(o)!=NULL || FWObjectReference::cast(o)!=NULL)));
|
||||
(IPv4::cast(o)!=nullptr || FWObjectReference::cast(o)!=nullptr)));
|
||||
}
|
||||
|
||||
const char *RuleElementRItf::TYPENAME={"RItf"};
|
||||
@ -694,12 +694,12 @@ RuleElementRItf::RuleElementRItf() {}
|
||||
|
||||
bool RuleElementRItf::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWObjectReference::cast(o)!=NULL) return true;
|
||||
if (FWObjectReference::cast(o)!=nullptr) return true;
|
||||
|
||||
if (getChildrenCount() > 0 && !isAny()) return false;
|
||||
|
||||
if ( o->getId() == getAnyElementId()) return true;
|
||||
|
||||
return (Interface::cast(o)!=NULL);
|
||||
return (Interface::cast(o)!=nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ RuleSet::RuleSet()
|
||||
void RuleSet::init(FWObjectDatabase *root)
|
||||
{
|
||||
FWObject *opt = getFirstByType(RuleSetOptions::TYPENAME);
|
||||
if (opt == NULL) add(root->createRuleSetOptions());
|
||||
if (opt == nullptr) add(root->createRuleSetOptions());
|
||||
}
|
||||
|
||||
RuleSet::~RuleSet() {}
|
||||
@ -67,21 +67,21 @@ void RuleSet::fromXML(xmlNodePtr root)
|
||||
// avoid having to increment DTD version number)
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ipv4_rule_set")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
ipv4 = (string(n)=="True" || string(n)=="true");
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root, TOXMLCAST("ipv6_rule_set")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
ipv6 = (string(n)=="True" || string(n)=="true");
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("top_rule_set")));
|
||||
if (n!=NULL)
|
||||
if (n!=nullptr)
|
||||
{
|
||||
top = (string(n)=="True" || string(n)=="true");
|
||||
FREEXMLBUFF(n);
|
||||
@ -106,11 +106,11 @@ xmlNodePtr RuleSet::toXML(xmlNodePtr parent)
|
||||
// First all rules, skip options
|
||||
for(list<FWObject*>::const_iterator j=begin(); j!=end(); ++j)
|
||||
{
|
||||
if (FWOptions::cast(*j) == NULL) (*j)->toXML(me);
|
||||
if (FWOptions::cast(*j) == nullptr) (*j)->toXML(me);
|
||||
}
|
||||
|
||||
FWObject *o;
|
||||
if ( (o=getFirstByType( RuleSetOptions::TYPENAME ))!=NULL )
|
||||
if ( (o=getFirstByType( RuleSetOptions::TYPENAME ))!=nullptr )
|
||||
o->toXML(me);
|
||||
|
||||
return me;
|
||||
@ -137,7 +137,7 @@ FWObject& RuleSet::shallowDuplicate(const FWObject *o, bool preserve_id)
|
||||
bool RuleSet::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
const RuleSet *other = RuleSet::constcast(obj);
|
||||
if (other == NULL) return false;
|
||||
if (other == nullptr) return false;
|
||||
if (ipv4 != other->ipv4 || ipv6 != other->ipv6 || top != other->top)
|
||||
return false;
|
||||
return FWObject::cmp(obj, recursive);
|
||||
@ -171,7 +171,7 @@ Rule* RuleSet::insertRuleBefore(int rule_n)
|
||||
{
|
||||
Rule *old_rule = getRuleByNum(rule_n);
|
||||
Rule *r = createRule();
|
||||
if (old_rule==NULL) add(r);
|
||||
if (old_rule==nullptr) add(r);
|
||||
else insert_before(old_rule, r);
|
||||
renumberRules();
|
||||
return(r);
|
||||
@ -183,7 +183,7 @@ Rule* RuleSet::appendRuleAtBottom(bool hidden_rule)
|
||||
r->setHidden(hidden_rule);
|
||||
int last_rule_position;
|
||||
Rule *last_rule = Rule::cast(back());
|
||||
if (last_rule != NULL)
|
||||
if (last_rule != nullptr)
|
||||
{
|
||||
last_rule_position = last_rule->getPosition() + 1000;
|
||||
} else
|
||||
@ -198,7 +198,7 @@ Rule* RuleSet::appendRuleAfter(int rule_n)
|
||||
{
|
||||
Rule *old_rule = getRuleByNum(rule_n);
|
||||
Rule *r = createRule();
|
||||
if (old_rule==NULL) add(r);
|
||||
if (old_rule==nullptr) add(r);
|
||||
else insert_after(old_rule,r);
|
||||
renumberRules();
|
||||
return(r);
|
||||
@ -211,7 +211,7 @@ bool RuleSet::deleteRule(int rule_n)
|
||||
|
||||
bool RuleSet::deleteRule(Rule *r)
|
||||
{
|
||||
if (r!=NULL)
|
||||
if (r!=nullptr)
|
||||
{
|
||||
remove(r, true); // and delete the rule if ref counter == 0
|
||||
renumberRules();
|
||||
@ -284,12 +284,12 @@ bool RuleSet::moveRule(int src_rule_n, int dst_rule_n)
|
||||
FWObject* src =getRuleByNum( src_rule_n );
|
||||
FWObject* dst =getRuleByNum( dst_rule_n );
|
||||
|
||||
if (src!=NULL && dst!=NULL && src!=dst ) {
|
||||
if (src!=nullptr && dst!=nullptr && src!=dst ) {
|
||||
|
||||
FWObject *o;
|
||||
list<FWObject*>::iterator m, m1, m2;
|
||||
for (m=begin(); m!=end(); ++m) {
|
||||
if ( (o=(*m))!=NULL ) {
|
||||
if ( (o=(*m))!=nullptr ) {
|
||||
if ( o==src ) m1=m;
|
||||
if ( o==dst ) m2=m;
|
||||
}
|
||||
@ -354,14 +354,14 @@ Rule* RuleSet::getRuleByNum(int n)
|
||||
for(list<FWObject*>::iterator m=begin(); m!=end(); ++m)
|
||||
{
|
||||
FWObject *o;
|
||||
if ( (o=(*m))!=NULL )
|
||||
if ( (o=(*m))!=nullptr )
|
||||
{
|
||||
Rule *r = Rule::cast(o);
|
||||
if (r && r->getPosition()==n)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int RuleSet::getRuleSetSize()
|
||||
@ -374,7 +374,7 @@ void RuleSet::assignUniqueRuleIds()
|
||||
for (FWObject::iterator it=begin(); it!=end(); ++it)
|
||||
{
|
||||
Rule *r = Rule::cast(*it);
|
||||
if (r != NULL && r->getUniqueId().empty())
|
||||
if (r != nullptr && r->getUniqueId().empty())
|
||||
r->setUniqueId(FWObjectDatabase::getStringId((*it)->getId()) );
|
||||
|
||||
}
|
||||
|
||||
@ -59,14 +59,14 @@ ServiceGroup::~ServiceGroup() {}
|
||||
|
||||
bool ServiceGroup::validateChild(FWObject *o)
|
||||
{
|
||||
if (FWServiceReference::cast(o)!=NULL) return true;
|
||||
if (FWServiceReference::cast(o)!=nullptr) return true;
|
||||
|
||||
return (FWObject::validateChild(o) &&
|
||||
Address::cast(o)==NULL &&
|
||||
ObjectGroup::cast(o)==NULL &&
|
||||
Interval::cast(o)==NULL &&
|
||||
FWObjectReference::cast(o)==NULL &&
|
||||
RuleSet::cast(o)==NULL);
|
||||
Address::cast(o)==nullptr &&
|
||||
ObjectGroup::cast(o)==nullptr &&
|
||||
Interval::cast(o)==nullptr &&
|
||||
FWObjectReference::cast(o)==nullptr &&
|
||||
RuleSet::cast(o)==nullptr);
|
||||
}
|
||||
|
||||
FWReference* ServiceGroup::createRef()
|
||||
|
||||
@ -81,7 +81,7 @@ void TCPService::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("established")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr("established", n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -91,7 +91,7 @@ void TCPService::fromXML(xmlNodePtr root)
|
||||
for (i=flags.begin(); i!=flags.end(); ++i)
|
||||
{
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST( (i->second).c_str() )));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr( i->second , n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -101,7 +101,7 @@ void TCPService::fromXML(xmlNodePtr root)
|
||||
for (i=flags_masks.begin(); i!=flags_masks.end(); ++i)
|
||||
{
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST( (i->second).c_str() )));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
setStr( i->second , n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
@ -56,28 +56,28 @@ void TCPUDPService::fromXML(xmlNodePtr root)
|
||||
const char *n;
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("src_range_start")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
src_range_start = atol(n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("src_range_end")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
src_range_end = atol(n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dst_range_start")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
dst_range_start = atol(n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("dst_range_end")));
|
||||
if(n!=NULL)
|
||||
if(n!=nullptr)
|
||||
{
|
||||
dst_range_end = atol(n);
|
||||
FREEXMLBUFF(n);
|
||||
@ -121,7 +121,7 @@ FWObject& TCPUDPService::shallowDuplicate(const FWObject *obj,
|
||||
bool TCPUDPService::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
const TCPUDPService *other = TCPUDPService::constcast(obj);
|
||||
if (other == NULL) return false;
|
||||
if (other == nullptr) return false;
|
||||
if (src_range_start != other->src_range_start ||
|
||||
src_range_end != other->src_range_end ||
|
||||
dst_range_start != other->dst_range_start ||
|
||||
|
||||
@ -62,7 +62,7 @@ void TagService::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char *n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("tagcode")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("tagcode", n);
|
||||
FREEXMLBUFF(n);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ void Mutex::unlock() const
|
||||
|
||||
Cond::Cond()
|
||||
{
|
||||
pthread_cond_init( &cond, NULL );
|
||||
pthread_cond_init( &cond, nullptr );
|
||||
}
|
||||
|
||||
Cond::~Cond()
|
||||
|
||||
@ -68,7 +68,7 @@ char *cxx_strdup(const string &x)
|
||||
char *cxx_strdup(const char *x)
|
||||
{
|
||||
if(!x)
|
||||
return (char*)NULL;
|
||||
return (char*)nullptr;
|
||||
|
||||
char *res=new char[strlen(x)+1];
|
||||
strcpy(res,x);
|
||||
@ -130,10 +130,10 @@ list<string> getDirList(const std::string &dir,
|
||||
|
||||
#ifndef _WIN32
|
||||
DIR *d=opendir(dir.c_str());
|
||||
if (d!=NULL)
|
||||
if (d!=nullptr)
|
||||
{
|
||||
struct dirent *de;
|
||||
while ( (de=readdir(d))!=NULL )
|
||||
while ( (de=readdir(d))!=nullptr )
|
||||
{
|
||||
if (strcmp(de->d_name,".")==SAME || strcmp(de->d_name,"..")==SAME)
|
||||
continue;
|
||||
|
||||
@ -76,7 +76,7 @@ xmlNodePtr UserService::toXML(xmlNodePtr parent)
|
||||
|
||||
bool UserService::cmp(const FWObject *obj, bool recursive)
|
||||
{
|
||||
if (UserService::constcast(obj)==NULL) return false;
|
||||
if (UserService::constcast(obj)==nullptr) return false;
|
||||
if (!FWObject::cmp(obj, recursive)) return false;
|
||||
|
||||
const UserService *user_serv = UserService::constcast(obj);
|
||||
|
||||
@ -98,7 +98,7 @@ static void xslt_error_handler(void *ctx, const char *msg, ...)
|
||||
char buf[4096];
|
||||
va_list args;
|
||||
|
||||
assert(ctx!=NULL);
|
||||
assert(ctx!=nullptr);
|
||||
va_start(args, msg);
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -125,7 +125,7 @@ xmlNodePtr XMLTools::getXmlChildNode(xmlNodePtr r,const char *child_name)
|
||||
if (strcmp(child_name,FROMXMLCAST(cur->name))==SAME)
|
||||
return cur;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
|
||||
char *path_copy;
|
||||
xmlNodePtr cur, res;
|
||||
|
||||
res=NULL;
|
||||
res=nullptr;
|
||||
|
||||
path_copy= cxx_strdup( path );
|
||||
|
||||
@ -155,7 +155,7 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
|
||||
}
|
||||
|
||||
cptr=strchr(s1,'/');
|
||||
if (cptr!=NULL) {
|
||||
if (cptr!=nullptr) {
|
||||
*cptr='\0';
|
||||
cptr++;
|
||||
}
|
||||
@ -177,14 +177,14 @@ xmlNodePtr XMLTools::getXmlNodeByPath(xmlNodePtr r, const char *path)
|
||||
}
|
||||
|
||||
|
||||
xmlExternalEntityLoader XMLTools::defaultLoader = NULL;
|
||||
xmlExternalEntityLoader XMLTools::defaultLoader = nullptr;
|
||||
|
||||
/**
|
||||
* This is global variable used in 'fwbExternalEntityLoader'
|
||||
* parser callback. It is protected by 'xml_parser_mutex'.
|
||||
*/
|
||||
|
||||
static char* current_template_dir=NULL;
|
||||
static char* current_template_dir=nullptr;
|
||||
|
||||
xmlParserInputPtr fwbExternalEntityLoader(const char *URL,
|
||||
const char *ID,
|
||||
@ -213,7 +213,7 @@ xmlParserInputPtr fwbExternalEntityLoader(const char *URL,
|
||||
else if(XMLTools::defaultLoader)
|
||||
return XMLTools::defaultLoader(URL, ID, ctxt);
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void XMLTools::initXMLTools()
|
||||
@ -249,7 +249,7 @@ string XMLTools::readFile(const std::string &rfile)
|
||||
}
|
||||
|
||||
gzFile gzf = gzopen(rfile.c_str(), "rb9");
|
||||
if (gzf == NULL) throw FWException("Could not read file "+rfile);
|
||||
if (gzf == nullptr) throw FWException("Could not read file "+rfile);
|
||||
|
||||
int chunk_size = 65536;
|
||||
char *chunk = (char*)malloc(chunk_size);
|
||||
@ -284,7 +284,7 @@ xmlDocPtr XMLTools::parseFile(const string &file_name,
|
||||
{
|
||||
xml_parser_mutex.lock();
|
||||
|
||||
if (current_template_dir!=NULL) delete[] current_template_dir;
|
||||
if (current_template_dir!=nullptr) delete[] current_template_dir;
|
||||
current_template_dir = cxx_strdup(template_dir.c_str());
|
||||
|
||||
xmlDoValidityCheckingDefaultValue = use_dtd ? 1 : 0;
|
||||
@ -296,7 +296,7 @@ xmlDocPtr XMLTools::parseFile(const string &file_name,
|
||||
|
||||
xmlDocPtr doc = xmlParseMemory(buffer.c_str(), buffer.length());
|
||||
|
||||
xmlSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc(nullptr, nullptr);
|
||||
|
||||
xml_parser_mutex.unlock();
|
||||
if (!doc || errors.length())
|
||||
@ -422,7 +422,7 @@ in the same directory with extension '.bak'. Are you sure you want to open it?";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
assert(doc!=NULL);
|
||||
assert(doc!=nullptr);
|
||||
xmlFreeDoc(doc);
|
||||
//xmlCleanupParser();
|
||||
|
||||
@ -443,7 +443,7 @@ void XMLTools::setDTD(xmlDocPtr doc,
|
||||
|
||||
|
||||
xmlCreateIntSubset(doc, STRTOXMLCAST(type_name),
|
||||
NULL,
|
||||
nullptr,
|
||||
STRTOXMLCAST(dtd_file)
|
||||
);
|
||||
|
||||
@ -477,12 +477,12 @@ void XMLTools::setDTD(xmlDocPtr doc,
|
||||
if(xmlValidateDocument(&vctxt, doc)!=1)
|
||||
throw FWException(string("DTD validation stage 2 failed with following errors:\n")+errors);
|
||||
*/
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
xml_parser_mutex.unlock();
|
||||
|
||||
} catch(...)
|
||||
{
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
xml_parser_mutex.unlock();
|
||||
throw;
|
||||
}
|
||||
@ -527,7 +527,7 @@ void XMLTools::transformFileToFile(const string &src_file,
|
||||
const string &dst_file)
|
||||
{
|
||||
string xslt_errors;
|
||||
xsltStylesheetPtr ss = NULL;
|
||||
xsltStylesheetPtr ss = nullptr;
|
||||
xmlDocPtr doc, res;
|
||||
|
||||
|
||||
@ -547,12 +547,12 @@ void XMLTools::transformFileToFile(const string &src_file,
|
||||
|
||||
if(!ss)
|
||||
{
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
throw FWException("File conversion error: Error loading stylesheet: " +
|
||||
@ -568,12 +568,12 @@ void XMLTools::transformFileToFile(const string &src_file,
|
||||
res = xsltApplyStylesheet(ss, doc, params);
|
||||
xsltSaveResultToFilename(dst_file.c_str(), res, ss, 0);
|
||||
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
@ -628,12 +628,12 @@ void XMLTools::transformDocumentToFile(xmlDocPtr doc,
|
||||
|
||||
if (!ss)
|
||||
{
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
throw FWException("File conversion error: Error loading stylesheet: " +
|
||||
@ -645,12 +645,12 @@ void XMLTools::transformDocumentToFile(xmlDocPtr doc,
|
||||
|
||||
xmlDocPtr res = xsltApplyStylesheet(ss, doc, params);
|
||||
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
@ -700,11 +700,11 @@ xmlDocPtr XMLTools::transformDocument(xmlDocPtr doc,
|
||||
|
||||
if (!ss)
|
||||
{
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
@ -716,11 +716,11 @@ xmlDocPtr XMLTools::transformDocument(xmlDocPtr doc,
|
||||
xmlDocPtr res = xsltApplyStylesheet(ss, doc, params);
|
||||
|
||||
xsltFreeStylesheet(ss);
|
||||
xsltSetGenericErrorFunc(NULL, NULL);
|
||||
xmlSetGenericErrorFunc (NULL, NULL);
|
||||
xsltSetGenericErrorFunc(nullptr, nullptr);
|
||||
xmlSetGenericErrorFunc (nullptr, nullptr);
|
||||
// Following line is workaround for bug #73088 in Gnome
|
||||
// bugzilla. To be removed than it will be fixed.
|
||||
xsltSetGenericDebugFunc (NULL, NULL);
|
||||
xsltSetGenericDebugFunc (nullptr, nullptr);
|
||||
|
||||
xml_parser_mutex.unlock();
|
||||
xslt_processor_mutex.unlock();
|
||||
@ -741,7 +741,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
|
||||
const string &template_dir,
|
||||
const string ¤t_version)
|
||||
{
|
||||
xmlDocPtr res = NULL;
|
||||
xmlDocPtr res = nullptr;
|
||||
|
||||
xmlNodePtr root = xmlDocGetRootElement(doc);
|
||||
if (!root || !root->name || type_name!=FROMXMLCAST(root->name))
|
||||
@ -753,7 +753,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
|
||||
|
||||
string vers;
|
||||
const char *v = FROMXMLCAST(xmlGetProp(root,TOXMLCAST("version")));
|
||||
if (v==NULL)
|
||||
if (v==nullptr)
|
||||
{
|
||||
// no version.
|
||||
v="0.8.7"; // at this version attribute has been introduced
|
||||
@ -817,7 +817,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
|
||||
|
||||
try
|
||||
{
|
||||
res = transformDocument(doc, fname, NULL);
|
||||
res = transformDocument(doc, fname, nullptr);
|
||||
} catch(FWException &ex)
|
||||
{
|
||||
ex.getProperties()["failed_transformation"]=fname;
|
||||
@ -839,7 +839,7 @@ xmlDocPtr XMLTools::convert(xmlDocPtr doc,
|
||||
}
|
||||
|
||||
v = FROMXMLCAST(xmlGetProp(root, TOXMLCAST("version")));
|
||||
if (v==NULL)
|
||||
if (v==nullptr)
|
||||
{
|
||||
xmlFreeDoc(doc);
|
||||
//xmlCleanupParser();
|
||||
|
||||
@ -58,14 +58,14 @@ using namespace libfwbuilder;
|
||||
|
||||
#undef DEBUG_DNS
|
||||
|
||||
Mutex *DNS::gethostbyname_mutex = NULL;
|
||||
Mutex *DNS::gethostbyaddr_mutex = NULL;
|
||||
Mutex *DNS::gethostbyname_mutex = nullptr;
|
||||
Mutex *DNS::gethostbyaddr_mutex = nullptr;
|
||||
|
||||
// use this function for delayed initialization
|
||||
void DNS::init()
|
||||
{
|
||||
if (gethostbyname_mutex==NULL) gethostbyname_mutex = new Mutex();
|
||||
if (gethostbyaddr_mutex==NULL) gethostbyaddr_mutex = new Mutex();
|
||||
if (gethostbyname_mutex==nullptr) gethostbyname_mutex = new Mutex();
|
||||
if (gethostbyaddr_mutex==nullptr) gethostbyaddr_mutex = new Mutex();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -94,7 +94,7 @@ HostEnt DNS::getHostByAddr(const InetAddr &addr, int type)
|
||||
type);
|
||||
}
|
||||
|
||||
if(hp==NULL)
|
||||
if(hp==nullptr)
|
||||
{
|
||||
gethostbyaddr_mutex->unlock();
|
||||
free(tmphstbuf);
|
||||
@ -118,14 +118,14 @@ list<InetAddr> DNS::getHostByName(const string &name, int type)
|
||||
|
||||
list<InetAddr> v;
|
||||
|
||||
struct addrinfo *aiList = NULL;
|
||||
struct addrinfo *aiList = nullptr;
|
||||
int retVal;
|
||||
|
||||
#ifdef DEBUG_DNS
|
||||
cerr << "DNS::getHostByName " << name << " type=" << type << endl;
|
||||
#endif
|
||||
|
||||
if ((retVal = getaddrinfo(name.c_str(), NULL, NULL, &aiList)) != 0)
|
||||
if ((retVal = getaddrinfo(name.c_str(), nullptr, nullptr, &aiList)) != 0)
|
||||
{
|
||||
std::ostringstream strerr;
|
||||
strerr << "Host or network '" + name + "' not found; last error: ";
|
||||
@ -140,7 +140,7 @@ list<InetAddr> DNS::getHostByName(const string &name, int type)
|
||||
struct addrinfo *ai;
|
||||
try
|
||||
{
|
||||
for (ai=aiList; ai!=NULL; ai=ai->ai_next)
|
||||
for (ai=aiList; ai!=nullptr; ai=ai->ai_next)
|
||||
{
|
||||
#ifdef DEBUG_DNS
|
||||
cerr << "DNS::getHostByName " << name
|
||||
|
||||
@ -50,7 +50,7 @@ void physAddress::fromXML(xmlNodePtr root)
|
||||
FWObject::fromXML(root);
|
||||
|
||||
const char* n=FROMXMLCAST(xmlGetProp(root,TOXMLCAST("address")));
|
||||
assert(n!=NULL);
|
||||
assert(n!=nullptr);
|
||||
setStr("address", n);
|
||||
FREEXMLBUFF(n);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void Compiler::epilog()
|
||||
|
||||
void Compiler::abort(const string &errstr)
|
||||
{
|
||||
BaseCompiler::abort(fw, source_ruleset, NULL, errstr);
|
||||
BaseCompiler::abort(fw, source_ruleset, nullptr, errstr);
|
||||
}
|
||||
|
||||
void Compiler::abort(FWObject *rule, const string &errstr)
|
||||
@ -92,7 +92,7 @@ void Compiler::abort(FWObject *rule, const string &errstr)
|
||||
|
||||
void Compiler::error(const string &errstr)
|
||||
{
|
||||
BaseCompiler::error(fw, source_ruleset, NULL, errstr);
|
||||
BaseCompiler::error(fw, source_ruleset, nullptr, errstr);
|
||||
}
|
||||
|
||||
void Compiler::error(FWObject *rule, const string &errstr)
|
||||
@ -102,7 +102,7 @@ void Compiler::error(FWObject *rule, const string &errstr)
|
||||
|
||||
void Compiler::warning(const string &errstr)
|
||||
{
|
||||
BaseCompiler::warning(fw, source_ruleset, NULL, errstr);
|
||||
BaseCompiler::warning(fw, source_ruleset, nullptr, errstr);
|
||||
}
|
||||
|
||||
void Compiler::warning(FWObject *rule, const string &errstr)
|
||||
@ -136,9 +136,9 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
|
||||
{
|
||||
initialized = false;
|
||||
_cntr_ = 1;
|
||||
group_registry = NULL;
|
||||
group_registry = nullptr;
|
||||
|
||||
temp_ruleset = NULL;
|
||||
temp_ruleset = nullptr;
|
||||
|
||||
debug = 0;
|
||||
debug_rule = -1;
|
||||
@ -148,13 +148,13 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
|
||||
single_rule_ruleset_name = "";
|
||||
single_rule_position = -1;
|
||||
|
||||
dbcopy = NULL;
|
||||
persistent_objects = NULL;
|
||||
fw = NULL;
|
||||
fwopt = NULL;
|
||||
dbcopy = nullptr;
|
||||
persistent_objects = nullptr;
|
||||
fw = nullptr;
|
||||
fwopt = nullptr;
|
||||
fw_id = -1;
|
||||
|
||||
if (_db != NULL && _fw != NULL)
|
||||
if (_db != nullptr && _fw != nullptr)
|
||||
{
|
||||
assert(_fw->getRoot() == _db);
|
||||
|
||||
@ -174,40 +174,40 @@ void Compiler::_init(FWObjectDatabase *_db, Firewall *_fw)
|
||||
|
||||
Compiler::Compiler(FWObjectDatabase *_db, Firewall *fw, bool ipv6_policy)
|
||||
{
|
||||
source_ruleset = NULL;
|
||||
source_ruleset = nullptr;
|
||||
ruleSetName = "";
|
||||
osconfigurator = NULL;
|
||||
osconfigurator = nullptr;
|
||||
countIPv6Rules = 0;
|
||||
ipv6 = ipv6_policy;
|
||||
persistent_objects = NULL;
|
||||
persistent_objects = nullptr;
|
||||
_init(_db, fw);
|
||||
}
|
||||
|
||||
Compiler::Compiler(FWObjectDatabase *_db, Firewall *fw, bool ipv6_policy,
|
||||
OSConfigurator *_oscnf)
|
||||
{
|
||||
source_ruleset = NULL;
|
||||
source_ruleset = nullptr;
|
||||
ruleSetName = "";
|
||||
osconfigurator = _oscnf;
|
||||
countIPv6Rules = 0;
|
||||
ipv6 = ipv6_policy;
|
||||
persistent_objects = NULL;
|
||||
persistent_objects = nullptr;
|
||||
_init(_db, fw);
|
||||
}
|
||||
|
||||
// this constructor is used by class Preprocessor, it does not call _init
|
||||
Compiler::Compiler(FWObjectDatabase*, bool ipv6_policy)
|
||||
{
|
||||
source_ruleset = NULL;
|
||||
source_ruleset = nullptr;
|
||||
ruleSetName = "";
|
||||
osconfigurator = NULL;
|
||||
osconfigurator = nullptr;
|
||||
countIPv6Rules = 0;
|
||||
ipv6 = ipv6_policy;
|
||||
initialized = false;
|
||||
_cntr_ = 1;
|
||||
persistent_objects = NULL;
|
||||
fw = NULL;
|
||||
temp_ruleset = NULL;
|
||||
persistent_objects = nullptr;
|
||||
fw = nullptr;
|
||||
temp_ruleset = nullptr;
|
||||
debug = 0;
|
||||
debug_rule = -1;
|
||||
rule_debug_on = false;
|
||||
@ -218,7 +218,7 @@ Compiler::Compiler(FWObjectDatabase*, bool ipv6_policy)
|
||||
Compiler::~Compiler()
|
||||
{
|
||||
deleteRuleProcessors();
|
||||
dbcopy = NULL;
|
||||
dbcopy = nullptr;
|
||||
}
|
||||
|
||||
void Compiler::setPersistentObjects(Library* po)
|
||||
@ -291,8 +291,8 @@ void Compiler::_expand_group_recursive(FWObject *o, list<FWObject*> &ol)
|
||||
*/
|
||||
MultiAddress *adt = MultiAddress::cast(o);
|
||||
|
||||
if ((Group::cast(o)!=NULL && adt==NULL) ||
|
||||
(adt!=NULL && adt->isCompileTime()))
|
||||
if ((Group::cast(o)!=nullptr && adt==nullptr) ||
|
||||
(adt!=nullptr && adt->isCompileTime()))
|
||||
{
|
||||
for (FWObject::iterator i2=o->begin(); i2!=o->end(); ++i2)
|
||||
{
|
||||
@ -406,7 +406,7 @@ void Compiler::_expand_addr_recursive(Rule *rule, FWObject *s,
|
||||
}
|
||||
|
||||
if (o->getId() == FWObjectDatabase::ANY_ADDRESS_ID ||
|
||||
MultiAddress::cast(o)!=NULL ||
|
||||
MultiAddress::cast(o)!=nullptr ||
|
||||
Interface::cast(o) ||
|
||||
physAddress::cast(o))
|
||||
{
|
||||
@ -417,7 +417,7 @@ void Compiler::_expand_addr_recursive(Rule *rule, FWObject *s,
|
||||
|
||||
if (addrlist.empty())
|
||||
{
|
||||
if (RuleElement::cast(s)==NULL) ol.push_back(s);
|
||||
if (RuleElement::cast(s)==nullptr) ol.push_back(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -480,15 +480,15 @@ void Compiler::_expand_interface(Rule *rule,
|
||||
FWObject *p = Host::getParentHost(iface);
|
||||
//FWObject *p = iface->getParentHost();
|
||||
Host *hp = Host::cast(p);
|
||||
if (hp==NULL) return; // something is very broken
|
||||
if (hp==nullptr) return; // something is very broken
|
||||
FWOptions *hopt = hp->getOptionsObject();
|
||||
bool use_mac = (hopt!=NULL && hopt->getBool("use_mac_addr_filter"));
|
||||
bool use_mac = (hopt!=nullptr && hopt->getBool("use_mac_addr_filter"));
|
||||
|
||||
for (FWObject::iterator i1=iface->begin(); i1!=iface->end(); ++i1)
|
||||
{
|
||||
FWObject *o= *i1;
|
||||
|
||||
if (physAddress::cast(o)!=NULL)
|
||||
if (physAddress::cast(o)!=nullptr)
|
||||
{
|
||||
if (use_mac) ol.push_back(o);
|
||||
continue;
|
||||
@ -504,7 +504,7 @@ void Compiler::_expand_interface(Rule *rule,
|
||||
}
|
||||
|
||||
if ( ! iface->isUnnumbered() &&
|
||||
Address::cast(o)!=NULL &&
|
||||
Address::cast(o)!=nullptr &&
|
||||
MatchesAddressFamily(o)) ol.push_back(o);
|
||||
}
|
||||
|
||||
@ -540,7 +540,7 @@ bool compare_addresses(FWObject *o1, FWObject *o2)
|
||||
{
|
||||
Address *a1 = Address::cast(o1);
|
||||
Address *a2 = Address::cast(o2);
|
||||
if (a1 == NULL || a2 == NULL)
|
||||
if (a1 == nullptr || a2 == nullptr)
|
||||
{
|
||||
// one or both could be MultiAddress objects (e.g. DNSName)
|
||||
return o1->getName() < o2->getName();
|
||||
@ -548,8 +548,8 @@ bool compare_addresses(FWObject *o1, FWObject *o2)
|
||||
|
||||
const InetAddr *addr1 = a1->getAddressPtr();
|
||||
const InetAddr *addr2 = a2->getAddressPtr();
|
||||
if (addr1 == NULL) return true;
|
||||
if (addr2 == NULL) return false;
|
||||
if (addr1 == nullptr) return true;
|
||||
if (addr2 == nullptr) return false;
|
||||
return *addr1 < *addr2;
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ void Compiler::_expandAddressRanges(Rule *rule, FWObject *re)
|
||||
for (FWObject::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i1);
|
||||
assert(o!=NULL);
|
||||
assert(o!=nullptr);
|
||||
|
||||
// if this is address range, check if it matches current address
|
||||
// family. If it is not address range, put it back into the rule element
|
||||
@ -628,7 +628,7 @@ void Compiler::_expandAddressRanges(Rule *rule, FWObject *re)
|
||||
cl.push_back(h);
|
||||
|
||||
// see GroupRegistry::registerGroupObject()
|
||||
if (group_registry != NULL)
|
||||
if (group_registry != nullptr)
|
||||
{
|
||||
group_registry->setGroupRegistryKey(
|
||||
h, group_registry->getGroupRegistryKey(aro));
|
||||
@ -659,7 +659,7 @@ void Compiler::debugRule()
|
||||
i!=source_ruleset->end(); i++)
|
||||
{
|
||||
Rule *rule = Rule::cast( *i );
|
||||
if (rule == NULL) continue;
|
||||
if (rule == nullptr) continue;
|
||||
if (rule_debug_on && rule->getPosition()==debug_rule )
|
||||
{
|
||||
info(debugPrintRule(rule));
|
||||
@ -687,7 +687,7 @@ string Compiler::debugPrintRule(libfwbuilder::Rule *rule)
|
||||
void Compiler::add(BasicRuleProcessor* rp)
|
||||
{
|
||||
rule_processors.push_back(rp);
|
||||
if (rule_debug_on && dynamic_cast<simplePrintProgress*>(rp)==NULL)
|
||||
if (rule_debug_on && dynamic_cast<simplePrintProgress*>(rp)==nullptr)
|
||||
rule_processors.push_back(new Debug());
|
||||
}
|
||||
|
||||
@ -728,14 +728,14 @@ Compiler::Begin::Begin(const std::string &n) : BasicRuleProcessor(n)
|
||||
|
||||
bool Compiler::Begin::processNext()
|
||||
{
|
||||
assert(compiler!=NULL);
|
||||
assert(compiler!=nullptr);
|
||||
if (!init)
|
||||
{
|
||||
for (FWObject::iterator i=compiler->source_ruleset->begin();
|
||||
i!=compiler->source_ruleset->end(); ++i)
|
||||
{
|
||||
Rule *rule = Rule::cast(*i);
|
||||
if (rule == NULL) continue;
|
||||
if (rule == nullptr) continue;
|
||||
if (rule->isDisabled()) continue;
|
||||
if (rule->isDummyRule()) {
|
||||
compiler->warning(rule, "Rule contains dummy object and is not parsed.");
|
||||
@ -759,8 +759,8 @@ bool Compiler::Begin::processNext()
|
||||
|
||||
bool Compiler::printTotalNumberOfRules::processNext()
|
||||
{
|
||||
assert(compiler!=NULL);
|
||||
assert(prev_processor!=NULL);
|
||||
assert(compiler!=nullptr);
|
||||
assert(prev_processor!=nullptr);
|
||||
|
||||
slurp();
|
||||
if (tmp_queue.size()==0) return false;
|
||||
@ -775,8 +775,8 @@ bool Compiler::printTotalNumberOfRules::processNext()
|
||||
|
||||
bool Compiler::createNewCompilerPass::processNext()
|
||||
{
|
||||
assert(compiler!=NULL);
|
||||
assert(prev_processor!=NULL);
|
||||
assert(compiler!=nullptr);
|
||||
assert(prev_processor!=nullptr);
|
||||
|
||||
slurp();
|
||||
if (tmp_queue.size()==0) return false;
|
||||
@ -786,8 +786,8 @@ bool Compiler::createNewCompilerPass::processNext()
|
||||
|
||||
bool Compiler::Debug::processNext()
|
||||
{
|
||||
assert(compiler!=NULL);
|
||||
assert(prev_processor!=NULL);
|
||||
assert(compiler!=nullptr);
|
||||
assert(prev_processor!=nullptr);
|
||||
|
||||
slurp();
|
||||
if (tmp_queue.size()==0) return false;
|
||||
@ -813,10 +813,10 @@ bool Compiler::Debug::processNext()
|
||||
|
||||
bool Compiler::singleRuleFilter::processNext()
|
||||
{
|
||||
assert(compiler!=NULL);
|
||||
assert(prev_processor!=NULL);
|
||||
assert(compiler!=nullptr);
|
||||
assert(prev_processor!=nullptr);
|
||||
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
if (!compiler->single_rule_mode)
|
||||
{
|
||||
@ -833,7 +833,7 @@ bool Compiler::singleRuleFilter::processNext()
|
||||
|
||||
bool Compiler::simplePrintProgress::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
std::string rl=rule->getLabel();
|
||||
if (rl!=current_rule_label) {
|
||||
@ -856,7 +856,7 @@ bool Compiler::simplePrintProgress::processNext()
|
||||
*/
|
||||
bool Compiler::splitIfRuleElementMatchesFW::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
int nre = re->size();
|
||||
@ -867,7 +867,7 @@ bool Compiler::splitIfRuleElementMatchesFW::processNext()
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*i1);
|
||||
Address *a = Address::cast(obj);
|
||||
assert(a!=NULL);
|
||||
assert(a!=nullptr);
|
||||
|
||||
if (a->getId() == compiler->fw->getId() ||
|
||||
a->getInt("parent_cluster_id") == compiler->fw->getId() ||
|
||||
@ -911,7 +911,7 @@ bool Compiler::splitIfRuleElementMatchesFW::processNext()
|
||||
bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule();
|
||||
if (rule==NULL) return false;
|
||||
if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
for (list<FWObject*>::iterator i1=re->begin(); i1!=re->end(); ++i1)
|
||||
@ -922,7 +922,7 @@ bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
|
||||
DNSName *self = DNSName::cast(
|
||||
compiler->persistent_objects->findObjectByName(
|
||||
DNSName::TYPENAME, "self"));
|
||||
if (self == NULL)
|
||||
if (self == nullptr)
|
||||
{
|
||||
self = compiler->dbcopy->createDNSName();
|
||||
self->setName("self");
|
||||
@ -944,16 +944,16 @@ bool Compiler::ReplaceFirewallObjectWithSelfInRE::processNext()
|
||||
bool Compiler::RegisterGroupsAndTablesInRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule();
|
||||
if (rule==NULL) return false;
|
||||
if (rule==nullptr) return false;
|
||||
|
||||
if (compiler->group_registry != NULL)
|
||||
if (compiler->group_registry != nullptr)
|
||||
{
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*i);
|
||||
if (ObjectGroup::cast(obj)!=NULL && obj->size() > 0)
|
||||
if (ObjectGroup::cast(obj)!=nullptr && obj->size() > 0)
|
||||
{
|
||||
compiler->registerGroupObject(re, ObjectGroup::cast(obj));
|
||||
}
|
||||
@ -966,7 +966,7 @@ bool Compiler::RegisterGroupsAndTablesInRE::processNext()
|
||||
|
||||
void Compiler::registerGroupObject(RuleElement *re, ObjectGroup *grp)
|
||||
{
|
||||
assert(group_registry!=NULL);
|
||||
assert(group_registry!=nullptr);
|
||||
list<FWObject*> objects;
|
||||
expandGroup(grp, objects);
|
||||
group_registry->registerGroup(grp, objects);
|
||||
@ -980,7 +980,7 @@ bool Compiler::equalObj::operator()(FWObject *o)
|
||||
|
||||
bool Compiler::singleObjectNegation::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *rel = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
assert(rel);
|
||||
@ -996,7 +996,7 @@ bool Compiler::singleObjectNegation::processNext()
|
||||
} else
|
||||
{
|
||||
FWObject *o = rel->front();
|
||||
if (FWReference::cast(o)!=NULL) o=FWReference::cast(o)->getPointer();
|
||||
if (FWReference::cast(o)!=nullptr) o=FWReference::cast(o)->getPointer();
|
||||
Address *reladdr = Address::cast(o);
|
||||
if ( reladdr && reladdr->countInetAddresses(true)==1 &&
|
||||
!compiler->complexMatch(reladdr, compiler->fw))
|
||||
@ -1031,10 +1031,10 @@ bool Compiler::singleObjectNegation::processNext()
|
||||
*/
|
||||
bool Compiler::fullInterfaceNegationInRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *itfre = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
if (itfre==NULL)
|
||||
if (itfre==nullptr)
|
||||
compiler->abort(rule, "Missing interface rule element");
|
||||
|
||||
FWOptions *fwopt = compiler->getCachedFwOpt();
|
||||
@ -1051,7 +1051,7 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
|
||||
for (FWObject::iterator i=all_interfaces.begin(); i!=all_interfaces.end(); ++i)
|
||||
{
|
||||
Interface *intf = Interface::cast(*i);
|
||||
if (intf == NULL) continue;
|
||||
if (intf == nullptr) continue;
|
||||
if (intf->isUnprotected()) continue;
|
||||
if (intf->isLoopback()) continue;
|
||||
|
||||
@ -1066,7 +1066,7 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
|
||||
{
|
||||
// Only interface objects are allowed in the "Interface" rule element
|
||||
Interface *rule_iface = Interface::cast(FWReference::getObject(*i));
|
||||
if (rule_iface == NULL) continue;
|
||||
if (rule_iface == nullptr) continue;
|
||||
// If this interface belongs to a cluster (which can only happen
|
||||
// if the rule set belongs to a cluster), then replace it with
|
||||
// corresponding interface of the member
|
||||
@ -1097,21 +1097,21 @@ bool Compiler::fullInterfaceNegationInRE::processNext()
|
||||
*/
|
||||
bool Compiler::replaceClusterInterfaceInItfRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *itfre = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
if (itfre==NULL)
|
||||
if (itfre==nullptr)
|
||||
compiler->abort(rule, "Missing interface rule element");
|
||||
|
||||
map<FWObject*, FWObject*> interface_replacement;
|
||||
|
||||
for (FWObject::iterator i=itfre->begin(); i!=itfre->end(); ++i)
|
||||
{
|
||||
Interface *member_iface = NULL;
|
||||
Interface *member_iface = nullptr;
|
||||
|
||||
// Only interface objects are allowed in the "Interface" rule element
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
Interface *rule_iface = Interface::cast(o);
|
||||
if (rule_iface == NULL) continue;
|
||||
if (rule_iface == nullptr) continue;
|
||||
// If this interface belongs to a cluster (which can only happen
|
||||
// if the rule set belongs to a cluster), then replace it with
|
||||
// corresponding interface of the member
|
||||
@ -1143,9 +1143,9 @@ bool Compiler::replaceClusterInterfaceInItfRE::processNext()
|
||||
|
||||
bool Compiler::eliminateDuplicatesInRE::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
if (comparator==NULL) comparator = new equalObj();
|
||||
if (comparator==nullptr) comparator = new equalObj();
|
||||
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
@ -1154,7 +1154,7 @@ bool Compiler::eliminateDuplicatesInRE::processNext()
|
||||
for(list<FWObject*>::iterator i=re->begin(); i!=re->end(); ++i)
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*i);
|
||||
if (obj == NULL) continue;
|
||||
if (obj == nullptr) continue;
|
||||
|
||||
comparator->set(obj);
|
||||
|
||||
@ -1183,7 +1183,7 @@ void Compiler::recursiveGroupsInRE::isRecursiveGroup(int grid, FWObject *obj)
|
||||
for (FWObject::iterator i=obj->begin(); i!=obj->end(); i++)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
if (Group::cast(o)!=NULL)
|
||||
if (Group::cast(o)!=nullptr)
|
||||
{
|
||||
if (o->getId()==grid || obj->getId()==o->getId())
|
||||
{
|
||||
@ -1199,10 +1199,10 @@ void Compiler::recursiveGroupsInRE::isRecursiveGroup(int grid, FWObject *obj)
|
||||
|
||||
bool Compiler::recursiveGroupsInRE::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
if (re == NULL || re->isAny())
|
||||
if (re == nullptr || re->isAny())
|
||||
{
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -1212,7 +1212,7 @@ bool Compiler::recursiveGroupsInRE::processNext()
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
if (Group::cast(o)!=NULL) isRecursiveGroup(o->getId(),o);
|
||||
if (Group::cast(o)!=nullptr) isRecursiveGroup(o->getId(),o);
|
||||
}
|
||||
|
||||
tmp_queue.push_back(rule);
|
||||
@ -1240,11 +1240,11 @@ int Compiler::emptyGroupsInRE::countChildren(FWObject *obj)
|
||||
// have some addresses at run time. So we just count it as a
|
||||
// regular object.
|
||||
|
||||
if (MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
|
||||
if (MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
|
||||
n++;
|
||||
else
|
||||
{
|
||||
if (Group::cast(o)!=NULL) n += countChildren(o);
|
||||
if (Group::cast(o)!=nullptr) n += countChildren(o);
|
||||
else n++; // but if it is not a group, then we count it.
|
||||
}
|
||||
}
|
||||
@ -1253,10 +1253,10 @@ int Compiler::emptyGroupsInRE::countChildren(FWObject *obj)
|
||||
|
||||
bool Compiler::emptyGroupsInRE::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast(rule->getFirstByType(re_type));
|
||||
|
||||
if (re == NULL || re->isAny())
|
||||
if (re == nullptr || re->isAny())
|
||||
{
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -1267,10 +1267,10 @@ bool Compiler::emptyGroupsInRE::processNext()
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
|
||||
if ( MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
|
||||
if ( MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
|
||||
continue;
|
||||
|
||||
if (Group::cast(o)!=NULL && countChildren(o)==0)
|
||||
if (Group::cast(o)!=nullptr && countChildren(o)==0)
|
||||
cl.push_back(o);
|
||||
}
|
||||
|
||||
@ -1335,10 +1335,10 @@ bool Compiler::emptyGroupsInRE::processNext()
|
||||
*/
|
||||
bool Compiler::swapMultiAddressObjectsInRE::processNext()
|
||||
{
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule=prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
RuleElement *re=RuleElement::cast( rule->getFirstByType(re_type) );
|
||||
if (re == NULL || re->isAny())
|
||||
if (re == nullptr || re->isAny())
|
||||
{
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -1348,7 +1348,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
if (MultiAddress::cast(o)!=NULL && MultiAddress::cast(o)->isRunTime())
|
||||
if (MultiAddress::cast(o)!=nullptr && MultiAddress::cast(o)->isRunTime())
|
||||
cl.push_back(MultiAddress::cast(o));
|
||||
}
|
||||
|
||||
@ -1369,7 +1369,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
|
||||
int mart_id = FWObjectDatabase::registerStringId(mart_id_str);
|
||||
MultiAddressRunTime *mart = MultiAddressRunTime::cast(
|
||||
compiler->dbcopy->findInIndex(mart_id));
|
||||
if (mart==NULL)
|
||||
if (mart==nullptr)
|
||||
{
|
||||
mart = new MultiAddressRunTime(ma);
|
||||
|
||||
@ -1396,7 +1396,7 @@ bool Compiler::swapMultiAddressObjectsInRE::processNext()
|
||||
|
||||
bool Compiler::expandMultipleAddressesInRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) );
|
||||
if (re) compiler->_expand_addr(rule, re, true);
|
||||
tmp_queue.push_back(rule);
|
||||
@ -1406,12 +1406,12 @@ bool Compiler::expandMultipleAddressesInRE::processNext()
|
||||
|
||||
bool Compiler::checkForObjectsWithErrors::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
for (FWObject::iterator it1=rule->begin(); it1!=rule->end(); it1++)
|
||||
{
|
||||
RuleElement *re = RuleElement::cast(*it1);
|
||||
if (re == NULL || re->isAny()) continue;
|
||||
if (re == nullptr || re->isAny()) continue;
|
||||
for (FWObject::iterator it2=re->begin(); it2!=re->end(); it2++)
|
||||
{
|
||||
FWObject *obj = FWReference::getObject(*it2);
|
||||
@ -1435,10 +1435,10 @@ bool Compiler::checkForObjectsWithErrors::processNext()
|
||||
|
||||
bool Compiler::replaceFailoverInterfaceInRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
RuleElement *re = RuleElement::cast( rule->getFirstByType(re_type) );
|
||||
|
||||
if (re == NULL || re->isAny())
|
||||
if (re == nullptr || re->isAny())
|
||||
{
|
||||
tmp_queue.push_back(rule);
|
||||
return true;
|
||||
@ -1449,7 +1449,7 @@ bool Compiler::replaceFailoverInterfaceInRE::processNext()
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
Interface *intf = Interface::cast(FWReference::getObject(*i));
|
||||
if (intf==NULL) continue;
|
||||
if (intf==nullptr) continue;
|
||||
|
||||
if (intf->isFailoverInterface()) cl.push_back(intf);
|
||||
else
|
||||
@ -1500,7 +1500,7 @@ bool Compiler::replaceFailoverInterfaceInRE::processNext()
|
||||
bool Compiler::FindAddressFamilyInRE(FWObject *parent, bool ipv6)
|
||||
{
|
||||
Address *addr = Address::cast(parent);
|
||||
if (addr!=NULL)
|
||||
if (addr!=nullptr)
|
||||
{
|
||||
const InetAddr *inet_addr = addr->getAddressPtr();
|
||||
if (ipv6)
|
||||
@ -1559,7 +1559,7 @@ bool Compiler::dropRuleWithEmptyRE::isREEmpty(Rule *rule,
|
||||
*/
|
||||
bool Compiler::dropRuleWithEmptyRE::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
if (PolicyRule::cast(rule) &&
|
||||
(isREEmpty(rule, RuleElementSrc::TYPENAME) ||
|
||||
@ -1607,7 +1607,7 @@ void Compiler::DropByServiceTypeInRE(RuleElement *rel, bool drop_ipv6)
|
||||
|
||||
Service *svc = Service::cast(o);
|
||||
|
||||
if (svc == NULL)
|
||||
if (svc == nullptr)
|
||||
{
|
||||
cerr << endl;
|
||||
cerr << "Rule " << Rule::cast(rel->getParent())->getLabel()
|
||||
@ -1641,7 +1641,7 @@ bool Compiler::catchUnnumberedIfaceInRE(RuleElement *re)
|
||||
for (FWObject::iterator i=re->begin(); i!=re->end(); i++)
|
||||
{
|
||||
FWObject *o = FWReference::getObject(*i);
|
||||
if (o==NULL)
|
||||
if (o==nullptr)
|
||||
{
|
||||
//Rule *rule = Rule::cast(re->getParent());
|
||||
FWReference *refo = FWReference::cast(*i);
|
||||
@ -1651,7 +1651,7 @@ bool Compiler::catchUnnumberedIfaceInRE(RuleElement *re)
|
||||
FWObjectDatabase::getStringId(refo->getPointerId());
|
||||
abort(re->getParent(), errmsg);
|
||||
}
|
||||
err |= ((iface=Interface::cast(o))!=NULL &&
|
||||
err |= ((iface=Interface::cast(o))!=nullptr &&
|
||||
(iface->isUnnumbered() || iface->isBridgePort())
|
||||
);
|
||||
}
|
||||
@ -1682,7 +1682,7 @@ Service* Compiler::getFirstSrv(PolicyRule *rule)
|
||||
Interval* Compiler::getFirstWhen(PolicyRule *rule)
|
||||
{
|
||||
RuleElementInterval *when = rule->getWhen();
|
||||
if (when==NULL) return NULL; // when is optional element
|
||||
if (when==nullptr) return nullptr; // when is optional element
|
||||
FWObject *o = FWReference::getObject(when->front());
|
||||
return Interval::cast(o);
|
||||
}
|
||||
@ -1690,7 +1690,7 @@ Interval* Compiler::getFirstWhen(PolicyRule *rule)
|
||||
Interface* Compiler::getFirstItf(PolicyRule *rule)
|
||||
{
|
||||
RuleElementItf *itf = rule->getItf();
|
||||
if (itf==NULL || itf->size()==0) return NULL; // itf is optional element
|
||||
if (itf==nullptr || itf->size()==0) return nullptr; // itf is optional element
|
||||
FWObject *o = FWReference::getObject(itf->front());
|
||||
return Interface::cast(o);
|
||||
}
|
||||
@ -1698,7 +1698,7 @@ Interface* Compiler::getFirstItf(PolicyRule *rule)
|
||||
Address* Compiler::getFirstOSrc(NATRule *rule)
|
||||
{
|
||||
RuleElementOSrc *osrc = rule->getOSrc();
|
||||
assert(osrc!=NULL);
|
||||
assert(osrc!=nullptr);
|
||||
FWObject *o = FWReference::getObject(osrc->front());
|
||||
return Address::cast(o);
|
||||
}
|
||||
@ -1706,7 +1706,7 @@ Address* Compiler::getFirstOSrc(NATRule *rule)
|
||||
Address* Compiler::getFirstODst(NATRule *rule)
|
||||
{
|
||||
RuleElementODst *odst = rule->getODst();
|
||||
assert(odst!=NULL);
|
||||
assert(odst!=nullptr);
|
||||
FWObject *o = FWReference::getObject(odst->front());
|
||||
return Address::cast(o);
|
||||
}
|
||||
@ -1714,7 +1714,7 @@ Address* Compiler::getFirstODst(NATRule *rule)
|
||||
Service* Compiler::getFirstOSrv(NATRule *rule)
|
||||
{
|
||||
RuleElementOSrv *osrv = rule->getOSrv();
|
||||
assert(osrv!=NULL);
|
||||
assert(osrv!=nullptr);
|
||||
FWObject *o = FWReference::getObject(osrv->front());
|
||||
return Service::cast(o);
|
||||
}
|
||||
@ -1722,7 +1722,7 @@ Service* Compiler::getFirstOSrv(NATRule *rule)
|
||||
Address* Compiler::getFirstTSrc(NATRule *rule)
|
||||
{
|
||||
RuleElementTSrc *tsrc = rule->getTSrc();
|
||||
assert(tsrc!=NULL);
|
||||
assert(tsrc!=nullptr);
|
||||
FWObject *o = FWReference::getObject(tsrc->front());
|
||||
return Address::cast(o);
|
||||
}
|
||||
@ -1730,7 +1730,7 @@ Address* Compiler::getFirstTSrc(NATRule *rule)
|
||||
Address* Compiler::getFirstTDst(NATRule *rule)
|
||||
{
|
||||
RuleElementTDst *tdst = rule->getTDst();
|
||||
assert(tdst!=NULL);
|
||||
assert(tdst!=nullptr);
|
||||
FWObject *o = FWReference::getObject(tdst->front());
|
||||
return Address::cast(o);
|
||||
}
|
||||
@ -1738,7 +1738,7 @@ Address* Compiler::getFirstTDst(NATRule *rule)
|
||||
Service* Compiler::getFirstTSrv(NATRule *rule)
|
||||
{
|
||||
RuleElementTSrv *tsrv = rule->getTSrv();
|
||||
assert(tsrv!=NULL);
|
||||
assert(tsrv!=nullptr);
|
||||
FWObject *o = FWReference::getObject(tsrv->front());
|
||||
return Service::cast(o);
|
||||
}
|
||||
@ -1842,21 +1842,21 @@ Address* Compiler::correctForCluster(Address *addr)
|
||||
*/
|
||||
bool Compiler::DropRulesByAddressFamilyAndServiceType::processNext()
|
||||
{
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==NULL) return false;
|
||||
Rule *rule = prev_processor->getNextRule(); if (rule==nullptr) return false;
|
||||
|
||||
for(FWObject::iterator it=rule->begin(); it!=rule->end(); ++it)
|
||||
{
|
||||
RuleElement *re = RuleElement::cast(*it);
|
||||
if (re == NULL) continue; // probably RuleOptions object
|
||||
if (re == nullptr) continue; // probably RuleOptions object
|
||||
|
||||
bool orig_any = re->isAny();
|
||||
if (orig_any) continue;
|
||||
|
||||
FWObject *first_object = FWReference::getObject(re->front());
|
||||
if (Address::cast(first_object) != NULL)
|
||||
if (Address::cast(first_object) != nullptr)
|
||||
compiler->DropAddressFamilyInRE(re, drop_ipv6);
|
||||
|
||||
if (Service::cast(first_object) != NULL)
|
||||
if (Service::cast(first_object) != nullptr)
|
||||
compiler->DropByServiceTypeInRE(re, drop_ipv6);
|
||||
|
||||
if (!orig_any && re->isAny())
|
||||
|
||||
@ -56,7 +56,7 @@ AddressRangeDialog::AddressRangeDialog(QWidget *parent):
|
||||
{
|
||||
m_dialog = new Ui::AddressRangeDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
obj=NULL;
|
||||
obj=nullptr;
|
||||
|
||||
connectSignalsOfAllWidgetsToSlotChange();
|
||||
}
|
||||
@ -70,7 +70,7 @@ void AddressRangeDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
obj=o;
|
||||
AddressRange *s = dynamic_cast<AddressRange*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
init=true;
|
||||
|
||||
@ -99,7 +99,7 @@ void AddressRangeDialog::validate(bool *res)
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
|
||||
AddressRange *s = dynamic_cast<AddressRange*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
try
|
||||
{
|
||||
InetAddr range_start(AF_UNSPEC, m_dialog->rangeStart->text().toLatin1().constData());
|
||||
@ -118,13 +118,13 @@ void AddressRangeDialog::validate(bool *res)
|
||||
{
|
||||
*res = false;
|
||||
// show warning dialog only if app has focus
|
||||
if (QApplication::focusWidget() != NULL)
|
||||
if (QApplication::focusWidget() != nullptr)
|
||||
{
|
||||
blockSignals(true);
|
||||
QMessageBox::critical(
|
||||
this, "Firewall Builder",
|
||||
QString::fromUtf8(ex.toString().c_str()),
|
||||
tr("&Continue"), 0, 0,
|
||||
tr("&Continue"), nullptr, nullptr,
|
||||
0 );
|
||||
blockSignals(false);
|
||||
}
|
||||
@ -138,7 +138,7 @@ void AddressRangeDialog::applyChanges()
|
||||
FWObject* new_state = cmd->getNewState();
|
||||
|
||||
AddressRange *s = dynamic_cast<AddressRange*>(new_state);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
string oldname = obj->getName();
|
||||
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
|
||||
|
||||
@ -66,7 +66,7 @@ AddressTableDialog::AddressTableDialog(QWidget *parent) : BaseObjectDialog(paren
|
||||
{
|
||||
m_dialog = new Ui::AddressTableDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
obj=NULL;
|
||||
obj=nullptr;
|
||||
|
||||
connectSignalsOfAllWidgetsToSlotChange();
|
||||
}
|
||||
@ -80,7 +80,7 @@ void AddressTableDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
obj=o;
|
||||
AddressTable *s = dynamic_cast<AddressTable*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
|
||||
init = true;
|
||||
@ -116,7 +116,7 @@ void AddressTableDialog::validate(bool *res)
|
||||
{
|
||||
*res=true;
|
||||
AddressTable *s = dynamic_cast<AddressTable*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
if (!validateName(this,obj,m_dialog->obj_name->text())) { *res=false; return; }
|
||||
}
|
||||
@ -127,7 +127,7 @@ void AddressTableDialog::applyChanges()
|
||||
FWObject* new_state = cmd->getNewState();
|
||||
|
||||
AddressTable *s = dynamic_cast<AddressTable*>(new_state);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
string oldname = obj->getName();
|
||||
new_state->setName( string(m_dialog->obj_name->text().toUtf8().constData()) );
|
||||
|
||||
@ -41,7 +41,7 @@ FWObject *AskLibForCopyDialog::askLibForCopyDialog( QWidget *parent,
|
||||
AskLibForCopyDialog dlg(parent, db, curr);
|
||||
if ( dlg.exec() == QDialog::Accepted )
|
||||
return dlg.getChoosenLib();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AskLibForCopyDialog::~AskLibForCopyDialog()
|
||||
@ -110,5 +110,5 @@ FWObject *AskLibForCopyDialog::getChoosenLib()
|
||||
int ind = m_dialog->libs->currentIndex();
|
||||
if (0 <= ind)
|
||||
return idxToLibs[ind];
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ AttachedNetworksDialog::AttachedNetworksDialog(QWidget *parent) : BaseObjectDial
|
||||
{
|
||||
m_dialog = new Ui::AttachedNetworksDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
obj=NULL;
|
||||
obj=nullptr;
|
||||
|
||||
connectSignalsOfAllWidgetsToSlotChange();
|
||||
}
|
||||
@ -70,7 +70,7 @@ void AttachedNetworksDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
obj=o;
|
||||
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
init=true;
|
||||
|
||||
@ -129,7 +129,7 @@ void AttachedNetworksDialog::validate(bool *result)
|
||||
|
||||
*result = true;
|
||||
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(obj);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
if (!validateName(this, obj, m_dialog->obj_name->text()))
|
||||
{
|
||||
@ -144,7 +144,7 @@ void AttachedNetworksDialog::applyChanges()
|
||||
FWObject* new_state = cmd->getNewState();
|
||||
|
||||
AttachedNetworks *s = dynamic_cast<AttachedNetworks*>(new_state);
|
||||
assert(s!=NULL);
|
||||
assert(s!=nullptr);
|
||||
|
||||
string oldname = obj->getName();
|
||||
new_state->setName(string(m_dialog->obj_name->text().toUtf8().constData()));
|
||||
|
||||
@ -58,7 +58,7 @@ ClusterGroupDialog::ClusterGroupDialog(QWidget *parent)
|
||||
{
|
||||
m_dialog = new Ui::ClusterGroupDialog_q;
|
||||
m_dialog->setupUi(this);
|
||||
obj = NULL;
|
||||
obj = nullptr;
|
||||
reload = false;
|
||||
|
||||
connectSignalsOfAllWidgetsToSlotChange();
|
||||
@ -68,7 +68,7 @@ void ClusterGroupDialog::loadFWObject(FWObject *o)
|
||||
{
|
||||
obj = o;
|
||||
ClusterGroup *g = dynamic_cast<ClusterGroup*>(obj);
|
||||
assert(g != NULL);
|
||||
assert(g != nullptr);
|
||||
|
||||
init = true;
|
||||
|
||||
@ -76,7 +76,7 @@ void ClusterGroupDialog::loadFWObject(FWObject *o)
|
||||
// Parent is either 'Cluster' or 'Interface', call getParent() approprietly
|
||||
FWObject *parent = obj;
|
||||
while (parent && !Cluster::isA(parent)) parent = parent->getParent();
|
||||
if (parent == NULL)
|
||||
if (parent == nullptr)
|
||||
{
|
||||
throw FWException("ClusterGroupDialog: parent is NULL!");
|
||||
}
|
||||
@ -199,7 +199,7 @@ void ClusterGroupDialog::saveGroupType(FWObject *group)
|
||||
void ClusterGroupDialog::addIcon(FWObject *o, bool master)
|
||||
{
|
||||
FWObject *iface = o;
|
||||
assert(Interface::cast(iface)!=NULL);
|
||||
assert(Interface::cast(iface)!=nullptr);
|
||||
FWObject *fw = Host::getParentHost(iface);
|
||||
// FWObject *fw = Interface::cast(iface)->getParentHost(); // because iface can be subinterface
|
||||
bool valid = cluster->validateMember(Firewall::cast(fw));
|
||||
@ -280,7 +280,7 @@ void ClusterGroupDialog::applyChanges()
|
||||
FWObject* new_state = cmd->getNewState();
|
||||
|
||||
ClusterGroup *g = dynamic_cast<ClusterGroup*>(new_state);
|
||||
assert(g != NULL);
|
||||
assert(g != nullptr);
|
||||
|
||||
QString oldname = obj->getName().c_str();
|
||||
new_state->setName(string(m_dialog->obj_name->text().toUtf8().constData()));
|
||||
@ -304,12 +304,12 @@ void ClusterGroupDialog::openClusterConfDialog()
|
||||
try
|
||||
{
|
||||
QWidget *w = DialogFactory::createClusterConfDialog(this, obj);
|
||||
if (w == NULL)
|
||||
if (w == nullptr)
|
||||
{
|
||||
return; // some dialogs may not be implemented yet
|
||||
}
|
||||
QDialog *d = dynamic_cast<QDialog*>(w);
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// connect obj changed signal
|
||||
//connect(d, SIGNAL(membersChanged()), this, SLOT(objectChanged()));
|
||||
@ -343,10 +343,10 @@ void ClusterGroupDialog::openClusterConfDialog()
|
||||
void ClusterGroupDialog::openObject(QTreeWidgetItem *item)
|
||||
{
|
||||
ObjectListViewItem *otvi = dynamic_cast<ObjectListViewItem*>(item);< | ||||