diff options
Diffstat (limited to 'winsup/cygwin/include')
-rw-r--r-- | winsup/cygwin/include/cygwin/in.h | 36 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/in6.h | 119 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/socket.h | 15 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/stdlib.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/version.h | 11 | ||||
-rw-r--r-- | winsup/cygwin/include/netdb.h | 73 | ||||
-rw-r--r-- | winsup/cygwin/include/netinet/in.h | 14 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/socket.h | 16 |
8 files changed, 253 insertions, 33 deletions
diff --git a/winsup/cygwin/include/cygwin/in.h b/winsup/cygwin/include/cygwin/in.h index a932ec6bf..619d47a30 100644 --- a/winsup/cygwin/include/cygwin/in.h +++ b/winsup/cygwin/include/cygwin/in.h @@ -28,6 +28,7 @@ typedef uint32_t in_addr_t; enum { IPPROTO_IP = 0, /* Dummy protocol for TCP */ + IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options */ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */ IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ @@ -36,12 +37,21 @@ enum IPPROTO_PUP = 12, /* PUP protocol */ IPPROTO_UDP = 17, /* User Datagram Protocol */ IPPROTO_IDP = 22, /* XNS IDP protocol */ + IPPROTO_IPV6 = 41, /* IPv6 header */ + IPPROTO_ROUTING = 43, /* IPv6 Routing header */ + IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header */ + IPPROTO_ESP = 50, /* encapsulating security payload */ + IPPROTO_AH = 51, /* authentication header */ + IPPROTO_ICMPV6 = 58, /* ICMPv6 */ + IPPROTO_NONE = 59, /* IPv6 no next header */ + IPPROTO_DSTOPTS = 60, /* IPv6 Destination options */ IPPROTO_RAW = 255, /* Raw IP packets */ IPPROTO_MAX }; /* Define IPPROTO_xxx values to accomodate SUSv3 */ #define IPPROTO_IP IPPROTO_IP +#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS #define IPPROTO_ICMP IPPROTO_ICMP #define IPPROTO_IGMP IPPROTO_IGMP #define IPPROTO_IPIP IPPROTO_IPIP @@ -51,6 +61,14 @@ enum #define IPPROTO_UDP IPPROTO_UDP #define IPPROTO_IDP IPPROTO_IDP #define IPPROTO_RAW IPPROTO_RAW +#define IPPROTO_IPV6 IPPROTO_IPV6 +#define IPPROTO_ROUTING IPPROTO_ROUTING +#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT +#define IPPROTO_ESP IPPROTO_ESP +#define IPPROTO_AH IPPROTO_AH +#define IPPROTO_ICMPV6 IPPROTO_ICMPV6 +#define IPPROTO_NONE IPPROTO_NONE +#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS /* Standard well-known ports. *//* from winsup/include/netinet/in.h */ enum @@ -185,21 +203,7 @@ struct sockaddr_in #endif -#ifdef USE_IPV6 -/* IPv6 definitions as we start to include them. This is just - a beginning dont get excited 8) */ -struct in6_addr -{ - uint8_t s6_addr[16]; -}; - -struct sockaddr_in6 -{ - sa_family_t sin6_family; /* AF_INET6 */ - in_port_t sin6_port; /* Port number. */ - uint32_t sin6_flowinfo; /* Traffic class and flow inf. */ - struct in6_addr sin6_addr; /* IPv6 address. */ - uint32_t sin6_scope_id; /* Set of interfaces for a scope. */ -}; +#ifdef AF_INET6 +#include <cygwin/in6.h> #endif #endif /* _CYGWIN_IN_H */ diff --git a/winsup/cygwin/include/cygwin/in6.h b/winsup/cygwin/include/cygwin/in6.h new file mode 100644 index 000000000..c01aefa06 --- /dev/null +++ b/winsup/cygwin/include/cygwin/in6.h @@ -0,0 +1,119 @@ +/* cygwin/in6.h + + Copyright 2006 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* NOTE: This file is NOT for direct inclusion. Use netinet/in.h. */ + +#ifndef _CYGWIN_IN6_H +#define _CYGWIN_IN6_H + +#define INET6_ADDRSTRLEN 46 + +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (((const uint32_t *)(a))[0] == ((const uint32_t *)(b))[0] \ + && ((const uint32_t *)(a))[1] == ((const uint32_t *)(b))[1] \ + && ((const uint32_t *)(a))[2] == ((const uint32_t *)(b))[2] \ + && ((const uint32_t *)(a))[3] == ((const uint32_t *)(b))[3]) + +#define IN6_IS_ADDR_UNSPECIFIED(addr) \ + (((const uint32_t *)(addr))[0] == 0 \ + && ((const uint32_t *)(addr))[1] == 0 \ + && ((const uint32_t *)(addr))[2] == 0 \ + && ((const uint32_t *)(addr))[3] == 0) + +#define IN6_IS_ADDR_LOOPBACK(addr) \ + (((const uint32_t *)(addr))[0] == 0 \ + && ((const uint32_t *)(addr))[1] == 0 \ + && ((const uint32_t *)(addr))[2] == 0 \ + && ((const uint32_t *)(addr))[3] == htonl (1)) + +#define IN6_IS_ADDR_MULTICAST(addr) (((const uint8_t *) (addr))[0] == 0xff) + +#define IN6_IS_ADDR_LINKLOCAL(addr) \ + ((((const uint16_t *)(addr))[0] & htons (0xffc0)) == htons (0xfe80)) + +#define IN6_IS_ADDR_SITELOCAL(addr) \ + ((((const uint16_t *)(addr))[0] & htons (0xffc0)) == htons (0xfec0)) + +#define IN6_IS_ADDR_V4MAPPED(addr) \ + (((const uint32_t *)(addr))[0] == 0 \ + && ((const uint32_t *)(addr))[1] == 0 \ + && ((const uint32_t *)(addr))[2] == htonl (0xffff)) + +#define IN6_IS_ADDR_V4COMPAT(addr) \ + (((const uint32_t *)(addr))[0] == 0 \ + && ((const uint32_t *)(addr))[1] == 0 \ + && ((const uint32_t *)(addr))[2] == 0 \ + && ntohl (((const uint32_t *)(addr))[3]) > 1) + +#define IN6_IS_ADDR_MC_NODELOCAL(addr) \ + (IN6_IS_ADDR_MULTICAST(addr) \ + && (((const uint8_t *)(addr))[1] & 0xf) == 0x1) + +#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \ + (IN6_IS_ADDR_MULTICAST (addr) \ + && (((const uint8_t *)(addr))[1] & 0xf) == 0x2) + +#define IN6_IS_ADDR_MC_SITELOCAL(addr) \ + (IN6_IS_ADDR_MULTICAST(addr) \ + && (((const uint8_t *)(addr))[1] & 0xf) == 0x5) + +#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \ + (IN6_IS_ADDR_MULTICAST(addr) \ + && (((const uint8_t *)(addr))[1] & 0xf) == 0x8) + +#define IN6_IS_ADDR_MC_GLOBAL(addr) \ + (IN6_IS_ADDR_MULTICAST(addr) \ + && (((const uint8_t *)(addr))[1] & 0xf) == 0xe) + +struct in6_addr +{ + union + { + uint8_t __s6_addr[16]; + uint16_t __s6_addr16[8]; + uint32_t __s6_addr32[4]; + } __u6; +#define s6_addr __u6.__s6_addr +#define s6_addr16 __u6.__s6_addr16 +#define s6_addr32 __u6.__s6_addr32 +}; + +struct ipv6_mreq +{ + struct in6_addr ipv6mr_multiaddr; + unsigned int ipv6mr_interface; +}; + +struct in6_pktinfo +{ + struct in6_addr ipi6_addr; + unsigned int ipi6_ifindex; +}; + +#ifdef __INSIDE_CYGWIN__ +typedef uint16_t in_port_t; +#endif + +struct sockaddr_in6 +{ + sa_family_t sin6_family; /* AF_INET6 */ + in_port_t sin6_port; /* Port number. */ + uint32_t sin6_flowinfo; /* Traffic class and flow inf. */ + struct in6_addr sin6_addr; /* IPv6 address. */ + uint32_t sin6_scope_id; /* Set of interfaces for a scope. */ +}; + +#define IN6ADDR_ANY_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } +#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } + +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; + +#endif /* _CYGWIN_IN6_H */ diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 11dc6595f..33aec8c63 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -152,9 +152,7 @@ struct OLD_msghdr #define AF_HYLINK 15 /* NSC Hyperchannel */ #define AF_APPLETALK 16 /* AppleTalk */ #define AF_NETBIOS 17 /* NetBios-style addresses */ -#if 0 /* Not yet */ #define AF_INET6 23 /* IP version 6 */ -#endif #define AF_MAX 32 /* @@ -180,9 +178,7 @@ struct OLD_msghdr #define PF_HYLINK AF_HYLINK #define PF_APPLETALK AF_APPLETALK #define PF_NETBIOS AF_NETBIOS -#if 0 #define PF_INET6 AF_INET6 -#endif #define PF_MAX AF_MAX @@ -236,6 +232,17 @@ struct OLD_msghdr #define IP_UNBLOCK_SOURCE 18 #define IP_PKTINFO 19 +/* IPv6 options for use with getsockopt/setsockopt */ +#define IPV6_UNICAST_HOPS 4 +#define IPV6_MULTICAST_IF 9 +#define IPV6_MULTICAST_HOPS 10 +#define IPV6_MULTICAST_LOOP 11 +#define IPV6_ADD_MEMBERSHIP 12 +#define IPV6_DROP_MEMBERSHIP 13 +#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP +#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP +#define IPV6_PKTINFO 19 + /* Old WinSock1 values, needed internally */ #ifdef __INSIDE_CYGWIN__ #define _WS1_IP_OPTIONS 1 diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h index 880051018..e034fe895 100644 --- a/winsup/cygwin/include/cygwin/stdlib.h +++ b/winsup/cygwin/include/cygwin/stdlib.h @@ -31,6 +31,8 @@ int grantpt (int); int unlockpt (int); #endif /*__STRICT_ANSI__*/ +int posix_openpt (int); + #ifdef _COMPILING_NEWLIB #define unsetenv UNUSED_unsetenv #define _unsetenv_r UNUSED__unsetenv_r diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index f00f85347..be660c61a 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -42,8 +42,8 @@ details. */ the Cygwin shared library". This version is used to track important changes to the DLL and is mainly informative in nature. */ -#define CYGWIN_VERSION_DLL_MAJOR 1005 -#define CYGWIN_VERSION_DLL_MINOR 22 +#define CYGWIN_VERSION_DLL_MAJOR 1007 +#define CYGWIN_VERSION_DLL_MINOR 0 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ @@ -289,12 +289,17 @@ details. */ 154: Export sigset, sigignore. 155: Export __isinff, __isinfd, __isnanf, __isnand. 156: Export __srbuf_r, __swget_r. + 157: Export gai_strerror, getaddrinfo, getnameinfo, freeaddrinfo, + in6addr_any, in6addr_loopback. + 158: Export bindresvport, bindresvport_sa, iruserok_sa, rcmd_af, + rresvport_af. + 159: Export posix_openpt. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 156 +#define CYGWIN_VERSION_API_MINOR 159 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h index f49a94379..74c205990 100644 --- a/winsup/cygwin/include/netdb.h +++ b/winsup/cygwin/include/netdb.h @@ -63,6 +63,9 @@ extern "C" { #endif +#include <stdint.h> +#include <cygwin/socket.h> + /* * Structures returned by network data base library. All addresses are * supplied in host order, and returned in network order (suitable for @@ -88,7 +91,7 @@ struct netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ short n_addrtype; /* net address type */ - unsigned long n_net; /* network # */ + uint32_t n_net; /* network # */ }; struct servent { @@ -111,6 +114,17 @@ struct rpcent { int r_number; /* rpc program number */ }; +struct addrinfo { + int ai_flags; /* input flags */ + int ai_family; /* address family of socket */ + int ai_socktype; /* socket type */ + int ai_protocol; /* ai_protocol */ + socklen_t ai_addrlen; /* length of socket address */ + char *ai_canonname; /* canonical name of service location */ + struct sockaddr *ai_addr; /* socket address of socket */ + struct addrinfo *ai_next; /* pointer to next in list */ +}; + /* * Error return codes from gethostbyname() and gethostbyaddr() * (left in extern int h_errno). @@ -130,6 +144,45 @@ extern __declspec(dllimport) int h_errno; #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ +#define AI_PASSIVE 1 +#define AI_CANONNAME 2 +#define AI_NUMERICHOST 4 +/* + * These are not available in the WinSock implementation. It wouldn't make + * sense to support them in the ipv4 only case, so we drop them entirely. + * We can define them if we run into problems but they are non-functional, so... + */ +#if 0 +#define AI_V4MAPPED 16 +#define AI_ALL 32 +#define AI_ADDRCONFIG 64 +#endif + +#define NI_NOFQDN 1 +#define NI_NUMERICHOST 2 +#define NI_NAMEREQD 4 +#define NI_NUMERICSERV 8 +#define NI_DGRAM 16 + +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +#define EAI_ADDRFAMILY 1 +#define EAI_AGAIN 2 +#define EAI_BADFLAGS 3 +#define EAI_FAIL 4 +#define EAI_FAMILY 5 +#define EAI_MEMORY 6 +#define EAI_NODATA 7 +#define EAI_NONAME 8 +#define EAI_SERVICE 9 +#define EAI_SOCKTYPE 10 +#define EAI_SYSTEM 11 +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 + +#define EAI_MAX 14 + #ifndef __INSIDE_CYGWIN_NET__ void endhostent (void); void endnetent (void); @@ -158,6 +211,24 @@ void setnetent (int); void setprotoent (int); void setservent (int); void setrpcent (int); +void freeaddrinfo (struct addrinfo *); +const char *gai_strerror (int); +int getaddrinfo (const char *, const char *, + const struct addrinfo *, struct addrinfo **); +int getnameinfo (const struct sockaddr *, socklen_t, char *, + socklen_t, char *, socklen_t, int); + +int rcmd (char **, uint16_t, const char *, const char *, + const char *, int *); +int rcmd_af (char **, uint16_t, const char *, const char *, + const char *, int *, int); +int rexec (char **, uint16_t rport, char *, char *, char *, int *); +int rresvport (int *); +int rresvport_af (int *, int); +int iruserok (unsigned long, int, const char *, const char *); +int iruserok_sa (const void *, int, int, const char *, + const char *); +int ruserok (const char *, int, const char *, const char *); #endif #ifdef __cplusplus diff --git a/winsup/cygwin/include/netinet/in.h b/winsup/cygwin/include/netinet/in.h index 7081282a7..027ac2cd1 100644 --- a/winsup/cygwin/include/netinet/in.h +++ b/winsup/cygwin/include/netinet/in.h @@ -1,6 +1,6 @@ /* netinet/in.h - Copyright 1998, 2001 Red Hat, Inc. + Copyright 1998, 2001, 2006 Red Hat, Inc. This file is part of Cygwin. @@ -13,4 +13,16 @@ details. */ #include <cygwin/in.h> +#ifdef __cplusplus +extern "C" +{ +#endif + +extern int bindresvport (int, struct sockaddr_in *); +extern int bindresvport_sa (int, struct sockaddr *); + +#ifdef __cplusplus +}; +#endif + #endif /* _NETINET_IN_H */ diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h index bcd8eeb1b..d4b1227ba 100644 --- a/winsup/cygwin/include/sys/socket.h +++ b/winsup/cygwin/include/sys/socket.h @@ -32,14 +32,14 @@ extern "C" int getpeername (int, struct sockaddr *__peer, socklen_t *); int getsockname (int, struct sockaddr *__addr, socklen_t *); int listen (int, int __n); - int recv (int, void *__buff, size_t __len, int __flags); - int recvfrom (int, void *__buff, size_t __len, int __flags, - struct sockaddr *__from, socklen_t *__fromlen); - int recvmsg(int s, struct msghdr *msg, int flags); - int send (int, const void *__buff, size_t __len, int __flags); - int sendmsg(int s, const struct msghdr *msg, int flags); - int sendto (int, const void *, size_t __len, int __flags, - const struct sockaddr *__to, socklen_t __tolen); + ssize_t recv (int, void *__buff, size_t __len, int __flags); + ssize_t recvfrom (int, void *__buff, size_t __len, int __flags, + struct sockaddr *__from, socklen_t *__fromlen); + ssize_t recvmsg(int s, struct msghdr *msg, int flags); + ssize_t send (int, const void *__buff, size_t __len, int __flags); + ssize_t sendmsg(int s, const struct msghdr *msg, int flags); + ssize_t sendto (int, const void *, size_t __len, int __flags, + const struct sockaddr *__to, socklen_t __tolen); int setsockopt (int __s, int __level, int __optname, const void *optval, socklen_t __optlen); int getsockopt (int __s, int __level, int __optname, void *__optval, |