mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 01:41:10 +00:00
A bunch of networking compile fixes.
This isn't everything needed to get networking compiling, but it's pretty close.
This commit is contained in:
parent
78f7604efc
commit
575693e4a0
4 changed files with 37 additions and 9 deletions
|
@ -12,12 +12,12 @@ AC_CHECK_HEADERS(
|
|||
dmedia/cdaudio.h dpmi.h dsound.h errno.h fcntl.h io.h \
|
||||
ifaddrs.h libc.h limits.h linux/cdrom.h linux/joystick.h \
|
||||
linux/soundcard.h machine/soundcard.h malloc.h math.h mgraph.h _mingw.h \
|
||||
netdb.h netinet/in.h process.h pthread.h pwd.h rpc/types.h setjmp.h \
|
||||
signal.h stdarg.h stdio.h stdlib.h string.h strings.h sys/asoundlib.h \
|
||||
sys/audioio.h sys/filio.h sys/ioctl.h sys/io.h sys/ipc.h sys/mman.h \
|
||||
sys/param.h sys/poll.h sys/select.h sys/shm.h sys/signal.h sys/socket.h \
|
||||
sys/soundcard.h sys/stat.h sys/time.h sys/types.h sys/uio.h termios.h \
|
||||
time.h unistd.h vgakeyboard.h vgamouse.h windows.h winsock.h
|
||||
netdb.h net/if.h netinet/in.h process.h pthread.h pwd.h rpc/types.h \
|
||||
setjmp.h signal.h stdarg.h stdio.h stdlib.h string.h strings.h \
|
||||
sys/asoundlib.h sys/audioio.h sys/filio.h sys/ioctl.h sys/io.h sys/ipc.h \
|
||||
sys/mman.h sys/param.h sys/poll.h sys/select.h sys/shm.h sys/signal.h \
|
||||
sys/socket.h sys/soundcard.h sys/stat.h sys/time.h sys/types.h sys/uio.h \
|
||||
termios.h time.h unistd.h vgakeyboard.h vgamouse.h windows.h winsock.h
|
||||
)
|
||||
if test "x$mingw" = xyes; then
|
||||
AC_MSG_CHECKING(for fnmatch.h)
|
||||
|
|
|
@ -46,6 +46,16 @@ if test "x$ac_cv_func_gethostbyname" != "xyes"; then
|
|||
ac_cv_func_gethostbyname=yes
|
||||
)
|
||||
fi
|
||||
if test "x$ac_cv_func_gethostbyname" != "xyes"; then
|
||||
SAVELIBS="$LIBS"
|
||||
#FIXME this should be checked too
|
||||
LIBS="$LIBS -lsysmodule"
|
||||
AC_CHECK_LIB(net, gethostbyname,
|
||||
NET_LIBS="$NET_LIBS -lnet -lsysmodule"
|
||||
ac_cv_func_gethostbyname=yes
|
||||
)
|
||||
LIBS="$SAVELIBS"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for connect in -lwsock32])
|
||||
SAVELIBS="$LIBS"
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
@ -120,7 +123,9 @@ byte net_message_buffer[MAX_UDP_PACKET];
|
|||
#define ADDR_SIZE 4
|
||||
|
||||
typedef union address {
|
||||
#ifdef HAV_SS_LEN // FIXME check properly, but should be ok
|
||||
struct sockaddr_storage ss;
|
||||
#endif
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in s4;
|
||||
} AF_address_t;
|
||||
|
@ -371,13 +376,15 @@ UDP_OpenSocket (int port)
|
|||
static void
|
||||
NET_GetLocalAddress (void)
|
||||
{
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
char buff[MAXHOSTNAMELEN] = "127.0.0.1"; //FIXME
|
||||
socklen_t namelen;
|
||||
AF_address_t address;
|
||||
|
||||
#ifdef HAVE_GETHOSTNAME
|
||||
if (gethostname (buff, MAXHOSTNAMELEN) == -1)
|
||||
Sys_Error ("Net_GetLocalAddress: gethostname: %s", strerror (errno));
|
||||
buff[MAXHOSTNAMELEN - 1] = 0;
|
||||
#endif
|
||||
|
||||
NET_StringToAdr (buff, &net_local_adr);
|
||||
|
||||
|
|
|
@ -67,6 +67,9 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#ifdef __sun__
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
|
@ -77,8 +80,12 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_NET_IF_H
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/dstring.h"
|
||||
|
@ -112,7 +119,9 @@
|
|||
#define ADDR_SIZE 4
|
||||
|
||||
typedef union address {
|
||||
#ifdef HAVE_SS_LEN
|
||||
struct sockaddr_storage ss;
|
||||
#endif
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in s4;
|
||||
} AF_address_t;
|
||||
|
@ -213,7 +222,7 @@ no_ifaddrs:
|
|||
int
|
||||
UDP_Init (void)
|
||||
{
|
||||
struct hostent *local;
|
||||
struct hostent *local = 0;
|
||||
char buff[MAXHOSTNAMELEN];
|
||||
netadr_t addr;
|
||||
char *colon;
|
||||
|
@ -229,8 +238,10 @@ UDP_Init (void)
|
|||
return -1;
|
||||
|
||||
// determine my name & address
|
||||
#ifdef HAVE_GETHOSTNAME //FIXME
|
||||
gethostname (buff, MAXHOSTNAMELEN);
|
||||
local = gethostbyname (buff);
|
||||
#endif
|
||||
if (local)
|
||||
myAddr = *(uint32_t *) local->h_addr_list[0];
|
||||
else
|
||||
|
@ -482,7 +493,7 @@ UDP_Read (int socket, byte *buf, int len, netadr_t *from)
|
|||
socklen_t addrlen = sizeof (AF_address_t);
|
||||
|
||||
memset (&addr, 0, sizeof (addr));
|
||||
ret = recvfrom (socket, buf, len, 0, &addr, &addrlen);
|
||||
ret = recvfrom (socket, buf, len, 0, (struct sockaddr *) &addr, &addrlen);
|
||||
if (ret == -1 && (errno == EWOULDBLOCK || errno == ECONNREFUSED))
|
||||
return 0;
|
||||
SockadrToNetadr (&addr, from);
|
||||
|
|
Loading…
Reference in a new issue