SatCat5
eth_crosslink.h
1 // Copyright 2024-2025 The Aerospace Corporation.
3 // This file is a part of SatCat5, licensed under CERN-OHL-W v2 or later.
5 // Crosslink between two simulated network devices.
6 
7 #pragma once
8 
9 #include <hal_posix/file_pcap.h>
10 #include <hal_posix/posix_utils.h>
11 #include <hal_test/eth_interface.h>
12 #include <hal_test/sim_utils.h>
13 #include <satcat5/ccsds_spp.h>
14 #include <satcat5/eth_dispatch.h>
15 #include <satcat5/ip_stack.h>
16 
17 namespace satcat5 {
18  namespace test {
24  struct Crosslink {
27  static constexpr satcat5::eth::MacAddr
28  MAC0 = {{0xDE, 0xAD, 0xBE, 0xEF, 0x11, 0x11}},
29  MAC1 = {{0xDE, 0xAD, 0xBE, 0xEF, 0x22, 0x22}};
30  static constexpr satcat5::ip::Addr
31  IP0 = satcat5::ip::Addr(192, 168, 1, 11),
32  IP1 = satcat5::ip::Addr(192, 168, 1, 74);
34 
37  explicit Crosslink(const char* filename,
38  u16 type = satcat5::io::LINKTYPE_ETHERNET);
39 
42 
45 
51 
53  void set_loss_rate(float rate);
54 
56  void set_zero_pad(unsigned len);
57  };
58 
61  explicit CrosslinkEth(const char* filename = 0);
64  };
65 
68  explicit CrosslinkIp(const char* filename = 0);
71  };
72 
75  explicit CrosslinkSpp(const char* filename = 0);
78  };
79  }
80 }
CCSDS Space Packet Protocol.
Implemention of "net::Dispatch" API for CCSDS-SPP packets.
Definition: ccsds_spp.h:199
Implemention of "net::Dispatch" for Ethernet frames.
Definition: eth_dispatch.h:21
Store packet stream to a file.
Definition: file_pcap.h:88
All-in-one Internet Protocol stack with all basic services.
Definition: ip_stack.h:32
Simulation of a PTP-compatible Ethernet interface controller.
Definition: eth_interface.h:25
Timekeeper object for granular simulation of elapsed time.
Definition: sim_utils.h:313
File I/O for packet capture files (PCAP, PCAPNG)
Miscellaneous POSIX wrappers (e.g., heap allocation, log to console...)
Miscellaneous simulation and test helper functions.
An Ethernet MAC address (with serializable interface).
Definition: eth_header.h:29
IPv4 address is a 32-bit unsigned integer.
Definition: ip_core.h:15