OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TWinSockDll Class Reference

The TWinSockDll class encapsulates the WinSock DLL (WINSOCK.DLL). More...

#include <owl/winsock.h>

Inheritance diagram for owl::TWinSockDll:
owl::TModule owl::TStreamableBase

Public Member Functions

 TWinSockDll ()
 
- Public Member Functions inherited from owl::TModule
 TModule (const tstring &name, bool shouldLoad=true, bool mustLoad=true, bool addToList=true)
 Constructs a TModule object that is used as an alias for a DLL.
 
 TModule (LPCTSTR name, THandle handle, bool addToList=true)
 Constructs a TModule object that is an alias for an already loaded DLL or program with an available HInstance.
 
 TModule (const tstring &name, THandle handle, bool addToList=true)
 String-aware overload.
 
 TModule (LPCTSTR name, THandle handle, const tstring &cmdLine, bool addToList=true)
 Constructs a TModule object for an ObjectWindows DLL or program from within LibMain or WinMain.
 
 TModule (const tstring &name, THandle handle, const tstring &cmdLine, bool addToList=true)
 String-aware overload.
 
virtual ~TModule ()
 Destructs a TModule, freeing the instance if appropriate, and deleting new'd strings.
 
void InitModule (THandle handle, const tstring &cmdLine)
 Finish-up initialization of a module.
 
virtual int Error (TXBase &x, uint captionResId, uint promptResId=0)
 Replaceable exception handler; may be redefined to process OWL exceptions if canResume is false, then the user doesn't have the option of ignoring.
 
LPCTSTR GetName () const
 Returns the name of the module.
 
void SetName (LPCTSTR name)
 Accessor function that sets the name of the module.
 
void SetName (const tstring &name)
 String-aware overload.
 
THandle GetHandle () const
 Return the instance handle of the library module represented by the TModule obect.
 
 operator THandle () const
 Returns the handle of the application or DLL module represented by this TModule.
 
bool operator== (const TModule &m) const
 Returns true if this instance is equal to the other instance; otherwise, returns false.
 
bool IsLoaded () const
 Returns a nonzero value if the instance handle is loaded.
 
int GetModuleFileName (TCHAR *buff, int maxChars) const
 Returns the expanded file name (path and file name) of the file from which this module was loaded.
 
tstring GetModuleFileName () const
 String-aware overload.
 
FARPROC GetProcAddress (TNarrowResId) const
 Returns the entry-point address of the specified exported function if found, otherwise returns NULL.
 
HRSRC FindResource (TResId id, TResId type) const
 Wrapper for the Windows API to find a particular resource.
 
HRSRC FindResourceEx (TResId id, TResId type, TLangId langId=LangNeutral) const
 Wrapper for the Windows API to find a particular resource.
 
HGLOBAL LoadResource (HRSRC hRsrc) const
 Wrapper for the Windows API.
 
uint32 SizeofResource (HRSRC hRsrc) const
 Wrapper for the Windows API.
 
int LoadString (uint id, TCHAR *buf, int maxChars) const
 Loads a string resource identified by id into the buffer pointed to by buff.
 
tstring LoadString (uint id) const
 Loads a string resource identified by id.
 
HBITMAP LoadBitmap (TResId id) const
 Wrapper for the Windows API.
 
HACCEL LoadAccelerators (TResId id) const
 Wrapper for the Windows API.
 
HMENU LoadMenu (TResId id) const
 Wrapper for the Windows API.
 
HCURSOR LoadCursor (TResId id) const
 Wrapper for the Windows API.
 
HICON LoadIcon (TResId name) const
 Wrapper for the Windows API.
 
std::string LoadHtml (TResId) const
 Loads the given HTML resource and returns it as a narrow string.
 
HICON CopyIcon (HICON hIcon) const
 Wrapper for the Windows API.
 
auto GetClassInfo (TWindowClassName, WNDCLASS *wndclass) const -> bool
 Retrieves information about the given window class.
 
auto GetClassInfo (TWindowClassName) const -> WNDCLASS
 Functional-style overload.
 
