DEV9: fix compilation issues

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-09-22 21:47:56 +02:00 committed by refractionpcsx2
parent b4185a96c7
commit 85c1aca70e
2 changed files with 11 additions and 36 deletions

View File

@ -24,21 +24,18 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <net/if.h> #include <net/if.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "pcap_io.h" #include "pcap_io.h"
#include "DEV9.h" #include "DEV9.h"
#include "net.h" #include "net.h"
#ifndef PCAP_NETMASK_UNKNOWN #ifndef PCAP_NETMASK_UNKNOWN
#define PCAP_NETMASK_UNKNOWN 0xffffffff #define PCAP_NETMASK_UNKNOWN 0xffffffff
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define mac_address char* #define mac_address char*
#elif #else
pcap_t *adhandle; pcap_t *adhandle;
pcap_dumper_t* dump_pcap; pcap_dumper_t* dump_pcap;
char errbuf[PCAP_ERRBUF_SIZE]; char errbuf[PCAP_ERRBUF_SIZE];
@ -49,13 +46,10 @@ mac_address host_mac = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
int pcap_io_running=0; int pcap_io_running=0;
extern u8 eeprom[]; extern u8 eeprom[];
char namebuff[256]; char namebuff[256];
// Fetches the MAC address and prints it // Fetches the MAC address and prints it
int GetMACAddress(char *adapter, mac_address* addr) int GetMACAddress(char *adapter, mac_address* addr)
{ {
@ -121,8 +115,7 @@ int GetMACAddress(char *adapter, mac_address* addr)
int pcap_io_init(char *adapter) int pcap_io_init(char *adapter)
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
struct bpf_program fp; struct bpf_program fp;
char filter[1024] = "ether broadcast or ether dst "; char filter[1024] = "ether broadcast or ether dst ";
int dlt; int dlt;
@ -194,7 +187,6 @@ int pcap_io_init(char *adapter)
pcap_io_running=1; pcap_io_running=1;
emu_printf("Ok.\n"); emu_printf("Ok.\n");
return 0;
#endif #endif
return 0; return 0;
} }
@ -213,8 +205,7 @@ int gettimeofday (struct timeval *tv, void* tz)
int pcap_io_send(void* packet, int plen) int pcap_io_send(void* packet, int plen)
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
if(pcap_io_running<=0) if(pcap_io_running<=0)
return -1; return -1;
@ -234,8 +225,7 @@ int pcap_io_send(void* packet, int plen)
int pcap_io_recv(void* packet, int max_len) int pcap_io_recv(void* packet, int max_len)
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
static struct pcap_pkthdr *header; static struct pcap_pkthdr *header;
static const u_char *pkt_data1; static const u_char *pkt_data1;
@ -258,8 +248,7 @@ int pcap_io_recv(void* packet, int max_len)
void pcap_io_close() void pcap_io_close()
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
if(dump_pcap) if(dump_pcap)
pcap_dump_close(dump_pcap); pcap_dump_close(dump_pcap);
if (adhandle) if (adhandle)
@ -268,20 +257,12 @@ void pcap_io_close()
#endif #endif
} }
void displayAddress(const SOCKET_ADDRESS& Address)
{
}
int pcap_io_get_dev_num() int pcap_io_get_dev_num()
{ {
#ifdef _WIN32 int i=0;
return 0; #ifndef _WIN32
#elif
pcap_if_t *alldevs; pcap_if_t *alldevs;
pcap_if_t *d; pcap_if_t *d;
int i=0;
if(pcap_findalldevs(&alldevs, errbuf) == -1) if(pcap_findalldevs(&alldevs, errbuf) == -1)
{ {
@ -293,15 +274,13 @@ int pcap_io_get_dev_num()
pcap_freealldevs(alldevs); pcap_freealldevs(alldevs);
return i;
#endif #endif
return i;
} }
char* pcap_io_get_dev_name(int num) char* pcap_io_get_dev_name(int num)
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
pcap_if_t *alldevs; pcap_if_t *alldevs;
pcap_if_t *d; pcap_if_t *d;
int i=0; int i=0;
@ -329,8 +308,7 @@ char* pcap_io_get_dev_name(int num)
char* pcap_io_get_dev_desc(int num) char* pcap_io_get_dev_desc(int num)
{ {
#ifdef _WIN32 #ifndef _WIN32
#elif
pcap_if_t *alldevs; pcap_if_t *alldevs;
pcap_if_t *d; pcap_if_t *d;
int i=0; int i=0;

View File

@ -24,10 +24,7 @@ extern "C" {
#endif #endif
#ifndef _WIN32
#ifdef _WIN32
#elif
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct _ip_address typedef struct _ip_address
{ {