SatCat5
satcat5::eth::SwitchVlan< VMAX > Class Template Reference

Detailed Description

template<unsigned VMAX = 4095>
class satcat5::eth::SwitchVlan< VMAX >

Wrapper for SwitchVlanInner with statically-allocated working memory.

See also
eth_sw_vlan.h

The maximum VID is adjustable to save memory, the default setting VMAX = 4095 allows all possible VLAN IDs [1..4095].

Definition at line 101 of file eth_sw_vlan.h.

#include <eth_sw_vlan.h>

Inheritance diagram for satcat5::eth::SwitchVlan< VMAX >:
[legend]
Collaboration diagram for satcat5::eth::SwitchVlan< VMAX >:
[legend]

Public Member Functions

 SwitchVlan (satcat5::eth::SwitchCore *sw, bool lockdown=false)
 Create this plugin and link it to the designated switch. More...
 
void query (PluginPacket &pkt) override
 Packet-received callback. More...
 
void vlan_reset (bool lockdown=false)
 Revert to default VLAN settings for all ports and VIDs. More...
 
SATCAT5_PMASK_TYPE vlan_get_mask (u16 vid)
 Get allowed-connectivity port-mask for designated VID.
 
void vlan_set_mask (u16 vid, SATCAT5_PMASK_TYPE mask)
 Limit the specified VID to the designated port(s).
 
VtagPolicy vlan_get_port (unsigned port) const
 Query a port's tag policy and other VLAN settings.
 
void vlan_set_port (const VtagPolicy &cfg)
 Set a port's tag policy and other VLAN settings.
 
void vlan_join (u16 vid, unsigned port)
 Port should join VLAN, updating vlan_get_mask.
 
void vlan_leave (u16 vid, unsigned port)
 Port should leave VLAN, updating vlan_get_mask.
 
void vlan_set_rate (u16 vid, const satcat5::eth::VlanRate &cfg)
 Set rate-limiting options for the designated VID.
 
void timer_once (unsigned msec)
 Configure a one-time notification after X milliseconds.
 
void timer_every (unsigned msec)
 Configure a repeating notification every X milliseconds.
 
void timer_stop ()
 Stop all future notifications.
 
unsigned timer_interval () const
 Accessor for recurring timer interval, if one is set.
 
unsigned timer_remaining () const
 Accessor for time to next event, if one is set.
 

Static Public Member Functions

static unsigned count_timer ()
 Count all objects of this type, including idle timers.
 

Protected Member Functions

void timer_event () override
 Child class MUST override this method.
 

Protected Attributes

satcat5::eth::SwitchVlanInner::VlanPolicy m_vtable [VMAX]
 
VlanPolicy *const m_policy
 
const unsigned m_vmax
 
satcat5::eth::SwitchCore *const m_switch
 Pointer to the associated SwitchCore object.
 

Private Attributes

satcat5::eth::PluginCorem_next
 
unsigned m_trem
 
unsigned m_tnext
 

Constructor & Destructor Documentation

◆ SwitchVlan()

template<unsigned VMAX = 4095>
satcat5::eth::SwitchVlan< VMAX >::SwitchVlan ( satcat5::eth::SwitchCore sw,
bool  lockdown = false 
)
inlineexplicit

Create this plugin and link it to the designated switch.

Parameters
swLinks this plugin to an Ethernet switch object.
lockdownSets the default configuration to allow-all or allow-none.

Definition at line 107 of file eth_sw_vlan.h.

Member Function Documentation

◆ query()

void SwitchVlanInner::query ( PluginPacket pkt)
overridevirtualinherited

Packet-received callback.

The query method is called for each incoming packet, passing a PluginPacket object that plugins can read or modify in-place. Plugins that alter header fields MUST set FLAG_HEADER_CHANGE and MUST NOT make any change that affects header length. The child class MUST override this method.

Implements satcat5::eth::PluginCore.

Definition at line 65 of file eth_sw_vlan.cc.

◆ vlan_reset()

void SwitchVlanInner::vlan_reset ( bool  lockdown = false)
inherited

Revert to default VLAN settings for all ports and VIDs.

The "lockdown" setting controls whether rules default to permissive (i.e., allow by default with a short blocklist) or lockdown (the opposite).

Definition at line 120 of file eth_sw_vlan.cc.


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