本文整理汇总了C++中FWOptions::getStr方法的典型用法代码示例。如果您正苦于以下问题:C++ FWOptions::getStr方法的具体用法?C++ FWOptions::getStr怎么用?C++ FWOptions::getStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWOptions
的用法示例。
在下文中一共展示了FWOptions::getStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSshAccessRule
void AutomaticRules_nxosacl::addSshAccessRule()
{
if (ruleset == NULL) return;
FWOptions *fwopt = fw->getOptionsObject();
if (fwopt->getBool("mgmt_ssh") && ! fwopt->getStr("mgmt_addr").empty())
{
AutomaticRules_cisco::addSshAccessRule();
/*
* AutomaticRules_cisco::addDefaultPolicyRule() adds a rule to
* permit backup ssh access to the firewall. Since NXOS ACL are
* stateless, we need to add another rule to permit reply
* packets.
*/
TCPService *ssh_rev = ruleset->getRoot()->createTCPService();
ssh_rev->setSrcRangeStart(22);
ssh_rev->setSrcRangeEnd(22);
persistent_objects->add(ssh_rev, false);
Network *mgmt_workstation = ruleset->getRoot()->createNetwork();
mgmt_workstation->setAddressNetmask(fwopt->getStr("mgmt_addr"));
persistent_objects->add(mgmt_workstation, false);
addMgmtRule(
fw, mgmt_workstation, ssh_rev,
NULL, PolicyRule::Outbound, PolicyRule::Accept,
"backup ssh access rule (out)");
}
}
示例2: QDialog
pixosIfaceOptsDialog::pixosIfaceOptsDialog(QWidget *parent, FWObject *o)
: QDialog(parent)
{
m_dialog = new Ui::pixosIfaceOptsDialog_q;
m_dialog->setupUi(this);
setWindowModality(Qt::WindowModal);
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
// Using "type" control only for subinterfaces
// and main interfaces of the firewall objects
if (cluster_interface)
{
m_dialog->iface_type->hide();
m_dialog->iface_type_label->hide();
} else
{
m_dialog->iface_type->show();
m_dialog->iface_type_label->show();
}
data.registerOption(m_dialog->vlan_id, ifopt, "vlan_id");
data.loadAll();
// special actions for different iface types
// VLAN (8021q)
typeChanged("");
}
示例3: prepareArgForCompiler
QStringList instDialog::prepareArgForCompiler(Firewall *fw)
{
FWOptions *fwopt = fw->getOptionsObject();
QStringList args;
/*
* I should be able to specify custom compiler for firewall with
* no platform (e.g. for experiments)
*/
string compiler = fwopt->getStr("compiler");
if (compiler=="")
{
compiler=Resources::platform_res[fw->getStr("platform")]->getCompiler();
}
if (compiler=="")
{
QMessageBox::warning(
this,"Firewall Builder",
tr("Firewall platform is not specified in this object.\n\
Can't compile firewall policy."),
tr("&Continue"), QString::null,QString::null,
0, 1 );
return args; // still empty list
}
示例4: assembleFwScript
QString CompilerDriver_junosacl::assembleFwScript(Cluster *cluster,
Firewall *fw,
bool cluster_member,
OSConfigurator *oscnf)
{
Configlet script_skeleton(fw, "junos", "script_skeleton");
Configlet top_comment(fw, "junos", "top_comment");
script_skeleton.setVariable("system_configuration_script",
QString::fromUtf8(system_configuration_script.c_str()));
script_skeleton.setVariable("policy_script",
QString::fromUtf8(policy_script.c_str()));
FWOptions* options = fw->getOptionsObject();
options->setStr("prolog_script", options->getStr("junosacl_prolog_script"));
options->setStr("epilog_script", options->getStr("junosacl_epilog_script"));
// we do not offer user a choice of the place where to put prolog
// lines, therefore we can reset this attribute to make sure it
// does not interfere
options->setStr("prolog_place", "");
assembleFwScriptInternal(cluster, fw, cluster_member,
oscnf, &script_skeleton, &top_comment, "!", true);
return script_skeleton.expand();
}
示例5: ip_forwarding
string OSConfigurator_linux24::printIPForwardingCommands()
{
/* Turn on packet forwarding if we have to */
// string os_family = Resources::os_res[fw->getStr("host_OS")]->
// getResourceStr("/FWBuilderResources/Target/family");
FWOptions* options = fw->getOptionsObject();
Configlet ip_forwarding(fw, "linux24", "ip_forwarding");
ip_forwarding.removeComments();
ip_forwarding.collapseEmptyStrings(true);
string s = options->getStr("linux24_ip_forward");
ip_forwarding.setVariable("ipv4", !s.empty());
ip_forwarding.setVariable("ipv4_forw", (s=="1" || s=="On" || s=="on")?1:0);
s = options->getStr("linux24_ipv6_forward");
ip_forwarding.setVariable("ipv6", !s.empty());
ip_forwarding.setVariable("ipv6_forw", (s=="1" || s=="On" || s=="on")?1:0);
return ip_forwarding.expand().toStdString();
}
示例6: getGeneratedFileName
QString FirewallInstaller::getGeneratedFileName(Firewall *fw)
{
FWOptions *fwopt = fw->getOptionsObject();
QString generated_file;
QString ofname = QString::fromUtf8(fwopt->getStr("output_file").c_str()).trimmed();
if (!ofname.isEmpty())
{
generated_file = ofname;
} else
generated_file = QString::fromUtf8(fw->getName().c_str()) + ".fw";
return generated_file;
}
示例7: setKernelVariable
void OSConfigurator_bsd::setKernelVariable(Firewall *fw,
const string &var_name,
Configlet *configlet)
{
FWOptions* options = fw->getOptionsObject();
string s;
s = options->getStr(var_name);
if (!s.empty())
{
configlet->setVariable(QString("have_") + var_name.c_str(), 1);
configlet->setVariable(var_name.c_str(), s=="1" || s=="on" || s=="On");
}
}
示例8: QDialog
secuwallIfaceOptsDialog::secuwallIfaceOptsDialog(QWidget *parent, FWObject *o)
: QDialog(parent)
{
m_dialog = new Ui::secuwallIfaceOptsDialog_q;
m_dialog->setupUi(this);
obj = o;
FWOptions *ifopt = (Interface::cast(obj))->getOptionsObject();
cluster_interface = (Cluster::cast(obj->getParent()) != NULL);
setInterfaceTypes(m_dialog->iface_type, Interface::cast(obj),
ifopt->getStr("type").c_str());
// Using "type" control only for subinterfaces
// and main interfaces of the firewall objects
if (cluster_interface)
{
m_dialog->iface_type->hide();
m_dialog->iface_type_label->hide();
} else
{
m_dialog->iface_type->show();
m_dialog->iface_type_label->show();
}
data.registerOption(m_dialog->iface_mtu,
ifopt,
"iface_mtu");
data.registerOption(m_dialog->iface_disablearp,
ifopt,
"iface_disablearp");
data.registerOption(m_dialog->iface_disableboot,
ifopt,
"iface_disableboot");
data.registerOption(m_dialog->iface_options,
ifopt,
"iface_options");
data.registerOption(m_dialog->vlan_id,
ifopt,
"vlan_id");
data.loadAll();
// perform special actions for different iface types
typeChanged("");
}
示例9:
string OSConfigurator_linux24::getPathForATool(const std::string &os_variant, OSData_ipt::tools tool_name)
{
FWOptions* options = fw->getOptionsObject();
string attr = os_data.getAttributeNameForTool(tool_name);
string s = options->getStr("linux24_" + attr);
if (!s.empty()) return s;
string host_os = fw->getStr("host_OS");
string r = "/FWBuilderResources/Target/tools/" + os_variant + "/" + attr;
if (Resources::os_res[host_os]->getResourceStr(r).empty())
r = "/FWBuilderResources/Target/tools/Unknown/" + attr;
return Resources::os_res[host_os]->getResourceStr(r);
}
示例10: switch
string PolicyCompiler_junosacl::PrintRule::_printAction(PolicyRule *rule)
{
ostringstream str;
switch (rule->getAction()) {
case PolicyRule::Accept: str << "accept"; break;
case PolicyRule::Deny: str << "discard"; break;
case PolicyRule::Reject: str << "reject";
{
FWOptions *ruleopt =rule->getOptionsObject();
string reason = ruleopt->getStr("action_on_reject");
if (!reason.empty())
str << " " << reject_icmp_reason.at(reason);
}
break;
default: str << rule->getActionAsString() << "";
}
return str.str();
}
示例11: applyChanges
void RuleOptionsDialog::applyChanges()
{
std::unique_ptr<FWCmdChange> cmd( new FWCmdRuleChangeOptions(m_project, obj));
// new_state is a copy of the rule object
FWObject* new_state = cmd->getNewState();
FWOptions* new_rule_options = Rule::cast(new_state)->getOptionsObject();
init = true;
data.saveAll(new_rule_options);
init = false;
/* #2367 */
PolicyRule *policy_rule = PolicyRule::cast(new_state);
if (policy_rule)
{
FWOptions *ropt = policy_rule->getOptionsObject();
if (platform=="iptables")
{
FWObject *tag_object = m_dialog->iptTagDropArea->getObject();
// if tag_object==NULL, setTagObject clears setting in the rule
policy_rule->setTagging(tag_object != NULL);
policy_rule->setTagObject(tag_object);
policy_rule->setClassification(
! ropt->getStr("classify_str").empty());
policy_rule->setRouting( ! ropt->getStr("ipt_iif").empty() ||
! ropt->getStr("ipt_oif").empty() ||
! ropt->getStr("ipt_gw").empty());
}
if (platform=="pf")
{
FWObject *tag_object = m_dialog->pfTagDropArea->getObject();
// if tag_object==NULL, setTagObject clears setting in the rule
policy_rule->setTagging(tag_object != NULL);
policy_rule->setTagObject(tag_object);
policy_rule->setClassification(
! new_rule_options->getStr("pf_classify_str").empty());
policy_rule->setRouting(
! new_rule_options->getStr("pf_route_option").empty() &&
new_rule_options->getStr("pf_route_option") != "none");
}
if (platform=="ipf")
{
policy_rule->setRouting(
! new_rule_options->getStr("ipf_route_option").empty() &&
new_rule_options->getStr("ipf_route_option") != "none");
}
if (platform=="ipfw")
{
policy_rule->setClassification(
new_rule_options->getInt("ipfw_classify_method") > -1);
}
}
if (!cmd->getOldState()->cmp(new_state, true))
{
if (obj->isReadOnly()) return;
m_project->undoStack->push(cmd.release());
}
}
示例12: assembleFwScript
QString CompilerDriver_pix::assembleFwScript(Cluster *cluster,
Firewall* fw,
bool cluster_member,
OSConfigurator *oscnf)
{
Configlet script_skeleton(fw, "pix_os", "script_skeleton");
Configlet top_comment(fw, "pix_os", "top_comment");
FWOptions* options = fw->getOptionsObject();
options->setStr("prolog_script", options->getStr("pix_prolog_script"));
options->setStr("epilog_script", options->getStr("pix_epilog_script"));
options->setStr("prolog_place", "");
string vers = fw->getStr("version");
string platform = fw->getStr("platform");
bool outbound_acl_supported =
Resources::platform_res[platform]->getResourceBool(
string("/FWBuilderResources/Target/options/")+
"version_"+vers+
"/pix_outbound_acl_supported");
bool afpa = options->getBool("pix_assume_fw_part_of_any");
bool emulate_outb_acls = options->getBool("pix_emulate_out_acl");
bool generate_outb_acls = options->getBool("pix_generate_out_acl");
top_comment.setVariable(
"outbound_acl_supported",
QString((outbound_acl_supported) ? "supported" : "not supported"));
top_comment.setVariable("emulate_outb_acls",
QString((emulate_outb_acls)?"yes":"no"));
top_comment.setVariable("generate_outb_acls",
QString((generate_outb_acls)?"yes":"no"));
top_comment.setVariable("afpa", QString((afpa)?"yes":"no"));
script_skeleton.setVariable("short_script", options->getBool("short_script"));
script_skeleton.setVariable("not_short_script",
! options->getBool("short_script"));
script_skeleton.setVariable("preamble_commands",
QString::fromUtf8(
preamble_commands.c_str()));
script_skeleton.setVariable("clear_commands",
QString::fromUtf8(
clear_commands.c_str()));
script_skeleton.setVariable("system_configuration_script",
QString::fromUtf8(
system_configuration_script.c_str()));
script_skeleton.setVariable("named_objects_and_object_groups",
QString::fromUtf8(
named_objects_and_groups.c_str()));
script_skeleton.setVariable("policy_script",
QString::fromUtf8(policy_script.c_str()));
script_skeleton.setVariable("nat_script",
QString::fromUtf8(nat_script.c_str()));
script_skeleton.setVariable("routing_script",
QString::fromUtf8(routing_script.c_str()));
assembleFwScriptInternal(cluster, fw, cluster_member, oscnf,
&script_skeleton, &top_comment, "!", true);
return script_skeleton.expand();
}
示例13: _printMPFPolicyMap
string OSConfigurator_pix_os::_printMPFPolicyMap()
{
ostringstream res;
string platform = fw->getStr("platform");
string version = fw->getStr("version");
string vers = "version_" + version;
FWOptions *options = fw->getOptionsObject();
assert(options!=NULL);
std::list<InspectionClassMap> defaultClassMaps;
std::list<InspectionClassMap> customClassMaps;
std::map<std::string,int> DefaultInspectionInspectStatements;
std::map<std::string,int> CustomInspectionInspectStatements;
QStringList allowed_fixups =
QString(Resources::platform_res[platform]->getResourceStr(
"/FWBuilderResources/Target/options/" + vers +
"/fixups/list").c_str()).split(",");
defaultClassMaps.clear();
customClassMaps.clear();
DefaultInspectionInspectStatements.clear();
CustomInspectionInspectStatements.clear();
foreach (QString fixup_xml_element, allowed_fixups)
{
string f = options->getStr(fixup_xml_element.toAscii().constData());
if (!f.empty())
{
QString fixup_name = fixup_xml_element.replace("_fixup", "");
int status;
int p1,p2;
string an;
int av;
istringstream str(f);
str >> status >> p1 >> p2 >> an >> av;
/* We should really fix this in the GUI and pass max length parameter
* as an/av rather than as port p1
*/
if (fixup_name == "dns" && p1 != 0)
{
an = "maximum-length";
av = p1;
p1 = 53;
}
if (fixup_name.startsWith("ip_options"))
{
continue;
}
InspectionClassMap cm(fixup_name.toAscii().constData(),
status, p1, p2, an, av);
if (cm.isDefault()) defaultClassMaps.push_back(cm);
else customClassMaps.push_back(cm);
}
示例14: run
QString CompilerDriver_junosacl::run(const string &cluster_id,
const string &firewall_id,
const string &single_rule_id)
{
Cluster *cluster = NULL;
Firewall *fw = NULL;
getFirewallAndClusterObjects(cluster_id, firewall_id, &cluster, &fw);
try
{
clearReadOnly(fw);
// Copy rules from the cluster object
populateClusterElements(cluster, fw);
commonChecks2(cluster, fw);
// Note that fwobjectname may be different from the name of the
// firewall fw This happens when we compile a member of a cluster
current_firewall_name = fw->getName().c_str();
determineOutputFileNames(cluster, fw, !cluster_id.empty(),
QStringList(""), QStringList("fw"),
QStringList(""));
/* Now that all checks are done, we can drop copies of cluster
* interfaces that were added to the firewall by
* CompilerDriver::populateClusterElements()
*/
list<FWObject*> all_interfaces = fw->getByTypeDeep(Interface::TYPENAME);
list<FWObject*> copies_of_cluster_interfaces;
for (std::list<FWObject*>::iterator i=all_interfaces.begin(); i!=all_interfaces.end(); ++i)
{
Interface *iface = Interface::cast(*i);
assert(iface);
if (iface->getOptionsObject()->getBool("cluster_interface"))
copies_of_cluster_interfaces.push_back(iface);
}
while (copies_of_cluster_interfaces.size())
{
fw->remove(copies_of_cluster_interfaces.front());
copies_of_cluster_interfaces.pop_front();
}
FWOptions* options = fw->getOptionsObject();
string fwvers = fw->getStr("version");
if (fwvers == "") fw->setStr("version", "11.2");
if (fwvers == "11.x") fw->setStr("version", "11.2");
string platform = fw->getStr("platform");
std::auto_ptr<OSConfigurator_junos> oscnf(new OSConfigurator_junos(objdb, fw, false));
oscnf->prolog();
oscnf->processFirewallOptions();
list<FWObject*> all_policies = fw->getByType(Policy::TYPENAME);
// assign unique rule ids that later will be used to generate
// chain names. This should be done after calls to
// findImportedRuleSets()
// NB: these ids are not used by this compiler
assignUniqueRuleIds(all_policies);
vector<int> ipv4_6_runs;
// // // // //NamedObjectsManager named_objects_manager(persistent_objects, fw);
// command line options -4 and -6 control address family for which
// script will be generated. If "-4" is used, only ipv4 part will
// be generated. If "-6" is used, only ipv6 part will be generated.
// If neither is used, both parts will be done.
if (options->getStr("ipv4_6_order").empty() ||
options->getStr("ipv4_6_order") == "ipv4_first")
{
if (ipv4_run) ipv4_6_runs.push_back(AF_INET);
if (ipv6_run) ipv4_6_runs.push_back(AF_INET6);
}
if (options->getStr("ipv4_6_order") == "ipv6_first")
{
if (ipv6_run) ipv4_6_runs.push_back(AF_INET6);
if (ipv4_run) ipv4_6_runs.push_back(AF_INET);
}
string object_groups_definitions;
for (vector<int>::iterator i=ipv4_6_runs.begin();
i!=ipv4_6_runs.end(); ++i)
{
int policy_af = *i;
bool ipv6_policy = (policy_af == AF_INET6);
// Count rules for each address family
int policy_count = 0;
//.........这里部分代码省略.........
示例15: loadFWObject
void RuleOptionsDialog::loadFWObject(FWObject *o)
{
obj = o;
firewall = o;
// use Firewall::cast to match both Firewall and Cluster
while (!Firewall::cast(firewall)) firewall = firewall->getParent();
platform = firewall->getStr("platform").c_str();
string version = firewall->getStr("version");
// build a map for combobox so visible combobox items can be localized
QStringList route_options = getRouteOptions_pf_ipf(platform);
QStringList route_load_options = getRouteLoadOptions_pf(platform);
QStringList classify_options_ipfw = getClassifyOptions_ipfw(platform);
Rule *rule = dynamic_cast<Rule*>(o);
FWOptions *ropt = rule->getOptionsObject();
PolicyRule *policy_rule = PolicyRule::cast(rule);
int wid=0;
if (platform=="iptables") wid=1;
if (platform=="ipf") wid=2;
if (platform=="pf") wid=3;
if (platform=="ipfw") wid=4;
if (platform=="pix" || platform=="fwsm") wid=5;
if (platform=="iosacl" || platform=="procurve_acl") wid=6;
if (platform=="junosacl") wid=7;
m_dialog->wStack->widget(wid)->raise();
m_dialog->wStack->setCurrentWidget(m_dialog->wStack->widget(wid));
QStringList logLevels=getLogLevels( obj->getStr("platform").c_str() );
m_dialog->ipt_logLevel->clear();
m_dialog->ipt_logLevel->addItems(getScreenNames(logLevels));
m_dialog->ipf_logLevel->clear();
m_dialog->ipf_logLevel->addItems(getScreenNames(logLevels));
m_dialog->pix_logLevel->clear();
m_dialog->pix_logLevel->addItems(getScreenNames(logLevels));
QStringList logFacilities=getLogFacilities( obj->getStr("platform").c_str());
m_dialog->ipf_logFacility->clear();
m_dialog->ipf_logFacility->addItems(getScreenNames(logFacilities));
QStringList limitSuffixes=getLimitSuffixes( obj->getStr("platform").c_str());
m_dialog->ipt_limitSuffix->clear();
m_dialog->ipt_limitSuffix->addItems(getScreenNames(limitSuffixes));
m_dialog->ipt_hashlimit_suffix->clear();
m_dialog->ipt_hashlimit_suffix->addItems(getScreenNames(limitSuffixes));
fillInterfaces(m_dialog->ipt_iif);
fillInterfaces(m_dialog->ipt_oif);
fillInterfaces(m_dialog->ipf_route_opt_if);
fillInterfaces(m_dialog->pf_route_opt_if);
data.clear();
if (platform=="iptables")
{
data.registerOption(m_dialog->ipt_logPrefix, ropt, "log_prefix");
data.registerOption(m_dialog->ipt_logLevel, ropt,
"log_level", logLevels);
data.registerOption(m_dialog->ipt_nlgroup, ropt, "ulog_nlgroup");
data.registerOption(m_dialog->ipt_limit, ropt, "limit_value");
data.registerOption(m_dialog->ipt_limitSuffix, ropt,
"limit_suffix", limitSuffixes);
data.registerOption(m_dialog->ipt_limit_not, ropt, "limit_value_not");
data.registerOption(m_dialog->ipt_burst, ropt, "limit_burst");
data.registerOption(m_dialog->ipt_connlimit, ropt, "connlimit_value");
data.registerOption(m_dialog->ipt_connlimit_above_not, ropt,
"connlimit_above_not");
data.registerOption(m_dialog->ipt_connlimit_masklen, ropt,
"connlimit_masklen");
data.registerOption(m_dialog->ipt_hashlimit, ropt, "hashlimit_value");
data.registerOption(m_dialog->ipt_hashlimit_suffix, ropt,
"hashlimit_suffix");
data.registerOption(m_dialog->ipt_hashlimit_burst, ropt,
"hashlimit_burst");
data.registerOption(m_dialog->cb_srcip, ropt, "hashlimit_mode_srcip");
data.registerOption(m_dialog->cb_dstip, ropt, "hashlimit_mode_dstip");
data.registerOption(m_dialog->cb_srcport, ropt,
"hashlimit_mode_srcport");
data.registerOption(m_dialog->cb_dstport, ropt,
"hashlimit_mode_dstport");
data.registerOption(m_dialog->ipt_hashlimit_dstlimit, ropt,
"hashlimit_dstlimit");
data.registerOption(m_dialog->ipt_hashlimit_name, ropt,
"hashlimit_name");
data.registerOption(m_dialog->ipt_hashlimit_size, ropt,
"hashlimit_size");
data.registerOption(m_dialog->ipt_hashlimit_max, ropt,
"hashlimit_max");
data.registerOption(m_dialog->ipt_hashlimit_expire, ropt,
"hashlimit_expire");
data.registerOption(m_dialog->ipt_hashlimit_gcinterval, ropt,
"hashlimit_gcinterval");
// in v3.0 attribute "assume fw is part of any" used to be a
//.........这里部分代码省略.........