More changes of etherslave to etherhelper.

This commit is contained in:
Dan Sumorok 2013-05-29 19:42:59 -04:00
parent 5db556214c
commit 8a02128473
7 changed files with 36 additions and 39 deletions

View File

@ -1,5 +1,5 @@
/*
* etherslavetool.c - Reads and writes raw ethernet packets usng bpf
* etherhelpertool.c - Reads and writes raw ethernet packets usng bpf
* interface.
*
* Copyright (C) 2010, Daniel Sumorok
@ -56,7 +56,7 @@ static int install_signal_handlers();
static void do_exit();
static int remove_bridge = 0;
static const char *exec_name = "etherslavetool";
static const char *exec_name = "etherhelpertool";
int main(int argc, char **argv)
{

View File

@ -46,7 +46,7 @@ FILE * run_tool(const char *if_name, const char *tool_name)
{
OSStatus auth_status;
FILE *fp = NULL;
char *args[] = {"etherslavetool", NULL, NULL};
char *args[] = {NULL, NULL, NULL};
int ret;
char path_buffer[256];
AuthorizationFlags auth_flags;

View File

@ -1,7 +1,7 @@
# Object files
obj/*
BasiliskII
etherslavetool
etherhelpertool
# Autotools generated files
Makefile

View File

@ -74,8 +74,8 @@ CXXFLAGS += $(GUI_CFLAGS)
LIBS += $(GUI_LIBS)
endif
ifeq (@MACOSX_ETHERSLAVE@,yes)
PROGS += etherslavetool
ifeq (@MACOSX_ETHERHELPER@,yes)
PROGS += etherhelpertool
endif
## Rules
@ -142,7 +142,7 @@ $(GUI_APP)_app: $(GUI_APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns
mkdir -p $(GUI_APP_APP)/Contents/Resources
./cpr.sh ../MacOSX/$(APP).icns $(GUI_APP_APP)/Contents/Resources/$(GUI_APP).icns
etherslavetool: ../MacOSX/etherslavetool.c
etherhelpertool: ../MacOSX/etherhelpertool.c
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(LIBS) $< -o $@
modules:
@ -175,7 +175,7 @@ mostlyclean:
clean: mostlyclean
rm -f cpuemu.cpp cpudefs.cpp cputmp*.s cpufast*.s cpustbl.cpp cputbl.h compemu.cpp compstbl.cpp comptbl.h
rm -rf etherslavetool.dSYM
rm -rf etherhelpertool.dSYM
distclean: clean
rm -rf $(OBJ_DIR)

View File

@ -24,8 +24,8 @@ AC_ARG_ENABLE(macosx-gui, [ --enable-macosx-gui enable Mac OS X GUI [def
dnl Mac OS X Sound
AC_ARG_ENABLE(macosx-sound, [ --enable-macosx-sound enable Mac OS X Sound [default=no]], [WANT_MACOSX_SOUND=$enableval], [WANT_MACOSX_SOUND=no])
dnl Mac OS X etherslave support
AC_ARG_ENABLE(macosx-etherslave, [ --enable-macosx-etherslave enable Mac OS X Sound [default=no]], [WANT_MACOSX_ETHERSLAVE=$enableval], [WANT_MACOSX_ETHERSLAVE=no])
dnl Mac OS X etherhelper support
AC_ARG_ENABLE(macosx-etherhelper, [ --enable-macosx-etherhelper enable Mac OS X Sound [default=no]], [WANT_MACOSX_ETHERHELPER=$enableval], [WANT_MACOSX_ETHERHELPER=no])
dnl Video options.
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
@ -735,13 +735,13 @@ if [[ "x$WANT_MACOSX_SOUND" = "xyes" ]]; then
LIBS="$LIBS -framework AudioToolbox -framework AudioUnit -framework CoreAudio"
fi
if [[ "x$WANT_MACOSX_ETHERSLAVE" = "xyes" ]]; then
if [[ "x$WANT_MACOSX_ETHERHELPER" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/runtool.c"
LIBS="$LIBS -framework Security"
AC_DEFINE(ENABLE_MACOSX_ETHERSLAVE, 1, [Define if supporting "etherslave" network device.])
AC_DEFINE(ENABLE_MACOSX_ETHERHELPER, 1, [Define if supporting "etherhelper" network device.])
fi
AC_SUBST(MACOSX_ETHERSLAVE, $WANT_MACOSX_ETHERSLAVE)
AC_SUBST(MACOSX_ETHERHELPER, $WANT_MACOSX_ETHERHELPER)
dnl SDL overrides
if [[ "x$WANT_SDL" = "xyes" ]]; then

View File

@ -42,7 +42,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
#include <net/if_dl.h>
#include <ifaddrs.h>
#endif
@ -101,11 +101,11 @@ enum {
NET_IF_ETHERTAP,
NET_IF_TUNTAP,
NET_IF_SLIRP,
NET_IF_ETHERSLAVE
NET_IF_ETHERHELPER
};
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
extern "C" {
extern FILE * run_tool(const char *if_name, const char *tool_name);
}
@ -138,7 +138,7 @@ const bool ether_driver_opened = true; // Flag: is the MacOS driver opened?
#endif
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
static uint8 packet_buffer[2048];
#endif
@ -155,9 +155,9 @@ static void ether_do_interrupt(void);
static void slirp_add_redirs();
static int slirp_add_redir(const char *redir_str);
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
static int get_mac_address(const char* dev, unsigned char *addr);
static bool open_ether_slave(const std::string &if_name);
static bool open_ether_helper(const std::string &if_name);
static int read_packet(void);
#endif
@ -260,7 +260,7 @@ bool ether_init(void)
// Do nothing if no Ethernet device specified
const char *name = PrefsFindString("ether");
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
std::string slave_dev;
#endif
if (name == NULL)
@ -278,9 +278,9 @@ bool ether_init(void)
else if (strcmp(name, "slirp") == 0)
net_if_type = NET_IF_SLIRP;
#endif
#ifdef ENABLE_MACOSX_ETHERSLAVE
else if (strncmp(name, "etherslave", 10) == 0)
net_if_type = NET_IF_ETHERSLAVE;
#ifdef ENABLE_MACOSX_ETHERHELPER
else if (strncmp(name, "etherhelper", 10) == 0)
net_if_type = NET_IF_ETHERHELPER;
#endif
else
net_if_type = NET_IF_SHEEPNET;
@ -332,8 +332,8 @@ bool ether_init(void)
case NET_IF_SHEEPNET:
strcpy(dev_name, "/dev/sheep_net");
break;
#ifdef ENABLE_MACOSX_ETHERSLAVE
case NET_IF_ETHERSLAVE: {
#ifdef ENABLE_MACOSX_ETHERHELPER
case NET_IF_ETHERHELPER: {
std::string device(name);
size_t pos;
@ -347,7 +347,7 @@ bool ether_init(void)
return false;
}
return open_ether_slave(slave_dev);
return open_ether_helper(slave_dev);
}
#endif
@ -802,8 +802,8 @@ static int16 ether_do_write(uint32 arg)
return noErr;
} else
#endif
#ifdef ENABLE_MACOSX_ETHERSLAVE
if (net_if_type == NET_IF_ETHERSLAVE) {
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
unsigned short pkt_len;
pkt_len = len;
@ -950,8 +950,8 @@ static void *receive_func(void *arg)
if (res <= 0)
break;
#ifdef ENABLE_MACOSX_ETHERSLAVE
if (net_if_type == NET_IF_ETHERSLAVE) {
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
if (read_packet() < 1) {
break;
}
@ -997,8 +997,8 @@ void ether_do_interrupt(void)
} else
#endif
#ifdef ENABLE_MACOSX_ETHERSLAVE
if (net_if_type == NET_IF_ETHERSLAVE) {
#ifdef ENABLE_MACOSX_ETHERHELPER
if (net_if_type == NET_IF_ETHERHELPER) {
unsigned short *pkt_len;
uint32 p = packet;
@ -1135,7 +1135,7 @@ static int slirp_add_redir(const char *redir_str)
return -1;
}
#ifdef ENABLE_MACOSX_ETHERSLAVE
#ifdef ENABLE_MACOSX_ETHERHELPER
static int get_mac_address(const char* dev, unsigned char *addr)
{
struct ifaddrs *ifaddrs, *next;
@ -1168,16 +1168,16 @@ static int get_mac_address(const char* dev, unsigned char *addr)
return ret;
}
static bool open_ether_slave(const std::string &if_name)
static bool open_ether_helper(const std::string &if_name)
{
FILE *fp;
char str[64];
std::string dev_name;
size_t pos;
fp = run_tool(if_name.c_str(), "etherslavetool");
fp = run_tool(if_name.c_str(), "etherhelpertool");
if (fp == NULL) {
snprintf(str, sizeof(str), "Unable to run ether slave helper tool.");
snprintf(str, sizeof(str), "Unable to run ether helper helper tool.");
WarningAlert(str);
return false;
}

View File

@ -40,9 +40,6 @@ prefs_desc platform_prefs_items[] = {
{"mixer", TYPE_STRING, false, "audio mixer device name"},
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
#endif
#ifdef ENABLE_MACOSX_ETHERSLAVE
{"etherslavedev", TYPE_STRING, false, "ethernet device for etherslave ethernet"},
#endif
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
{NULL, TYPE_END, false, NULL} // End of list