mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 06:11:03 +00:00
Merge pull request #45 from d3m3vilurr/vita-newlib
vita: Apply newlib changes
This commit is contained in:
@@ -114,11 +114,7 @@ SOCKET bindUdpSocket(int addrfamily, int bufferSize) {
|
|||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
#ifndef __vita__
|
|
||||||
LC_ASSERT(addrfamily == AF_INET || addrfamily == AF_INET6);
|
LC_ASSERT(addrfamily == AF_INET || addrfamily == AF_INET6);
|
||||||
#else
|
|
||||||
LC_ASSERT(addrfamily == AF_INET);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s = socket(addrfamily, SOCK_DGRAM, IPPROTO_UDP);
|
s = socket(addrfamily, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
if (s == INVALID_SOCKET) {
|
if (s == INVALID_SOCKET) {
|
||||||
@@ -332,7 +328,6 @@ int resolveHostName(const char* host, int family, int tcpTestPort, struct sockad
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __vita__
|
|
||||||
int isInSubnetV6(struct sockaddr_in6* sin6, unsigned char* subnet, int prefixLength) {
|
int isInSubnetV6(struct sockaddr_in6* sin6, unsigned char* subnet, int prefixLength) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -345,7 +340,6 @@ int isInSubnetV6(struct sockaddr_in6* sin6, unsigned char* subnet, int prefixLen
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int isPrivateNetworkAddress(struct sockaddr_storage* address) {
|
int isPrivateNetworkAddress(struct sockaddr_storage* address) {
|
||||||
|
|
||||||
@@ -373,7 +367,6 @@ int isPrivateNetworkAddress(struct sockaddr_storage* address) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef __vita__
|
|
||||||
else if (address->ss_family == AF_INET6) {
|
else if (address->ss_family == AF_INET6) {
|
||||||
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)address;
|
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)address;
|
||||||
static unsigned char linkLocalPrefix[] = {0xfe, 0x80};
|
static unsigned char linkLocalPrefix[] = {0xfe, 0x80};
|
||||||
@@ -393,7 +386,6 @@ int isPrivateNetworkAddress(struct sockaddr_storage* address) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,7 @@ typedef int SOCKADDR_LEN;
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#ifndef __vita__
|
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#else
|
|
||||||
#include <psp2/net/net.h>
|
|
||||||
#include <enet/enet.h>
|
|
||||||
#endif
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@@ -45,14 +40,6 @@ typedef ssize_t SOCK_RET;
|
|||||||
typedef socklen_t SOCKADDR_LEN;
|
typedef socklen_t SOCKADDR_LEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__vita__)
|
|
||||||
#define TCP_NODELAY SCE_NET_TCP_NODELAY
|
|
||||||
|
|
||||||
#define sockaddr_in6 sockaddr_in
|
|
||||||
#define sin6_addr sin_addr
|
|
||||||
#define sin6_port sin_port
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LastSocketFail() ((LastSocketError() != 0) ? LastSocketError() : -1)
|
#define LastSocketFail() ((LastSocketError() != 0) ? LastSocketError() : -1)
|
||||||
|
|
||||||
// IPv6 addresses have 2 extra characters for URL escaping
|
// IPv6 addresses have 2 extra characters for URL escaping
|
||||||
|
|||||||
Reference in New Issue
Block a user