auto IsRegisteredClass (TWindowClassName) const -> bool
 Returns true if the given window class has been registered.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Static Public Member Functions

static SOCKET accept (SOCKET s, struct sockaddr *addr, int *addrLen)
 
static int bind (SOCKET s, struct sockaddr *addr, int nameLen)
 
static int closesocket (SOCKET s)
 
static int connect (SOCKET s, struct sockaddr *name, int nameLen)
 
static int getpeername (SOCKET s, struct sockaddr *name, int *nameLen)
 
static int getsockname (SOCKET s, struct sockaddr *name, int *nameLen)
 
static int getsockopt (SOCKET s, int level, int optName, char *optVal, int *optLen)
 
static ulong _htonl (ulong hostLong)
 
static ushort _htons (ushort hostShort)
 
static ulong inet_addr (const char *cp)
 
static charinet_ntoa (struct in_addr in)
 
static int ioctlsocket (SOCKET s, long cmd, ulong *argp)
 
static int listen (SOCKET s, int backlog)
 
static ulong _ntohl (ulong netLong)
 
static ushort _ntohs (ushort netShort)
 
static int recv (SOCKET s, char *buf, int len, int flags)
 
static int recvfrom (SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromLen)
 
static int select (int nfds, struct fd_set *readfds, struct fd_set *writefds, struct fd_set *exceptfds, const struct timeval *timeout)
 
static int send (SOCKET s, LPCSTR buf, int len, int flags)
 
static int sendto (SOCKET s, LPCSTR buf, int len, int flags, const struct sockaddr *to, int toLen)
 
static int setsockopt (SOCKET s, int level, int optName, LPCSTR optVal, int optLen)
 
static int shutdown (SOCKET s, int how)
 
static SOCKET socket (int af, int type, int protocol)
 
static struct hostent * gethostbyaddr (LPCSTR addr, int len, int type)
 
static struct hostent * gethostbyname (LPCSTR name)
 
static int gethostname (char *name, int nameLen)
 
static struct servent * getservbyname (LPCSTR name, LPCSTR proto)
 
static struct servent * getservbyport (int port, LPCSTR proto)
 
static struct protoentgetprotobyname (LPCSTR name)
 
static struct protoentgetprotobynumber (int proto)
 
static int WSAStartup (uint16 versionRequested, LPWSADATA WSAData)
 
static int WSACleanup (void)
 
static void WSASetLastError (int error)
 
static int WSAGetLastError (void)
 
static BOOL WSAIsBlocking (void)
 
static int WSAUnhookBlockingHook (void)
 
static FARPROC WSASetBlockingHook (FARPROC blockFunc)
 
static int WSACancelBlockingCall (void)
 
static HANDLE WSAAsyncGetServByName (HWND hWnd, uint msg, LPCSTR name, LPCSTR proto, char *buf, int bufLen)
 
static HANDLE WSAAsyncGetServByPort (HWND hWnd, uint msg, int port, LPCSTR proto, char *buf, int bufLen)
 
static HANDLE WSAAsyncGetProtoByName (HWND hWnd, uint msg, LPCSTR name, char *buf, int bufLen)
 
static HANDLE WSAAsyncGetProtoByNumber (HWND hWnd, uint msg, int number, char *buf, int bufLen)
 
static HANDLE WSAAsyncGetHostByName (HWND hWnd, uint msg, LPCSTR name, char *buf, int bufLen)
 
static HANDLE WSAAsyncGetHostByAddr (HWND hWnd, uint msg, LPCSTR addr, int len, int type, char *buf, int bufLen)
 
static int WSACancelAsyncRequest (HANDLE hTaskHandle)
 
static int WSAAsyncSelect (SOCKET s, HWND hWnd, uint msg, long event)
 
static int WSARecvEx (SOCKET s, char *buf, int len, int *flags)
 
static TModuleWinSockModule ()
 
static bool IsAvailable ()
 
- Static Public Member Functions inherited from owl::TModule
static TModuleFindResModule (TResId id, TResId type)
 Global search for resources.
 
static TModuleNextModule (TModule *module=nullptr)
 

