FreeRDP
winsock.h File Reference
#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>
#include <winpr/platform.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  LPWSAPROTOCOLCHAIN
 
struct  LPWSAPROTOCOL_INFOA
 
struct  LPWSAPROTOCOL_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_INFO * LPINTERFACE_INFO
 
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 HANDLE WSACreateEvent (void)
 
WINPR_API BOOL WSASetEvent (HANDLE hEvent)
 
WINPR_API BOOL WSAResetEvent (HANDLE hEvent)
 
WINPR_API BOOL WSACloseEvent (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

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

#define WSAOVERLAPPED   OVERLAPPED
#define WSAPROTOCOL_INFO   WSAPROTOCOL_INFOA
#define WSAPROTOCOL_LEN   255
#define WSASocket   WSASocketA
#define WSASYS_STATUS_LEN   128

Typedef Documentation

typedef UINT32 GROUP
typedef struct in6_addr IN6_ADDR
typedef struct in6_addr* LPIN6_ADDR
typedef INTERFACE_INFO* LPINTERFACE_INFO
typedef void(CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE) (DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
typedef struct in6_addr* PIN6_ADDR
typedef struct sockaddr_storage SOCKADDR_STORAGE
typedef UINT_PTR SOCKET

Function Documentation

WINPR_API SOCKET _accept ( SOCKET  s,
struct sockaddr *  addr,
int *  addrlen 
)
WINPR_API int _bind ( SOCKET  s,
const struct sockaddr *  addr,
int  namelen 
)

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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 int _getpeername ( SOCKET  s,
struct sockaddr *  name,
int *  namelen 
)
WINPR_API struct protoent* _getprotobyname ( const char *  name)
WINPR_API struct protoent* _getprotobynumber ( int  number)
WINPR_API struct servent* _getservbyname ( const char *  name,
const char *  proto 
)
WINPR_API struct servent* _getservbyport ( int  port,
const char *  proto 
)
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 _ioctlsocket ( SOCKET  s,
long  cmd,
u_long *  argp 
)

Here is the caller graph for this function:

WINPR_API int _listen ( SOCKET  s,
int  backlog 
)

Here is the caller graph for this function:

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 
)

Here is the caller graph for this function:

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 
)

Here is the caller graph for this function:

WINPR_API int _send ( SOCKET  s,
const char *  buf,
int  len,
int  flags 
)

Here is the caller graph for this function:

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:

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

Here is the caller graph for this function:

WINPR_API SOCKET _socket ( int  af,
int  type,
int  protocol 
)

Here is the caller graph for this function:

WINPR_API int closesocket ( SOCKET  s)

Here is the caller graph for this function:

WINPR_API int WSACleanup ( void  )

Here is the caller graph for this function:

WINPR_API BOOL WSACloseEvent ( HANDLE  hEvent)

Here is the call graph for this function:

WINPR_API HANDLE WSACreateEvent ( void  )

Here is the caller graph for this function:

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:

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:

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:

WINPR_API BOOL WSAResetEvent ( HANDLE  hEvent)

Here is the caller graph for this function:

WINPR_API BOOL WSASetEvent ( HANDLE  hEvent)

Here is the call graph for this function:

WINPR_API void WSASetLastError ( int  iError)

Here is the caller graph for this function:

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:

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:

WINPR_API int WSAStartup ( WORD  wVersionRequired,
LPWSADATA  lpWSAData 
)

Here is the caller graph for this function:

WINPR_API DWORD WSAWaitForMultipleEvents ( DWORD  cEvents,
const HANDLE *  lphEvents,
BOOL  fWaitAll,
DWORD  dwTimeout,
BOOL  fAlertable 
)

Here is the call graph for this function: