socklen_t compatibility cruft.
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "socket.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_accept4(int s,char *ip,uint16 *port) {
|
||||
struct sockaddr_in si;
|
||||
unsigned int len = sizeof si;
|
||||
socklen_t len = sizeof si;
|
||||
int fd;
|
||||
if ((fd=accept(s,(struct sockaddr*) &si,&len))<0) return -1;
|
||||
*(uint32*)ip = *(uint32*)&si.sin_addr;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "socket.h"
|
||||
#include "ip6.h"
|
||||
#include "haveip6.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_accept6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
{
|
||||
@@ -14,7 +15,7 @@ int socket_accept6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
#else
|
||||
struct sockaddr_in sa;
|
||||
#endif
|
||||
unsigned int dummy = sizeof sa;
|
||||
socklen_t dummy = sizeof sa;
|
||||
int fd;
|
||||
|
||||
fd = accept(s,(struct sockaddr *) &sa,&dummy);
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
|
||||
int socket_connected(int s) {
|
||||
struct sockaddr si;
|
||||
#ifdef HAVE_SOCKLEN_T
|
||||
socklen_t sl=sizeof si;
|
||||
#else
|
||||
int sl=sizeof si;
|
||||
#endif
|
||||
if (getpeername(s,&si,&sl))
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
#include <netinet/in.h>
|
||||
#include "byte.h"
|
||||
#include "socket.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_local4(int s,char ip[4],uint16 *port)
|
||||
{
|
||||
struct sockaddr_in si;
|
||||
unsigned int len = sizeof si;
|
||||
socklen_t len = sizeof si;
|
||||
|
||||
if (getsockname(s,(struct sockaddr *) &si,&len) == -1) return -1;
|
||||
*(uint32*)ip = *(uint32*)&si.sin_addr;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "ip6.h"
|
||||
#include "haveip6.h"
|
||||
#include "uint32.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_local6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
{
|
||||
@@ -15,7 +16,7 @@ int socket_local6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
#else
|
||||
struct sockaddr_in si;
|
||||
#endif
|
||||
unsigned int len = sizeof si;
|
||||
socklen_t len = sizeof si;
|
||||
|
||||
if (getsockname(s,(struct sockaddr *) &si,&len) == -1) return -1;
|
||||
#ifdef LIBC_HAS_IP6
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "socket.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_recv4(int s,char *buf,unsigned int len,char ip[4],uint16 *port) {
|
||||
struct sockaddr_in si;
|
||||
unsigned int Len = sizeof si;
|
||||
socklen_t Len = sizeof si;
|
||||
int r;
|
||||
|
||||
if ((r = recvfrom(s,buf,len,0,(struct sockaddr *) &si,&Len))<0) return -1;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "socket.h"
|
||||
#include "ip6.h"
|
||||
#include "haveip6.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_recv6(int s,char *buf,unsigned int len,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
{
|
||||
@@ -14,7 +15,7 @@ int socket_recv6(int s,char *buf,unsigned int len,char ip[16],uint16 *port,uint3
|
||||
#else
|
||||
struct sockaddr_in si;
|
||||
#endif
|
||||
unsigned int Len = sizeof si;
|
||||
socklen_t Len = sizeof si;
|
||||
int r;
|
||||
|
||||
byte_zero(&si,Len);
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
#include <netinet/in.h>
|
||||
#include "byte.h"
|
||||
#include "socket.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_remote4(int s,char ip[4],uint16 *port)
|
||||
{
|
||||
struct sockaddr_in si;
|
||||
unsigned int len = sizeof si;
|
||||
socklen_t len = sizeof si;
|
||||
|
||||
if (getpeername(s,(struct sockaddr *) &si,&len) == -1) return -1;
|
||||
*(uint32*)ip = *(uint32*)&si.sin_addr;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "ip6.h"
|
||||
#include "haveip6.h"
|
||||
#include "uint32.h"
|
||||
#include "havesl.h"
|
||||
|
||||
int socket_remote6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
{
|
||||
@@ -15,7 +16,7 @@ int socket_remote6(int s,char ip[16],uint16 *port,uint32 *scope_id)
|
||||
#else
|
||||
struct sockaddr_in si;
|
||||
#endif
|
||||
unsigned int len = sizeof si;
|
||||
socklen_t len = sizeof si;
|
||||
|
||||
if (getpeername(s,(struct sockaddr *) &si,&len) == -1) return -1;
|
||||
#ifdef LIBC_HAS_IP6
|
||||
|
||||
Reference in New Issue
Block a user