Additional Inherited Members

- Public Types inherited from owl::TModule
typedef HINSTANCE THandle
 TModule encapsulates an HINSTANCE.
 
- Protected Member Functions inherited from owl::TModule
void SetHandle (THandle handle)
 Set the module instance handle.
 

Detailed Description

The TWinSockDll class encapsulates the WinSock DLL (WINSOCK.DLL).

It provides an easy method to dynamically test for the availability of the DLL and bind to its exported functions at runtime. By using the TWinSockDll class instead of direct calls to the WinSock DLL, ObjectWindows applications can provide the appropriate behaviour when running in an environment where the DLL is not available.

Each data member of the TWinSockDll class corresponds to the API with a similar name exposed by the WinSock DLL. For example, TWinSockDll::WSAStartup corresponds to the WSAStartup API exported by the WinSock DLL.

For more information about the members, consult the documentation about the corresponding API exposed by the WinSock DLL.

Definition at line 48 of file winsock.h.

Constructor & Destructor Documentation

◆ TWinSockDll()

owl::TWinSockDll::TWinSockDll ( )

Definition at line 23 of file winsock.cpp.

Member Function Documentation

◆ _htonl()

ulong owl::TWinSockDll::_htonl ( ulong hostLong)
static

Definition at line 88 of file winsock.cpp.

References _htonl(), and WinSockModule().

◆ _htons()

ushort owl::TWinSockDll::_htons ( ushort hostShort)
static

Definition at line 95 of file winsock.cpp.

References _htons(), and WinSockModule().

◆ _ntohl()

ulong owl::TWinSockDll::_ntohl ( ulong netLong)
static

Definition at line 131 of file winsock.cpp.

References _ntohl(), and WinSockModule().

◆ _ntohs()

ushort owl::TWinSockDll::_ntohs ( ushort netShort)
static

Definition at line 138 of file winsock.cpp.

References _ntohs(), and WinSockModule().

◆ accept()

SOCKET owl::TWinSockDll::accept ( SOCKET s,
struct sockaddr * addr,
int * addrLen )
static

Definition at line 33 of file winsock.cpp.

References accept(), and WinSockModule().

◆ bind()

int owl::TWinSockDll::bind ( SOCKET s,
struct sockaddr * addr,
int nameLen )
static

Definition at line 41 of file winsock.cpp.

References bind(), and WinSockModule().

◆ closesocket()

int owl::TWinSockDll::closesocket ( SOCKET s)
static

Definition at line 49 of file winsock.cpp.

References closesocket(), and WinSockModule().

◆ connect()

int owl::TWinSockDll::connect ( SOCKET s,
struct sockaddr * name,
int nameLen )
static

Definition at line 56 of file winsock.cpp.

References connect(), and WinSockModule().

◆ gethostbyaddr()

struct hostent * owl::TWinSockDll::gethostbyaddr ( LPCSTR addr,
int len,
int type )
static

Definition at line 214 of file winsock.cpp.

References gethostbyaddr(), and WinSockModule().

◆ gethostbyname()

struct hostent * owl::TWinSockDll::gethostbyname ( LPCSTR name)
static

Definition at line 222 of file winsock.cpp.

References gethostbyname(), and WinSockModule().

◆ gethostname()

int owl::TWinSockDll::gethostname ( char * name,
int nameLen )
static

Definition at line 230 of file winsock.cpp.

References gethostname(), and WinSockModule().

◆ getpeername()

int owl::TWinSockDll::getpeername ( SOCKET s,
struct sockaddr * name,
int * nameLen )
static

Definition at line 64 of file winsock.cpp.

References getpeername(), and WinSockModule().

◆ getprotobyname()

struct protoent * owl::TWinSockDll::getprotobyname ( LPCSTR name)
static

Definition at line 253 of file winsock.cpp.

References getprotobyname(), and WinSockModule().

◆ getprotobynumber()

struct protoent * owl::TWinSockDll::getprotobynumber ( int proto)
static

Definition at line 261 of file winsock.cpp.

References getprotobynumber(), and WinSockModule().

◆ getservbyname()

