Added pcap_if.exe utility, updated net_ne2000.c and updated Makefile.mingw.

This commit is contained in:
waltje
2017-05-08 18:27:42 -04:00
parent 769a2939d5
commit 52cf57cf56
3 changed files with 79 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
#
# Modified Makefile for Win32 MinGW 32-bit environment.
#
# Version: @(#)Makefile.mingw 1.0.7 2017/05/07
# Version: @(#)Makefile.mingw 1.0.8 2017/05/08
#
# Authors: Kotori, <oubattler@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -128,7 +128,8 @@ DEVOBJ = bugger.o lpt.o serial.o \
disc.o \
disc_86f.o disc_fdi.o disc_imd.o disc_img.o \
disc_random.o disc_td0.o \
cdrom.o cdrom-dosbox.o cdrom-image.o cdrom-ioctl.o cdrom-null.o
cdrom.o \
cdrom-dosbox.o cdrom-image.o cdrom-ioctl.o cdrom-null.o
USBOBJ = usb.o
NETOBJ = network.o net_ne2000.o
SCSIOBJ = scsi.o scsi_disk.o scsi_buslogic.o scsi_aha154x.o
@@ -182,7 +183,7 @@ OBJ = $(MAINOBJ) $(CPUOBJ) $(SYSOBJ) $(DEVOBJ) $(USBOBJ) \
LZFOBJ = lzf_c.o lzf_d.o
SLIRPOBJ= bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \
ip_input.o queue.o tcp_input.o tftp.o debug.o ip_output.o \
ip_input.o queue.o tcp_input.o debug.o ip_output.o \
sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o
LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \
@@ -204,6 +205,9 @@ LIBS = -mwindows -lcomctl32 -lwinmm -lopenal.dll -lopenal -lddraw \
@echo $<
@$(CPP) $(CFLAGS) -c $<
all: $(PROG).exe pcap_if.exe
$(PROG).exe: $(OBJ) $(LZFOBJ) $(SLIRPOBJ)
@echo Linking $(PROG).exe ..
@$(CC) -o $(PROG).exe \
@@ -212,7 +216,15 @@ ifneq ($(DEBUG), y)
strip $(PROG).exe
endif
all: $(PROG).exe
pcap_if.exe: pcap_if.o
@echo Linking pcap_if.exe ..
@$(CC) -o pcap_if.exe \
pcap_if.o -static -L. -lwpcapdelay
ifneq ($(DEBUG), y)
strip pcap_if.exe
endif
clean:
rm *.o

View File

@@ -222,7 +222,14 @@ uint32_t ne2000_chipmem_read(ne2000_t *ne2000, uint32_t address, unsigned int io
void ne2000_page0_write(ne2000_t *ne2000, uint32_t offset, uint32_t value, unsigned io_len);
void ne2000_rx_frame(void *p, const void *buf, int io_len);
#ifdef WALTJE
#define ENABLE_NE2000_LOG
int ne2000_do_log = 1;
#else
int ne2000_do_log = 0;
#endif
void ne2000_log(const char *format, ...)

56
src/pcap_if.c Normal file
View File

@@ -0,0 +1,56 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Simple program to show usable interfaces for WinPcap.
*
* Based on the "libpcap" example.
*
* Version: @(#)pcap_if.c 1.0.1 2017/05/08
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <pcap.h>
int
main(int argc, char **argv)
{
char errbuf[PCAP_ERRBUF_SIZE];
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&alldevs, errbuf) == -1) {
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
exit(1);
}
/* Print the list */
for (d= alldevs; d != NULL; d= d->next) {
printf("%d. %s\n", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
printf("\n");
i++;
}
if (i == 0) {
printf("No interfaces found! Make sure WinPcap is installed.\n");
return(i);
}
/* Not really needed as we are about to exit, but oh-well. */
pcap_freealldevs(alldevs);
return(i);
}