dd47129bef
A Nic::Session client can install a signal handler that is used to propagate changes of the link-state by calling 'link_state_sigh()'. The actual link state is queried via 'link_state()'. The nic-driver interface now provides a Driver_notification callback, which is used to forward link-state changes from the driver to the Nic::Session_component. The following drivers now provide real link state: dde_ipxe, nic_bridge, and usb_drv. Currently, OpenVPN, Linux nic_drv, and lan9118 do not support link state and always report link up. Fixes #1327
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
/*
|
|
* \brief Proxy-ARP NIC session handler
|
|
* \author Stefan Kalkowski
|
|
* \date 2010-08-18
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2010-2013 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _SRC__SERVER__NIC_BRIDGE__NIC_H_
|
|
#define _SRC__SERVER__NIC_BRIDGE__NIC_H_
|
|
|
|
#include <nic_session/connection.h>
|
|
#include <nic/packet_allocator.h>
|
|
|
|
#include "env.h"
|
|
#include "packet_handler.h"
|
|
|
|
namespace Net {
|
|
class Nic;
|
|
}
|
|
|
|
|
|
class Net::Nic : public Net::Packet_handler
|
|
{
|
|
private:
|
|
|
|
enum {
|
|
PACKET_SIZE = ::Nic::Packet_allocator::DEFAULT_PACKET_SIZE,
|
|
BUF_SIZE = ::Nic::Session::QUEUE_SIZE * PACKET_SIZE,
|
|
};
|
|
|
|
::Nic::Packet_allocator _tx_block_alloc;
|
|
::Nic::Connection _nic;
|
|
Ethernet_frame::Mac_address _mac;
|
|
|
|
public:
|
|
|
|
Nic();
|
|
|
|
::Nic::Connection *nic() { return &_nic; }
|
|
Ethernet_frame::Mac_address mac() { return _mac; }
|
|
|
|
bool link_state() { return _nic.link_state(); }
|
|
|
|
/******************************
|
|
** Packet_handler interface **
|
|
******************************/
|
|
|
|
Packet_stream_sink< ::Nic::Session::Policy> * sink() {
|
|
return _nic.rx(); }
|
|
|
|
Packet_stream_source< ::Nic::Session::Policy> * source() {
|
|
return _nic.tx(); }
|
|
|
|
bool handle_arp(Ethernet_frame *eth, Genode::size_t size);
|
|
bool handle_ip(Ethernet_frame *eth, Genode::size_t size);
|
|
void finalize_packet(Ethernet_frame *eth, Genode::size_t size) {}
|
|
};
|
|
|
|
#endif /* _SRC__SERVER__NIC_BRIDGE__NIC_H_ */
|