FreeRDP
winsock.h File Reference
#include <winpr/platform.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#include <winpr/windows.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <net/if.h>
#include <winpr/io.h>
#include <winpr/error.h>
This graph shows which files directly or indirectly include this file:

Data Structures

struct  LPWSADATA
 
struct  sockaddr_in6_old
 
union  sockaddr_gen
 
struct  INTERFACE_INFO
 
struct  WSAPROTOCOLCHAIN
 
struct  WSAPROTOCOL_INFOA
 
struct  WSAPROTOCOL_INFOW
 

Macros

#define WSAEVENT   HANDLE
 
#define LPWSAEVENT   LPHANDLE
 
#define WSAOVERLAPPED   OVERLAPPED
 
#define INVALID_SOCKET   (SOCKET)(~0)
 
#define WSADESCRIPTION_LEN   256
 
#define WSASYS_STATUS_LEN   128
 
#define FD_READ_BIT   0
 
#define FD_READ   (1 << FD_READ_BIT)
 
#define FD_WRITE_BIT   1
 
#define FD_WRITE   (1 << FD_WRITE_BIT)
 
#define FD_OOB_BIT   2
 
#define FD_OOB   (1 << FD_OOB_BIT)
 
#define FD_ACCEPT_BIT   3
 
#define FD_ACCEPT   (1 << FD_ACCEPT_BIT)
 
#define FD_CONNECT_BIT   4
 
#define FD_CONNECT   (1 << FD_CONNECT_BIT)
 
#define FD_CLOSE_BIT   5
 
#define FD_CLOSE   (1 << FD_CLOSE_BIT)
 
#define FD_QOS_BIT   6
 
#define FD_QOS   (1 << FD_QOS_BIT)
 
#define FD_GROUP_QOS_BIT   7
 
#define FD_GROUP_QOS   (1 << FD_GROUP_QOS_BIT)
 
#define FD_ROUTING_INTERFACE_CHANGE_BIT   8
 
#define FD_ROUTING_INTERFACE_CHANGE   (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)
 
#define FD_ADDRESS_LIST_CHANGE_BIT   9
 
#define FD_ADDRESS_LIST_CHANGE   (1 << FD_ADDRESS_LIST_CHANGE_BIT)
 
#define FD_MAX_EVENTS   10
 
#define FD_ALL_EVENTS   ((1 << FD_MAX_EVENTS) - 1)
 
#define SD_RECEIVE   0
 
#define SD_SEND   1
 
#define SD_BOTH   2
 
#define SOCKET_ERROR   (-1)
 
#define MAKEWORD(a, b)    ((WORD)(((BYTE)((DWORD_PTR)(a)&0xFF)) | (((WORD)((BYTE)((DWORD_PTR)(b)&0xFF))) << 8)))
 
#define _IFF_UP   0x00000001
 
#define _IFF_BROADCAST   0x00000002
 
#define _IFF_LOOPBACK   0x00000004
 
#define _IFF_POINTTOPOINT   0x00000008
 
#define _IFF_MULTICAST   0x00000010
 
#define MAX_PROTOCOL_CHAIN   7
 
#define WSAPROTOCOL_LEN   255
 
#define SG_UNCONSTRAINED_GROUP   0x01
 
#define SG_CONSTRAINED_GROUP   0x02
 
#define SIO_GET_INTERFACE_LIST   _IOR('t', 127, ULONG)
 
#define SIO_GET_INTERFACE_LIST_EX   _IOR('t', 126, ULONG)
 
#define SIO_SET_MULTICAST_FILTER   _IOW('t', 125, ULONG)
 
#define SIO_GET_MULTICAST_FILTER   _IOW('t', 124 | IOC_IN, ULONG)
 
#define SIOCSIPMSFILTER   SIO_SET_MULTICAST_FILTER
 
#define SIOCGIPMSFILTER   SIO_GET_MULTICAST_FILTER
 
#define WSAPROTOCOL_INFO   WSAPROTOCOL_INFOA
 
#define LPWSAPROTOCOL_INFO   LPWSAPROTOCOL_INFOA
 
#define WSASocket   WSASocketA
 

Typedefs

typedef OVERLAPPEDLPWSAOVERLAPPED
 
typedef UINT_PTR SOCKET
 
typedef struct sockaddr_storage SOCKADDR_STORAGE
 
typedef struct in6_addr IN6_ADDR
 
