mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +00:00
parent
eef18e1ecd
commit
591ed80dcf
@ -27,7 +27,7 @@ using namespace Genode;
|
||||
** Utilities **
|
||||
***************/
|
||||
|
||||
static unsigned read_rtt_sec(Xml_node const &node)
|
||||
static unsigned read_rtt_sec(Xml_node const node)
|
||||
{
|
||||
unsigned const rtt_sec = node.attribute_value("rtt_sec", 0UL);
|
||||
if (!rtt_sec) {
|
||||
@ -48,7 +48,7 @@ Configuration::Configuration(Xml_node const node, Allocator &alloc)
|
||||
_rtt_sec(read_rtt_sec(node)), _node(node)
|
||||
{
|
||||
/* read domains */
|
||||
node.for_each_sub_node("domain", [&] (Xml_node const &node) {
|
||||
node.for_each_sub_node("domain", [&] (Xml_node const node) {
|
||||
try { _domains.insert(*new (_alloc) Domain(*this, node, _alloc)); }
|
||||
catch (Domain::Invalid) { warning("invalid domain"); }
|
||||
});
|
||||
|
@ -14,14 +14,11 @@
|
||||
/* local includes */
|
||||
#include <direct_rule.h>
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/xml_node.h>
|
||||
|
||||
using namespace Net;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Direct_rule_base::Direct_rule_base(Xml_node const &node)
|
||||
Direct_rule_base::Direct_rule_base(Xml_node const node)
|
||||
:
|
||||
_dst(node.attribute_value("dst", Ipv4_address_prefix()))
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
/* Genode includes */
|
||||
#include <net/ipv4.h>
|
||||
#include <util/list.h>
|
||||
#include <util/xml_node.h>
|
||||
|
||||
/* local includes */
|
||||
#include <rule.h>
|
||||
@ -39,7 +40,7 @@ class Net::Direct_rule_base : public Rule
|
||||
|
||||
public:
|
||||
|
||||
Direct_rule_base(Genode::Xml_node const &node);
|
||||
Direct_rule_base(Genode::Xml_node const node);
|
||||
|
||||
|
||||
/*********
|
||||
@ -61,7 +62,7 @@ template <typename T>
|
||||
struct Net::Direct_rule : Direct_rule_base,
|
||||
Direct_rule_list<T>::Element
|
||||
{
|
||||
Direct_rule(Genode::Xml_node const &node) : Direct_rule_base(node) { }
|
||||
Direct_rule(Genode::Xml_node const node) : Direct_rule_base(node) { }
|
||||
};
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ Domain_avl_member::Domain_avl_member(Domain_name const &name,
|
||||
** Domain_base **
|
||||
*****************/
|
||||
|
||||
Domain_base::Domain_base(Xml_node const &node)
|
||||
Domain_base::Domain_base(Xml_node const node)
|
||||
:
|
||||
_name(Cstring(node.attribute("name").value_base(),
|
||||
node.attribute("name").value_size()))
|
||||
@ -52,11 +52,11 @@ Domain_base::Domain_base(Xml_node const &node)
|
||||
|
||||
void Domain::_read_forward_rules(Cstring const &protocol,
|
||||
Domain_tree &domains,
|
||||
Xml_node const &node,
|
||||
Xml_node const node,
|
||||
char const *type,
|
||||
Forward_rule_tree &rules)
|
||||
{
|
||||
node.for_each_sub_node(type, [&] (Xml_node const &node) {
|
||||
node.for_each_sub_node(type, [&] (Xml_node const node) {
|
||||
try {
|
||||
Forward_rule &rule = *new (_alloc) Forward_rule(domains, node);
|
||||
rules.insert(&rule);
|
||||
@ -70,11 +70,11 @@ void Domain::_read_forward_rules(Cstring const &protocol,
|
||||
|
||||
void Domain::_read_transport_rules(Cstring const &protocol,
|
||||
Domain_tree &domains,
|
||||
Xml_node const &node,
|
||||
Xml_node const node,
|
||||
char const *type,
|
||||
Transport_rule_list &rules)
|
||||
{
|
||||
node.for_each_sub_node(type, [&] (Xml_node const &node) {
|
||||
node.for_each_sub_node(type, [&] (Xml_node const node) {
|
||||
try {
|
||||
rules.insert(*new (_alloc) Transport_rule(domains, node, _alloc,
|
||||
protocol, _config));
|
||||
@ -90,7 +90,7 @@ void Domain::print(Output &output) const
|
||||
}
|
||||
|
||||
|
||||
Domain::Domain(Configuration &config, Xml_node const &node, Allocator &alloc)
|
||||
Domain::Domain(Configuration &config, Xml_node const node, Allocator &alloc)
|
||||
:
|
||||
Domain_base(node), _avl_member(_name, *this), _config(config),
|
||||
_node(node), _alloc(alloc),
|
||||
@ -119,7 +119,7 @@ void Domain::create_rules(Domain_tree &domains)
|
||||
_read_transport_rules(udp_name(), domains, _node, "udp", _udp_rules);
|
||||
|
||||
/* read NAT rules */
|
||||
_node.for_each_sub_node("nat", [&] (Xml_node const &node) {
|
||||
_node.for_each_sub_node("nat", [&] (Xml_node const node) {
|
||||
try {
|
||||
_nat_rules.insert(
|
||||
new (_alloc) Nat_rule(domains, _tcp_port_alloc,
|
||||
@ -128,7 +128,7 @@ void Domain::create_rules(Domain_tree &domains)
|
||||
catch (Rule::Invalid) { warning("invalid NAT rule"); }
|
||||
});
|
||||
/* read IP rules */
|
||||
_node.for_each_sub_node("ip", [&] (Xml_node const &node) {
|
||||
_node.for_each_sub_node("ip", [&] (Xml_node const node) {
|
||||
try { _ip_rules.insert(*new (_alloc) Ip_rule(domains, node)); }
|
||||
catch (Rule::Invalid) { warning("invalid IP rule"); }
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ class Net::Domain_base
|
||||
|
||||
Domain_name const _name;
|
||||
|
||||
Domain_base(Genode::Xml_node const &node);
|
||||
Domain_base(Genode::Xml_node const node);
|
||||
};
|
||||
|
||||
|
||||
@ -93,13 +93,13 @@ class Net::Domain : public Domain_base
|
||||
|
||||
void _read_forward_rules(Genode::Cstring const &protocol,
|
||||
Domain_tree &domains,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Xml_node const node,
|
||||
char const *type,
|
||||
Forward_rule_tree &rules);
|
||||
|
||||
void _read_transport_rules(Genode::Cstring const &protocol,
|
||||
Domain_tree &domains,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Xml_node const node,
|
||||
char const *type,
|
||||
Transport_rule_list &rules);
|
||||
|
||||
@ -109,7 +109,7 @@ class Net::Domain : public Domain_base
|
||||
struct No_next_hop : Genode::Exception { };
|
||||
|
||||
Domain(Configuration &config,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Allocator &alloc);
|
||||
|
||||
void create_rules(Domain_tree &domains);
|
||||
|
@ -33,7 +33,7 @@ void Forward_rule::print(Output &output) const
|
||||
}
|
||||
|
||||
|
||||
Forward_rule::Forward_rule(Domain_tree &domains, Xml_node const &node)
|
||||
Forward_rule::Forward_rule(Domain_tree &domains, Xml_node const node)
|
||||
:
|
||||
Leaf_rule(domains, node),
|
||||
_port(node.attribute_value("port", Port(0))),
|
||||
|
@ -41,7 +41,7 @@ class Net::Forward_rule : public Leaf_rule,
|
||||
|
||||
public:
|
||||
|
||||
Forward_rule(Domain_tree &domains, Genode::Xml_node const &node);
|
||||
Forward_rule(Domain_tree &domains, Genode::Xml_node const node);
|
||||
|
||||
Forward_rule const &find_by_port(Port const port) const;
|
||||
|
||||
|
@ -18,7 +18,7 @@ using namespace Net;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Ip_rule::Ip_rule(Domain_tree &domains, Xml_node const &node)
|
||||
Ip_rule::Ip_rule(Domain_tree &domains, Xml_node const node)
|
||||
:
|
||||
Leaf_rule(domains, node),
|
||||
Direct_rule(node)
|
||||
|
@ -29,7 +29,7 @@ struct Net::Ip_rule : Leaf_rule, Direct_rule<Ip_rule>
|
||||
{
|
||||
public:
|
||||
|
||||
Ip_rule(Domain_tree &domains, Genode::Xml_node const &node);
|
||||
Ip_rule(Domain_tree &domains, Genode::Xml_node const node);
|
||||
};
|
||||
|
||||
#endif /* _IP_RULE_H_ */
|
||||
|
@ -20,7 +20,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
Domain &Leaf_rule::_find_domain(Domain_tree &domains,
|
||||
Xml_node const &node)
|
||||
Xml_node const node)
|
||||
{
|
||||
try {
|
||||
return domains.find_by_name(
|
||||
@ -31,7 +31,7 @@ Domain &Leaf_rule::_find_domain(Domain_tree &domains,
|
||||
}
|
||||
|
||||
|
||||
Leaf_rule::Leaf_rule(Domain_tree &domains, Xml_node const &node)
|
||||
Leaf_rule::Leaf_rule(Domain_tree &domains, Xml_node const node)
|
||||
:
|
||||
_domain(_find_domain(domains, node))
|
||||
{ }
|
||||
|
@ -33,11 +33,11 @@ class Net::Leaf_rule : public Rule
|
||||
Domain &_domain;
|
||||
|
||||
static Domain &_find_domain(Domain_tree &domains,
|
||||
Genode::Xml_node const &node);
|
||||
Genode::Xml_node const node);
|
||||
|
||||
public:
|
||||
|
||||
Leaf_rule(Domain_tree &domains, Genode::Xml_node const &node);
|
||||
Leaf_rule(Domain_tree &domains, Genode::Xml_node const node);
|
||||
|
||||
|
||||
/***************
|
||||
|
@ -35,7 +35,7 @@ bool Nat_rule::higher(Nat_rule *rule)
|
||||
Nat_rule::Nat_rule(Domain_tree &domains,
|
||||
Port_allocator &tcp_port_alloc,
|
||||
Port_allocator &udp_port_alloc,
|
||||
Xml_node const &node)
|
||||
Xml_node const node)
|
||||
:
|
||||
Leaf_rule(domains, node),
|
||||
_tcp_port_alloc(tcp_port_alloc, node.attribute_value("tcp-ports", 0UL)),
|
||||
|
@ -43,7 +43,7 @@ class Net::Nat_rule : public Leaf_rule,
|
||||
Nat_rule(Domain_tree &domains,
|
||||
Port_allocator &tcp_port_alloc,
|
||||
Port_allocator &udp_port_alloc,
|
||||
Genode::Xml_node const &node);
|
||||
Genode::Xml_node const node);
|
||||
|
||||
Nat_rule &find_by_domain(Domain &domain);
|
||||
|
||||
|
@ -26,7 +26,7 @@ using namespace Genode;
|
||||
** Permit_rule **
|
||||
*****************/
|
||||
|
||||
Permit_rule::Permit_rule(Domain_tree &domains, Xml_node const &node)
|
||||
Permit_rule::Permit_rule(Domain_tree &domains, Xml_node const node)
|
||||
:
|
||||
Leaf_rule(domains, node)
|
||||
{ }
|
||||
@ -42,7 +42,7 @@ void Permit_any_rule::print(Output &output) const
|
||||
}
|
||||
|
||||
|
||||
Permit_any_rule::Permit_any_rule(Domain_tree &domains, Xml_node const &node)
|
||||
Permit_any_rule::Permit_any_rule(Domain_tree &domains, Xml_node const node)
|
||||
:
|
||||
Permit_rule(domains, node)
|
||||
{ }
|
||||
@ -65,7 +65,7 @@ void Permit_single_rule::print(Output &output) const
|
||||
|
||||
|
||||
Permit_single_rule::Permit_single_rule(Domain_tree &domains,
|
||||
Xml_node const &node)
|
||||
Xml_node const node)
|
||||
:
|
||||
Permit_rule(domains, node),
|
||||
_port(node.attribute_value("port", Port(0)))
|
||||
|
@ -34,7 +34,7 @@ namespace Net {
|
||||
|
||||
struct Net::Permit_rule : Leaf_rule
|
||||
{
|
||||
Permit_rule(Domain_tree &domains, Genode::Xml_node const &node);
|
||||
Permit_rule(Domain_tree &domains, Genode::Xml_node const node);
|
||||
|
||||
|
||||
/*********
|
||||
@ -47,7 +47,7 @@ struct Net::Permit_rule : Leaf_rule
|
||||
|
||||
struct Net::Permit_any_rule : Permit_rule
|
||||
{
|
||||
Permit_any_rule(Domain_tree &domains, Genode::Xml_node const &node);
|
||||
Permit_any_rule(Domain_tree &domains, Genode::Xml_node const node);
|
||||
|
||||
|
||||
/*********
|
||||
@ -68,7 +68,7 @@ class Net::Permit_single_rule : public Permit_rule,
|
||||
public:
|
||||
|
||||
Permit_single_rule(Domain_tree &domains,
|
||||
Genode::Xml_node const &node);
|
||||
Genode::Xml_node const node);
|
||||
|
||||
Permit_single_rule const &find_by_port(Port const port) const;
|
||||
|
||||
|
@ -25,7 +25,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
Permit_any_rule *Transport_rule::_read_permit_any(Domain_tree &domains,
|
||||
Xml_node const &node,
|
||||
Xml_node const node,
|
||||
Allocator &alloc)
|
||||
{
|
||||
try {
|
||||
@ -39,7 +39,7 @@ Permit_any_rule *Transport_rule::_read_permit_any(Domain_tree &domains,
|
||||
|
||||
|
||||
Transport_rule::Transport_rule(Domain_tree &domains,
|
||||
Xml_node const &node,
|
||||
Xml_node const node,
|
||||
Allocator &alloc,
|
||||
Cstring const &protocol,
|
||||
Configuration &config)
|
||||
@ -55,7 +55,7 @@ Transport_rule::Transport_rule(Domain_tree &domains,
|
||||
}
|
||||
|
||||
/* read specific permit rules */
|
||||
node.for_each_sub_node("permit", [&] (Xml_node const &node) {
|
||||
node.for_each_sub_node("permit", [&] (Xml_node const node) {
|
||||
try {
|
||||
Permit_single_rule &rule = *new (alloc)
|
||||
Permit_single_rule(domains, node);
|
||||
|
@ -37,13 +37,13 @@ class Net::Transport_rule : public Direct_rule<Transport_rule>
|
||||
|
||||
static Permit_any_rule *
|
||||
_read_permit_any(Domain_tree &domains,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Allocator &alloc);
|
||||
|
||||
public:
|
||||
|
||||
Transport_rule(Domain_tree &domains,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Cstring const &protocol,
|
||||
Configuration &config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user