ReactOS 0.4.15-dev-5666-gc548b97
ws2tcpip.h File Reference
#include <winsock2.h>
#include <ws2ipdef.h>
#include <limits.h>
#include <wspiapi.h>
Include dependency graph for ws2tcpip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _WS2TCPIP_H
 
#define UDP_NOCHECKSUM   1
 
#define UDP_CHECKSUM_COVERAGE   20
 
#define WS2TCPIP_INLINE   static inline
 
#define EAI_AGAIN   WSATRY_AGAIN
 
#define EAI_BADFLAGS   WSAEINVAL
 
#define EAI_FAIL   WSANO_RECOVERY
 
#define EAI_FAMILY   WSAEAFNOSUPPORT
 
#define EAI_MEMORY   WSA_NOT_ENOUGH_MEMORY
 
#define EAI_NODATA   EAI_NONAME
 
#define EAI_NOSECURENAME   WSA_SECURE_HOST_NOT_FOUND
 
#define EAI_NONAME   WSAHOST_NOT_FOUND
 
#define EAI_SERVICE   WSATYPE_NOT_FOUND
 
#define EAI_SOCKTYPE   WSAESOCKTNOSUPPORT
 
#define EAI_IPSECPOLICY   WSA_IPSEC_NAME_POLICY_ERROR
 
#define GetAddrInfoA   getaddrinfo
 
#define GetAddrInfo   GetAddrInfoA
 
#define FreeAddrInfoA   freeaddrinfo
 
#define FreeAddrInfo   FreeAddrInfoA
 
#define GetNameInfoA   getnameinfo
 
#define GetNameInfo   GetNameInfoA
 
#define InetPtonA   inet_pton
 
#define InetNtopA   inet_ntop
 
#define InetPton   InetPtonA
 
#define InetNtop   InetNtopA
 

Typedefs

typedef ADDRINFOA ADDRINFOT
 
typedef ADDRINFOAPADDRINFOT
 
typedef ADDRINFOA ADDRINFO
 
typedef ADDRINFOA FARLPADDRINFO
 
typedef int socklen_t
 

Functions

WINSOCK_API_LINKAGE INT WSAAPI getaddrinfo (_In_opt_ PCSTR pNodeName, _In_opt_ PCSTR pServiceName, _In_opt_ const ADDRINFOA *pHints, _Outptr_ PADDRINFOA *ppResult)
 
WINSOCK_API_LINKAGE INT WSAAPI GetAddrInfoW (_In_opt_ PCWSTR pNodeName, _In_opt_ PCWSTR pServiceName, _In_opt_ const ADDRINFOW *pHints, _Outptr_ PADDRINFOW *ppResult)
 
WINSOCK_API_LINKAGE VOID WSAAPI freeaddrinfo (_In_opt_ PADDRINFOA pAddrInfo)
 
WINSOCK_API_LINKAGE VOID WSAAPI FreeAddrInfoW (_In_opt_ PADDRINFOW pAddrInfo)
 
WINSOCK_API_LINKAGE INT WSAAPI getnameinfo (_In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr, _In_ socklen_t SockaddrLength, _Out_writes_opt_(NodeBufferSize) PCHAR pNodeBuffer, _In_ DWORD NodeBufferSize, _Out_writes_opt_(ServiceBufferSize) PCHAR pServiceBuffer, _In_ DWORD ServiceBufferSize, _In_ INT Flags)
 
WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW (_In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr, _In_ socklen_t SockaddrLength, _Out_writes_opt_(NodeBufferSize) PWCHAR pNodeBuffer, _In_ DWORD NodeBufferSize, _Out_writes_opt_(ServiceBufferSize) PWCHAR pServiceBuffer, _In_ DWORD ServiceBufferSize, _In_ INT Flags)
 
WINSOCK_API_LINKAGE INT WSAAPI inet_pton (_In_ INT Family, _In_ PCSTR pszAddrString, _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf)
 
INT WSAAPI InetPtonW (_In_ INT Family, _In_ PCWSTR pszAddrString, _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf)
 
PCSTR WSAAPI inet_ntop (_In_ INT Family, _In_ PVOID pAddr, _Out_writes_(StringBufSize) PSTR pStringBuf, _In_ size_t StringBufSize)
 
