genode/repos/os/include/uplink_session/rpc_object.h
Martin Stein cf72d1aac3 os: introduce new "Uplink" session
Adds new Uplink session interface, the corresponding client side (Client,
Connection), and the corresponding API archives. An Uplink session is almost
the same as a NIC session with the difference that the roles of the end points
are swapped. An Uplink client is the one that provides a network interface
(for instance, a NIC driver) whereas an Uplink server is the one that uses
that network interface (for instance, a networking stack).

Therefore, in contrast to the NIC session, MAC address and link state come from
the Uplink client. The link state is reflected through the lifetime of an
Uplink session: The client requests the session only when the link state is
"UP" and closes it whenever the link state becomes "DOWN" again. The MAC
address is transmitted from the Uplink client to the Uplink server as an
argument of the session request.

Ref #3961
2021-01-25 13:48:09 +01:00

60 lines
1.7 KiB
C++

/*
* \brief Server-side Uplink session interface
* \author Martin Stein
* \date 2020-11-30
*/
/*
* Copyright (C) 2020 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _UPLINK_SESSION__RPC_OBJECT_H_
#define _UPLINK_SESSION__RPC_OBJECT_H_
/* Genode includes */
#include <uplink_session/uplink_session.h>
#include <packet_stream_tx/rpc_object.h>
#include <packet_stream_rx/rpc_object.h>
namespace Uplink { class Session_rpc_object; }
class Uplink::Session_rpc_object : public Genode::Rpc_object<Session, Session_rpc_object>
{
protected:
Packet_stream_tx::Rpc_object<Tx> _tx;
Packet_stream_rx::Rpc_object<Rx> _rx;
public:
/**
* Constructor
*
* \param tx_ds dataspace used as communication buffer
* for the tx packet stream
* \param rx_ds dataspace used as communication buffer
* for the rx packet stream
* \param rx_buffer_alloc allocator used for managing the communication
* buffer of the rx packet stream
* \param ep entry point used for packet-stream channels
*/
Session_rpc_object(Genode::Region_map &rm,
Genode::Dataspace_capability tx_ds,
Genode::Dataspace_capability rx_ds,
Genode::Range_allocator *rx_buffer_alloc,
Genode::Rpc_entrypoint &ep)
:
_tx(tx_ds, rm, ep),
_rx(rx_ds, rm, *rx_buffer_alloc, ep)
{ }
Genode::Capability<Tx> _tx_cap() { return _tx.cap(); }
Genode::Capability<Rx> _rx_cap() { return _rx.cap(); }
};
#endif /* _UPLINK_SESSION__RPC_OBJECT_H_ */