Retail products


Traffic interception SDK

Control every TCP/IP network connection

  • Route connections via proxy
  • Redirect connections and modify the data
  • Block connections and applications
SSL interception SDK

View SSL in plaintext and modify it

  • View the SSL stream decrypted in plaintext
  • Redirect SSL connection and modify decrypted data
  • Browser shows "SSL lock" without warnings

Documentation


CSocketThreadManager Class Reference

#include <SocketThreadManager.h>

Inheritance diagram for CSocketThreadManager:
Collaboration diagram for CSocketThreadManager:

List of all members.


Classes

struct  _ThreadData
struct  _TimeoutData
struct  _TimerID

Public Types

typedef TimeoutProc LPTimeoutProc
typedef struct
CSocketThreadManager::_TimerID 
TimerID
typedef void(* TimeoutProc )(LPVOID pParam)
enum  _LogPriority { lpDebug, lpMessage, lpCritical, lpError }
typedef enum
CErrorHandler::_LogPriority 
LogPriority

Public Member Functions

const std::string & GetClassName () const
BOOL ReSetTimeout (const TimerID &rTimerID)
BOOL RemoveTimeout (TimerID &aTimerID)
TimerID RegisterTimeout (int iMS, LPTimeoutProc pProc, LPVOID pData, BOOL bClearTimeout=FALSE, HWND hHandle=NULL, TimerID *pTimer=NULL)
void DecreaseSocketCount (HWND hWindowHandle, BOOL bFreeze=FALSE)
void DecreaseTimeoutCount (HWND hWindowHandle, BOOL bFreeze=FALSE)
HWND GetWindowHandle (BOOL bTimeout=FALSE)
BOOL Initialize (unsigned long ulThreadCount, LPCSTR lpClassName)
BOOL Uninitialize ()
 CSocketThreadManager (HINSTANCE hInstance)
virtual ~CSocketThreadManager ()
void SetLocalLog (CErrorLog *pLog)

Static Public Member Functions

static std::string GetCurrentDateTime ()
static std::string ErrorCodeToString (DWORD dwErrorCode)
static void SetLog (CErrorLog *pLog)

Protected Member Functions

void WriteMessage (const std::string &rMethod, const std::string &rMessage, LogPriority aPriority=lpMessage)
void WriteMessage (const std::string &rMethod, const std::string &rMessage, DWORD dwAdditionalData, LogPriority aPriority=lpMessage)
virtual void ReportError (const std::string &rMethod) const
virtual void ReportError (const std::string &rMethod, const std::string &rMessage) const
virtual void ReportError (const std::string &rMethod, const std::string &rMessage, DWORD dwAdditionalData) const
virtual void ReportError (const std::string &rMethod, int iErrorCode) const
virtual void ReportError (const std::string &rMethod, const std::string &rMessage, int iErrorCode) const
virtual void ReportErrorOS (const std::string &rMethod, const std::string &rMessage) const
void SetName (const std::string &rName) const

Static Protected Member Functions

static void WriteStaticMessage (const std::string &rClass, const std::string &rMethod, const std::string &rMessage, LogPriority aPriority=lpMessage)
static void WriteStaticMessage (const std::string &rClass, const std::string &rMethod, const std::string &rMessage, DWORD dwAdditionalData, LogPriority aPriority=lpMessage)
static void ReportStaticError (const std::string &rClass, const std::string &rMethod)
static void ReportStaticError (const std::string &rClass, const std::string &rMethod, const std::string &rMessage)
static void ReportStaticError (const std::string &rClass, const std::string &rMethod, const std::string &rMessage, DWORD dwAdditionalData)

Detailed Description

Definition at line 61 of file SocketThreadManager.h.


Member Typedef Documentation

typedef void(* CSocketThreadManager::TimeoutProc)(LPVOID pParam)


Member Enumeration Documentation

enum CErrorHandler::_LogPriority [inherited]

Enumerator:
lpDebug 
lpMessage 
lpCritical 
lpError 

Definition at line 53 of file ErrorHandler.h.

00054     {
00055         lpDebug,
00056         lpMessage,
00057         lpCritical,
00058         lpError
00059     } LogPriority;


Constructor & Destructor Documentation

CSocketThreadManager::CSocketThreadManager ( HINSTANCE  hInstance  ) 

Definition at line 66 of file SocketThreadManager.cpp.

00066                                                               : CErrorHandler(),
00067                                                                   m_ulThreadCount(0),
00068                                                                   m_hInstance(hInstance),
00069                                                                   m_pThreadData(NULL),
00070                                                                   m_pCSection(NULL),
00071                                                                   m_bStaticClass(FALSE),
00072                                                                   m_bInitialized(FALSE)
00073 {
00074     try
00075     {
00076         //Set the class name
00077         SetName(CSocketThreadManager_Class);
00078 
00079         //Create the critical section
00080         m_pCSection=COSManager::CreateCriticalSection();
00081     }
00082     ERROR_HANDLER("CSocketThreadManager")
00083 }

CSocketThreadManager::~CSocketThreadManager (  )  [virtual]

Definition at line 96 of file SocketThreadManager.cpp.

00097 {
00098     try
00099     {
00100         //Are we initialized
00101         if (m_bInitialized)
00102             Uninitialize();
00103 
00104         //Delete the CS
00105         delete m_pCSection;
00106     }
00107     ERROR_HANDLER("~CSocketThreadManager")
00108 }


Member Function Documentation

void CSocketThreadManager::DecreaseSocketCount ( HWND  hWindowHandle,
BOOL  bFreeze = FALSE 
)

Definition at line 502 of file SocketThreadManager.cpp.

00504 {
00505     try
00506     {
00507         //First find the window handle
00508         int iIndex;
00509         iIndex=GetIndexByHWND(hWindowHandle);
00510 
00511         //Check it's valid
00512         if (!iIndex)
00513             return;
00514 
00515         //Enter the critical section
00516         CCriticalAutoRelease aRelease(m_pCSection);
00517 
00518         //Decrement the socket count
00519         if (m_pThreadData[iIndex-1].iSocketCount>0)
00520         {
00521             --m_pThreadData[iIndex-1].iSocketCount;
00522             m_pThreadData[iIndex-1].bFreeze=bFreeze;
00523         }
00524     }
00525     ERROR_HANDLER("DecreaseSocketCount")
00526 }

void CSocketThreadManager::DecreaseTimeoutCount ( HWND  hWindowHandle,
BOOL  bFreeze = FALSE 
)

Definition at line 528 of file SocketThreadManager.cpp.

00530 {
00531     try
00532     {
00533         //First find the window handle
00534         int iIndex;
00535         iIndex=GetIndexByHWND(hWindowHandle);
00536 
00537         //Check it's valid
00538         if (!iIndex)
00539             return;
00540 
00541         //Enter the critical section
00542         CCriticalAutoRelease aRelease(m_pCSection);
00543 
00544         //Decrement the socket count
00545         if (m_pThreadData[iIndex-1].iTimeoutCount>0)
00546         {
00547             --m_pThreadData[iIndex-1].iTimeoutCount;
00548             m_pThreadData[iIndex-1].bFreeze=bFreeze;
00549         }
00550     }
00551     ERROR_HANDLER("DecreaseTimeoutCount")
00552 }

std::string CErrorHandler::ErrorCodeToString ( DWORD  dwErrorCode  )  [static, inherited]

Definition at line 122 of file ErrorHandler.cpp.

00123 {
00124     try
00125     {
00126         //Get the error string
00127         LPVOID lpMsgBuf;
00128         FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
00129                       FORMAT_MESSAGE_FROM_SYSTEM | 
00130                       FORMAT_MESSAGE_IGNORE_INSERTS,
00131                       NULL,
00132                       dwErrorCode,
00133                       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
00134                       (LPTSTR) &lpMsgBuf,
00135                       0,
00136                       NULL);
00137 
00138         //Save it
00139         std::string sMessage;
00140         sMessage+=(char*)lpMsgBuf;
00141         
00142         //Release the buffer
00143         LocalFree(lpMsgBuf);
00144 
00145         //Done
00146         return sMessage;
00147     }
00148     catch (...)
00149     {
00150         return "Unknown";
00151     }
00152 }

const std::string & CSocketThreadManager::GetClassName (  )  const

Reimplemented from CErrorHandler.

Definition at line 901 of file SocketThreadManager.cpp.

00902 {
00903     return m_sClassName;
00904 }

std::string CErrorHandler::GetCurrentDateTime (  )  [static, inherited]

Definition at line 521 of file ErrorHandler.cpp.

00522 {
00523     try
00524     {
00525         //Our string
00526         std::string sDate;
00527 
00528         //Our tmp buf
00529         char cTmp[128];
00530 
00531         //Get date
00532         _strdate(cTmp);
00533         sDate=cTmp;
00534         sDate+=' ';
00535 
00536         //Get time
00537         _strtime(cTmp);
00538         sDate+=cTmp;
00539 
00540         //Done
00541         return sDate;
00542     }
00543     ERROR_HANDLER_STATIC_RETURN(CErrorHandler_Class,"GetCurrentDateTime","")
00544 }

HWND CSocketThreadManager::GetWindowHandle ( BOOL  bTimeout = FALSE  ) 

Definition at line 473 of file SocketThreadManager.cpp.

00474 {   
00475     try
00476     {
00477         //Shared resource
00478         CCriticalAutoRelease aRelease(m_pCSection);
00479     
00480         //Get the freeiest index
00481         int iIndex;
00482         iIndex=GetMostAvailableThread();
00483 
00484         //Check it's valid
00485         if (!iIndex)
00486             //Quit
00487             return 0;
00488     
00489         //Check what to increase
00490         if (bTimeout)
00491             ++m_pThreadData[iIndex-1].iTimeoutCount;
00492         else
00493             //Increase the socket count
00494             ++m_pThreadData[iIndex-1].iSocketCount;
00495 
00496         //Done
00497         return m_pThreadData[iIndex-1].hWindowHandle;
00498     }
00499     ERROR_HANDLER_RETURN("GetWindowHandle",0)
00500 }

BOOL CSocketThreadManager::Initialize ( unsigned long  ulThreadCount,
LPCSTR  lpClassName 
)

Definition at line 110 of file SocketThreadManager.cpp.

00112 {
00113     try
00114     {
00115         //Are we initialized?
00116         if (m_bInitialized)
00117         {
00118             //Report it
00119             ReportError("Initialize","Already initialized!");
00120 
00121             //Exit
00122             return FALSE;
00123         }
00124 
00125         //Check the number of threads
00126         if (ulThreadCount>MAX_THREADS)
00127         {
00128             //Report it
00129             ReportError("Initialize","Too many threads to spawn!");
00130 
00131             //Exit
00132             return FALSE;
00133         }
00134 
00135         //Check the number of threads
00136         if (!ulThreadCount)
00137         {
00138             //Report it
00139             ReportError("Initialize","Can't have zero threads!");
00140 
00141             //Exit
00142             return FALSE;
00143         }
00144 
00145         //Save the count
00146         m_ulThreadCount=ulThreadCount;
00147 
00148         //Try to spawn the threads
00149         return SpawnThreads(lpClassName);
00150     }
00151     ERROR_HANDLER_RETURN("Initialize",FALSE)
00152 }

CSocketThreadManager::TimerID CSocketThreadManager::RegisterTimeout ( int  iMS,
LPTimeoutProc  pProc,
LPVOID  pData,
BOOL  bClearTimeout = FALSE,
HWND  hHandle = NULL,
TimerID pTimer = NULL 
)

Definition at line 637 of file SocketThreadManager.cpp.

00643 {
00644     TimerID aTimerID;
00645     aTimerID.iIndex=0;
00646 
00647     try
00648     {
00649         //Do we have a timer ?
00650         if (pTimer)
00651             memset(pTimer,0,sizeof(TimerID));
00652 
00653         int iIndex;
00654 
00655         //Create the data structure (to save time on the CS)
00656         TimeoutData aData;
00657         aData.pTimeoutProc=pProc;
00658         aData.pData=pData;
00659         aData.bClearTimeout=bClearTimeout;
00660         aData.pTimer=pTimer;
00661 
00662         //Enter the CS
00663         CCriticalAutoRelease aRelease(m_pCSection);
00664 
00665         //Do we have a handle
00666         if (hHandle)
00667         {
00668             //Get it
00669             iIndex=GetIndexByHWND(hHandle);
00670 
00671             //Do we have it
00672             if (!iIndex)
00673             {
00674                 //Report it
00675                 ReportError("RegisterTimeout","Failed to find handle!");
00676 
00677                 //Exit
00678                 return aTimerID;
00679             }
00680             else
00681                 --iIndex;           
00682         }
00683         else
00684         {
00685             //Get the handler
00686             iIndex=GetMostAvailableThread();
00687 
00688             //Check it's legal
00689             if (!iIndex)
00690             {
00691                 //Report the error
00692                 ReportError("RegisterTimeout","Failed to find thread!");
00693 
00694                 //Quit
00695                 return aTimerID;
00696             }
00697 
00698             //Reset the index
00699             --iIndex;
00700         }
00701 
00702         //Our timer ID
00703         unsigned int iTimerID;
00704         iTimerID=0;
00705 
00706         //Timer counter
00707         static int sTimerCounter=1000000;
00708 
00709         //Get the timerID
00710         int iSetTimerID;
00711         iSetTimerID=sTimerCounter++;
00712 
00713         //Lock the thread data
00714         CCriticalAutoRelease aRelease2(m_pThreadData[iIndex].pCSection);
00715 
00716         //Increase the timeout count
00717         ++m_pThreadData[iIndex].iTimeoutCount;
00718 
00719         //Register the data
00720         m_pThreadData[iIndex].pMap.insert(TOMap::value_type(iSetTimerID,aData));
00721 
00722         //Exit the CS
00723         aRelease2.Exit();
00724         aRelease.Exit();
00725 
00726         //Register the timeout
00727         iTimerID=SetTimer(m_pThreadData[iIndex].hWindowHandle,
00728                           iSetTimerID,
00729                           iMS,
00730                           NULL);
00731 
00732         //Check we have the timer
00733         if (!iTimerID)
00734         {
00735             {
00736                 //Remove it
00737                 //Lock the thread data
00738                 CCriticalAutoRelease aRelease2(m_pThreadData[iIndex].pCSection);
00739 
00740                 //Increase the timeout count
00741                 --m_pThreadData[iIndex].iTimeoutCount;
00742 
00743                 //Register the data
00744                 m_pThreadData[iIndex].pMap.erase(iSetTimerID);
00745             }
00746 
00747             //Write the error
00748             ReportError("RegisterTimeout","Failed to create the timer!");
00749 
00750             //Quit
00751             return aTimerID;
00752         }
00753 
00754         //Create the data
00755         aTimerID.iTimerID=iSetTimerID;
00756         aTimerID.iIndex=iIndex+1;
00757         aTimerID.iMS=iMS;
00758 
00759         //Do we have a timer ?
00760         if (pTimer)
00761             memcpy(pTimer,&aTimerID,sizeof(aTimerID));
00762 
00763         //Done
00764         return aTimerID;
00765     }
00766     ERROR_HANDLER_RETURN("RegisterTimeout",aTimerID)
00767 }

BOOL CSocketThreadManager::RemoveTimeout ( TimerID aTimerID  ) 

Definition at line 769 of file SocketThreadManager.cpp.

00770 {
00771     //Check it's a valid timeout
00772     if (!aTimerID.iIndex)
00773     {
00774         //Write the error
00775         ReportError("RemoveTimeout","Received invalid TimerID");
00776 
00777         //Quit
00778         return FALSE;
00779     }
00780 
00781     try
00782     {
00783         //Our timer ID
00784         TimerID aID;
00785         aID=aTimerID;
00786 
00787         {
00788             //Lock the timeout manager
00789             CCriticalAutoRelease aRelease(m_pThreadData[aID.iIndex-1].pCSection);
00790 
00791             //Check the ID now
00792             if (!aTimerID.iIndex)
00793                 return TRUE;
00794 
00795             //No remove from the map
00796             m_pThreadData[aTimerID.iIndex-1].pMap.erase(aTimerID.iTimerID);
00797 
00798             //Decrease the count
00799             --m_pThreadData[aTimerID.iIndex-1].iTimeoutCount;
00800 
00801             //Set the old timer ID
00802             aTimerID.iIndex=0;
00803             aTimerID.iMS=0;
00804             aTimerID.iTimerID=0;
00805         }
00806 
00807         //First unregister the timer
00808         if (!KillTimer(m_pThreadData[aID.iIndex-1].hWindowHandle,
00809                        aID.iTimerID))
00810             //Report it
00811             ReportErrorOS("RemoveTimeout","Failed to delete timer!");
00812 
00813         //Done 
00814         return TRUE;
00815     }
00816     ERROR_HANDLER_RETURN("RemoveTimeout",FALSE)
00817 }

void CErrorHandler::ReportError ( const std::string &  rMethod,
const std::string &  rMessage,
int  iErrorCode 
) const [protected, virtual, inherited]

Definition at line 154 of file ErrorHandler.cpp.

00157 {
00158     if (!GetLog())
00159         return;
00160 
00161     try
00162     {
00163         //Get the log
00164         CErrorLog* pLog;
00165         pLog=GetLog();
00166 
00167         //Convert the error code
00168         char aTmp[11];
00169         sprintf(aTmp,"%d",iErrorCode);
00170 
00171         //Get the string for it
00172         std::string sError;
00173         sError=rMessage;
00174         sError+=", and Socket error: ";
00175         sError+=aTmp;
00176         sError+=", ";
00177         sError+=ErrorCodeToString(iErrorCode);
00178 
00179         //Report to the log
00180         pLog->ReportError(m_sClassName,
00181                           rMethod,
00182                           sError);
00183     }
00184     ERROR_UNKNOWN("ReportError")
00185 }

void CErrorHandler::ReportError ( const std::string &  rMethod,
int  iErrorCode 
) const [protected, virtual, inherited]

Definition at line 187 of file ErrorHandler.cpp.

00189 {
00190     if (!GetLog())
00191         return;
00192 
00193     try
00194     {
00195         //Get the log
00196         CErrorLog* pLog;
00197         pLog=GetLog();
00198 
00199         //Convert the error code
00200         char aTmp[11];
00201         sprintf(aTmp,"%d",iErrorCode);
00202 
00203         //Get the string for it
00204         std::string sError;
00205         sError="Socket error: ";
00206         sError+=aTmp;
00207         sError+=", ";
00208         sError+=ErrorCodeToString(iErrorCode);
00209 
00210         //Report to the log
00211         pLog->ReportError(m_sClassName,
00212                           rMethod,
00213                           sError);
00214     }
00215     ERROR_UNKNOWN("ReportError")
00216 }

void CErrorHandler::ReportError ( const std::string &  rMethod,
const std::string &  rMessage,
DWORD  dwAdditionalData 
) const [protected, virtual, inherited]

Definition at line 275 of file ErrorHandler.cpp.

00278 {
00279     if (!GetLog())
00280         return;
00281 
00282     try
00283     {
00284         //Get the log
00285         CErrorLog* pLog;
00286         pLog=GetLog();
00287 
00288         //Convert the number
00289         char aTmp[11];
00290         ltoa(dwAdditionalData,aTmp,10);
00291 
00292         //Create the new message
00293         std::string sNewMessage(rMessage);
00294         sNewMessage+="Additional data: ";
00295         sNewMessage+=aTmp;
00296 
00297         //Report to the log
00298         pLog->ReportError(m_sClassName,
00299                           rMethod,
00300                           sNewMessage);
00301     }
00302     ERROR_UNKNOWN("ReportError")
00303 }

void CErrorHandler::ReportError ( const std::string &  rMethod,
const std::string &  rMessage 
) const [protected, virtual, inherited]

Definition at line 218 of file ErrorHandler.cpp.

00220 {
00221     if (!GetLog())
00222         return;
00223 
00224     try
00225     {
00226         CErrorLog* pLog;
00227         pLog=GetLog();
00228 
00229         //Report to the log
00230         pLog->ReportError(m_sClassName,
00231                           rMethod,
00232                           rMessage);
00233     }
00234     ERROR_UNKNOWN("ReportError")
00235 }

void CErrorHandler::ReportError ( const std::string &  rMethod  )  const [protected, virtual, inherited]

Definition at line 311 of file ErrorHandler.cpp.

00312 {
00313     if (!GetLog())
00314         return;
00315 
00316     try
00317     {
00318 #ifdef WIN32
00319         //Get the last error
00320         DWORD dwLastError;
00321         dwLastError=GetLastError();
00322 
00323         //Report the error
00324         GetLog()->ReportError(m_sClassName,
00325                               rMethod,
00326                               ErrorCodeToString(dwLastError));
00327 
00328 #else
00329         GetLog()->ReportCatchError(m_sClassName,
00330                                    rMethod,
00331                                    "Unknown error!");
00332 #endif
00333     }
00334     ERROR_UNKNOWN("ReportError")
00335 }

void CErrorHandler::ReportErrorOS ( const std::string &  rMethod,
const std::string &  rMessage 
) const [protected, virtual, inherited]

Definition at line 237 of file ErrorHandler.cpp.

00239 {
00240     if (!GetLog())
00241         return;
00242 
00243     try
00244     {
00245         //Get the last error
00246         DWORD dwLastError;
00247         dwLastError=GetLastError();
00248 
00249         //Format the message
00250         std::string sMessage;
00251         sMessage=rMessage;
00252         sMessage+=", with error code: ";
00253 
00254         //Convert the error code
00255         char aTmp[11];
00256         itoa(dwLastError,aTmp,10);
00257 
00258         //Add it again
00259         sMessage+=aTmp;
00260         sMessage+=" ";
00261         sMessage+=ErrorCodeToString(dwLastError);
00262         
00263         //Get the log
00264         CErrorLog* pLog;
00265         pLog=GetLog();
00266 
00267         //Report to the log
00268         pLog->ReportError(m_sClassName,
00269                           rMethod,
00270                           sMessage);
00271     }
00272     ERROR_UNKNOWN("ReportErrorOS")
00273 }

void CErrorHandler::ReportStaticError ( const std::string &  rClass,
const std::string &  rMethod,
const std::string &  rMessage,
DWORD  dwAdditionalData 
) [static, protected, inherited]

Definition at line 489 of file ErrorHandler.cpp.

00493 {
00494     if (!m_pLog)
00495         return;
00496 
00497     try
00498     {
00499         //Convert the number
00500         char aTmp[11];
00501         ltoa(dwAdditionalData,aTmp,10);
00502 
00503         //Create the new message
00504         std::string sNewMessage(rMessage);
00505         sNewMessage+="Additional data: ";
00506         sNewMessage+=aTmp;
00507 
00508         //Report to the log
00509         m_pLog->ReportError(rClass,
00510                             rMethod,
00511                             sNewMessage);
00512     }
00513     ERROR_UNKNOWN("ReportStaticError")
00514 }

void CErrorHandler::ReportStaticError ( const std::string &  rClass,
const std::string &  rMethod,
const std::string &  rMessage 
) [static, protected, inherited]

Definition at line 472 of file ErrorHandler.cpp.

00475 {
00476     if (!m_pLog)
00477         return;
00478 
00479     try
00480     {
00481         //Report to the log
00482         m_pLog->ReportError(rClass,
00483                             rMethod,
00484                             rMessage);
00485     }
00486     ERROR_UNKNOWN("ReportStaticError")
00487 }

void CErrorHandler::ReportStaticError ( const std::string &  rClass,
const std::string &  rMethod 
) [static, protected, inherited]

Definition at line 446 of file ErrorHandler.cpp.

00448 {
00449     if (!m_pLog)
00450         return;
00451 
00452     try
00453     {
00454 #ifdef WIN32
00455         //Get the last error
00456         DWORD dwLastError;
00457         dwLastError=GetLastError();
00458 
00459         //Report the error
00460         m_pLog->ReportError(rClass,
00461                             rMethod,
00462                             ErrorCodeToString(dwLastError));
00463 #else
00464         m_pLog->ReportError(rClass,
00465                             rMethod,
00466                             "Unknown error!");
00467 #endif
00468     }
00469     ERROR_UNKNOWN("ReportStaticError")
00470 }

BOOL CSocketThreadManager::ReSetTimeout ( const TimerID rTimerID  ) 

Definition at line 870 of file SocketThreadManager.cpp.

00871 {
00872     //Check if anyone is smartass
00873     if (!rTimerID.iTimerID)
00874     {
00875         //Report it
00876         ReportError("ReSetTimeout","Someone send an empty TimerID!");
00877 
00878         //And exit
00879         return FALSE;
00880     }
00881 
00882     try
00883     {
00884         //Reset the timer
00885         int iResult;
00886         iResult=SetTimer(m_pThreadData[rTimerID.iIndex-1].hWindowHandle,
00887                          rTimerID.iTimerID,
00888                          rTimerID.iMS,
00889                          NULL);
00890 
00891         //Check the result
00892         if (!iResult)
00893             ReportError("ReSetTimeout","Failed to reset the timeout!");
00894 
00895         //Done
00896         return iResult!=0;
00897     }
00898     ERROR_HANDLER_RETURN("ReSetTimeout",FALSE)
00899 }

void CErrorHandler::SetLocalLog ( CErrorLog pLog  )  [inherited]

Definition at line 441 of file ErrorHandler.cpp.

