modSocketMaster

modSocketMaster


This module contains API declarations and helper functions for the CSocketMaster class


Version: 1.3
Author: Copyright (c) 2004 by Emiliano Scavuzzo. Rosario, Argentina
Modified: 04/02/2005

Public:

Constants:

NameDescription
 FD_ACCEPT 
 FD_CLOSE 
 FD_CONNECT 
 FD_READ 
 FD_WRITE 
 INADDR_NONE 
 INVALID_SOCKET 
 RESOLVE_MESSAGE 
 sckBadState 
 sckInvalidArg 
 sckInvalidOp 
 sckOutOfMemory 
 sckUnsupported 
 SOCKET_ERROR 
 SOCKET_MESSAGE 
 WSAEACCES 
 WSAEADDRINUSE 
 WSAEADDRNOTAVAIL 
 WSAEAFNOSUPPORT 
 WSAEALREADY 
 WSAECONNABORTED 
 WSAECONNREFUSED 
 WSAECONNRESET 
 WSAEDESTADDRREQ 
 WSAEFAULT 
 WSAEHOSTUNREACH 
 WSAEINPROGRESS 
 WSAEINTR 
 WSAEINVAL 
 WSAEISCONN 
 WSAEMFILE 
 WSAEMSGSIZE 
 WSAENETDOWN 
 WSAENETRESET 
 WSAENETUNREACH 
 WSAENOBUFS 
 WSAENOPROTOOPT 
 WSAENOTCONN 
 WSAENOTSOCK 
 WSAEOPNOTSUPP 
 WSAEPFNOSUPPORT 
 WSAEPROCLIM 
 WSAEPROTONOSUPPORT 
 WSAEPROTOTYPE 
 WSAESHUTDOWN 
 WSAESOCKTNOSUPPORT 
 WSAETIMEDOUT 
 WSAEWOULDBLOCK 
 WSAHOST_NOT_FOUND 
 WSANO_DATA 
 WSANO_RECOVERY 
 WSANOTINITIALISED 
 WSASYSNOTREADY 
 WSATRY_AGAIN 
 WSAVERNOTSUPPORTED 

Methods:

NameDescription
 FinalizeProcesses Once we are done with the class instance we call this function to discount it and finish winsock service if it was the last one.  
 GetAcceptClass Return the accept instance class from a socket.  
 GetErrorDescription This function receives a number that represents an error and returns the corresponding description string.  
 HiWord Returns the hi word from a double word.  
 InitiateProcesses This function initiates the processes needed to keep control of sockets.  
 IntegerToUnsigned The function takes an unsigned Integer from and API and� converts it to a Long for display or arithmetic purposes  
 IsAcceptRegistered Returns TRUE if the socket that is passed is registered in the accept list.  
 IsSocketRegistered Returns TRUE if the socket that is passed is registered in the colSocketsInst collection.  
 LoWord Returns the low word from a double word.  
 RegisterAccept Assign a temporal instance of CSocketMaster to a socket and register this socket to the accept list.  
 RegisterSocket 
 StringFromPointer Receives a string pointer and it turns it into a regular string.  
 Subclass_ChangeOwner 
 UnregisterAccept Unregister lngSocket from the accept list.  
 UnregisterResolution When ResolveHost is called an async task handle is added to TableA list. Use this function to remove that record.  
 UnregisterSocket Removes the socket from the m_colSocketsInst collection If it is the last socket in that collection, the window and collection will be destroyed as well.  
 UnsignedToInteger The function takes a Long containing a value in the range� of an unsigned Integer and returns an Integer that you� can pass to an API that requires an unsigned Integer  

Declarations:

NameDescription
 api_CopyMemory (sub) 
 api_GlobalAlloc (function) 
 api_GlobalFree (function) 

Private:

Constants:

NameDescription
 GWL_WNDPROC 
 MAXINT_2 
 OFFSET_2 
 PATCH_09 
 PATCH_0C 
 TIMER_TIMEOUT 
 WM_APP 
 WSABASEERR 
 WSADESCRIPTION_LEN 
 WSASYS_STATUS_LEN 

Types:

NameDescription
 WinsockVersion 
 WSAData 

Properties:

NameDescription
 hTimer 
 hWndSub 
 lngMsgCntA 
 lngMsgCntB 
 lngTableA1 
 lngTableA2 
 lngTableB1 
 lngTableB2 
 m_blnInitiated 
 m_colAcceptList 
 m_colSocketsInst 
 m_lngSocksQuantity 
 m_lngWindowHandle 
 nAddrOriginal 
 nAddrSubclass 

Methods:

NameDescription
 CreateWinsockMessageWindow Create a window that is used to capture sockets messages.  
 DestroyWinsockMessageWindow Destroy the window that is used to capture sockets messages.  
 InitiateService This function initiate the winsock service calling the api_WSAStartup function.  
 Subclass_AddrFunc Return the address of the passed function in the passed dll  
 Subclass_AddrMsgTbl Return the address of the low bound of the passed table array  
 Subclass_AddSocketMessage 
 Subclass_DelResolveMessage 
 Subclass_DelSocketMessage 
 Subclass_InIDE Return whether were running in the IDE. Public for general utility purposes 
 Subclass_Initialize 
 Subclass_PatchRel Patch the machine code buffer offset with the relative address to the target address  
 Subclass_PatchTableB 
 Subclass_PatchVal Patch the machine code buffer offset with the passed value  
 Subclass_SetTrue Worker function for InIDE - will only be called whilst running in the IDE  
 Subclass_Subclass Set the window subclass  
 Subclass_Terminate UnSubclass and release the allocated memory 
 Subclass_UnSubclass Stop subclassing the window  

Declarations:

NameDescription
 api_CreateWindowEx (function) 
 api_DestroyWindow (function) 
 api_GetModuleHandle (function) 
 api_GetProcAddress (function) 
 api_GetWindowLong (function) 
 api_IsWindow (function) 
 api_KillTimer (function) 
 api_LoadLibrary (function) 
 api_lstrcpy (function) 
 api_lstrlen (function) 
 api_SetTimer (function) 
 api_SetWindowLong (function) 
 api_WSAAsyncSelect (function) 
 api_WSACleanup (function) 
 api_WSAStartup (function) 

Requirements

1.3