PCWSTR WSAAPI InetNtopW (_In_ INT Family, _In_ PVOID pAddr, _Out_writes_(StringBufSize) PWSTR pStringBuf, _In_ size_t StringBufSize)
 
WS2TCPIP_INLINE int setipv4sourcefilter (_In_ SOCKET Socket, _In_ IN_ADDR Interface, _In_ IN_ADDR Group, _In_ MULTICAST_MODE_TYPE FilterMode, _In_ ULONG SourceCount, _In_reads_(SourceCount) CONST IN_ADDR *SourceList)
 
 _Success_ (return==0) WS2TCPIP_INLINE int getipv4sourcefilter(_In_ SOCKET Socket
 
ifSourceCount (((ULONG)(ULONG_MAX - sizeof(*Filter)))/sizeof(*SourceList))
 
 if (Filter==NULL)
 
 if (Error==0)
 
 HeapFree (GetProcessHeap(), 0, Filter)
 
WS2TCPIP_INLINE int setsourcefilter (_In_ SOCKET Socket, _In_ ULONG Interface, _In_ CONST SOCKADDR *Group, _In_ int GroupLength, _In_ MULTICAST_MODE_TYPE FilterMode, _In_ ULONG SourceCount, _In_reads_(SourceCount) CONST SOCKADDR_STORAGE *SourceList)
 
ZeroMemoryFilter (Filter->gf_group)
 

Variables

_In_ IN_ADDR Interface
 
_In_ IN_ADDR _In_ IN_ADDR Group
 
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPEFilterMode
 
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONGSourceCount
 
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDRSourceList
 
DWORD Size = IP_MSFILTER_SIZE(*SourceCount)
 
DWORD Returned
 
PIP_MSFILTER Filter = (PIP_MSFILTER) HeapAlloc(GetProcessHeap(), 0, Size)
 
Filter imsf_multiaddr = Group
 
Filter imsf_interface = Interface
 
Filter imsf_numsrc = *SourceCount
 
 Error
 
_In_ ULONG _In_ CONST SOCKADDR _In_ int GroupLength
 
Filter gf_interface = Interface
 
Filter gf_numsrc = *SourceCount
 

Macro Definition Documentation

◆ _WS2TCPIP_H

#define _WS2TCPIP_H

Definition at line 11 of file ws2tcpip.h.

◆ EAI_AGAIN

#define EAI_AGAIN   WSATRY_AGAIN

Definition at line 31 of file ws2tcpip.h.

◆ EAI_BADFLAGS

#define EAI_BADFLAGS   WSAEINVAL

Definition at line 32 of file ws2tcpip.h.

◆ EAI_FAIL

#define EAI_FAIL   WSANO_RECOVERY

Definition at line 33 of file ws2tcpip.h.

◆ EAI_FAMILY

#define EAI_FAMILY   WSAEAFNOSUPPORT

Definition at line 34 of file ws2tcpip.h.

◆ EAI_IPSECPOLICY

#define EAI_IPSECPOLICY   WSA_IPSEC_NAME_POLICY_ERROR

Definition at line 41 of file ws2tcpip.h.

◆ EAI_MEMORY

#define EAI_MEMORY   WSA_NOT_ENOUGH_MEMORY

Definition at line 35 of file ws2tcpip.h.

◆ EAI_NODATA

#define EAI_NODATA   EAI_NONAME

Definition at line 36 of file ws2tcpip.h.

◆ EAI_NONAME

#define EAI_NONAME   WSAHOST_NOT_FOUND

Definition at line 38 of file ws2tcpip.h.

◆ EAI_NOSECURENAME

#define EAI_NOSECURENAME   WSA_SECURE_HOST_NOT_FOUND

Definition at line 37 of file ws2tcpip.h.

◆ EAI_SERVICE

#define EAI_SERVICE   WSATYPE_NOT_FOUND

Definition at line 39 of file ws2tcpip.h.

◆ EAI_SOCKTYPE

#define EAI_SOCKTYPE   WSAESOCKTNOSUPPORT

Definition at line 40 of file ws2tcpip.h.

◆ FreeAddrInfo

#define FreeAddrInfo   FreeAddrInfoA

Definition at line 300 of file ws2tcpip.h.

◆ FreeAddrInfoA

#define FreeAddrInfoA   freeaddrinfo

Definition at line 295 of file ws2tcpip.h.

◆ GetAddrInfo

#define GetAddrInfo   GetAddrInfoA

Definition at line 86 of file ws2tcpip.h.

◆ GetAddrInfoA

#define GetAddrInfoA   getaddrinfo

Definition at line 81 of file ws2tcpip.h.

◆ GetNameInfo

#define GetNameInfo   GetNameInfoA

Definition at line 397 of file ws2tcpip.h.

◆ GetNameInfoA

#define GetNameInfoA   getnameinfo

Definition at line 392 of file ws2tcpip.h.

◆ InetNtop

#define InetNtop   InetNtopA

Definition at line 474 of file ws2tcpip.h.

◆ InetNtopA

#define InetNtopA   inet_ntop

Definition at line 467 of file ws2tcpip.h.

◆ InetPton

#define InetPton   InetPtonA

Definition at line 473 of file ws2tcpip.h.

◆ InetPtonA

#define InetPtonA   inet_pton

Definition at line 466 of file ws2tcpip.h.

◆ UDP_CHECKSUM_COVERAGE

#define UDP_CHECKSUM_COVERAGE   20

Definition at line 22 of file ws2tcpip.h.

◆ UDP_NOCHECKSUM

#define UDP_NOCHECKSUM   1

Definition at line 21 of file ws2tcpip.h.

◆ WS2TCPIP_INLINE

#define WS2TCPIP_INLINE   static inline

Definition at line 27 of file ws2tcpip.h.

Typedef Documentation

◆ ADDRINFO

Definition at line 49 of file ws2tcpip.h.

◆ ADDRINFOT

Definition at line 46 of file ws2tcpip.h.

◆ LPADDRINFO

Definition at line 49 of file ws2tcpip.h.

◆ PADDRINFOT

typedef ADDRINFOA * PADDRINFOT

Definition at line 46 of file ws2tcpip.h.

◆ socklen_t

typedef int socklen_t

Definition at line 364 of file ws2tcpip.h.

Function Documentation

◆ _Success_()

_Success_ ( return  = = 0)

◆ Filter()

ZeroMemory & Filter ( Filter->  gf_group)

◆ freeaddrinfo()

WINSOCK_API_LINKAGE VOID WSAAPI freeaddrinfo ( _In_opt_ PADDRINFOA  pAddrInfo)

◆ FreeAddrInfoW()

WINSOCK_API_LINKAGE VOID WSAAPI FreeAddrInfoW ( _In_opt_ PADDRINFOW  pAddrInfo)

◆ getaddrinfo()

WINSOCK_API_LINKAGE INT WSAAPI getaddrinfo ( _In_opt_ PCSTR  pNodeName,
_In_opt_ PCSTR  pServiceName,
_In_opt_ const ADDRINFOA pHints,
_Outptr_ PADDRINFOA ppResult 
)

◆ GetAddrInfoW()

WINSOCK_API_LINKAGE INT WSAAPI GetAddrInfoW ( _In_opt_ PCWSTR  pNodeName,
_In_opt_ PCWSTR  pServiceName,
_In_opt_ const ADDRINFOW pHints,
_Outptr_ PADDRINFOW ppResult 
)

◆ getnameinfo()

WINSOCK_API_LINKAGE INT WSAAPI getnameinfo ( _In_reads_bytes_(SockaddrLength) const SOCKADDR pSockaddr,
_In_ socklen_t  SockaddrLength,
_Out_writes_opt_(NodeBufferSize) PCHAR  pNodeBuffer,
_In_ DWORD  NodeBufferSize,
_Out_writes_opt_(ServiceBufferSize) PCHAR  pServiceBuffer,
_In_ DWORD  ServiceBufferSize,
_In_ INT  Flags 
)

◆ GetNameInfoW()

WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW ( _In_reads_bytes_(SockaddrLength) const SOCKADDR pSockaddr,
_In_ socklen_t  SockaddrLength,
_Out_writes_opt_(NodeBufferSize) PWCHAR  pNodeBuffer,
_In_ DWORD  NodeBufferSize,
_Out_writes_opt_(ServiceBufferSize) PWCHAR  pServiceBuffer,
_In_ DWORD  ServiceBufferSize,
_In_ INT  Flags 
)

◆ HeapFree()

HeapFree ( GetProcessHeap()  ,
,
Filter   
)

◆ if() [1/2]

if ( Error  = = 0)

Definition at line 647 of file ws2tcpip.h.

647 {
648 if (*SourceCount > 0) {
650 *SourceCount * sizeof(*SourceList));
652 }
654 }
ULONG imsf_numsrc
Definition: ws2ipdef.h:541
MULTICAST_MODE_TYPE imsf_fmode
Definition: ws2ipdef.h:540
IN_ADDR imsf_slist[1]
Definition: ws2ipdef.h:542
#define CopyMemory
Definition: winbase.h:1668
PIP_MSFILTER Filter
Definition: ws2tcpip.h:625
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE * FilterMode
Definition: ws2tcpip.h:619
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
Definition: ws2tcpip.h:622
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG * SourceCount
Definition: ws2tcpip.h:620

