L4Re - L4 Runtime Environment
L4::Ipc::Iostream Class Reference

Input/Output stream for IPC [un]marshalling. More...

+ Inheritance diagram for L4::Ipc::Iostream:
+ Collaboration diagram for L4::Ipc::Iostream:

Public Member Functions

 Iostream (l4_utcb_t *utcb)
 Create an IPC IO stream with a single message buffer. More...
 
void reset ()
 Reset the stream to its initial state. More...
 
IPC operations.
l4_msgtag_t call (l4_cap_idx_t dst, l4_timeout_t timeout, long proto=0)
 Do an IPC call using the message in the output stream and receiving to the input stream. More...
 
l4_msgtag_t call (l4_cap_idx_t dst, long proto=0)
 
l4_msgtag_t reply_and_wait (l4_umword_t *src_dst, long proto=0)
 Do an IPC reply and wait. More...
 
l4_msgtag_t send_and_wait (l4_cap_idx_t dest, l4_umword_t *src, long proto=0)
 
l4_msgtag_t reply_and_wait (l4_umword_t *src_dst, l4_timeout_t timeout, long proto=0)
 Do an IPC reply and wait. More...
 
l4_msgtag_t send_and_wait (l4_cap_idx_t dest, l4_umword_t *src, l4_timeout_t timeout, long proto=0)
 
l4_msgtag_t reply (l4_timeout_t timeout, long proto=0)
 
l4_msgtag_t reply (long proto=0)
 
- Public Member Functions inherited from L4::Ipc::Istream
 Istream (l4_utcb_t *utcb)
 Create an input stream for the given message buffer. More...
 
void reset ()
 Reset the stream to empty, and ready for receive()/wait(). More...
 
template<typename T >
bool has_more (unsigned long count=1)
 Check whether a value of type T can be obtained from the stream.
 
l4_utcb_tutcb () const
 Return utcb pointer.
 
template<typename T >
unsigned long get (T *buf, unsigned long elems)
 Copy out an array of type T with size elements. More...
 
template<typename T >
void skip (unsigned long elems)
 Skip size elements of type T in the stream. More...
 
template<typename T >
unsigned long get (Msg_ptr< T > const &buf, unsigned long elems=1)
 Read one size elements of type T from the stream and return a pointer. More...
 
template<typename T >
bool get (T &v)
 Extract a single element of type T from the stream. More...
 
bool get (Ipc::Varg *va)
 
l4_msgtag_t tag () const
 Get the message tag of a received IPC. More...
 
l4_msgtag_ttag ()
 Get the message tag of a received IPC. More...
 
l4_msgtag_t wait (l4_umword_t *src)
 Wait for an incoming message from any sender. More...
 
l4_msgtag_t wait (l4_umword_t *src, l4_timeout_t timeout)
 Wait for an incoming message from any sender. More...
 
l4_msgtag_t receive (l4_cap_idx_t src)
 Wait for a message from the specified sender. More...
 
l4_msgtag_t receive (l4_cap_idx_t src, l4_timeout_t timeout)
 
- Public Member Functions inherited from L4::Ipc::Ostream
 Ostream (l4_utcb_t *utcb)
 Create an IPC output stream using the given message buffer utcb.
 
void reset ()
 Reset the stream to empty, same state as a newly created stream.
 
l4_utcb_tutcb () const
 Return utcb pointer.
 
template<typename T >
bool put (T *buf, unsigned long size)
 Put an array with size elements of type T into the stream. More...
 
template<typename T >
bool put (T const &v)
 Insert an element of type T into the stream. More...
 
int put (Varg const &va)
 
template<typename T >
int put (Varg_t< T > const &va)
 
l4_msgtag_t tag () const
 Extract the L4 message tag from the stream. More...
 
l4_msgtag_ttag ()
 Extract a reference to the L4 message tag from the stream. More...
 
l4_msgtag_t send (l4_cap_idx_t dst, long proto=0, unsigned flags=0)
 Send the message via IPC to the given receiver. More...
 

Detailed Description

Input/Output stream for IPC [un]marshalling.

The Ipc::Iostream is part of the AW Env IPC framework as well as Ipc::Istream and Ipc::Ostream. In particular an Ipc::Iostream is a combination of an Ipc::Istream and an Ipc::Ostream. It can use either a single message buffer for receiving and sending messages or a pair of a receive and a send buffer. The stream also supports combined IPC operations such as call() and reply_and_wait(), which can be used to implement RPC functionality.

Examples:
examples/libs/l4re/c++/shared_ds/ds_srv.cc, examples/libs/l4re/streammap/client.cc, and examples/libs/l4re/streammap/server.cc.

Definition at line 791 of file ipc_stream.

Constructor & Destructor Documentation

◆ Iostream()

L4::Ipc::Iostream::Iostream ( l4_utcb_t utcb)
inlineexplicit

Create an IPC IO stream with a single message buffer.

Parameters
utcbThe message buffer used as backing store.

The created IO stream uses the same message buffer for sending and receiving IPC messages.

Definition at line 803 of file ipc_stream.

Member Function Documentation

◆ call()

l4_msgtag_t L4::Ipc::Iostream::call ( l4_cap_idx_t  dst,
l4_timeout_t  timeout,
long  proto = 0 
)
inline

Do an IPC call using the message in the output stream and receiving to the input stream.

Parameters
dstThe destination L4 UID (thread) to call.
timeoutThe IPC timeout for the call.
protoThe protocol value to use in the message tag.
Returns
The result dope of the IPC operation.

This is a combined IPC operation consisting of a send and a receive to/from the given destination dst.

A call is usually used by clients for RPCs to a server.

Examples:
examples/libs/l4re/streammap/client.cc.

Definition at line 962 of file ipc_stream.

◆ reply_and_wait() [1/2]

l4_msgtag_t L4::Ipc::Iostream::reply_and_wait ( l4_umword_t src_dst,
long  proto = 0 
)
inline

Do an IPC reply and wait.

Parameters
[in,out]src_dstInput: the destination for the send operation.
Output: the source of the received message.
protoProtocol to use.
Returns
the result dope of the IPC operation.

This is a combined IPC operation consisting of a send operation and an open wait for any message.

A reply and wait is usually used by servers that reply to a client and wait for the next request by any other client.

Definition at line 876 of file ipc_stream.

◆ reply_and_wait() [2/2]

l4_msgtag_t L4::Ipc::Iostream::reply_and_wait ( l4_umword_t src_dst,
l4_timeout_t  timeout,
long  proto = 0 
)
inline

Do an IPC reply and wait.

Parameters
[in,out]src_dstInput: the destination for the send operation.
Output: the source of the received message.
timeoutTimeout used for IPC.
protoProtocol to use.
Returns
the result dope of the IPC operation.

This is a combined IPC operation consisting of a send operation and an open wait for any message.

A reply and wait is usually used by servers that reply to a client and wait for the next request by any other client.

Definition at line 977 of file ipc_stream.

◆ reset()

void L4::Ipc::Iostream::reset ( )
inline

Reset the stream to its initial state.

Input as well as the output stream are reset.

Definition at line 817 of file ipc_stream.


The documentation for this class was generated from the following file: