TinyWifiDongle 0.1.0
Header-only USB WiFi dongle for Arduino
Loading...
Searching...
No Matches
twd::L2Bridge Class Reference

Layer-2 bridge between the USB host and the uplink network. More...

#include <L2Bridge.h>

Inheritance diagram for twd::L2Bridge:
Collaboration diagram for twd::L2Bridge:

Classes

struct  Stats
 Counters since start. More...

Public Member Functions

 L2Bridge (UsbTransport &usb, FrameLink &link)
 Bridge usb and link.
void begin ()
 Start forwarding; both sides must already be started.
Stats stats () const
 Current counters.
void onFrame (const uint8_t *frame, uint16_t len) override
 Host -> uplink (called by the UsbTransport).
Public Member Functions inherited from twd::FrameReceiver
virtual ~FrameReceiver ()=default

Detailed Description

Layer-2 bridge between the USB host and the uplink network.

Host <-- UsbTransport <-- L2Bridge --> FrameLink --> access point

Frames are forwarded unchanged in both directions: no IP stack, NAT or DHCP server on the MCU, so the host gets its address from the uplink network's own DHCP server. Two rules keep an access point happy:

  • the host adapter uses the link's MAC address (see UsbTransport::setHostMac), and frames from the host with any other source address are dropped;
  • frames from the link that carry that address as source are the access point echoing the host's own broadcasts, and are dropped.

Shared by all ports; they only provide a UsbTransport and a FrameLink.

Definition at line 23 of file L2Bridge.h.

Constructor & Destructor Documentation

◆ L2Bridge()

twd::L2Bridge::L2Bridge ( UsbTransport & usb,
FrameLink & link )
inline

Bridge usb and link.

Definition at line 35 of file L2Bridge.h.

Member Function Documentation

◆ begin()

void twd::L2Bridge::begin ( )
inline

Start forwarding; both sides must already be started.

Definition at line 38 of file L2Bridge.h.

◆ onFrame()

void twd::L2Bridge::onFrame ( const uint8_t * frame,
uint16_t len )
inlineoverridevirtual

Host -> uplink (called by the UsbTransport).

Implements twd::FrameReceiver.

Definition at line 50 of file L2Bridge.h.

◆ stats()

Stats twd::L2Bridge::stats ( ) const
inline

Current counters.

Definition at line 47 of file L2Bridge.h.


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