◆ if() [2/2]

if ( Filter  = NULL)

Definition at line 635 of file ws2tcpip.h.

635 {
637 return SOCKET_ERROR;
638 }
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
#define WSAENOBUFS
Definition: winerror.h:1968
#define SOCKET_ERROR
Definition: winsock.h:333

◆ inet_ntop()

PCSTR WSAAPI inet_ntop ( _In_ INT  Family,
_In_ PVOID  pAddr,
_Out_writes_(StringBufSize) PSTR  pStringBuf,
_In_ size_t  StringBufSize 
)

Definition at line 54 of file inet_ntop.c.

59{
60
61 switch (af) {
62 case AF_INET:
63 return (inet_ntop4(src, dst, size));
64#ifdef INET6
65 case AF_INET6:
66 return (inet_ntop6(src, dst, size));
67#endif
68 default:
70 return (NULL);
71 }
72 /* NOTREACHED */
73}
#define NULL
Definition: types.h:112
#define AF_INET
Definition: tcpip.h:117
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define WSAEAFNOSUPPORT
Definition: winerror.h:1960
static const char * inet_ntop4(const u_char *src, char *dst, socklen_t size)
Definition: inet_ntop.c:87
#define AF_INET6
Definition: winsock.h:369

◆ inet_pton()

WINSOCK_API_LINKAGE INT WSAAPI inet_pton ( _In_ INT  Family,
_In_ PCSTR  pszAddrString,
_Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID  pAddrBuf 
)

