FreeRDP
winsock.c File Reference
#include <winpr/config.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/winsock.h>
#include <fcntl.h>
#include <netdb.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <net/if.h>
#include <winpr/assert.h>

Macros

#define MSG_NOSIGNAL   0
 

Functions

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

Macro Definition Documentation

◆ MSG_NOSIGNAL

#define MSG_NOSIGNAL   0

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. ws2_32.dll:

__WSAFDIsSet accept bind closesocket connect freeaddrinfo FreeAddrInfoEx FreeAddrInfoExW FreeAddrInfoW getaddrinfo GetAddrInfoExA GetAddrInfoExCancel GetAddrInfoExOverlappedResult GetAddrInfoExW GetAddrInfoW gethostbyaddr gethostbyname gethostname GetHostNameW getnameinfo GetNameInfoW getpeername getprotobyname getprotobynumber getservbyname getservbyport getsockname getsockopt htonl htons inet_addr inet_ntoa inet_ntop inet_pton InetNtopW InetPtonW ioctlsocket listen ntohl ntohs recv recvfrom select send sendto SetAddrInfoExA SetAddrInfoExW setsockopt shutdown socket WahCloseApcHelper WahCloseHandleHelper WahCloseNotificationHandleHelper WahCloseSocketHandle WahCloseThread WahCompleteRequest WahCreateHandleContextTable WahCreateNotificationHandle WahCreateSocketHandle WahDestroyHandleContextTable WahDisableNonIFSHandleSupport WahEnableNonIFSHandleSupport WahEnumerateHandleContexts WahInsertHandleContext WahNotifyAllProcesses WahOpenApcHelper WahOpenCurrentThread WahOpenHandleHelper WahOpenNotificationHandleHelper WahQueueUserApc WahReferenceContextByHandle WahRemoveHandleContext WahWaitForNotification WahWriteLSPEvent WEP WPUCompleteOverlappedRequest WPUGetProviderPathEx WSAAccept WSAAddressToStringA WSAAddressToStringW WSAAdvertiseProvider WSAAsyncGetHostByAddr WSAAsyncGetHostByName WSAAsyncGetProtoByName WSAAsyncGetProtoByNumber WSAAsyncGetServByName WSAAsyncGetServByPort WSAAsyncSelect WSACancelAsyncRequest WSACancelBlockingCall WSACleanup WSACloseEvent WSAConnect WSAConnectByList WSAConnectByNameA WSAConnectByNameW WSACreateEvent WSADuplicateSocketA WSADuplicateSocketW WSAEnumNameSpaceProvidersA WSAEnumNameSpaceProvidersExA WSAEnumNameSpaceProvidersExW WSAEnumNameSpaceProvidersW WSAEnumNetworkEvents WSAEnumProtocolsA WSAEnumProtocolsW WSAEventSelect WSAGetLastError WSAGetOverlappedResult WSAGetQOSByName WSAGetServiceClassInfoA WSAGetServiceClassInfoW WSAGetServiceClassNameByClassIdA WSAGetServiceClassNameByClassIdW WSAHtonl WSAHtons WSAInstallServiceClassA WSAInstallServiceClassW WSAIoctl WSAIsBlocking WSAJoinLeaf WSALookupServiceBeginA WSALookupServiceBeginW WSALookupServiceEnd WSALookupServiceNextA WSALookupServiceNextW WSANSPIoctl WSANtohl WSANtohs WSAPoll WSAProviderCompleteAsyncCall WSAProviderConfigChange WSApSetPostRoutine WSARecv WSARecvDisconnect WSARecvFrom WSARemoveServiceClass WSAResetEvent WSASend WSASendDisconnect WSASendMsg WSASendTo WSASetBlockingHook WSASetEvent WSASetLastError WSASetServiceA WSASetServiceW WSASocketA WSASocketW WSAStartup WSAStringToAddressA WSAStringToAddressW WSAUnadvertiseProvider WSAUnhookBlockingHook WSAWaitForMultipleEvents WSCDeinstallProvider WSCDeinstallProviderEx WSCEnableNSProvider WSCEnumProtocols WSCEnumProtocolsEx WSCGetApplicationCategory WSCGetApplicationCategoryEx WSCGetProviderInfo WSCGetProviderPath WSCInstallNameSpace WSCInstallNameSpaceEx WSCInstallNameSpaceEx2 WSCInstallProvider WSCInstallProviderAndChains WSCInstallProviderEx WSCSetApplicationCategory WSCSetApplicationCategoryEx WSCSetProviderInfo WSCUnInstallNameSpace WSCUnInstallNameSpaceEx2 WSCUpdateProvider WSCUpdateProviderEx WSCWriteNameSpaceOrder WSCWriteProviderOrder WSCWriteProviderOrderEx

Function Documentation

◆ _accept()

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

◆ _bind()

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

◆ _connect()

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

◆ _gethostbyaddr()

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

◆ _gethostbyname()

struct hostent* _gethostbyname ( const char *  name)

◆ _gethostname()

int _gethostname ( char *  name,
int  namelen 
)

◆ _getpeername()

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

◆ _getprotobyname()

struct protoent* _getprotobyname ( const char *  name)

◆ _getprotobynumber()

struct protoent* _getprotobynumber ( int  number)

◆ _getservbyname()

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

◆ _getservbyport()

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

◆ _getsockname()

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

◆ _getsockopt()

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

◆ _htonl()

u_long _htonl ( u_long  hostlong)

◆ _htons()

u_short _htons ( u_short  hostshort)

◆ _inet_addr()

unsigned long _inet_addr ( const char *  cp)

◆ _inet_ntoa()

char* _inet_ntoa ( struct in_addr  in)

◆ _ioctlsocket()

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

◆ _listen()

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

◆ _ntohl()

u_long _ntohl ( u_long  netlong)

◆ _ntohs()

u_short _ntohs ( u_short  netshort)

◆ _recv()

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

◆ _recvfrom()

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

◆ _select()

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

◆ _send()

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

◆ _sendto()

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

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

◆ _shutdown()

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

◆ _socket()

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

◆ closesocket()

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

◆ WSACleanup()

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

◆ WSACloseEvent()

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

◆ WSACreateEvent()

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

◆ WSAEventSelect()

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

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

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

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

◆ WSASetEvent()

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

◆ WSASetLastError()

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

◆ WSASocketA()

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

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

◆ WSAStartup()

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

◆ WSAWaitForMultipleEvents()

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