typedef struct in6_addr * PIN6_ADDR
 
typedef struct in6_addr * LPIN6_ADDR
 
typedef INTERFACE_INFOLPINTERFACE_INFO
 
typedef struct WSAPROTOCOLCHAINLPWSAPROTOCOLCHAIN
 
typedef struct WSAPROTOCOL_INFOALPWSAPROTOCOL_INFOA
 
typedef struct WSAPROTOCOL_INFOWLPWSAPROTOCOL_INFOW
 
typedef void(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
 
typedef UINT32 GROUP
 

Functions

WINPR_API int WSAStartup (WORD wVersionRequired, LPWSADATA lpWSAData)
 
WINPR_API int WSACleanup (void)
 
WINPR_API void WSASetLastError (int iError)
 
WINPR_API int WSAGetLastError (void)
 
WINPR_API BOOL WSACloseEvent (HANDLE hEvent)
 
WINPR_API HANDLE WSACreateEvent (void)
 
WINPR_API BOOL WSASetEvent (HANDLE hEvent)
 
WINPR_API BOOL WSAResetEvent (HANDLE hEvent)
 
WINPR_API int WSAEventSelect (SOCKET s, WSAEVENT hEventObject, LONG lNetworkEvents)
 
WINPR_API DWORD WSAWaitForMultipleEvents (DWORD cEvents, const HANDLE *lphEvents, BOOL fWaitAll, DWORD dwTimeout, BOOL fAlertable)
 
WINPR_API SOCKET WSASocketA (int af, int type, int protocol, LPWSAPROTOCOL_INFOA lpProtocolInfo, GROUP g, DWORD dwFlags)
 
WINPR_API SOCKET WSASocketW (int af, int type, int protocol, LPWSAPROTOCOL_INFOW lpProtocolInfo, GROUP g, DWORD dwFlags)
 
WINPR_API int WSAIoctl (SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 
WINPR_API SOCKET _accept (SOCKET s, struct sockaddr *addr, int *addrlen)
 
WINPR_API int _bind (SOCKET s, const struct sockaddr *addr, int namelen)
 
WINPR_API int closesocket (SOCKET s)
 
WINPR_API int _connect (SOCKET s, const struct sockaddr *name, int namelen)
 
WINPR_API int _ioctlsocket (SOCKET s, long cmd, u_long *argp)
 
WINPR_API int _getpeername (SOCKET s, struct sockaddr *name, int *namelen)
 
WINPR_API int _getsockname (SOCKET s, struct sockaddr *name, int *namelen)
 
WINPR_API int _getsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
 
WINPR_API u_long _htonl (u_long hostlong)
 
WINPR_API u_short _htons (u_short hostshort)
 
WINPR_API unsigned long _inet_addr (const char *cp)
 
WINPR_API char * _inet_ntoa (struct in_addr in)
 
WINPR_API int _listen (SOCKET s, int backlog)
 
WINPR_API u_long _ntohl (u_long netlong)
 
WINPR_API u_short _ntohs (u_short netshort)
 
WINPR_API int _recv (SOCKET s, char *buf, int len, int flags)
 
WINPR_API int _recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen)
 
WINPR_API int _select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout)
 
WINPR_API int _send (SOCKET s, const char *buf, int len, int flags)
 
WINPR_API int _sendto (SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen)
 
WINPR_API int _setsockopt (SOCKET s, int level, int optname, const char *optval, int optlen)
 
WINPR_API int _shutdown (SOCKET s, int how)
 
WINPR_API SOCKET _socket (int af, int type, int protocol)
 
WINPR_API struct hostent * _gethostbyaddr (const char *addr, int len, int type)
 
WINPR_API struct hostent * _gethostbyname (const char *name)
 
WINPR_API int _gethostname (char *name, int namelen)
 
WINPR_API struct servent * _getservbyport (int port, const char *proto)
 
WINPR_API struct servent * _getservbyname (const char *name, const char *proto)
 
WINPR_API struct protoent * _getprotobynumber (int number)
 
WINPR_API struct protoent * _getprotobyname (const char *name)
 

Macro Definition Documentation

◆ _IFF_BROADCAST

#define _IFF_BROADCAST   0x00000002

◆ _IFF_LOOPBACK

#define _IFF_LOOPBACK   0x00000004

◆ _IFF_MULTICAST

#define _IFF_MULTICAST   0x00000010

