mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 02:01:38 +00:00
parent
7d576b4f15
commit
e7f564cd3b
@ -42,12 +42,7 @@ class Net::Arp_cache_entry : public Genode::Avl_node<Arp_cache_entry>
|
||||
|
||||
Arp_cache_entry(Ipv4_address const &ip, Mac_address const &mac);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_ip(Ipv4_address const &ip,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_ip(Ipv4_address const &ip, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (ip != _ip) {
|
||||
|
||||
@ -115,12 +110,7 @@ class Net::Arp_cache : public Genode::Avl_tree<Arp_cache_entry>
|
||||
|
||||
void destroy_entries_with_mac(Mac_address const &mac);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_ip(Ipv4_address const &ip,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_ip(Ipv4_address const &ip, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (first() != nullptr) {
|
||||
|
||||
|
@ -113,8 +113,7 @@ class Net::Dhcp_server : private Genode::Noncopyable,
|
||||
|
||||
bool has_invalid_remote_dns_cfg() const;
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_dns_server_ip(FUNC && functor) const
|
||||
void for_each_dns_server_ip(auto const &functor) const
|
||||
{
|
||||
if (_dns_config_from_ptr) {
|
||||
|
||||
@ -262,8 +261,7 @@ struct Net::Dhcp_allocation_tree
|
||||
|
||||
Dhcp_allocation *first() { return _tree.first(); }
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each(FUNC && functor)
|
||||
void for_each(auto const &functor)
|
||||
{
|
||||
using List_item = Dhcp_allocation_list::Element;
|
||||
for (Dhcp_allocation *item = _list.first(); item; )
|
||||
|
@ -32,8 +32,7 @@ class Net::Dictionary : public Genode::Dictionary<OBJECT_T, NAME_T>
|
||||
|
||||
public:
|
||||
|
||||
template <typename FUNCTION_T>
|
||||
void for_each(FUNCTION_T const &function) const
|
||||
void for_each(auto const &function) const
|
||||
{
|
||||
Dict::for_each(
|
||||
[&] (OBJECT_T const &obj)
|
||||
|
@ -71,12 +71,10 @@ struct Net::Direct_rule_list : List<T>
|
||||
{
|
||||
using Base = List<T>;
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
void
|
||||
find_longest_prefix_match(Ipv4_address const &ip,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
find_longest_prefix_match(Ipv4_address const &ip,
|
||||
auto const &handle_match,
|
||||
auto const &handle_no_match) const
|
||||
{
|
||||
/*
|
||||
* Simply handling the first match is sufficient as the list is
|
||||
|
@ -46,13 +46,10 @@ class Net::Dns_server : private Genode::Noncopyable,
|
||||
|
||||
public:
|
||||
|
||||
template <typename HANDLE_SUCCESS_FN,
|
||||
typename HANDLE_FAILURE_FN>
|
||||
|
||||
static void construct(Genode::Allocator &alloc,
|
||||
Net::Ipv4_address const &ip,
|
||||
HANDLE_SUCCESS_FN && handle_success,
|
||||
HANDLE_FAILURE_FN && handle_failure)
|
||||
auto const &handle_success,
|
||||
auto const &handle_failure)
|
||||
{
|
||||
if (!ip.valid()) {
|
||||
handle_failure();
|
||||
@ -107,8 +104,7 @@ class Net::Dns_domain_name : private Genode::Noncopyable
|
||||
|
||||
bool valid() const { return _string_ptr; }
|
||||
|
||||
template <typename FUNC>
|
||||
void with_string(FUNC && func) const
|
||||
void with_string(auto const &func) const
|
||||
{
|
||||
if (_string_ptr)
|
||||
func(*_string_ptr);
|
||||
|
@ -148,8 +148,7 @@ class Net::Domain : public List<Domain>::Element,
|
||||
|
||||
void _finish_reconstructing_ip_config();
|
||||
|
||||
template <typename FUNC>
|
||||
void _reconstruct_ip_config(FUNC && functor)
|
||||
void _reconstruct_ip_config(auto const &functor)
|
||||
{
|
||||
_prepare_reconstructing_ip_config();
|
||||
functor(_ip_config);
|
||||
|
@ -51,12 +51,7 @@ class Net::Forward_rule : public Genode::Avl_node<Forward_rule>
|
||||
|
||||
Forward_rule(Port port, Ipv4_address to_ip, Port to_port, Domain &domain);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_port(Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_port(Port port, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (port.value != _port.value) {
|
||||
|
||||
@ -106,12 +101,7 @@ class Net::Forward_rule : public Genode::Avl_node<Forward_rule>
|
||||
|
||||
struct Net::Forward_rule_tree : Avl_tree<Forward_rule>
|
||||
{
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_port(Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_port(Port port, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (first() != nullptr) {
|
||||
|
||||
|
@ -394,8 +394,7 @@ class Net::Interface : private Interface_list::Element
|
||||
|
||||
void dhcp_allocation_expired(Dhcp_allocation &allocation);
|
||||
|
||||
template <typename FUNC>
|
||||
void send(Genode::size_t pkt_size, FUNC && write_to_pkt)
|
||||
void send(Genode::size_t pkt_size, auto const &write_to_pkt)
|
||||
{
|
||||
if (!link_state()) {
|
||||
_failed_to_send_packet_link();
|
||||
|
@ -78,8 +78,7 @@ class Net::Ipv4_config
|
||||
return !(*this != other);
|
||||
}
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each_dns_server(FUNC && func) const
|
||||
void for_each_dns_server(auto const &func) const
|
||||
{
|
||||
_dns_servers.for_each([&] (Dns_server const &dns_server) {
|
||||
func(dns_server);
|
||||
|
@ -105,12 +105,7 @@ class Net::Link_side : public Genode::Avl_node<Link_side>
|
||||
Link_side_id const &id,
|
||||
Link &link);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_id(Link_side_id const &id,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_id(Link_side_id const &id, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (id != _id) {
|
||||
|
||||
@ -165,12 +160,7 @@ class Net::Link_side : public Genode::Avl_node<Link_side>
|
||||
|
||||
struct Net::Link_side_tree : Genode::Avl_tree<Link_side>
|
||||
{
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_id(Link_side_id const &id,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_id(Link_side_id const &id, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (first() != nullptr) {
|
||||
|
||||
|
@ -26,8 +26,7 @@ struct Net::List : Genode::List<LT>
|
||||
{
|
||||
using Base = Genode::List<LT>;
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each(FUNC && functor)
|
||||
void for_each(auto const &functor)
|
||||
{
|
||||
for (LT *elem = Base::first(); elem; )
|
||||
{
|
||||
@ -37,8 +36,7 @@ struct Net::List : Genode::List<LT>
|
||||
}
|
||||
}
|
||||
|
||||
template <typename FUNC>
|
||||
void for_each(FUNC && functor) const
|
||||
void for_each(auto const &functor) const
|
||||
{
|
||||
for (LT const *elem = Base::first(); elem; )
|
||||
{
|
||||
|
@ -55,8 +55,7 @@ class Net::Main
|
||||
|
||||
void _handle_config();
|
||||
|
||||
template <typename FUNC>
|
||||
void _for_each_interface(FUNC && functor)
|
||||
void _for_each_interface(auto const &functor)
|
||||
{
|
||||
_interfaces.for_each([&] (Interface &interface) {
|
||||
functor(interface);
|
||||
|
@ -53,12 +53,7 @@ class Net::Nat_rule : public Genode::Avl_node<Nat_rule>
|
||||
|
||||
Nat_rule &find_by_domain(Domain &domain);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_domain(Domain &domain,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match)
|
||||
void find_by_domain(Domain &domain, auto const &handle_match, auto const &handle_no_match)
|
||||
{
|
||||
if (&domain != &_domain) {
|
||||
|
||||
@ -112,12 +107,7 @@ class Net::Nat_rule : public Genode::Avl_node<Nat_rule>
|
||||
|
||||
struct Net::Nat_rule_tree : Avl_tree<Nat_rule>
|
||||
{
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_domain(Domain &domain,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match)
|
||||
void find_by_domain(Domain &domain, auto const &handle_match, auto const &handle_no_match)
|
||||
{
|
||||
if (first() != nullptr) {
|
||||
|
||||
|
@ -99,12 +99,7 @@ class Net::Permit_single_rule : public Permit_rule,
|
||||
|
||||
Permit_single_rule(Port port, Domain &domain);
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_port(Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_port(Port port, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (port.value != _port.value) {
|
||||
|
||||
@ -161,12 +156,7 @@ struct Net::Permit_single_rule_tree : private Avl_tree<Permit_single_rule>
|
||||
|
||||
using Genode::Avl_tree<Permit_single_rule>::first;
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_by_port(Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_by_port(Port port, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (first() != nullptr) {
|
||||
|
||||
|
@ -38,11 +38,10 @@ class Net::Session_creation
|
||||
|
||||
public:
|
||||
|
||||
template <typename CREATE_SESSION_FN>
|
||||
SESSION_COMPONENT *execute(Env &env,
|
||||
Quota &shared_quota,
|
||||
char const *session_args,
|
||||
CREATE_SESSION_FN && create_session_fn)
|
||||
auto const &create_session_fn)
|
||||
{
|
||||
/*
|
||||
* Note that this cannot be done in the constructor of this class
|
||||
|
@ -30,12 +30,11 @@ class Genode::Session_env : public Ram_allocator,
|
||||
Ram_quota_guard _ram_guard;
|
||||
Cap_quota_guard _cap_guard;
|
||||
|
||||
template <typename FUNC>
|
||||
void _consume(size_t own_ram,
|
||||
size_t max_shared_ram,
|
||||
size_t own_cap,
|
||||
size_t max_shared_cap,
|
||||
FUNC && functor)
|
||||
void _consume(size_t own_ram,
|
||||
size_t max_shared_ram,
|
||||
size_t own_cap,
|
||||
size_t max_shared_cap,
|
||||
auto const &functor)
|
||||
{
|
||||
size_t const max_ram_consumpt { own_ram + max_shared_ram };
|
||||
size_t const max_cap_consumpt { own_cap + max_shared_cap };
|
||||
@ -69,10 +68,9 @@ class Genode::Session_env : public Ram_allocator,
|
||||
_cap_guard.replenish( Cap_quota { max_shared_cap } );
|
||||
}
|
||||
|
||||
template <typename FUNC>
|
||||
void _replenish(size_t accounted_ram,
|
||||
size_t accounted_cap,
|
||||
FUNC && functor)
|
||||
void _replenish(size_t accounted_ram,
|
||||
size_t accounted_cap,
|
||||
auto const &functor)
|
||||
{
|
||||
size_t ram_replenish { _env.pd().used_ram().value };
|
||||
size_t cap_replenish { _env.pd().used_caps().value };
|
||||
|
@ -54,12 +54,7 @@ class Net::Transport_rule : public Direct_rule<Transport_rule>
|
||||
|
||||
~Transport_rule();
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
void
|
||||
find_permit_rule_by_port(Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_permit_rule_by_port(Port port, auto const &handle_match, auto const &handle_no_match) const
|
||||
{
|
||||
if (_permit_any_rule_ptr) {
|
||||
|
||||
@ -84,13 +79,10 @@ class Net::Transport_rule_list : public Direct_rule_list<Transport_rule>
|
||||
{
|
||||
public:
|
||||
|
||||
template <typename HANDLE_MATCH_FN,
|
||||
typename HANDLE_NO_MATCH_FN>
|
||||
|
||||
void find_best_match(Ipv4_address const &ip,
|
||||
Port const port,
|
||||
HANDLE_MATCH_FN && handle_match,
|
||||
HANDLE_NO_MATCH_FN && handle_no_match) const
|
||||
void find_best_match(Ipv4_address const &ip,
|
||||
Port const port,
|
||||
auto const &handle_match,
|
||||
auto const &handle_no_match) const
|
||||
{
|
||||
find_longest_prefix_match(
|
||||
ip,
|
||||
|
Loading…
x
Reference in New Issue
Block a user