struct servent * owl::TWinSockDll::getservbyname ( LPCSTR name,
LPCSTR proto )
static

Definition at line 237 of file winsock.cpp.

References getservbyname(), and WinSockModule().

◆ getservbyport()

struct servent * owl::TWinSockDll::getservbyport ( int port,
LPCSTR proto )
static

Definition at line 245 of file winsock.cpp.

References getservbyport(), and WinSockModule().

◆ getsockname()

int owl::TWinSockDll::getsockname ( SOCKET s,
struct sockaddr * name,
int * nameLen )
static

Definition at line 72 of file winsock.cpp.

References getsockname(), and WinSockModule().

◆ getsockopt()

int owl::TWinSockDll::getsockopt ( SOCKET s,
int level,
int optName,
char * optVal,
int * optLen )
static

Definition at line 80 of file winsock.cpp.

References getsockopt(), and WinSockModule().

◆ inet_addr()

ulong owl::TWinSockDll::inet_addr ( const char * cp)
static

Definition at line 102 of file winsock.cpp.

References inet_addr(), and WinSockModule().

◆ inet_ntoa()

char * owl::TWinSockDll::inet_ntoa ( struct in_addr in)
static

Definition at line 109 of file winsock.cpp.

References inet_ntoa(), and WinSockModule().

◆ ioctlsocket()

int owl::TWinSockDll::ioctlsocket ( SOCKET s,
long cmd,
ulong * argp )
static

Definition at line 116 of file winsock.cpp.

References ioctlsocket(), and WinSockModule().

◆ IsAvailable()

bool owl::TWinSockDll::IsAvailable ( )
static

Definition at line 414 of file winsock.cpp.

References WinSockModule().

◆ listen()

int owl::TWinSockDll::listen ( SOCKET s,
int backlog )
static

Definition at line 124 of file winsock.cpp.

References listen(), and WinSockModule().

◆ recv()

int owl::TWinSockDll::recv ( SOCKET s,
char * buf,
int len,
int flags )
static

Definition at line 145 of file winsock.cpp.

References recv(), and WinSockModule().

◆ recvfrom()

int owl::TWinSockDll::recvfrom ( SOCKET s,
char * buf,
int len,
int flags,
struct sockaddr * from,
int * fromLen )
static

Definition at line 152 of file winsock.cpp.

References recvfrom(), and WinSockModule().

◆ select()

int owl::TWinSockDll::select ( int nfds,
struct fd_set * readfds,
struct fd_set * writefds,
struct fd_set * exceptfds,
const struct timeval * timeout )
static

Definition at line 161 of file winsock.cpp.

References select(), and WinSockModule().

◆ send()

int owl::TWinSockDll::send ( SOCKET s,
LPCSTR buf,
int len,
int flags )
static

Definition at line 171 of file winsock.cpp.

References send(), and WinSockModule().

◆ sendto()

int owl::TWinSockDll::sendto ( SOCKET s,
LPCSTR buf,
int len,
int flags,
const struct sockaddr * to,
int toLen )
static

Definition at line 178 of file winsock.cpp.

References sendto(), and WinSockModule().

◆ setsockopt()

int owl::TWinSockDll::setsockopt ( SOCKET s,
int level,
int optName,
LPCSTR optVal,
int optLen )
static

Definition at line 187 of file winsock.cpp.

References setsockopt(), and WinSockModule().

◆ shutdown()

int owl::TWinSockDll::shutdown ( SOCKET s,
int how )
static

Definition at line 196 of file winsock.cpp.

References shutdown(), and WinSockModule().

◆ socket()

SOCKET owl::TWinSockDll::socket ( int af,
int type,
int protocol )
static

Definition at line 203 of file winsock.cpp.

References socket(), and WinSockModule().

◆ WinSockModule()

TModule & owl::TWinSockDll::WinSockModule ( )
static

Definition at line 407 of file winsock.cpp.

◆ WSAAsyncGetHostByAddr()

HANDLE owl::TWinSockDll::WSAAsyncGetHostByAddr ( HWND hWnd,
uint msg,
LPCSTR addr,
int len,
int type,
char * buf,
int bufLen )
static

