mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
cf72d1aac3
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
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*
|
|
* \brief Connection to Uplink service
|
|
* \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__CONNECTION_H_
|
|
#define _UPLINK_SESSION__CONNECTION_H_
|
|
|
|
/* Genode includes */
|
|
#include <uplink_session/client.h>
|
|
#include <base/connection.h>
|
|
#include <base/allocator.h>
|
|
#include <net/mac_address.h>
|
|
|
|
namespace Uplink { struct Connection; }
|
|
|
|
|
|
struct Uplink::Connection : Genode::Connection<Session>, Session_client
|
|
{
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \param tx_buffer_alloc allocator used for managing the
|
|
* transmission buffer
|
|
* \param tx_buf_size size of transmission buffer in bytes
|
|
* \param rx_buf_size size of reception buffer in bytes
|
|
*/
|
|
Connection(Genode::Env &env,
|
|
Genode::Range_allocator *tx_block_alloc,
|
|
Genode::size_t tx_buf_size,
|
|
Genode::size_t rx_buf_size,
|
|
Net::Mac_address const &mac_address,
|
|
char const *label = "")
|
|
:
|
|
Genode::Connection<Session>(
|
|
env,
|
|
session(
|
|
env.parent(),
|
|
"ram_quota=%ld, cap_quota=%ld, mac_address=\"%s\", "
|
|
"tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"",
|
|
32 * 1024 * sizeof(long) + tx_buf_size + rx_buf_size,
|
|
CAP_QUOTA,
|
|
Genode::String<18>(mac_address).string(),
|
|
tx_buf_size,
|
|
rx_buf_size,
|
|
label)),
|
|
|
|
Session_client(cap(), *tx_block_alloc, env.rm())
|
|
{ }
|
|
};
|
|
|
|
#endif /* _UPLINK_SESSION__CONNECTION_H_ */
|