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

Input stream for IPC unmarshalling. More...

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

Public Member Functions

 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.
 
Get/Put Functions.
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...
 
IPC operations.
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)
 

Detailed Description

Input stream for IPC unmarshalling.

Ipc::Istream is part of the dynamic IPC marshalling infrastructure, as well as Ipc::Ostream and Ipc::Iostream.

Ipc::Istream is an input stream supporting extraction of values from an IPC message buffer. A received IPC message can be unmarshalled using the usual extraction operator (>>).

There exist some special wrapper classes to extract arrays (see Ipc_buf_cp_in and Ipc_buf_in) and indirect strings (see Msg_in_buffer and Msg_io_buffer).

Definition at line 347 of file ipc_stream.

Constructor & Destructor Documentation

◆ Istream()

L4::Ipc::Istream::Istream ( l4_utcb_t utcb)
inline

Create an input stream for the given message buffer.

The given message buffer is used for IPC operations wait()/receive() and received data can be extracted using the >> operator afterwards. In the case of indirect message parts a buffer of type Msg_in_buffer must be inserted into the stream before the IPC operation and contains received data afterwards.

Parameters
utcbThe message buffer to receive IPC messages.

Definition at line 361 of file ipc_stream.

Member Function Documentation

◆ get() [1/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.

See Istream::operator>>()

Definition at line 405 of file ipc_stream.

◆ get() [2/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).

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

See Istream::operator>>()

Definition at line 447 of file ipc_stream.

◆ get() [3/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.

See Istream::operator>>()

Definition at line 469 of file ipc_stream.

◆ receive()

l4_msgtag_t L4::Ipc::Istream::receive ( l4_cap_idx_t  src)
inline

Wait for a message from the specified sender.

Parameters
srcThe sender id to receive from.
Returns
The IPC result dope (l4_msgtag_t).

This is commonly known as 'closed wait'.

Definition at line 577 of file ipc_stream.

◆ reset()

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

Reset the stream to empty, and ready for receive()/wait().

The stream is reset to the same state as on its creation.

Definition at line 371 of file ipc_stream.

◆ skip()

template<typename T >
void L4::Ipc::Istream::skip ( unsigned long  elems)
inline

Skip size elements of type T in the stream.

Parameters
elemsNumber of elements to skip.

Definition at line 424 of file ipc_stream.

◆ tag() [1/2]

l4_msgtag_t L4::Ipc::Istream::tag ( ) const
inline

Get the message tag of a received IPC.

Returns
The L4 message tag for the received IPC.

This is in particular useful for handling page faults or exceptions.

See Istream::operator>>()

Definition at line 510 of file ipc_stream.

◆ tag() [2/2]

l4_msgtag_t& L4::Ipc::Istream::tag ( )
inline

Get the message tag of a received IPC.

Returns
A reference to the L4 message tag for the received IPC.

This is in particular useful for handling page faults or exceptions.

See Istream::operator>>()

Definition at line 522 of file ipc_stream.

◆ wait() [1/2]

l4_msgtag_t L4::Ipc::Istream::wait ( l4_umword_t src)
inline

Wait for an incoming message from any sender.

Parameters
[out]srcContains the sender after a successful IPC operation.
Returns
Syscall return tag.

This wait is actually known as 'open wait'.

Definition at line 553 of file ipc_stream.

◆ wait() [2/2]

l4_msgtag_t L4::Ipc::Istream::wait ( l4_umword_t src,
l4_timeout_t  timeout 
)
inline

Wait for an incoming message from any sender.

Parameters
[out]srcContains the sender after a successful IPC operation.
timeoutTimeout used for IPC.
Returns
The IPC result dope (l4_msgtag_t).

This wait is actually known as 'open wait'.

Definition at line 1011 of file ipc_stream.


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