Referenced by __rpc_uaddr2taddr_af().

◆ InetNtopW()

PCWSTR WSAAPI InetNtopW ( _In_ INT  Family,
_In_ PVOID  pAddr,
_Out_writes_(StringBufSize) PWSTR  pStringBuf,
_In_ size_t  StringBufSize 
)

◆ InetPtonW()

INT WSAAPI InetPtonW ( _In_ INT  Family,
_In_ PCWSTR  pszAddrString,
_Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID  pAddrBuf 
)

◆ setipv4sourcefilter()

WS2TCPIP_INLINE int setipv4sourcefilter ( _In_ SOCKET  Socket,
_In_ IN_ADDR  Interface,
_In_ IN_ADDR  Group,
_In_ MULTICAST_MODE_TYPE  FilterMode,
_In_ ULONG  SourceCount,
_In_reads_(SourceCount) CONST IN_ADDR SourceList 
)

Definition at line 570 of file ws2tcpip.h.

577{
578 int Error;
581
582 if (SourceCount >
583 (((ULONG) (ULONG_MAX - sizeof(*Filter))) / sizeof(*SourceList))) {
585 return SOCKET_ERROR;
586 }
587
590 if (Filter == NULL) {
592 return SOCKET_ERROR;
593 }
594
599 if (SourceCount > 0) {
601 SourceCount * sizeof(*SourceList));
602 }
603
605 &Returned, NULL, NULL);
606
608
609 return Error;
610}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
INT WSAAPI WSAIoctl(IN SOCKET s, IN DWORD dwIoControlCode, IN LPVOID lpvInBuffer, IN DWORD cbInBuffer, OUT LPVOID lpvOutBuffer, IN DWORD cbOutBuffer, OUT LPDWORD lpcbBytesReturned, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
Definition: ioctl.c:46
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ULONG_MAX
Definition: limits.h:44
unsigned int ULONG
Definition: retypes.h:1
IN_ADDR imsf_multiaddr
Definition: ws2ipdef.h:538
IN_ADDR imsf_interface
Definition: ws2ipdef.h:539
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define SIOCSIPMSFILTER
Definition: ws2ipdef.h:66
struct ip_msfilter * PIP_MSFILTER
#define IP_MSFILTER_SIZE(NumSources)
Definition: ws2ipdef.h:88
DWORD Size
Definition: ws2tcpip.h:624
Error
Definition: ws2tcpip.h:644
_In_ IN_ADDR Interface
Definition: ws2tcpip.h:617
DWORD Returned
Definition: ws2tcpip.h:624
_In_ IN_ADDR _In_ IN_ADDR Group
Definition: ws2tcpip.h:618

◆ setsourcefilter()

WS2TCPIP_INLINE int setsourcefilter ( _In_ SOCKET  Socket,
_In_ ULONG  Interface,
_In_ CONST SOCKADDR Group,
_In_ int  GroupLength,
_In_ MULTICAST_MODE_TYPE  FilterMode,
_In_ ULONG  SourceCount,
_In_reads_(SourceCount) CONST SOCKADDR_STORAGE *  SourceList 
)

Definition at line 665 of file ws2tcpip.h.

673{
674 int Error;
677
678 if (SourceCount >= (((ULONG) (ULONG_MAX - sizeof(*Filter))) / sizeof(*SourceList))) {
680 return SOCKET_ERROR;
681 }
682
685 if (Filter == NULL) {
687 return SOCKET_ERROR;
688 }
689
690 Filter->gf_interface = Interface;
691 ZeroMemory(&Filter->gf_group, sizeof(Filter->gf_group));
692 CopyMemory(&Filter->gf_group, Group, GroupLength);
693 Filter->gf_fmode = FilterMode;
694 Filter->gf_numsrc = SourceCount;
695 if (SourceCount > 0) {
696 CopyMemory(Filter->gf_slist, SourceList, SourceCount * sizeof(*SourceList));
697 }
698
701
702 return Error;
703}
#define ZeroMemory
Definition: winbase.h:1670
struct group_filter * PGROUP_FILTER
#define SIOCSMSFILTER
Definition: ws2ipdef.h:69
#define GROUP_FILTER_SIZE(numsrc)
Definition: ws2ipdef.h:571
_In_ ULONG _In_ CONST SOCKADDR _In_ int GroupLength
Definition: ws2tcpip.h:712

◆ SourceCount()

if * SourceCount ( ((ULONG)(ULONG_MAX - sizeof(*Filter)))/sizeof SourceList)

Definition at line 627 of file ws2tcpip.h.

628 {
630 return SOCKET_ERROR;
631 }

Variable Documentation

◆ Error

return Error
Initial value:
#define SIOCGIPMSFILTER
Definition: ws2ipdef.h:67

Definition at line 644 of file ws2tcpip.h.

Referenced by setipv4sourcefilter(), and setsourcefilter().

◆ Filter

Definition at line 625 of file ws2tcpip.h.

Referenced by if(), setipv4sourcefilter(), and setsourcefilter().

◆ FilterMode

Definition at line 619 of file ws2tcpip.h.

Referenced by if(), setipv4sourcefilter(), and setsourcefilter().

◆ gf_interface

Filter gf_interface = Interface

Definition at line 733 of file ws2tcpip.h.

◆ gf_numsrc

Filter gf_numsrc = *SourceCount

Definition at line 736 of file ws2tcpip.h.

◆ Group

Definition at line 618 of file ws2tcpip.h.

Referenced by setipv4sourcefilter(), and setsourcefilter().

◆ GroupLength

◆ imsf_interface

Filter imsf_interface = Interface

Definition at line 641 of file ws2tcpip.h.

◆ imsf_multiaddr

Filter imsf_multiaddr = Group

Definition at line 640 of file ws2tcpip.h.

◆ imsf_numsrc

Filter imsf_numsrc = *SourceCount

Definition at line 642 of file ws2tcpip.h.

◆ Interface

Definition at line 617 of file ws2tcpip.h.

Referenced by setipv4sourcefilter(), and setsourcefilter().

◆ Returned

DWORD Returned

Definition at line 624 of file ws2tcpip.h.

Referenced by setipv4sourcefilter(), and setsourcefilter().

◆ Size

Definition at line 624 of file ws2tcpip.h.

Referenced by setipv4sourcefilter(), and setsourcefilter().

◆ SourceCount

if * SourceCount

Definition at line 620 of file ws2tcpip.h.

Referenced by if(), setipv4sourcefilter(), and setsourcefilter().

◆ SourceList