mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-27 04:48:21 +01:00
final fixes for building for PSP without IPv6 support
This commit is contained in:
parent
b41e0a03c2
commit
69d4916a0f
@ -371,6 +371,7 @@ const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm)
|
|||||||
return socket_strerror(socket_connect(ps, (SA *) &sin,
|
return socket_strerror(socket_connect(ps, (SA *) &sin,
|
||||||
sizeof(sin), tm));
|
sizeof(sin), tm));
|
||||||
}
|
}
|
||||||
|
#ifndef NOIPV6
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
struct sockaddr_in6 sin6;
|
struct sockaddr_in6 sin6;
|
||||||
struct in6_addr addrany = IN6ADDR_ANY_INIT;
|
struct in6_addr addrany = IN6ADDR_ANY_INIT;
|
||||||
@ -380,6 +381,7 @@ const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm)
|
|||||||
return socket_strerror(socket_connect(ps, (SA *) &sin6,
|
return socket_strerror(socket_connect(ps, (SA *) &sin6,
|
||||||
sizeof(sin6), tm));
|
sizeof(sin6), tm));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -438,7 +440,9 @@ const char *inet_tryaccept(p_socket server, int family, p_socket client,
|
|||||||
socklen_t len;
|
socklen_t len;
|
||||||
t_sockaddr_storage addr;
|
t_sockaddr_storage addr;
|
||||||
switch (family) {
|
switch (family) {
|
||||||
|
#ifndef NOIPV6
|
||||||
case AF_INET6: len = sizeof(struct sockaddr_in6); break;
|
case AF_INET6: len = sizeof(struct sockaddr_in6); break;
|
||||||
|
#endif
|
||||||
case AF_INET: len = sizeof(struct sockaddr_in); break;
|
case AF_INET: len = sizeof(struct sockaddr_in); break;
|
||||||
default: len = sizeof(addr); break;
|
default: len = sizeof(addr); break;
|
||||||
}
|
}
|
||||||
@ -526,9 +530,11 @@ int inet_pton(int af, const char *src, void *dst)
|
|||||||
if (af == AF_INET) {
|
if (af == AF_INET) {
|
||||||
struct sockaddr_in *in = (struct sockaddr_in *) res->ai_addr;
|
struct sockaddr_in *in = (struct sockaddr_in *) res->ai_addr;
|
||||||
memcpy(dst, &in->sin_addr, sizeof(in->sin_addr));
|
memcpy(dst, &in->sin_addr, sizeof(in->sin_addr));
|
||||||
|
#ifndef NOIPV6
|
||||||
} else if (af == AF_INET6) {
|
} else if (af == AF_INET6) {
|
||||||
struct sockaddr_in6 *in = (struct sockaddr_in6 *) res->ai_addr;
|
struct sockaddr_in6 *in = (struct sockaddr_in6 *) res->ai_addr;
|
||||||
memcpy(dst, &in->sin6_addr, sizeof(in->sin6_addr));
|
memcpy(dst, &in->sin6_addr, sizeof(in->sin6_addr));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ SOCKET=$(SOCKET_$(PLAT))
|
|||||||
#
|
#
|
||||||
CC=$(CC_$(PLAT))
|
CC=$(CC_$(PLAT))
|
||||||
DEF=$(DEF_$(PLAT))
|
DEF=$(DEF_$(PLAT))
|
||||||
CFLAGS=$(MYCFLAGS) $(CFLAGS_$(PLAT)) -DHAVE_CONFIG_H
|
CFLAGS=$(MYCFLAGS) $(CFLAGS_$(PLAT)) -DHAVE_CONFIG_H -DSOCKET_SELECT -DNOIPV6
|
||||||
LDFLAGS=$(MYLDFLAGS) $(LDFLAGS_$(PLAT))
|
LDFLAGS=$(MYLDFLAGS) $(LDFLAGS_$(PLAT))
|
||||||
LD=$(LD_$(PLAT))
|
LD=$(LD_$(PLAT))
|
||||||
LUAINC= $(LUAINC_$(PLAT))
|
LUAINC= $(LUAINC_$(PLAT))
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
#include "getaddrinfo.h"
|
#include "getaddrinfo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INET6_ADDRSTRLEN
|
||||||
|
#define INET6_ADDRSTRLEN INET_ADDRSTRLEN
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Replacement for sockaddr storage that we can use internally on platforms
|
/* Replacement for sockaddr storage that we can use internally on platforms
|
||||||
* that lack it. It is not space-efficient, but neither is sockaddr_storage.
|
* that lack it. It is not space-efficient, but neither is sockaddr_storage.
|
||||||
*/
|
*/
|
||||||
@ -43,7 +47,9 @@ struct sockaddr_storage {
|
|||||||
union {
|
union {
|
||||||
struct sockaddr ss_sa;
|
struct sockaddr ss_sa;
|
||||||
struct sockaddr_in ss_sin;
|
struct sockaddr_in ss_sin;
|
||||||
|
#ifndef NOIPV6
|
||||||
struct sockaddr_in6 ss_sin6;
|
struct sockaddr_in6 ss_sin6;
|
||||||
|
#endif
|
||||||
char ss_padding[128];
|
char ss_padding[128];
|
||||||
} ss_union;
|
} ss_union;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user