◆ _IFF_POINTTOPOINT

#define _IFF_POINTTOPOINT   0x00000008

◆ _IFF_UP

#define _IFF_UP   0x00000001

◆ FD_ACCEPT

#define FD_ACCEPT   (1 << FD_ACCEPT_BIT)

◆ FD_ACCEPT_BIT

#define FD_ACCEPT_BIT   3

◆ FD_ADDRESS_LIST_CHANGE

#define FD_ADDRESS_LIST_CHANGE   (1 << FD_ADDRESS_LIST_CHANGE_BIT)

◆ FD_ADDRESS_LIST_CHANGE_BIT

#define FD_ADDRESS_LIST_CHANGE_BIT   9

◆ FD_ALL_EVENTS

#define FD_ALL_EVENTS   ((1 << FD_MAX_EVENTS) - 1)

◆ FD_CLOSE

#define FD_CLOSE   (1 << FD_CLOSE_BIT)

◆ FD_CLOSE_BIT

#define FD_CLOSE_BIT   5

◆ FD_CONNECT

#define FD_CONNECT   (1 << FD_CONNECT_BIT)

◆ FD_CONNECT_BIT

#define FD_CONNECT_BIT   4

◆ FD_GROUP_QOS

#define FD_GROUP_QOS   (1 << FD_GROUP_QOS_BIT)

◆ FD_GROUP_QOS_BIT

#define FD_GROUP_QOS_BIT   7

◆ FD_MAX_EVENTS

#define FD_MAX_EVENTS   10

◆ FD_OOB

#define FD_OOB   (1 << FD_OOB_BIT)

◆ FD_OOB_BIT

#define FD_OOB_BIT   2

◆ FD_QOS

#define FD_QOS   (1 << FD_QOS_BIT)

◆ FD_QOS_BIT

#define FD_QOS_BIT   6

◆ FD_READ

#define FD_READ   (1 << FD_READ_BIT)

◆ FD_READ_BIT

#define FD_READ_BIT   0

◆ FD_ROUTING_INTERFACE_CHANGE

#define FD_ROUTING_INTERFACE_CHANGE   (1 << FD_ROUTING_INTERFACE_CHANGE_BIT)

◆ FD_ROUTING_INTERFACE_CHANGE_BIT

#define FD_ROUTING_INTERFACE_CHANGE_BIT   8

◆ FD_WRITE

#define FD_WRITE   (1 << FD_WRITE_BIT)

◆ FD_WRITE_BIT

#define FD_WRITE_BIT   1

◆ INVALID_SOCKET

#define INVALID_SOCKET   (SOCKET)(~0)

◆ LPWSAEVENT

#define LPWSAEVENT   LPHANDLE

◆ LPWSAPROTOCOL_INFO

#define LPWSAPROTOCOL_INFO   LPWSAPROTOCOL_INFOA

◆ MAKEWORD

#define MAKEWORD (   a,
 
)     ((WORD)(((BYTE)((DWORD_PTR)(a)&0xFF)) | (((WORD)((BYTE)((DWORD_PTR)(b)&0xFF))) << 8)))

◆ MAX_PROTOCOL_CHAIN

#define MAX_PROTOCOL_CHAIN   7

◆ SD_BOTH

#define SD_BOTH   2

◆ SD_RECEIVE

#define SD_RECEIVE   0

◆ SD_SEND

#define SD_SEND   1

◆ SG_CONSTRAINED_GROUP

#define SG_CONSTRAINED_GROUP   0x02

◆ SG_UNCONSTRAINED_GROUP

#define SG_UNCONSTRAINED_GROUP   0x01

◆ SIO_GET_INTERFACE_LIST

#define SIO_GET_INTERFACE_LIST   _IOR('t', 127, ULONG)

◆ SIO_GET_INTERFACE_LIST_EX

#define SIO_GET_INTERFACE_LIST_EX   _IOR('t', 126, ULONG)

◆ SIO_GET_MULTICAST_FILTER

#define SIO_GET_MULTICAST_FILTER   _IOW('t', 124 | IOC_IN, ULONG)

◆ SIO_SET_MULTICAST_FILTER

#define SIO_SET_MULTICAST_FILTER   _IOW('t', 125, ULONG)

◆ SIOCGIPMSFILTER

#define SIOCGIPMSFILTER   SIO_GET_MULTICAST_FILTER

◆ SIOCSIPMSFILTER

