diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/core/host.cpp | 2 | ||||
-rw-r--r-- | src/network/core/os_abstraction.h | 58 | ||||
-rw-r--r-- | src/network/core/udp.cpp | 2 |
3 files changed, 17 insertions, 45 deletions
diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp index 216839032..c2faf4c8b 100644 --- a/src/network/core/host.cpp +++ b/src/network/core/host.cpp @@ -24,7 +24,7 @@ */ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast); -#if defined(BEOS_NET_SERVER) || defined(__HAIKU__) /* doesn't have neither getifaddrs or net/if.h */ +#if defined(__HAIKU__) /* doesn't have neither getifaddrs or net/if.h */ /* Based on Andrew Bachmann's netstat+.c. Big thanks to him! */ extern "C" int _netstat(int fd, char **output, int verbose); diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h index 187e2584c..084f763c2 100644 --- a/src/network/core/os_abstraction.h +++ b/src/network/core/os_abstraction.h @@ -49,9 +49,7 @@ typedef unsigned long in_addr_t; # define SOCKET int # define INVALID_SOCKET -1 # define ioctlsocket ioctl -# if !defined(BEOS_NET_SERVER) -# define closesocket close -# endif +# define closesocket close # define GET_LAST_ERROR() (errno) /* Need this for FIONREAD on solaris */ # define BSD_COMP @@ -59,37 +57,25 @@ typedef unsigned long in_addr_t; /* Includes needed for UNIX-like systems */ # include <unistd.h> # include <sys/ioctl.h> -# if defined(__BEOS__) && defined(BEOS_NET_SERVER) -# include <be/net/socket.h> -# include <be/kernel/OS.h> /* snooze() */ -# include <be/net/netdb.h> - typedef unsigned long in_addr_t; -# define INADDR_NONE INADDR_BROADCAST -# else -# include <sys/socket.h> -# include <netinet/in.h> -# include <netinet/tcp.h> -# include <arpa/inet.h> -# include <net/if.h> +# include <sys/socket.h> +# include <netinet/in.h> +# include <netinet/tcp.h> +# include <arpa/inet.h> +# include <net/if.h> /* According to glibc/NEWS, <ifaddrs.h> appeared in glibc-2.3. */ -# if !defined(__sgi__) && !defined(SUNOS) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ - && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) +# if !defined(__sgi__) && !defined(SUNOS) && !defined(__HAIKU__) && !defined(__INNOTEK_LIBC__) \ + && !(defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 2)) && !defined(__dietlibc__) && !defined(HPUX) /* If for any reason ifaddrs.h does not exist on your system, comment out * the following two lines and an alternative way will be used to fetch * the list of IPs from the system. */ -# include <ifaddrs.h> -# define HAVE_GETIFADDRS -# endif -# if !defined(INADDR_NONE) -# define INADDR_NONE 0xffffffff -# endif -# if defined(__BEOS__) && !defined(BEOS_NET_SERVER) - /* needed on Zeta */ -# include <sys/sockio.h> -# endif -# endif /* BEOS_NET_SERVER */ - -# if !defined(__BEOS__) && defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) +# include <ifaddrs.h> +# define HAVE_GETIFADDRS +# endif +# if !defined(INADDR_NONE) +# define INADDR_NONE 0xffffffff +# endif + +# if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 1) typedef uint32_t in_addr_t; # endif @@ -98,10 +84,6 @@ typedef unsigned long in_addr_t; # include <netdb.h> #endif /* UNIX */ -#ifdef __BEOS__ - typedef int socklen_t; -#endif - #ifdef __HAIKU__ #define IPV6_V6ONLY 27 #endif @@ -174,11 +156,7 @@ static inline bool SetNonBlocking(SOCKET d) #else int nonblocking = 1; #endif -#if (defined(__BEOS__) && defined(BEOS_NET_SERVER)) - return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking, sizeof(nonblocking)) == 0; -#else return ioctlsocket(d, FIONBIO, &nonblocking) == 0; -#endif } /** @@ -189,13 +167,9 @@ static inline bool SetNonBlocking(SOCKET d) static inline bool SetNoDelay(SOCKET d) { /* XXX should this be done at all? */ -#if !defined(BEOS_NET_SERVER) /* not implemented on BeOS net_server */ int b = 1; /* The (const char*) cast is needed for windows */ return setsockopt(d, IPPROTO_TCP, TCP_NODELAY, (const char*)&b, sizeof(b)) == 0; -#else - return true; -#endif } /* Make sure these structures have the size we expect them to be */ diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp index d2dc15d42..1f34d15b0 100644 --- a/src/network/core/udp.cpp +++ b/src/network/core/udp.cpp @@ -94,7 +94,6 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool a p->PrepareToSend(); -#ifndef BEOS_NET_SERVER /* will work around this, some day; maybe. */ if (broadcast) { /* Enable broadcast */ unsigned long val = 1; @@ -102,7 +101,6 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool a DEBUG(net, 1, "[udp] setting broadcast failed with: %i", GET_LAST_ERROR()); } } -#endif /* Send the buffer */ int res = sendto(s->second, (const char*)p->buffer, p->size, 0, (const struct sockaddr *)send.GetAddress(), send.GetAddressLength()); |