nic_router: fix net session aliases

The Interface class of the router is an abstraction for NIC client sessions,
NIC server sessions, and Uplink sessions. Nonetheless, Interface generally used
to use the packet stream types of the Nic namespace and it worked because the
Uplink packet stream types are factually the same (the are typedef'd from the
same base type templates with the same parameters).

The initial intention of this issue was to remove dependency on the diverse
packet stream stream types from Interface. However, this turned out to be more
tricky than thought. The Interface class calls function templates on the packet
stream types, making a generic virtual interface impossible. And moving the
calling code to the session classes as well would produce a lot of redundancy.

Therefore, this commit removes only the use of the Nic namespace in the
interface.* files by typedef'ing the packet stream types from the generic
Genode type templates with the same parameters as in Nic and Uplink.

Fixes #4385
This commit is contained in:
Martin Stein 2022-09-06 13:13:15 +02:00 committed by Norman Feske
parent ede007c2dd
commit 054990aafa

View File

@ -24,7 +24,6 @@
#include <report.h>
/* Genode includes */
#include <nic_session/nic_session.h>
#include <net/dhcp.h>
#include <net/icmp.h>
@ -32,10 +31,22 @@ namespace Genode { class Xml_generator; }
namespace Net {
using Packet_descriptor = ::Nic::Packet_descriptor;
using Packet_stream_sink = ::Nic::Packet_stream_sink< ::Nic::Session::Policy>;
using Packet_stream_source = ::Nic::Packet_stream_source< ::Nic::Session::Policy>;
using Domain_name = Genode::String<160>;
enum { PKT_STREAM_QUEUE_SIZE = 1024 };
/*
* In order to be compliant to both the Uplink and the Nic packet stream
* types, we use the more base types from the Genode namespace here and
* combine them with the same parameters as in the Uplink and Nic
* namespaces. I.e., we assume the Uplink and Nic packet stream types to
* be factually the same although they are logically independent from each
* other.
*/
using Packet_descriptor = Genode::Packet_descriptor;
using Packet_stream_policy = Genode::Packet_stream_policy<Packet_descriptor, PKT_STREAM_QUEUE_SIZE, PKT_STREAM_QUEUE_SIZE, char>;
using Packet_stream_sink = Genode::Packet_stream_sink<Packet_stream_policy>;
using Packet_stream_source = Genode::Packet_stream_source<Packet_stream_policy>;
using Domain_name = Genode::String<160>;
class Ipv4_config;
class Forward_rule_tree;
class Transport_rule_list;