00442 {
00443     m_pLocalLog=pLog;
00444 }

void CErrorHandler::SetLog ( CErrorLog pLog  )  [static, inherited]

Definition at line 305 of file ErrorHandler.cpp.

00306 {
00307     //Save the new log
00308     m_pLog=pLog;
00309 }

void CErrorHandler::SetName ( const std::string &  rName  )  const [protected, inherited]

Definition at line 116 of file ErrorHandler.cpp.

00117 {
00118     //Save the class name
00119     m_sClassName=rName;
00120 }

BOOL CSocketThreadManager::Uninitialize (  ) 

Definition at line 154 of file SocketThreadManager.cpp.

00155 {
00156     try
00157     {
00158         //Are we initialized?
00159         if (!m_bInitialized)
00160         {
00161             //Report it
00162             ReportError("Initialize","Not initialized!");
00163 
00164             //Exit
00165             return FALSE;
00166         }
00167 
00168         //Are we a static class
00169         if (m_bStaticClass)
00170             //Deallocate the class
00171             UnregisterClass();
00172         else
00173             //Delete the thread data
00174             CleanThreads(FALSE);
00175 
00176         //Done
00177         return TRUE;
00178     }
00179     ERROR_HANDLER_RETURN("Uninitialize",FALSE)
00180 }

void CErrorHandler::WriteMessage ( const std::string &  rMethod,
const std::string &  rMessage,
DWORD  dwAdditionalData,
LogPriority  aPriority = lpMessage 
) [protected, inherited]

Definition at line 355 of file ErrorHandler.cpp.

00359 {
00360     if (!GetLog())
00361         return;
00362 
00363     try
00364     {
00365         //Convert the number
00366         char aTmp[11];
00367         ltoa(dwAdditionalData,aTmp,10);
00368 
00369         //Create the new message
00370         std::string sNewMessage(rMessage);
00371         sNewMessage+="Additional data: ";
00372         sNewMessage+=aTmp;
00373 
00374         //Delegate the call
00375         GetLog()->WriteMessage(m_sClassName,
00376                                rMethod,
00377                                sNewMessage,
00378                                aPriority);
00379     }
00380     ERROR_UNKNOWN("WriteMessage")
00381 }

void CErrorHandler::WriteMessage ( const std::string &  rMethod,
const std::string &  rMessage,
LogPriority  aPriority = lpMessage 
) [protected, inherited]

Definition at line 337 of file ErrorHandler.cpp.

00340 {
00341     if (!GetLog())
00342         return;
00343 
00344     try
00345     {
00346         //Delegate the call
00347         GetLog()->WriteMessage(m_sClassName,
00348                                rMethod,
00349                                rMessage,
00350                                aPriority);
00351     }
00352     ERROR_UNKNOWN("WriteMessage")
00353 }

void CErrorHandler::WriteStaticMessage ( const std::string &  rClass,
const std::string &  rMethod,
const std::string &  rMessage,
DWORD  dwAdditionalData,
LogPriority  aPriority = lpMessage 
) [static, protected, inherited]

Definition at line 403 of file ErrorHandler.cpp.

00408 {
00409     if (!m_pLog)
00410         return;
00411 
00412     try
00413     {
00414         //Convert the number
00415         char aTmp[11];
00416         ltoa(dwAdditionalData,aTmp,10);
00417 
00418         //Create the new message
00419         std::string sNewMessage(rMessage);
00420         sNewMessage+="Additional data: ";
00421         sNewMessage+=aTmp;
00422 
00423         //Delegate the call
00424         m_pLog->WriteMessage(rClass,
00425                              rMethod,
00426                              sNewMessage,
00427                              aPriority);
00428     }
00429     ERROR_UNKNOWN("WriteStaticMessage")
00430 }

void CErrorHandler::WriteStaticMessage ( const std::string &  rClass,
const std::string &  rMethod,
const std::string &  rMessage,
LogPriority  aPriority = lpMessage 
) [static, protected, inherited]

Definition at line 383 of file ErrorHandler.cpp.

00388 {
00389     if (!m_pLog)
00390         return;
00391 
00392     try
00393     {
00394         //Delegate the call
00395         m_pLog->WriteMessage(rClass,
00396                              rMethod,
00397                              rMessage,
00398                              aPriority);
00399     }
00400     ERROR_UNKNOWN("WriteStaticMessage")
00401 }


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