mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-23 04:33:24 +00:00
More changes of etherslave to etherhelper.
This commit is contained in:
parent
5db556214c
commit
8a02128473
@ -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.
|
* interface.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010, Daniel Sumorok
|
* Copyright (C) 2010, Daniel Sumorok
|
||||||
@ -56,7 +56,7 @@ static int install_signal_handlers();
|
|||||||
static void do_exit();
|
static void do_exit();
|
||||||
|
|
||||||
static int remove_bridge = 0;
|
static int remove_bridge = 0;
|
||||||
static const char *exec_name = "etherslavetool";
|
static const char *exec_name = "etherhelpertool";
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +46,7 @@ FILE * run_tool(const char *if_name, const char *tool_name)
|
|||||||
{
|
{
|
||||||
OSStatus auth_status;
|
OSStatus auth_status;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char *args[] = {"etherslavetool", NULL, NULL};
|
char *args[] = {NULL, NULL, NULL};
|
||||||
int ret;
|
int ret;
|
||||||
char path_buffer[256];
|
char path_buffer[256];
|
||||||
AuthorizationFlags auth_flags;
|
AuthorizationFlags auth_flags;
|
||||||
|
2
BasiliskII/src/Unix/.gitignore
vendored
2
BasiliskII/src/Unix/.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
# Object files
|
# Object files
|
||||||
obj/*
|
obj/*
|
||||||
BasiliskII
|
BasiliskII
|
||||||
etherslavetool
|
etherhelpertool
|
||||||
|
|
||||||
# Autotools generated files
|
# Autotools generated files
|
||||||
Makefile
|
Makefile
|
||||||
|
@ -74,8 +74,8 @@ CXXFLAGS += $(GUI_CFLAGS)
|
|||||||
LIBS += $(GUI_LIBS)
|
LIBS += $(GUI_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (@MACOSX_ETHERSLAVE@,yes)
|
ifeq (@MACOSX_ETHERHELPER@,yes)
|
||||||
PROGS += etherslavetool
|
PROGS += etherhelpertool
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## Rules
|
## Rules
|
||||||
@ -142,7 +142,7 @@ $(GUI_APP)_app: $(GUI_APP) ../MacOSX/Info.plist ../MacOSX/$(APP).icns
|
|||||||
mkdir -p $(GUI_APP_APP)/Contents/Resources
|
mkdir -p $(GUI_APP_APP)/Contents/Resources
|
||||||
./cpr.sh ../MacOSX/$(APP).icns $(GUI_APP_APP)/Contents/Resources/$(GUI_APP).icns
|
./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 $@
|
$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(LIBS) $< -o $@
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
@ -175,7 +175,7 @@ mostlyclean:
|
|||||||
|
|
||||||
clean: mostlyclean
|
clean: mostlyclean
|
||||||
rm -f cpuemu.cpp cpudefs.cpp cputmp*.s cpufast*.s cpustbl.cpp cputbl.h compemu.cpp compstbl.cpp comptbl.h
|
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
|
distclean: clean
|
||||||
rm -rf $(OBJ_DIR)
|
rm -rf $(OBJ_DIR)
|
||||||
|
@ -24,8 +24,8 @@ AC_ARG_ENABLE(macosx-gui, [ --enable-macosx-gui enable Mac OS X GUI [def
|
|||||||
dnl Mac OS X Sound
|
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])
|
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
|
dnl Mac OS X etherhelper support
|
||||||
AC_ARG_ENABLE(macosx-etherslave, [ --enable-macosx-etherslave enable Mac OS X Sound [default=no]], [WANT_MACOSX_ETHERSLAVE=$enableval], [WANT_MACOSX_ETHERSLAVE=no])
|
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.
|
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])
|
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"
|
LIBS="$LIBS -framework AudioToolbox -framework AudioUnit -framework CoreAudio"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "x$WANT_MACOSX_ETHERSLAVE" = "xyes" ]]; then
|
if [[ "x$WANT_MACOSX_ETHERHELPER" = "xyes" ]]; then
|
||||||
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/runtool.c"
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/runtool.c"
|
||||||
LIBS="$LIBS -framework Security"
|
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
|
fi
|
||||||
|
|
||||||
AC_SUBST(MACOSX_ETHERSLAVE, $WANT_MACOSX_ETHERSLAVE)
|
AC_SUBST(MACOSX_ETHERHELPER, $WANT_MACOSX_ETHERHELPER)
|
||||||
|
|
||||||
dnl SDL overrides
|
dnl SDL overrides
|
||||||
if [[ "x$WANT_SDL" = "xyes" ]]; then
|
if [[ "x$WANT_SDL" = "xyes" ]]; then
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
@ -101,11 +101,11 @@ enum {
|
|||||||
NET_IF_ETHERTAP,
|
NET_IF_ETHERTAP,
|
||||||
NET_IF_TUNTAP,
|
NET_IF_TUNTAP,
|
||||||
NET_IF_SLIRP,
|
NET_IF_SLIRP,
|
||||||
NET_IF_ETHERSLAVE
|
NET_IF_ETHERHELPER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern FILE * run_tool(const char *if_name, const char *tool_name);
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
static uint8 packet_buffer[2048];
|
static uint8 packet_buffer[2048];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -155,9 +155,9 @@ static void ether_do_interrupt(void);
|
|||||||
static void slirp_add_redirs();
|
static void slirp_add_redirs();
|
||||||
static int slirp_add_redir(const char *redir_str);
|
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 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);
|
static int read_packet(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ bool ether_init(void)
|
|||||||
|
|
||||||
// Do nothing if no Ethernet device specified
|
// Do nothing if no Ethernet device specified
|
||||||
const char *name = PrefsFindString("ether");
|
const char *name = PrefsFindString("ether");
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
std::string slave_dev;
|
std::string slave_dev;
|
||||||
#endif
|
#endif
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@ -278,9 +278,9 @@ bool ether_init(void)
|
|||||||
else if (strcmp(name, "slirp") == 0)
|
else if (strcmp(name, "slirp") == 0)
|
||||||
net_if_type = NET_IF_SLIRP;
|
net_if_type = NET_IF_SLIRP;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
else if (strncmp(name, "etherslave", 10) == 0)
|
else if (strncmp(name, "etherhelper", 10) == 0)
|
||||||
net_if_type = NET_IF_ETHERSLAVE;
|
net_if_type = NET_IF_ETHERHELPER;
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
net_if_type = NET_IF_SHEEPNET;
|
net_if_type = NET_IF_SHEEPNET;
|
||||||
@ -332,8 +332,8 @@ bool ether_init(void)
|
|||||||
case NET_IF_SHEEPNET:
|
case NET_IF_SHEEPNET:
|
||||||
strcpy(dev_name, "/dev/sheep_net");
|
strcpy(dev_name, "/dev/sheep_net");
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
case NET_IF_ETHERSLAVE: {
|
case NET_IF_ETHERHELPER: {
|
||||||
std::string device(name);
|
std::string device(name);
|
||||||
size_t pos;
|
size_t pos;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ bool ether_init(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return open_ether_slave(slave_dev);
|
return open_ether_helper(slave_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -802,8 +802,8 @@ static int16 ether_do_write(uint32 arg)
|
|||||||
return noErr;
|
return noErr;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
if (net_if_type == NET_IF_ETHERSLAVE) {
|
if (net_if_type == NET_IF_ETHERHELPER) {
|
||||||
unsigned short pkt_len;
|
unsigned short pkt_len;
|
||||||
|
|
||||||
pkt_len = len;
|
pkt_len = len;
|
||||||
@ -950,8 +950,8 @@ static void *receive_func(void *arg)
|
|||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
if (net_if_type == NET_IF_ETHERSLAVE) {
|
if (net_if_type == NET_IF_ETHERHELPER) {
|
||||||
if (read_packet() < 1) {
|
if (read_packet() < 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -997,8 +997,8 @@ void ether_do_interrupt(void)
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
if (net_if_type == NET_IF_ETHERSLAVE) {
|
if (net_if_type == NET_IF_ETHERHELPER) {
|
||||||
unsigned short *pkt_len;
|
unsigned short *pkt_len;
|
||||||
uint32 p = packet;
|
uint32 p = packet;
|
||||||
|
|
||||||
@ -1135,7 +1135,7 @@ static int slirp_add_redir(const char *redir_str)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||||
static int get_mac_address(const char* dev, unsigned char *addr)
|
static int get_mac_address(const char* dev, unsigned char *addr)
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifaddrs, *next;
|
struct ifaddrs *ifaddrs, *next;
|
||||||
@ -1168,16 +1168,16 @@ static int get_mac_address(const char* dev, unsigned char *addr)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool open_ether_slave(const std::string &if_name)
|
static bool open_ether_helper(const std::string &if_name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char str[64];
|
char str[64];
|
||||||
std::string dev_name;
|
std::string dev_name;
|
||||||
size_t pos;
|
size_t pos;
|
||||||
|
|
||||||
fp = run_tool(if_name.c_str(), "etherslavetool");
|
fp = run_tool(if_name.c_str(), "etherhelpertool");
|
||||||
if (fp == NULL) {
|
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);
|
WarningAlert(str);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,6 @@ prefs_desc platform_prefs_items[] = {
|
|||||||
{"mixer", TYPE_STRING, false, "audio mixer device name"},
|
{"mixer", TYPE_STRING, false, "audio mixer device name"},
|
||||||
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
|
||||||
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
{"ignoresegv", TYPE_BOOLEAN, false, "ignore illegal memory accesses"},
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_MACOSX_ETHERSLAVE
|
|
||||||
{"etherslavedev", TYPE_STRING, false, "ethernet device for etherslave ethernet"},
|
|
||||||
#endif
|
#endif
|
||||||
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
{"idlewait", TYPE_BOOLEAN, false, "sleep when idle"},
|
||||||
{NULL, TYPE_END, false, NULL} // End of list
|
{NULL, TYPE_END, false, NULL} // End of list
|
||||||
|
Loading…
Reference in New Issue
Block a user