ReactOS  0.4.12-dev-945-g5a2911d
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
 
#define gai_strerror   gai_strerrorA
 
#define GAI_STRERROR_BUFFER_SIZE   1024
 

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)
 
static __inline chargai_strerrorA (_In_ int ecode)
 
static __inline WCHARgai_strerrorW (_In_ int ecode)
 
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)
 
WS2TCPIP_INLINE int idealsendbacklogquery (_In_ SOCKET s, _Out_ ULONG *pISB)
 
WS2TCPIP_INLINE int idealsendbacklognotify (_In_ SOCKET s, _In_opt_ LPWSAOVERLAPPED lpOverlapped, _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 

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.

◆ gai_strerror

#define gai_strerror   gai_strerrorA

Definition at line 521 of file ws2tcpip.h.

◆ GAI_STRERROR_BUFFER_SIZE

#define GAI_STRERROR_BUFFER_SIZE   1024

Definition at line 524 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)

Referenced by GetAddress(), RunTraceRoute(), and wmain().

◆ gai_strerrorA()

static __inline char* gai_strerrorA ( _In_ int  ecode)
static

Definition at line 528 of file ws2tcpip.h.

530 {
531  static char buff[GAI_STRERROR_BUFFER_SIZE + 1];
532 
536  NULL,
537  ecode,
539  (LPSTR)buff,
541  NULL);
542 
543  return buff;
544 }
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
Definition: winbase.h:406
#define LANG_NEUTRAL
Definition: nls.h:22
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
#define SUBLANG_DEFAULT
Definition: nls.h:168
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
#define GAI_STRERROR_BUFFER_SIZE
Definition: ws2tcpip.h:524
#define MAKELANGID(p, s)
Definition: nls.h:15
static unsigned char buff[32768]
Definition: fatten.c:17

◆ gai_strerrorW()

static __inline WCHAR* gai_strerrorW ( _In_ int  ecode)
static

Definition at line 548 of file ws2tcpip.h.

550 {
551  static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
552 
556  NULL,
557  ecode,
559  (LPWSTR)buff,
561  NULL);
562 
563  return buff;
564 }
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
Definition: winbase.h:406
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
smooth NULL
Definition: ftsmooth.c:416
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
#define GAI_STRERROR_BUFFER_SIZE
Definition: ws2tcpip.h:524
#define MAKELANGID(p, s)
Definition: nls.h:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static unsigned char buff[32768]
Definition: fatten.c:17

◆ 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   
)

◆ idealsendbacklognotify()

WS2TCPIP_INLINE int idealsendbacklognotify ( _In_ SOCKET  s,
_In_opt_ LPWSAOVERLAPPED  lpOverlapped,
_In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)

Definition at line 769 of file ws2tcpip.h.

773 {
774  DWORD bytes;
775 
777  NULL, 0, NULL, 0, &bytes,
778  lpOverlapped, lpCompletionRoutine);
779 }
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
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
#define SIO_IDEAL_SEND_BACKLOG_CHANGE
Definition: ws2ipdef.h:77
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
Definition: mswsock.h:90

◆ idealsendbacklogquery()

WS2TCPIP_INLINE int idealsendbacklogquery ( _In_ SOCKET  s,
_Out_ ULONG pISB 
)

Definition at line 757 of file ws2tcpip.h.

760 {
761  DWORD bytes;
762 
764  NULL, 0, pISB, sizeof(*pISB), &bytes, NULL, NULL);
765 }
#define SIO_IDEAL_SEND_BACKLOG_QUERY
Definition: ws2ipdef.h:76
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
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039

◆ if() [1/2]

if ( Filter  = NULL)

Definition at line 635 of file ws2tcpip.h.

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

◆ if() [2/2]

if ( Error  = = 0)

Definition at line 647 of file ws2tcpip.h.

647  {
648  if (*SourceCount > 0) {
650  *SourceCount * sizeof(*SourceList));
652  }
654  }
_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 * FilterMode
Definition: ws2tcpip.h:617
IN_ADDR imsf_slist[1]
Definition: ws2ipdef.h:542
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG * SourceCount
Definition: ws2tcpip.h:617
#define CopyMemory
Definition: winbase.h:1633
ULONG imsf_numsrc
Definition: ws2ipdef.h:541
MULTICAST_MODE_TYPE imsf_fmode
Definition: ws2ipdef.h:540
PIP_MSFILTER Filter
Definition: ws2tcpip.h:625