#define SIOCSIPMSFILTER   SIO_SET_MULTICAST_FILTER

◆ SOCKET_ERROR

#define SOCKET_ERROR   (-1)

◆ WSADESCRIPTION_LEN

#define WSADESCRIPTION_LEN   256

◆ WSAEVENT

#define WSAEVENT   HANDLE

WinPR: Windows Portable Runtime Windows Sockets (Winsock)

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

◆ WSAOVERLAPPED

#define WSAOVERLAPPED   OVERLAPPED

◆ WSAPROTOCOL_INFO

#define WSAPROTOCOL_INFO   WSAPROTOCOL_INFOA

◆ WSAPROTOCOL_LEN

#define WSAPROTOCOL_LEN   255

◆ WSASocket

#define WSASocket   WSASocketA

◆ WSASYS_STATUS_LEN

#define WSASYS_STATUS_LEN   128

Typedef Documentation

◆ GROUP

typedef UINT32 GROUP

◆ IN6_ADDR

typedef struct in6_addr IN6_ADDR

◆ LPIN6_ADDR

typedef struct in6_addr* LPIN6_ADDR

◆ LPINTERFACE_INFO

◆ LPWSAOVERLAPPED

◆ LPWSAOVERLAPPED_COMPLETION_ROUTINE

typedef void(CALLBACK* LPWSAOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)

◆ LPWSAPROTOCOL_INFOA

◆ LPWSAPROTOCOL_INFOW

◆ LPWSAPROTOCOLCHAIN

◆ PIN6_ADDR

typedef struct in6_addr* PIN6_ADDR

◆ SOCKADDR_STORAGE

typedef struct sockaddr_storage SOCKADDR_STORAGE

◆ SOCKET

typedef UINT_PTR SOCKET

Function Documentation

◆ _accept()

WINPR_API SOCKET _accept ( SOCKET  s,
struct sockaddr *  addr,
int *  addrlen 
)
Here is the caller graph for this function:

◆ _bind()

WINPR_API int _bind ( SOCKET  s,
const struct sockaddr *  addr,
int  namelen 
)
Here is the caller graph for this function:

◆ _connect()

WINPR_API int _connect ( SOCKET  s,
const struct sockaddr *  name,
int  namelen 
)
Here is the caller graph for this function:

◆ _gethostbyaddr()

WINPR_API struct hostent* _gethostbyaddr ( const char *  addr,
int  len,
int  type 
)

◆ _gethostbyname()

WINPR_API struct hostent* _gethostbyname ( const char *  name)

◆ _gethostname()

WINPR_API int _gethostname ( char *  name,
int  namelen 
)

◆ _getpeername()

WINPR_API int _getpeername ( SOCKET  s,
struct sockaddr *  name,
int *  namelen 
)

◆ _getprotobyname()

WINPR_API struct protoent* _getprotobyname ( const char *  name)

◆ _getprotobynumber()

WINPR_API struct protoent* _getprotobynumber ( int  number)

◆ _getservbyname()

WINPR_API struct servent* _getservbyname ( const char *  name,
const char *  proto 
)

◆ _getservbyport()

WINPR_API struct servent* _getservbyport ( int  port,
const char *  proto 
)

◆ _getsockname()

WINPR_API int _getsockname ( SOCKET  s,
struct sockaddr *  name,
int *  namelen 
)

◆ _getsockopt()

WINPR_API int _getsockopt ( SOCKET  s,
int  level,
int  optname,
char *  optval,
int *  optlen 
)

◆ _htonl()

WINPR_API u_long _htonl ( u_long  hostlong)

◆ _htons()

WINPR_API u_short _htons ( u_short  hostshort)

◆ _inet_addr()

WINPR_API unsigned long _inet_addr ( const char *  cp)

◆ _inet_ntoa()

WINPR_API char* _inet_ntoa ( struct in_addr  in)

◆ _ioctlsocket()

WINPR_API int _ioctlsocket ( SOCKET  s,
long  cmd,
u_long *  argp 
)
Here is the caller graph for this function:

◆ _listen()

WINPR_API int _listen ( SOCKET  s,
int  backlog 
)
Here is the caller graph for this function:

◆ _ntohl()

WINPR_API u_long _ntohl ( u_long  netlong)

◆ _ntohs()

WINPR_API u_short _ntohs ( u_short  netshort)

◆ _recv()

