vrf

namespace eos
class vrf_handler
#include <vrf.h>

The VRF handler.

This class provides handler APIs to react to a VRF’s operational state change.

Public Functions

vrf_handler(vrf_mgr * mgr)
vrf_mgr * get_vrf_mgr() const
virtual void on_vrf_state(std::string vrf_name, vrf_state_t vrf_state)

Called when a VRF’s state changes. When a VRF:

  • is created, its state is VRF_INITIALIZING.
  • becomes active, its state is VRF_ACTIVE.
  • is being deleted, its state is VRF_DELETING.
  • is deleted, its state is VRF_NULL.

class vrf_iter_t

Private Functions

vrf_iter_t(vrf_iter_impl * const)

Friends

friend class vrf_iter_impl
class vrf_mgr
#include <vrf.h>

The manager for VRF, this is the main entry point for applications to use EosSdk VRF APIs.

Public Functions

virtual ~vrf_mgr()
virtual vrf_iter_t vrf_iter() const = 0

Iterates through all VRFs on the system, yielding a vrf_t for each VRF.

virtual vrf_t vrf(std::string const & vrf_name) const = 0

Returns the named VRF, or a default VRF object if it does not exist.

virtual int socket_at(int domain, int type, int protocol, std::string const & vrf_name) = 0

Opens a socket inside a VRF specified by ‘vrf_name’.

Return
fd on success, -1 on error, and errno is set appropriately.
Parameters
  • domain -

    A communication domain, same as in socket().

  • type -

    The communication semantics, such as SOCK_STREAM, same as in socket().

  • protocol -

    The protocol to be used with the socket, same as in socket().

  • vrf_name -

    The name of the vrf_name in which the socket will be created.

Protected Functions

vrf_mgr()

Private Members

vrf_mgr

Friends

friend class vrf_handler

Type definitions in vrf

namespace eos

Enums

vrf_state_t enum

VRF state.

Values:

  • VRF_NULL -

    Not a valid vrf type.

  • VRF_INITIALIZING -

    VRF being initialized.

  • VRF_ACTIVE -

    VRF is active.

  • VRF_DELETING -

    VRF is being deleted.

  • VRF_CONFIGURED -

    VRF is configured.

class vrf_t
#include <vrf.h>

This data structure is used to describe an VRF on a switch.

Public Functions

vrf_t()
vrf_t(std::string name, vrf_state_t state, uint64_t rd)
std::string name() const

Getter for ‘name’: the name of the VRF.

vrf_state_t state() const

Getter for ‘state’: the state of this VRF.

uint64_t rd() const

Getter for ‘rd’: the route distinguisher of the VRF.

bool operator==(vrf_t const & other) const
bool operator!=(vrf_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::string name_
vrf_state_t state_
uint64_t rd_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of vrf_t to the ostream.

Table Of Contents

Previous topic

version