◆ inet_ntop()

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

◆ 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 
604  Error = WSAIoctl(Socket, SIOCSIPMSFILTER, Filter, Size, NULL, 0,
605  &Returned, NULL, NULL);
606 
608 
609  return Error;
610 }
#define SOCKET_ERROR
Definition: winsock.h:333
#define IP_MSFILTER_SIZE(NumSources)
Definition: ws2ipdef.h:88
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
Definition: ws2tcpip.h:622
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
DWORD Size
Definition: ws2tcpip.h:624
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE * FilterMode
Definition: ws2tcpip.h:617
IN_ADDR imsf_multiaddr
Definition: ws2ipdef.h:538
IN_ADDR imsf_slist[1]
Definition: ws2ipdef.h:542
_In_ IN_ADDR Interface
Definition: ws2tcpip.h:617
IN_ADDR imsf_interface
Definition: ws2ipdef.h:539
smooth NULL
Definition: ftsmooth.c:416
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG * SourceCount
Definition: ws2tcpip.h:617
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CopyMemory
Definition: winbase.h:1633
DWORD Returned
Definition: ws2tcpip.h:624
unsigned long DWORD
Definition: ntddk_ex.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
_In_ IN_ADDR _In_ IN_ADDR Group
Definition: ws2tcpip.h:617
ULONG imsf_numsrc
Definition: ws2ipdef.h:541
HeapFree(GetProcessHeap(), 0, Filter)
MULTICAST_MODE_TYPE imsf_fmode
Definition: ws2ipdef.h:540
unsigned int ULONG
Definition: retypes.h:1
PIP_MSFILTER Filter
Definition: ws2tcpip.h:625
Error
Definition: ws2tcpip.h:644
#define SIOCSIPMSFILTER
Definition: ws2ipdef.h:66
struct ip_msfilter * PIP_MSFILTER
#define WSAENOBUFS
Definition: winerror.h:1968
#define ULONG_MAX
Definition: limits.h:44

◆ 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 SOCKET_ERROR
Definition: winsock.h:333
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG _Out_writes_ SourceCount IN_ADDR * SourceList
Definition: ws2tcpip.h:622
#define ZeroMemory
Definition: winbase.h:1635
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
DWORD Size
Definition: ws2tcpip.h:624
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE * FilterMode
Definition: ws2tcpip.h:617
_In_ IN_ADDR Interface
Definition: ws2tcpip.h:617
smooth NULL
Definition: ftsmooth.c:416
VOID WSAAPI WSASetLastError(IN INT iError)
Definition: dllmain.c:123
_In_ IN_ADDR _In_ IN_ADDR _Out_ MULTICAST_MODE_TYPE _Inout_ ULONG * SourceCount
Definition: ws2tcpip.h:617
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CopyMemory
Definition: winbase.h:1633
DWORD Returned
Definition: ws2tcpip.h:624
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GROUP_FILTER_SIZE(numsrc)
Definition: ws2ipdef.h:571
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
_In_ IN_ADDR _In_ IN_ADDR Group
Definition: ws2tcpip.h:617
#define SIOCSMSFILTER
Definition: ws2ipdef.h:69
HeapFree(GetProcessHeap(), 0, Filter)
struct group_filter * PGROUP_FILTER
unsigned int ULONG
Definition: retypes.h:1
_In_ ULONG _In_ CONST SOCKADDR _In_ int GroupLength
Definition: ws2tcpip.h:710
PIP_MSFILTER Filter
Definition: ws2tcpip.h:625
Error
Definition: ws2tcpip.h:644
#define WSAENOBUFS
Definition: winerror.h:1968
#define ULONG_MAX
Definition: limits.h:44

◆ SourceCount()

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

Definition at line 628 of file ws2tcpip.h.

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

Variable Documentation

◆ Error

return Error
Initial value:
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
#define SIOCGIPMSFILTER
Definition: ws2ipdef.h:67
smooth NULL
Definition: ftsmooth.c:416
DWORD Returned
Definition: ws2tcpip.h:624
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PIP_MSFILTER Filter
Definition: ws2tcpip.h:625

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 617 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 617 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 617 of file ws2tcpip.h.

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

◆ SourceList