(Network) Move the HAVE_INET6 macro to a proper place (#14096)

This commit is contained in:
Cthulhu-throwaway 2022-06-24 20:54:39 -03:00 committed by GitHub
parent 456fb6f2c9
commit 8c6c399a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 77 deletions

View File

@ -52,9 +52,20 @@
#elif defined(_XBOX)
#define NOD3D
#include <xtl.h>
#include <io.h>
#define socklen_t int
#ifndef h_addr
#define h_addr h_addr_list[0] /* for backward compatibility */
#endif
#ifndef SO_KEEPALIVE
#define SO_KEEPALIVE 0 /* verify if correct */
#endif
#elif defined(GEKKO)
#include <network.h>
@ -178,6 +189,10 @@ struct SceNetInAddr inet_aton(const char *ip_addr);
#include <signal.h>
#endif
#ifdef WIIU
#define WIIU_RCVBUF (128 * 2 * 1024)
#define WIIU_SNDBUF (128 * 2 * 1024)
#endif
#if defined(__PSL1GHT__)
#include <net/poll.h>
@ -192,8 +207,59 @@ struct SceNetInAddr inet_aton(const char *ip_addr);
#endif
#endif
#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
#endif
#include <errno.h>
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif
#if defined(AF_INET6) && !defined(HAVE_SOCKET_LEGACY) && !defined(_3DS)
#define HAVE_INET6 1
#endif
#ifdef NETWORK_HAVE_POLL
#ifdef GEKKO
#define NET_POLL_FD(sockfd, sockfds) (sockfds)->socket = (sockfd)
#else
#define NET_POLL_FD(sockfd, sockfds) (sockfds)->fd = (sockfd)
#endif
#define NET_POLL_EVENT(sockev, sockfds) (sockfds)->events |= (sockev)
#define NET_POLL_HAS_EVENT(sockev, sockfds) ((sockfds)->revents & (sockev))
#endif
/* Compatibility layer for legacy or incomplete BSD socket implementations.
* Only for IPv4. Mostly useful for the consoles which do not support
* anything reasonably modern on the socket API side of things. */
#ifdef HAVE_SOCKET_LEGACY
#define sockaddr_storage sockaddr_in
#define addrinfo addrinfo_retro__
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
#endif
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
/* gai_strerror() not used, so we skip that. */
#endif
static INLINE bool isagain(int bytes)
{
#if defined(_WIN32)
@ -224,71 +290,6 @@ static INLINE bool isinprogress(int bytes)
#endif
}
#ifdef WIIU
#define WIIU_RCVBUF (128 * 2 * 1024)
#define WIIU_SNDBUF (128 * 2 * 1024)
#endif
#ifdef _XBOX
#define socklen_t int
#ifndef h_addr
#define h_addr h_addr_list[0] /* for backward compatibility */
#endif
#ifndef SO_KEEPALIVE
#define SO_KEEPALIVE 0 /* verify if correct */
#endif
#endif
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif
#ifndef _WIN32
#include <sys/time.h>
#include <unistd.h>
#endif
#ifdef NETWORK_HAVE_POLL
#ifdef GEKKO
#define NET_POLL_FD(sockfd, sockfds) (sockfds)->socket = (sockfd)
#else
#define NET_POLL_FD(sockfd, sockfds) (sockfds)->fd = (sockfd)
#endif
#define NET_POLL_EVENT(sockev, sockfds) (sockfds)->events |= (sockev)
#define NET_POLL_HAS_EVENT(sockev, sockfds) ((sockfds)->revents & (sockev))
#endif
/* Compatibility layer for legacy or incomplete BSD socket implementations.
* Only for IPv4. Mostly useful for the consoles which do not support
* anything reasonably modern on the socket API side of things. */
#ifdef HAVE_SOCKET_LEGACY
#define sockaddr_storage sockaddr_in
#define addrinfo addrinfo_retro__
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr *ai_addr;
char *ai_canonname;
struct addrinfo *ai_next;
};
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
#endif
/* gai_strerror() not used, so we skip that. */
#endif
uint16_t inet_htons(uint16_t hostshort);
int inet_ptrton(int af, const char *src, void *dst);

View File

@ -30,12 +30,6 @@
#include "natt.h"
#if defined(AF_INET6) && !defined(HAVE_SOCKET_LEGACY) && !defined(_3DS)
#ifndef HAVE_INET6
#define HAVE_INET6 1
#endif
#endif
static bool translate_addr(struct sockaddr_in *addr,
char *host, size_t hostlen, char *port, size_t portlen)
{

View File

@ -78,12 +78,6 @@
#include "netplay_private.h"
#if defined(AF_INET6) && !defined(HAVE_SOCKET_LEGACY) && !defined(_3DS)
#ifndef HAVE_INET6
#define HAVE_INET6 1
#endif
#endif
#ifdef TCP_NODELAY
#define SET_TCP_NODELAY(fd) \
{ \