mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 14:13:09 +00:00
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
69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
/*
|
|
* \brief Client-side NIC session interface
|
|
* \author Norman Feske
|
|
* \date 2009-11-13
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2009-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 _INCLUDE__NIC_SESSION__CLIENT_H_
|
|
#define _INCLUDE__NIC_SESSION__CLIENT_H_
|
|
|
|
#include <base/rpc_client.h>
|
|
#include <nic_session/capability.h>
|
|
#include <packet_stream_tx/client.h>
|
|
#include <packet_stream_rx/client.h>
|
|
|
|
namespace Nic { class Session_client; }
|
|
|
|
|
|
class Nic::Session_client : public Genode::Rpc_client<Session>
|
|
{
|
|
private:
|
|
|
|
Packet_stream_tx::Client<Tx> _tx;
|
|
Packet_stream_rx::Client<Rx> _rx;
|
|
|
|
public:
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \param tx_buffer_alloc allocator used for managing the
|
|
* transmission buffer
|
|
*/
|
|
Session_client(Session_capability session,
|
|
Genode::Range_allocator *tx_buffer_alloc)
|
|
:
|
|
Genode::Rpc_client<Session>(session),
|
|
_tx(call<Rpc_tx_cap>(), tx_buffer_alloc),
|
|
_rx(call<Rpc_rx_cap>())
|
|
{ }
|
|
|
|
|
|
/***************************
|
|
** NIC session interface **
|
|
***************************/
|
|
|
|
Mac_address mac_address() override { return call<Rpc_mac_address>(); }
|
|
|
|
Tx *tx_channel() { return &_tx; }
|
|
Rx *rx_channel() { return &_rx; }
|
|
Tx::Source *tx() { return _tx.source(); }
|
|
Rx::Sink *rx() { return _rx.sink(); }
|
|
|
|
void link_state_sigh(Genode::Signal_context_capability sigh) override
|
|
{
|
|
call<Rpc_link_state_sigh>(sigh);
|
|
}
|
|
|
|
bool link_state() override { return call<Rpc_link_state>(); }
|
|
};
|
|
|
|
#endif /* _INCLUDE__NIC_SESSION__CLIENT_H_ */
|