Loading...
Searching...
No Matches
Virtio_vlan_mangle Class Reference
Virtio Net Switch

Class for VLAN packet rewriting. More...

`#include <vlan.h>`

Collaboration diagram for Virtio_vlan_mangle:

## Public Member Functions

| Virtio_vlan_mangle ()
| Default constructor.
l4_uint32_t | copy_pkt (Buffer &dst, Buffer &src)
| Copy packet from src to dst.
void | rewrite_hdr (Virtio_net::Hdr *hdr)
| Rewrite the virtio network header.

## Static Public Member Functions

static constexpr Virtio_vlan_mangle | add (l4_uint16_t tci)
| Construct an object that adds a VLAN tag.
static constexpr Virtio_vlan_mangle | remove ()
| Construct an object that removes the VLAN tag.

## Detailed Description

Class for VLAN packet rewriting.

Definition at line 36 of file vlan.h.

## Constructor & Destructor Documentation

## Virtio_vlan_mangle()

Virtio_vlan_mangle::Virtio_vlan_mangle | ( |  | ) |

inline

Default constructor.

The packet is not touched in any way.

Definition at line 52 of file vlan.h.

Referenced by add(), and remove().

Here is the caller graph for this function:

## Member Function Documentation

## add()

constexpr Virtio_vlan_mangle Virtio_vlan_mangle::add | ( | l4_uint16_t | tci | ) |

inlinestaticconstexpr

Construct an object that adds a VLAN tag.

Parameters

  tci | The TCI field of the VLAN tag to add.

It is the callers responsibility to ensure that the packet is not already tagged.

Definition at line 64 of file vlan.h.

References Virtio_vlan_mangle().

Here is the call graph for this function:

## copy_pkt()

l4_uint32_t Virtio_vlan_mangle::copy_pkt | ( | Buffer & | dst,
|  | Buffer & | src )

inline

Copy packet from src to dst.

Parameters

  src | Source packet buffer
  dst | Destination packet buffer

Returns
  The number of bytes copied

Copy the data from src to dst, possibly rewriting parts of the packet. The method is expected to be called repeatedly until the source packet is finished. Partial copies are allowed (including reading nothing from the source buffer) as long as progress is made, i.e. repeatedly calling this function eventually consumes the source buffer.

Definition at line 93 of file vlan.h.

References L4virtio::Svr::Data_buffer::copy_to(), L4_LIKELY, L4virtio::Svr::Data_buffer::left, L4virtio::Svr::Data_buffer::pos, and L4virtio::Svr::Data_buffer::skip().

Here is the call graph for this function:

## remove()

constexpr Virtio_vlan_mangle Virtio_vlan_mangle::remove | ( |  | ) |

inlinestaticconstexpr

Construct an object that removes the VLAN tag.

This object assumes that the Ethernet packet has a VLAN tag and will slavishly remove the necessary bytes from the packet.

Definition at line 75 of file vlan.h.

References Virtio_vlan_mangle().

Here is the call graph for this function:

## rewrite_hdr()

void Virtio_vlan_mangle::rewrite_hdr | ( | Virtio_net::Hdr * | hdr | ) |

inline

Rewrite the virtio network header.

Parameters

  hdr | The virtio header of the packet

This method is called exactly once for every virtio network packet. Any necessary changes to the header are done in-place.

Definition at line 142 of file vlan.h.

References L4_UNLIKELY.

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

- pkg/virtio-net-switch/server/switch/vlan.h