WINPR_API int _recv ( SOCKET  s,
char *  buf,
int  len,
int  flags 
)
Here is the caller graph for this function:

◆ _recvfrom()

WINPR_API int _recvfrom ( SOCKET  s,
char *  buf,
int  len,
int  flags,
struct sockaddr *  from,
int *  fromlen 
)

◆ _select()

WINPR_API int _select ( int  nfds,
fd_set *  readfds,
fd_set *  writefds,
fd_set *  exceptfds,
const struct timeval *  timeout 
)

◆ _send()

WINPR_API int _send ( SOCKET  s,
const char *  buf,
int  len,
int  flags 
)
Here is the caller graph for this function:

◆ _sendto()

WINPR_API int _sendto ( SOCKET  s,
const char *  buf,
int  len,
int  flags,
const struct sockaddr *  to,
int  tolen 
)
Here is the caller graph for this function:

◆ _setsockopt()

WINPR_API int _setsockopt ( SOCKET  s,
int  level,
int  optname,
const char *  optval,
int  optlen 
)

◆ _shutdown()

WINPR_API int _shutdown ( SOCKET  s,
int  how 
)
Here is the caller graph for this function:

◆ _socket()

WINPR_API SOCKET _socket ( int  af,
int  type,
int  protocol 
)
Here is the caller graph for this function:

◆ closesocket()

WINPR_API int closesocket ( SOCKET  s)
Here is the caller graph for this function:

◆ WSACleanup()

WINPR_API int WSACleanup ( void  )
Here is the caller graph for this function:

◆ WSACloseEvent()

WINPR_API BOOL WSACloseEvent ( HANDLE  hEvent)
Here is the call graph for this function:

◆ WSACreateEvent()

WINPR_API HANDLE WSACreateEvent ( void  )
Here is the caller graph for this function:

◆ WSAEventSelect()

WINPR_API int WSAEventSelect ( SOCKET  s,
WSAEVENT  hEventObject,
LONG  lNetworkEvents 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WSAGetLastError()

WINPR_API int WSAGetLastError ( void  )

Windows Sockets Extended Error Codes:

WSASYSNOTREADY WSAVERNOTSUPPORTED WSANOTINITIALISED WSAEDISCON WSAENOMORE WSAECANCELLED WSAEINVALIDPROCTABLE WSAEINVALIDPROVIDER WSAEPROVIDERFAILEDINIT WSASYSCALLFAILURE WSASERVICE_NOT_FOUND WSATYPE_NOT_FOUND WSA_E_NO_MORE WSA_E_CANCELLED WSAEREFUSED

Here is the caller graph for this function:

◆ WSAIoctl()

WINPR_API int WSAIoctl ( SOCKET  s,
DWORD  dwIoControlCode,
LPVOID  lpvInBuffer,
DWORD  cbInBuffer,
LPVOID  lpvOutBuffer,
DWORD  cbOutBuffer,
LPDWORD  lpcbBytesReturned,
LPWSAOVERLAPPED  lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)
Here is the call graph for this function:

◆ WSAResetEvent()

WINPR_API BOOL WSAResetEvent ( HANDLE  hEvent)
Here is the caller graph for this function:

◆ WSASetEvent()

WINPR_API BOOL WSASetEvent ( HANDLE  hEvent)
Here is the call graph for this function:

◆ WSASetLastError()

WINPR_API void WSASetLastError ( int  iError)
Here is the caller graph for this function:

◆ WSASocketA()

WINPR_API SOCKET WSASocketA ( int  af,
int  type,
int  protocol,
LPWSAPROTOCOL_INFOA  lpProtocolInfo,
GROUP  g,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WSASocketW()

WINPR_API SOCKET WSASocketW ( int  af,
int  type,
int  protocol,
LPWSAPROTOCOL_INFOW  lpProtocolInfo,
GROUP  g,
DWORD  dwFlags 
)
Here is the call graph for this function:

◆ WSAStartup()

WINPR_API int WSAStartup ( WORD  wVersionRequired,
LPWSADATA  lpWSAData 
)
Here is the caller graph for this function:

◆ WSAWaitForMultipleEvents()

WINPR_API DWORD WSAWaitForMultipleEvents ( DWORD  cEvents,
const HANDLE *  lphEvents,
BOOL  fWaitAll,
DWORD  dwTimeout,
BOOL  fAlertable 
)
Here is the call graph for this function: