mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-28 17:30:02 +00:00
6a5ea92a4e
Uthernet II: add extended feature to virtualise DNS requests. . This allows pure TCP/UDP sockets to run *without* MACRAW requests (and so without libpcap). . Raw sockets will not work. . Add configuration for Virtual DNS. libpcap: ensure all functions check if the library is loaded before using it. Uthernet 1: do NOT overwrite tfe_cannot_use as it should only reflect the availability of npcap on *this* system. Add Copyright notice, and mention Virtual DNS in html.
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#define MAX_TXLENGTH 1518
|
|
#define MIN_TXLENGTH 4
|
|
|
|
#define MAX_RXLENGTH 1518
|
|
#define MIN_RXLENGTH 64
|
|
|
|
#pragma pack(push)
|
|
#pragma pack(1) // Ensure struct is packed
|
|
struct MACAddress
|
|
{
|
|
uint8_t address[6];
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
class NetworkBackend
|
|
{
|
|
public:
|
|
virtual ~NetworkBackend();
|
|
|
|
// transmit a packet
|
|
virtual void transmit(
|
|
const int txlength, /* Frame length */
|
|
uint8_t *txframe /* Pointer to the frame to be transmitted */
|
|
) = 0;
|
|
|
|
// receive a single packet, return size (>0) or missing (-1)
|
|
virtual int receive(
|
|
const int size, /* Buffer size */
|
|
uint8_t * rxframe /* Pointer to the buffer */
|
|
) = 0;
|
|
|
|
// process pending packets
|
|
virtual void update(const ULONG nExecutedCycles) = 0;
|
|
|
|
// get MAC for IPRAW (it is only supposed to handle addresses on the local network)
|
|
virtual void getMACAddress(const uint32_t address, MACAddress & mac) = 0;
|
|
|
|
// if the backend is usable
|
|
virtual bool isValid() = 0;
|
|
|
|
// get interface name
|
|
virtual const std::string & getInterfaceName() = 0;
|
|
};
|