VDE networking support

Adds VDE (https://github.com/virtualsquare/vde-2) support to 86Box.
- Adds new networking type
- Modifies networking configuration dialog
- Adds CMake Presets to build and debug under MacOS
This commit is contained in:
Jordi Guillaumes i Pons
2023-05-04 21:12:02 +02:00
parent ec51229fd5
commit 52b0e54fd7
9 changed files with 701 additions and 181 deletions

View File

@@ -51,6 +51,7 @@
#define NET_TYPE_NONE 0 /* networking disabled */
#define NET_TYPE_SLIRP 1 /* use the SLiRP port forwarder */
#define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */
#define NET_TYPE_VDE 3 /* use the VDE plug API */
#define NET_MAX_FRAME 1518
/* Queue size must be a power of 2 */
@@ -123,6 +124,7 @@ typedef struct netdrv_t {
extern const netdrv_t net_pcap_drv;
extern const netdrv_t net_slirp_drv;
extern const netdrv_t net_vde_drv;
struct _netcard_t {
const device_t *device;
@@ -147,15 +149,27 @@ typedef struct {
char description[128];
} netdev_t;
typedef struct {
int has_slirp: 1;
int has_pcap: 1;
int has_vde: 1;
} network_devmap_t;
#define HAS_NOSLIRP_NET(x) (x.has_pcap || x.has_vde)
#ifdef __cplusplus
extern "C" {
#endif
/* Global variables. */
extern int nic_do_log; /* config */
extern int network_ndev;
extern network_devmap_t network_devmap;
extern int network_ndev; // Number of pcap devices
extern network_devmap_t network_devmap; // Bitmap of available network types
extern netdev_t network_devs[NET_HOST_INTF_MAX];
/* Function prototypes. */
extern void network_init(void);
extern netcard_t *network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_link_state);
@@ -166,6 +180,8 @@ extern int network_available(void);
extern void network_tx(netcard_t *card, uint8_t *, int);
extern int net_pcap_prepare(netdev_t *);
extern int net_vde_prepare(void);
extern void network_connect(int id, int connect);
extern int network_is_connected(int id);