L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4::Ipc::Iostream Class Reference

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

#include <ipc_stream>

+ 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.
 
void reset ()
 Reset the stream to its initial state.
 
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 receive the reply in the input stream.
 
l4_msgtag_t reply_and_wait (l4_umword_t *src_dst, long proto=0)
 Do an IPC reply and wait.
 
l4_msgtag_t reply_and_wait (l4_umword_t *src_dst, l4_timeout_t timeout, long proto=0)
 Do an IPC reply and wait.
 
Get/Put functions.

These functions are basically used to implement the insertion operators (<<) and should not be called directly.

template<typename T >
unsigned long get (T *buf, unsigned long elems)
 Copy out an array of type T with size elements.
 
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.
 
template<typename T >
bool get (T &v)
 Extract a single element of type T from the stream.
 
template<typename T >
bool put (T *buf, unsigned long size)
 Put an array with size elements of type T into the stream.
 
template<typename T >
bool put (T const &v)
 Insert an element of type T into the stream.
 
- Public Member Functions inherited from L4::Ipc::Istream
 Istream (l4_utcb_t *utcb)
 Create an input stream for the given message buffer.
 
void reset ()
 Reset the stream to empty, and ready for receive()/wait().
 
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.
 
template<typename T >
void skip (unsigned long elems)
 Skip size elements of type T in the stream.
 
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.
 
template<typename T >
bool get (T &v)
 Extract a single element of type T from the stream.
 
l4_msgtag_t tag () const
 Get the message tag of a received IPC.
 
l4_msgtag_ttag ()
 Get the message tag of a received IPC.
 
l4_msgtag_t wait (l4_umword_t *src)
 Wait for an incoming message from any sender.
 
l4_msgtag_t wait (l4_umword_t *src, l4_timeout_t timeout)
 Wait for an incoming message from any sender.
 
l4_msgtag_t receive (l4_cap_idx_t src)
 Wait for a message from the specified sender.
 
- 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.
 
template<typename T >
bool put (T const &v)
 Insert an element of type T into the stream.
 
l4_msgtag_t tag () const
 Extract the L4 message tag from the stream.
 
l4_msgtag_ttag ()
 Extract a reference to the L4 message tag from the stream.
 
l4_msgtag_t send (l4_cap_idx_t dst, long proto=0, unsigned flags=0)
 Send the message via IPC to the given receiver.
 

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 800 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 812 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 receive the reply in the input stream.

Parameters
dstThe destination to call.
timeoutThe IPC timeout for the call.
protoThe protocol value to use in the message tag.
Returns
The result tag 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 977 of file ipc_stream.

References l4_ipc_call(), and L4::Ipc::Istream::tag().

+ Here is the call graph for this function:

◆ get() [1/3]

template<typename T >
unsigned long L4::Ipc::Istream::get ( Msg_ptr< T > const &  buf,
unsigned long  elems = 1 
)
inline

Read one size elements of type T from the stream and return a pointer.

Parameters
bufA Msg_ptr that is actually set to point to the element in the stream.
elemsNumber of elements to extract (default is 1).
Returns
The number of elements extracted.

In contrast to a normal get, this version does actually not copy the data but returns a pointer to the data.

See operator>>()

Definition at line 450 of file ipc_stream.

◆ get() [2/3]

template<typename T >
bool L4::Ipc::Istream::get ( T &  v)
inline

Extract a single element of type T from the stream.

Parameters
[out]vThe element.
Return values
trueAn element was successfully extracted.
falseAn element could not be extracted.

See operator>>()

Definition at line 475 of file ipc_stream.

◆ get() [3/3]

template<typename T >
unsigned long L4::Ipc::Istream::get ( T *  buf,
unsigned long  elems 
)
inline

Copy out an array of type T with size elements.

Parameters
bufPointer to a buffer for size elements of type T.
elemsNumber of elements of type T to copy out.
Returns
The number of elements copied out.

See operator>>()

Definition at line 405 of file ipc_stream.

◆ put() [1/2]

template<typename T >
bool L4::Ipc::Ostream::put ( T *  buf,
unsigned long  size 
)
inline

Put an array with size elements of type T into the stream.

Parameters
bufA pointer to the array to insert into the buffer.
sizeThe number of elements in the array.

Definition at line 671 of file ipc_stream.

◆ put() [2/2]

template<typename T >
bool L4::Ipc::Ostream::put ( T const &  v)
inline

Insert an element of type T into the stream.

Parameters
vThe element to insert.

Definition at line 689 of file ipc_stream.

◆ reply_and_wait() [1/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 tag 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 992 of file ipc_stream.

References l4_ipc_reply_and_wait(), and L4::Ipc::Istream::tag().

+ Here is the call graph for this function:

◆ reply_and_wait() [2/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 tag 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 885 of file ipc_stream.

References L4_IPC_SEND_TIMEOUT_0, and reply_and_wait().

Referenced by reply_and_wait().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 826 of file ipc_stream.

References L4::Ipc::Istream::reset(), and L4::Ipc::Ostream::reset().

+ Here is the call graph for this function:

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