Definition at line 375 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetHostByAddr().

◆ WSAAsyncGetHostByName()

HANDLE owl::TWinSockDll::WSAAsyncGetHostByName ( HWND hWnd,
uint msg,
LPCSTR name,
char * buf,
int bufLen )
static

Definition at line 366 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetHostByName().

◆ WSAAsyncGetProtoByName()

HANDLE owl::TWinSockDll::WSAAsyncGetProtoByName ( HWND hWnd,
uint msg,
LPCSTR name,
char * buf,
int bufLen )
static

Definition at line 348 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetProtoByName().

◆ WSAAsyncGetProtoByNumber()

HANDLE owl::TWinSockDll::WSAAsyncGetProtoByNumber ( HWND hWnd,
uint msg,
int number,
char * buf,
int bufLen )
static

Definition at line 357 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetProtoByNumber().

◆ WSAAsyncGetServByName()

HANDLE owl::TWinSockDll::WSAAsyncGetServByName ( HWND hWnd,
uint msg,
LPCSTR name,
LPCSTR proto,
char * buf,
int bufLen )
static

Definition at line 330 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetServByName().

◆ WSAAsyncGetServByPort()

HANDLE owl::TWinSockDll::WSAAsyncGetServByPort ( HWND hWnd,
uint msg,
int port,
LPCSTR proto,
char * buf,
int bufLen )
static

Definition at line 339 of file winsock.cpp.

References WinSockModule(), and WSAAsyncGetServByPort().

◆ WSAAsyncSelect()

int owl::TWinSockDll::WSAAsyncSelect ( SOCKET s,
HWND hWnd,
uint msg,
long event )
static

Definition at line 392 of file winsock.cpp.

References WinSockModule(), and WSAAsyncSelect().

◆ WSACancelAsyncRequest()

int owl::TWinSockDll::WSACancelAsyncRequest ( HANDLE hTaskHandle)
static

Definition at line 384 of file winsock.cpp.

References WinSockModule(), and WSACancelAsyncRequest().

◆ WSACancelBlockingCall()

int owl::TWinSockDll::WSACancelBlockingCall ( void )
static

Definition at line 323 of file winsock.cpp.

References WinSockModule(), and WSACancelBlockingCall().

◆ WSACleanup()

int owl::TWinSockDll::WSACleanup ( void )
static

Definition at line 280 of file winsock.cpp.

References WinSockModule(), and WSACleanup().

◆ WSAGetLastError()

int owl::TWinSockDll::WSAGetLastError ( void )
static

Definition at line 294 of file winsock.cpp.

References WinSockModule(), and WSAGetLastError().

◆ WSAIsBlocking()

BOOL owl::TWinSockDll::WSAIsBlocking ( void )
static

Definition at line 301 of file winsock.cpp.

References WinSockModule(), and WSAIsBlocking().

◆ WSARecvEx()

int owl::TWinSockDll::WSARecvEx ( SOCKET s,
char * buf,
int len,
int * flags )
static

Definition at line 400 of file winsock.cpp.

References WinSockModule(), and WSARecvEx().

◆ WSASetBlockingHook()

FARPROC owl::TWinSockDll::WSASetBlockingHook ( FARPROC blockFunc)
static

Definition at line 315 of file winsock.cpp.

References WinSockModule(), and WSASetBlockingHook().

◆ WSASetLastError()

void owl::TWinSockDll::WSASetLastError ( int error)
static

Definition at line 287 of file winsock.cpp.

References WinSockModule(), and WSASetLastError().

◆ WSAStartup()

int owl::TWinSockDll::WSAStartup ( uint16 versionRequested,
LPWSADATA WSAData )
static

Definition at line 273 of file winsock.cpp.

References WinSockModule(), and WSAStartup().

◆ WSAUnhookBlockingHook()

int owl::TWinSockDll::WSAUnhookBlockingHook ( void )
static

Definition at line 308 of file winsock.cpp.

References WinSockModule(), and WSAUnhookBlockingHook().


The documentation for this class was generated from the following files: