include: Move some declarations in ws2tcpip.h to where they belong in new ws2ipdef.h header.

This commit is contained in:
Rob Shearman 2009-03-31 13:37:49 +01:00 committed by Alexandre Julliard
parent 2ef9411434
commit 76fdd19476
3 changed files with 153 additions and 114 deletions

View File

@ -473,6 +473,7 @@ SRCDIR_INCLUDES = \
wmistr.h \
wnaspi32.h \
wownt32.h \
ws2ipdef.h \
ws2spi.h \
ws2tcpip.h \
wshisotp.h \

151
include/ws2ipdef.h Normal file
View File

@ -0,0 +1,151 @@
/*
* Copyright (C) 2009 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WS2IPDEF__
#define __WS2IPDEF__
/* FIXME: #include <in6addr.h> */
#ifdef USE_WS_PREFIX
#define WS(x) WS_##x
#else
#define WS(x) x
#endif
/* FIXME: This gets defined by some Unix (Linux) header and messes things */
#undef s6_addr
/* FIXME: should be in in6addr.h */
typedef struct WS(in_addr6)
{
WS(u_char) s6_addr[16]; /* IPv6 address */
} IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
typedef struct WS(sockaddr_in6_old)
{
short sin6_family; /* AF_INET6 */
WS(u_short) sin6_port; /* Transport level port number */
WS(u_long) sin6_flowinfo; /* IPv6 flow information */
struct WS(in_addr6) sin6_addr; /* IPv6 address */
} SOCKADDR_IN6_OLD,*PSOCKADDR_IN6_OLD, *LPSOCKADDR_IN6_OLD;
typedef union sockaddr_gen
{
struct WS(sockaddr) Address;
struct WS(sockaddr_in) AddressIn;
struct WS(sockaddr_in6_old) AddressIn6;
} WS(sockaddr_gen);
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
WS(u_long) iiFlags; /* Interface flags */
WS(sockaddr_gen) iiAddress; /* Interface address */
WS(sockaddr_gen) iiBroadcastAddress; /* Broadcast address */
WS(sockaddr_gen) iiNetmask; /* Network mask */
} INTERFACE_INFO, * LPINTERFACE_INFO;
/* Possible flags for the iiFlags - bitmask */
#ifndef USE_WS_PREFIX
#define IFF_UP 0x00000001 /* Interface is up */
#define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define IFF_MULTICAST 0x00000010 /* multicast is supported */
#else
#define WS_IFF_UP 0x00000001 /* Interface is up */
#define WS_IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define WS_IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define WS_IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define WS_IFF_MULTICAST 0x00000010 /* multicast is supported */
#endif /* USE_WS_PREFIX */
#ifndef USE_WS_PREFIX
#define IP_OPTIONS 1
#define IP_HDRINCL 2
#define IP_TOS 3
#define IP_TTL 4
#define IP_MULTICAST_IF 9
#define IP_MULTICAST_TTL 10
#define IP_MULTICAST_LOOP 11
#define IP_ADD_MEMBERSHIP 12
#define IP_DROP_MEMBERSHIP 13
#define IP_DONTFRAGMENT 14
#define IP_ADD_SOURCE_MEMBERSHIP 15
#define IP_DROP_SOURCE_MEMBERSHIP 16
#define IP_BLOCK_SOURCE 17
#define IP_UNBLOCK_SOURCE 18
#define IP_PKTINFO 19
#define IP_RECEIVE_BROADCAST 22
#else
#define WS_IP_OPTIONS 1
#define WS_IP_HDRINCL 2
#define WS_IP_TOS 3
#define WS_IP_TTL 4
#define WS_IP_MULTICAST_IF 9
#define WS_IP_MULTICAST_TTL 10
#define WS_IP_MULTICAST_LOOP 11
#define WS_IP_ADD_MEMBERSHIP 12
#define WS_IP_DROP_MEMBERSHIP 13
#define WS_IP_DONTFRAGMENT 14
#define WS_IP_ADD_SOURCE_MEMBERSHIP 15
#define WS_IP_DROP_SOURCE_MEMBERSHIP 16
#define WS_IP_BLOCK_SOURCE 17
#define WS_IP_UNBLOCK_SOURCE 18
#define WS_IP_PKTINFO 19
#define WS_IP_RECEIVE_BROADCAST 22
#endif /* USE_WS_PREFIX */
typedef struct WS(sockaddr_in6)
{
short sin6_family; /* AF_INET6 */
WS(u_short) sin6_port; /* Transport level port number */
WS(u_long) sin6_flowinfo; /* IPv6 flow information */
struct WS(in_addr6) sin6_addr; /* IPv6 address */
WS(u_long) sin6_scope_id; /* IPv6 scope id */
} SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
/*
* Multicast group information
*/
struct WS(ip_mreq)
{
struct WS(in_addr) imr_multiaddr;
struct WS(in_addr) imr_interface;
} WS(IP_MREQ), *WS(PIP_MREQ);
struct WS(ip_mreq_source) {
struct WS(in_addr) imr_multiaddr;
struct WS(in_addr) imr_sourceaddr;
struct WS(in_addr) imr_interface;
} WS(IP_MREQ_SOURCE), *WS(PIP_MREQ_SOURCE);
struct WS(ip_msfilter) {
struct WS(in_addr) imsf_multiaddr;
struct WS(in_addr) imsf_interface;
WS(u_long) imsf_fmode;
WS(u_long) imsf_numsrc;
struct WS(in_addr) imsf_slist[1];
} WS(IP_MSFILTER), *WS(PIP_MSFILTER);
#ifdef __cplusplus
}
#endif
#endif /* __WS2IPDEF__ */

View File

@ -20,7 +20,7 @@
#define __WS2TCPIP__
#include <winsock2.h>
/* FIXME: #include <ws2ipdef.h> */
#include <ws2ipdef.h>
#include <limits.h>
#ifdef USE_WS_PREFIX
@ -61,119 +61,6 @@ typedef int WS(socklen_t);
typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
/*
* Multicast group information
*/
struct WS(ip_mreq)
{
struct WS(in_addr) imr_multiaddr;
struct WS(in_addr) imr_interface;
};
struct WS(ip_mreq_source) {
struct WS(in_addr) imr_multiaddr;
struct WS(in_addr) imr_sourceaddr;
struct WS(in_addr) imr_interface;
};
struct WS(ip_msfilter) {
struct WS(in_addr) imsf_multiaddr;
struct WS(in_addr) imsf_interface;
WS(u_long) imsf_fmode;
WS(u_long) imsf_numsrc;
struct WS(in_addr) imsf_slist[1];
};
typedef struct WS(in_addr6)
{
WS(u_char) s6_addr[16]; /* IPv6 address */
} IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
typedef struct WS(sockaddr_in6)
{
short sin6_family; /* AF_INET6 */
WS(u_short) sin6_port; /* Transport level port number */
WS(u_long) sin6_flowinfo; /* IPv6 flow information */
struct WS(in_addr6) sin6_addr; /* IPv6 address */
WS(u_long) sin6_scope_id; /* IPv6 scope id */
} SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
typedef struct WS(sockaddr_in6_old)
{
short sin6_family; /* AF_INET6 */
WS(u_short) sin6_port; /* Transport level port number */
WS(u_long) sin6_flowinfo; /* IPv6 flow information */
struct WS(in_addr6) sin6_addr; /* IPv6 address */
} SOCKADDR_IN6_OLD,*PSOCKADDR_IN6_OLD, *LPSOCKADDR_IN6_OLD;
typedef union sockaddr_gen
{
struct WS(sockaddr) Address;
struct WS(sockaddr_in) AddressIn;
struct WS(sockaddr_in6_old) AddressIn6;
} WS(sockaddr_gen);
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
WS(u_long) iiFlags; /* Interface flags */
WS(sockaddr_gen) iiAddress; /* Interface address */
WS(sockaddr_gen) iiBroadcastAddress; /* Broadcast address */
WS(sockaddr_gen) iiNetmask; /* Network mask */
} INTERFACE_INFO, * LPINTERFACE_INFO;
/* Possible flags for the iiFlags - bitmask */
#ifndef USE_WS_PREFIX
#define IFF_UP 0x00000001 /* Interface is up */
#define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define IFF_MULTICAST 0x00000010 /* multicast is supported */
#else
#define WS_IFF_UP 0x00000001 /* Interface is up */
#define WS_IFF_BROADCAST 0x00000002 /* Broadcast is supported */
#define WS_IFF_LOOPBACK 0x00000004 /* this is loopback interface */
#define WS_IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
#define WS_IFF_MULTICAST 0x00000010 /* multicast is supported */
#endif /* USE_WS_PREFIX */
#ifndef USE_WS_PREFIX
#define IP_OPTIONS 1
#define IP_HDRINCL 2
#define IP_TOS 3
#define IP_TTL 4
#define IP_MULTICAST_IF 9
#define IP_MULTICAST_TTL 10
#define IP_MULTICAST_LOOP 11
#define IP_ADD_MEMBERSHIP 12
#define IP_DROP_MEMBERSHIP 13
#define IP_DONTFRAGMENT 14
#define IP_ADD_SOURCE_MEMBERSHIP 15
#define IP_DROP_SOURCE_MEMBERSHIP 16
#define IP_BLOCK_SOURCE 17
#define IP_UNBLOCK_SOURCE 18
#define IP_PKTINFO 19
#define IP_RECEIVE_BROADCAST 22
#else
#define WS_IP_OPTIONS 1
#define WS_IP_HDRINCL 2
#define WS_IP_TOS 3
#define WS_IP_TTL 4
#define WS_IP_MULTICAST_IF 9
#define WS_IP_MULTICAST_TTL 10
#define WS_IP_MULTICAST_LOOP 11
#define WS_IP_ADD_MEMBERSHIP 12
#define WS_IP_DROP_MEMBERSHIP 13
#define WS_IP_DONTFRAGMENT 14
#define WS_IP_ADD_SOURCE_MEMBERSHIP 15
#define WS_IP_DROP_SOURCE_MEMBERSHIP 16
#define WS_IP_BLOCK_SOURCE 17
#define WS_IP_UNBLOCK_SOURCE 18
#define WS_IP_PKTINFO 19
#define WS_IP_RECEIVE_BROADCAST 22
#endif /* USE_WS_PREFIX */
/* Possible Windows flags for getaddrinfo() */
#ifndef USE_WS_PREFIX
# define AI_PASSIVE 0x0001