L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4virtio::Svr::Data_buffer Struct Reference

Abstract data buffer. More...

#include <virtio>

+ Inheritance diagram for L4virtio::Svr::Data_buffer:
+ Collaboration diagram for L4virtio::Svr::Data_buffer:

Public Member Functions

template<typename T >
 Data_buffer (T *p)
 Create buffer for object p.
 
template<typename T >
void set (T *p)
 Set buffer for object p.
 
l4_uint32_t copy_to (Data_buffer *dst, l4_uint32_t max=UINT_MAX)
 Copy contents from this buffer to the destination buffer.
 
l4_uint32_t skip (l4_uint32_t bytes)
 Skip given number of bytes in this buffer.
 
bool done () const
 Check if there are no more bytes left in the buffer.
 

Data Fields

char * pos
 Current buffer position.
 
l4_uint32_t left
 Bytes left in buffer.
 

Detailed Description

Abstract data buffer.

Definition at line 306 of file virtio.

Constructor & Destructor Documentation

◆ Data_buffer()

template<typename T >
L4virtio::Svr::Data_buffer::Data_buffer ( T *  p)
inlineexplicit

Create buffer for object p.

Template Parameters
TType of object (implicit)
Parameters
pPointer to object.

The buffer shall point to the start of the object p and the size left is sizeof(T).

Definition at line 323 of file virtio.

Member Function Documentation

◆ copy_to()

l4_uint32_t L4virtio::Svr::Data_buffer::copy_to ( Data_buffer dst,
l4_uint32_t  max = UINT_MAX 
)
inline

Copy contents from this buffer to the destination buffer.

Parameters
dstDestination buffer.
max(optional) Maximum number of bytes to copy.
Returns
the number of bytes copied.

This function copies at most max bytes from this to dst. If max is omitted, copies the maximum number of bytes available that fit dst.

Definition at line 354 of file virtio.

References left, and pos.

Referenced by Virtio_vlan_mangle::copy_pkt(), and L4virtio::Svr::Console::Device::port_write().

+ Here is the caller graph for this function:

◆ done()

bool L4virtio::Svr::Data_buffer::done ( ) const
inline

Check if there are no more bytes left in the buffer.

Returns
true if there are no more bytes left in the buffer.

Definition at line 388 of file virtio.

References left.

Referenced by Virtio_net_transfer::transfer().

+ Here is the caller graph for this function:

◆ set()

template<typename T >
void L4virtio::Svr::Data_buffer::set ( T *  p)
inline

Set buffer for object p.

Template Parameters
TType of object (implicit)
Parameters
pPointer to object.

The buffer shall point to the start of the object p and the size left is sizeof(T).

Definition at line 337 of file virtio.

References left, and pos.

◆ skip()

l4_uint32_t L4virtio::Svr::Data_buffer::skip ( l4_uint32_t  bytes)
inline

Skip given number of bytes in this buffer.

Parameters
bytesNumber of bytes that shall be skipped.
Returns
The number of bytes skipped.

Try to skip the given number of bytes in this buffer, if there are less bytes left in the buffer that given then at most left bytes are skipped and the amount is returned.

Definition at line 375 of file virtio.

References left, and pos.

Referenced by Virtio_vlan_mangle::copy_pkt(), and Virtio_net_transfer::transfer().

+ Here is the caller graph for this function:

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