nic_dump: default attribute

The 'default' attribute is useful to change the default value for those
protocol attributes that are not explicitely set in the configuration of
the component.

Issue #2738
This commit is contained in:
Martin Stein 2018-04-06 15:47:12 +02:00 committed by Christian Helmuth
parent ed13a0a262
commit d6e1c462cc
4 changed files with 23 additions and 16 deletions

View File

@ -62,6 +62,7 @@ append config {
<config uplink="bridge"
downlink="router"
time="yes"
default="name"
eth="name"
arp="all"
ipv4="default"

View File

@ -13,6 +13,7 @@ their default values (except config.uplink and config.downlink):
! <config uplink="uplink"
! downlink="downlink"
! time="no"
! default="default"
! eth="default"
! arp="default"
! ipv4="default"
@ -33,6 +34,9 @@ accepts one of four possible values:
* default - print a short summary of the most important header values
* all - print all available header values
The 'default' attribute is useful to change the default value for protocol
attributes that are not explicitely set.
An example output snippet of the component might be:
! (olivia <- karl) ETH ... ARP ... time 4626 (15)

View File

@ -99,20 +99,21 @@ Net::Interface::Interface(Entrypoint &ep,
Allocator &alloc,
Xml_node config)
:
_sink_ack { ep, *this, &Interface::_ack_avail },
_sink_submit { ep, *this, &Interface::_ready_to_submit },
_source_ack { ep, *this, &Interface::_ready_to_ack },
_source_submit { ep, *this, &Interface::_packet_avail },
_alloc { alloc },
_label { label },
_timer { timer },
_curr_time { curr_time },
_log_time { log_time },
_log_cfg { config.attribute_value("eth", Packet_log_style::DEFAULT),
config.attribute_value("arp", Packet_log_style::DEFAULT),
config.attribute_value("ipv4", Packet_log_style::DEFAULT),
config.attribute_value("dhcp", Packet_log_style::DEFAULT),
config.attribute_value("udp", Packet_log_style::DEFAULT),
config.attribute_value("icmp", Packet_log_style::DEFAULT),
config.attribute_value("tcp", Packet_log_style::DEFAULT) }
_sink_ack { ep, *this, &Interface::_ack_avail },
_sink_submit { ep, *this, &Interface::_ready_to_submit },
_source_ack { ep, *this, &Interface::_ready_to_ack },
_source_submit { ep, *this, &Interface::_packet_avail },
_alloc { alloc },
_label { label },
_timer { timer },
_curr_time { curr_time },
_log_time { log_time },
_default_log_style { config.attribute_value("default", Packet_log_style::DEFAULT) },
_log_cfg { config.attribute_value("eth", _default_log_style),
config.attribute_value("arp", _default_log_style),
config.attribute_value("ipv4", _default_log_style),
config.attribute_value("dhcp", _default_log_style),
config.attribute_value("udp", _default_log_style),
config.attribute_value("icmp", _default_log_style),
config.attribute_value("tcp", _default_log_style) }
{ }

View File

@ -55,6 +55,7 @@ class Net::Interface
Timer::Connection &_timer;
Genode::Duration &_curr_time;
bool _log_time;
Packet_log_style const _default_log_style;
Packet_log_config const _log_cfg;
void _send(Ethernet_frame &eth, Genode::size_t const eth_size);