--- previous/src/slirp/slirp.h 2018/04/24 19:30:44 1.1.1.1 +++ previous/src/slirp/slirp.h 2018/04/24 19:34:33 1.1.1.3 @@ -12,7 +12,10 @@ #include "slirp_config.h" #ifdef _WIN32 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 # include +# include typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; @@ -22,18 +25,12 @@ typedef char *caddr_t; typedef int socklen_t; typedef unsigned long ioctlsockopt_t; -# include # include +# include # include # include # define USE_FIONBIO 1 -# define EWOULDBLOCK WSAEWOULDBLOCK -# define EINPROGRESS WSAEINPROGRESS -# define ENOTCONN WSAENOTCONN -# define EHOSTUNREACH WSAEHOSTUNREACH -# define ENETUNREACH WSAENETUNREACH -# define ECONNREFUSED WSAECONNREFUSED /* Basilisk II Router defines those */ # define udp_read_completion slirp_udp_read_completion @@ -41,6 +38,14 @@ typedef unsigned long ioctlsockopt_t; # define init_udp slirp_init_udp # define final_udp slirp_final_udp #else +# define WSAGetLastError() (int)(errno) +# define WSASetLastError(e) (void)(errno = (e)) +# define WSAEWOULDBLOCK EWOULDBLOCK +# define WSAEINPROGRESS EINPROGRESS +# define WSAENOTCONN ENOTCONN +# define WSAEHOSTUNREACH EHOSTUNREACH +# define WSAENETUNREACH ENETUNREACH +# define WSAECONNREFUSED ECONNREFUSED typedef int ioctlsockopt_t; # define ioctlsocket ioctl # define closesocket(s) close(s) @@ -55,7 +60,9 @@ typedef int ioctlsockopt_t; # include #endif +#ifndef _WIN32 #include +#endif #ifdef NEED_TYPEDEFS typedef char int8_t; @@ -86,10 +93,14 @@ typedef unsigned char u_int8_t; # endif #endif /* NEED_TYPEDEFS */ +#ifdef __HAIKU__ +#include +#else /* Basilisk II types glue */ typedef u_int8_t uint8; typedef u_int16_t uint16; typedef u_int32_t uint32; +#endif #ifdef HAVE_UNISTD_H # include @@ -102,7 +113,7 @@ typedef u_int32_t uint32; #include #include -#ifndef HAVE_MEMMOVE +#ifndef SLIRP_HAVE_MEMMOVE #define memmove(x, y, z) bcopy(y, x, z) #endif @@ -125,17 +136,6 @@ typedef u_int32_t uint32; #ifndef _WIN32 #include -#endif - -#ifndef _P -#ifndef NO_PROTOTYPES -# define _P(x) x -#else -# define _P(x) () -#endif -#endif - -#ifndef _WIN32 #include #include #endif @@ -146,20 +146,24 @@ typedef u_int32_t uint32; /* Systems lacking strdup() definition in . */ #if defined(ultrix) -char *strdup _P((const char *)); +char *strdup(const char *); #endif /* Systems lacking malloc() definition in . */ #if defined(ultrix) || defined(hcx) -void *malloc _P((size_t arg)); -void free _P((void *ptr)); +void *malloc(size_t arg); +void free(void *ptr); #endif #ifndef HAVE_INET_ATON -int inet_aton _P((const char *cp, struct in_addr *ia)); +int inet_aton(const char *cp, struct in_addr *ia); #endif #include +#ifdef _WIN32 +#include +const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); +#endif #ifndef NO_UNIX_SOCKETS #include #endif @@ -191,11 +195,7 @@ int inet_aton _P((const char *cp, struct #include #endif -#ifdef __STDC__ #include -#else -#include -#endif #include @@ -212,8 +212,13 @@ int inet_aton _P((const char *cp, struct #if defined __GNUC__ #define PACKED__ __attribute__ ((packed)) +#elif defined _MSC_VER +#define PRAGMA_PACK_SUPPORTED 1 +#define PACK_RESET +#define PACKED__ #elif defined __sgi #define PRAGMA_PACK_SUPPORTED 1 +#define PACK_RESET 0 #define PACKED__ #else #error "Packed attribute or pragma shall be supported" @@ -249,38 +254,38 @@ extern struct ttys *ttys_unit[MAX_INTERF #endif #ifndef FULL_BOLT -void if_start _P((void)); +void if_start(void); #else -void if_start _P((struct ttys *)); +void if_start(struct ttys *); #endif #ifdef BAD_SPRINTF # define vsprintf vsprintf_len # define sprintf sprintf_len - extern int vsprintf_len _P((char *, const char *, va_list)); - extern int sprintf_len _P((char *, const char *, ...)); + extern int vsprintf_len(char *, const char *, va_list); + extern int sprintf_len(char *, const char *, ...); #endif #ifdef DECLARE_SPRINTF # ifndef BAD_SPRINTF - extern int vsprintf _P((char *, const char *, va_list)); + extern int vsprintf(char *, const char *, va_list); # endif - extern int vfprintf _P((FILE *, const char *, va_list)); + extern int vfprintf(FILE *, const char *, va_list); #endif #ifndef HAVE_STRERROR - extern char *strerror _P((int error)); + extern char *strerror(int error); #endif #ifndef HAVE_INDEX - char *index _P((const char *, int)); + char *index(const char *, int); #endif #ifndef HAVE_GETHOSTID - long gethostid _P((void)); + long gethostid(void); #endif -void lprint _P((const char *, ...)); +void lprint(const char *, ...); extern int do_echo; @@ -294,48 +299,47 @@ extern int do_echo; int cksum(struct mbuf *m, int len); /* if.c */ -void if_init _P((void)); -void if_output _P((struct socket *, struct mbuf *)); +void if_init(void); +void if_output(struct socket *, struct mbuf *); /* ip_input.c */ -void ip_init _P((void)); -void ip_input _P((struct mbuf *)); -static struct ip * -ip_reass(register struct ip *ip, register struct ipq *); -void ip_freef _P((struct ipq *)); -void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *)); -void ip_deq _P((register struct ipasfrag *)); -void ip_slowtimo _P((void)); -void ip_stripoptions _P((register struct mbuf *, struct mbuf *)); +void ip_init(void); +void ip_input(struct mbuf *); +struct ip * ip_reass(register struct ip *ip, register struct ipq *); +void ip_freef(struct ipq *); +void ip_enq(register struct ipasfrag *, register struct ipasfrag *); +void ip_deq(register struct ipasfrag *); +void ip_slowtimo(void); +void ip_stripoptions(register struct mbuf *, struct mbuf *); /* ip_output.c */ -int ip_output _P((struct socket *, struct mbuf *)); +int ip_output(struct socket *, struct mbuf *); /* tcp_input.c */ -int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *)); -void tcp_input _P((register struct mbuf *, int, struct socket *)); -void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *)); -void tcp_xmit_timer _P((register struct tcpcb *, int)); -int tcp_mss _P((register struct tcpcb *, u_int)); +int tcp_reass(register struct tcpcb *, register struct tcpiphdr *, struct mbuf *); +void tcp_input(register struct mbuf *, int, struct socket *); +void tcp_dooptions(struct tcpcb *, u_char *, int, struct tcpiphdr *); +void tcp_xmit_timer(register struct tcpcb *, int); +u_int tcp_mss(register struct tcpcb *, u_int); /* tcp_output.c */ -int tcp_output _P((register struct tcpcb *)); -void tcp_setpersist _P((register struct tcpcb *)); +int tcp_output(register struct tcpcb *); +void tcp_setpersist(register struct tcpcb *); /* tcp_subr.c */ -void tcp_init _P((void)); -void tcp_template _P((struct tcpcb *)); -void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int)); -struct tcpcb * tcp_newtcpcb _P((struct socket *)); -struct tcpcb * tcp_close _P((register struct tcpcb *)); -void tcp_drain _P((void)); -void tcp_sockclosed _P((struct tcpcb *)); -int tcp_fconnect _P((struct socket *)); -void tcp_connect _P((struct socket *)); -int tcp_attach _P((struct socket *)); -u_int8_t tcp_tos _P((struct socket *)); -int tcp_emu _P((struct socket *, struct mbuf *)); -int tcp_ctl _P((struct socket *)); +void tcp_init(void); +void tcp_template(struct tcpcb *); +void tcp_respond(struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int); +struct tcpcb * tcp_newtcpcb(struct socket *); +struct tcpcb * tcp_close(register struct tcpcb *); +void tcp_drain(void); +void tcp_sockclosed(struct tcpcb *); +int tcp_fconnect(struct socket *); +void tcp_connect(struct socket *); +int tcp_attach(struct socket *); +u_int8_t tcp_tos(struct socket *); +int tcp_emu(struct socket *, struct mbuf *); +int tcp_ctl(struct socket *); struct tcpcb *tcp_drop(struct tcpcb *tp, int err); #ifdef USE_PPP @@ -351,9 +355,4 @@ struct tcpcb *tcp_drop(struct tcpcb *tp, #define max(x,y) ((x) > (y) ? (x) : (y)) #endif -#ifdef _WIN32 -#undef errno -#define errno (WSAGetLastError()) -#endif - #endif