join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Neighbor Class Reference

class representing a single ARP / NDP neighbor cache entry. More...

#include <neighbor.hpp>

Public Types

using Ptr = std::shared_ptr<Neighbor>
 

Public Member Functions

 Neighbor ()=delete
 create instance.
 
 ~Neighbor ()=default
 destroy instance.
 
uint32_t index () const noexcept
 get interface index.
 
const IpAddressip () const noexcept
 get the destination address.
 
MacAddress mac () const
 get the address resolved for this entry.
 
uint16_t state () const
 get the NUD state bitmask.
 
bool isReachable () const noexcept
 is the entry in NUD_REACHABLE state.
 
bool isStale () const noexcept
 is the entry in NUD_STALE state.
 
bool isPermanent () const noexcept
 is the entry in NUD_PERMANENT state (static).
 
bool isIncomplete () const noexcept
 is the entry in NUD_INCOMPLETE state (resolution ongoing).
 
bool isFailed () const noexcept
 is the entry in NUD_FAILED state.
 
int set (const MacAddress &macAddress, uint16_t state=NUD_PERMANENT, bool sync=false) const
 update or replace this neighbor entry in the kernel table.
 
int remove (bool sync=false) const
 remove this neighbor entry from the kernel table.
 

Friends

class NeighborManager
 
bool operator== (const Neighbor::Ptr &lhs, const Neighbor::Ptr &rhs)
 compare if two neighbor are equal.
 
bool operator< (const Neighbor::Ptr &lhs, const Neighbor::Ptr &rhs)
 compare two neighbor for ordering.
 

Detailed Description

class representing a single ARP / NDP neighbor cache entry.

Member Typedef Documentation

◆ Ptr

using join::Neighbor::Ptr = std::shared_ptr<Neighbor>

Constructor & Destructor Documentation

◆ Neighbor()

join::Neighbor::Neighbor ( )
delete

create instance.

◆ ~Neighbor()

join::Neighbor::~Neighbor ( )
default

destroy instance.

Member Function Documentation

◆ index()

uint32_t Neighbor::index ( ) const
noexcept

get interface index.

Returns
interface index.

◆ ip()

const IpAddress & Neighbor::ip ( ) const
noexcept

get the destination address.

Returns
IP address.

◆ isFailed()

bool Neighbor::isFailed ( ) const
noexcept

is the entry in NUD_FAILED state.

Returns
true if failed.

◆ isIncomplete()

bool Neighbor::isIncomplete ( ) const
noexcept

is the entry in NUD_INCOMPLETE state (resolution ongoing).

Returns
true if incomplete.

◆ isPermanent()

bool Neighbor::isPermanent ( ) const
noexcept

is the entry in NUD_PERMANENT state (static).

Returns
true if permanent.

◆ isReachable()

bool Neighbor::isReachable ( ) const
noexcept

is the entry in NUD_REACHABLE state.

Returns
true if reachable.

◆ isStale()

bool Neighbor::isStale ( ) const
noexcept

is the entry in NUD_STALE state.

Returns
true if stale.

◆ mac()

MacAddress Neighbor::mac ( ) const

get the address resolved for this entry.

Returns
MAC address.

◆ remove()

int Neighbor::remove ( bool sync = false) const

remove this neighbor entry from the kernel table.

Parameters
syncwait for operation completion if true.
Returns
0 on success, -1 on failure.

◆ set()

int Neighbor::set ( const MacAddress & macAddress,
uint16_t state = NUD_PERMANENT,
bool sync = false ) const

update or replace this neighbor entry in the kernel table.

Parameters
macAddressnew address to associate.
stateNUD state to set (default: NUD_PERMANENT).
syncwait for operation completion if true.
Returns
0 on success, -1 on failure.

◆ state()

uint16_t Neighbor::state ( ) const

get the NUD state bitmask.

Returns
NUD state flags.

Friends And Related Symbol Documentation

◆ NeighborManager

friend class NeighborManager
friend

◆ operator<

bool operator< ( const Neighbor::Ptr & lhs,
const Neighbor::Ptr & rhs )
friend

compare two neighbor for ordering.

Parameters
lhsleft side key.
rhsright side key.
Returns
true if lhs is less than rhs.

◆ operator==

bool operator== ( const Neighbor::Ptr & lhs,
const Neighbor::Ptr & rhs )
friend

compare if two neighbor are equal.

Parameters
lhsleft side key.
rhsright side key.
Returns
true if both are equal.

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