SatCat5
router2_basic_nat.h
1 // Copyright 2025 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
5 // Basic Network Address Translation (NAT) for the IPv4 router.
6 
7 #pragma once
8 
9 #include <satcat5/eth_plugin.h>
10 #include <satcat5/ip_core.h>
11 
12 namespace satcat5 {
13  namespace router2 {
23  public:
26  explicit BasicNat(satcat5::eth::SwitchPort* port);
27 
32  bool config(
33  const satcat5::ip::Subnet& ip_ext,
34  const satcat5::ip::Subnet& ip_int);
35 
36  protected:
37  // Override plugin callbacks.
38  void ingress(satcat5::eth::PluginPacket& pkt) override;
39  void egress(satcat5::eth::PluginPacket& pkt) override;
40 
41  // NAT configuration.
42  satcat5::ip::Subnet m_ext, m_int;
43  };
44  }
45 }
Ethernet port plugin API.
Definition: eth_plugin.h:198
Generic packetized I/O interface for use with SwitchCore.
Definition: eth_switch.h:245
Basic Network Address Translation (NAT) for the IPv4 router.
void ingress(satcat5::eth::PluginPacket &pkt) override
Packet-received callback.
void egress(satcat5::eth::PluginPacket &pkt) override
Packet-transmit callback.
bool config(const satcat5::ip::Subnet &ip_ext, const satcat5::ip::Subnet &ip_int)
Change the NAT configuration.
BasicNat(satcat5::eth::SwitchPort *port)
Attach this object to the designated router port.
Plugins for the software-defined Ethernet switch and IPv4 router.
Ephemeral data structure provided to plugin callbacks.
Definition: eth_plugin.h:48
An IPv4 subnet consists of a base address and a subnet mask.
Definition: ip_core.h:87