genode/repos/os/include/packet_stream_rx/client.h

67 lines
1.9 KiB
C
Raw Normal View History

2011-12-22 15:19:25 +00:00
/*
* \brief Client-side interface for packet-stream transmission
* \author Norman Feske
* \date 2010-03-01
*/
/*
2013-01-10 20:44:47 +00:00
* Copyright (C) 2010-2013 Genode Labs GmbH
2011-12-22 15:19:25 +00:00
*
* 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__PACKET_STREAM_RX__CLIENT_H_
#define _INCLUDE__PACKET_STREAM_RX__CLIENT_H_
#include <packet_stream_rx/packet_stream_rx.h>
#include <base/rpc_client.h>
namespace Packet_stream_rx { template <typename> class Client; }
2011-12-22 15:19:25 +00:00
template <typename CHANNEL>
class Packet_stream_rx::Client : public Genode::Rpc_client<CHANNEL>
{
private:
2011-12-22 15:19:25 +00:00
typename CHANNEL::Sink _sink;
2011-12-22 15:19:25 +00:00
/*
* Type shortcuts
*/
typedef Genode::Rpc_client<CHANNEL> Base;
typedef typename Base::Rpc_dataspace Rpc_dataspace;
typedef typename Base::Rpc_packet_avail Rpc_packet_avail;
typedef typename Base::Rpc_ready_to_ack Rpc_ready_to_ack;
typedef typename Base::Rpc_ready_to_submit Rpc_ready_to_submit;
typedef typename Base::Rpc_ack_avail Rpc_ack_avail;
2011-12-22 15:19:25 +00:00
public:
2011-12-22 15:19:25 +00:00
/**
* Constructor
*/
Client(Genode::Capability<CHANNEL> channel_cap) :
Genode::Rpc_client<CHANNEL>(channel_cap),
_sink(Base::template call<Rpc_dataspace>())
{
/* wire data-flow signals for the packet receiver */
_sink.register_sigh_ack_avail(Base::template call<Rpc_ack_avail>());
_sink.register_sigh_ready_to_submit(Base::template call<Rpc_ready_to_submit>());
2011-12-22 15:19:25 +00:00
sigh_ready_to_ack(_sink.sigh_ready_to_ack());
sigh_packet_avail(_sink.sigh_packet_avail());
}
2011-12-22 15:19:25 +00:00
void sigh_ready_to_ack(Genode::Signal_context_capability sigh) {
Base::template call<Rpc_ready_to_ack>(sigh); }
2011-12-22 15:19:25 +00:00
void sigh_packet_avail(Genode::Signal_context_capability sigh) {
Base::template call<Rpc_packet_avail>(sigh); }
typename CHANNEL::Sink *sink() { return &_sink; }
};
2011-12-22 15:19:25 +00:00
#endif /* _INCLUDE__PACKET_STREAM_RX__CLIENT_H_ */