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

Input stream for IPC unmarshalling. More...

#include <ipc_stream>

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

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 345 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 359 of file ipc_stream.

Member Function Documentation

◆ 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.

References L4_UNLIKELY.

◆ 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.

References L4_UNLIKELY.

◆ 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.

References L4_UNLIKELY.

Referenced by operator>>(), operator>>(), operator>>(), operator>>(), and operator>>().

+ Here is the caller graph for this function:

◆ 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 tag (l4_msgtag_t).

This is commonly known as 'closed wait'.

Definition at line 583 of file ipc_stream.

References L4_IPC_NEVER, and receive().

Referenced by receive().

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

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

References l4_msg_regs_t::mr.

Referenced by L4::Ipc::Iostream::reset().

+ Here is the caller graph for this function:

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

References L4_UNLIKELY.

◆ tag() [1/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 operator>>()

Definition at line 528 of file ipc_stream.

◆ tag() [2/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 operator>>()

Definition at line 516 of file ipc_stream.

Referenced by L4::Ipc::Iostream::call(), operator>>(), L4::Ipc::Iostream::reply_and_wait(), and wait().

+ Here is the caller graph for this function:

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

References L4_IPC_NEVER, and wait().

Referenced by wait().

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

◆ 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 tag (l4_msgtag_t).

This wait is actually known as 'open wait'.

Definition at line 1024 of file ipc_stream.

References l4_ipc_wait(), and tag().

+ Here is the call graph for this function:

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