Download Source Code

CNetMgr Class Reference

Top level network class. More...

#include <NetMgr.h>

Inheritance diagram for CNetMgr:

Inheritance graph
[legend]
Collaboration diagram for CNetMgr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

THList< GUID, CNetCom >::iterator RemoveNode (THList< GUID, CNetCom >::iterator itNode)
 Disconnects and removes the specified network session.
BOOL RemoveUpdateNotification (const GUID *pguidNode, const GUID *pguidClass, DWORD dwCmd)
 Removes update notifications for the specified class and command.
BOOL CleanupNotifications ()
 Removes invalid sessions from the message map.
virtual BOOL NotifyNetwork (const GUID *pguidClass, DWORD dwCmd)
 Sends the specified notification message to network.
BOOL AddUpdateNotification (const GUID *pguidNode, const GUID *pguidClass, DWORD dwCmd)
 Includes the specified session to receive described update messages.
void BootNode (CNetCom *pNode)
 Disconnects the specified session.
void BootNode (const GUID *pNode)
 Disconnects the specified node.
CNetComCreateNewSession ()
 Creates a new unconnected network session.
BOOL InitSession (CNetCom *pNc)
 Initializes the specified network session object.
BOOL Cleanup ()
 Removes disconnected sessions from the list.
void Destroy ()
 Closes all sessions and the network server.
CNetComFindSession (const GUID *guidId)
 Returns the session object for a given session ID.
CNetComAddSession (const GUID *guidId)
 Adds a session with the specified ID to the network.
CNetComAddSession (const GUID *guidId, CNetCom *pNc)
 Adds a session with the specified ID to the network.
 CNetMgr ()
 Default contstructor.
virtual ~CNetMgr ()
 Destructor.
long OnNetMsg (WPARAM wParam, LPARAM lParam, const GUID *pGuid)
 Relays network messages to appropriate dispatch objects.
virtual CNetComCreateSessionObject ()=0
 Create a new CNetCom derived session object.
virtual BOOL OnAuthenticate (CNetCom *pNc)
 Over-ride to supply custom authentication.
virtual CNetComGetNode (const GUID *pGuid)
 Returns a pointer to the specified session.
virtual CNetComFindByRxName (LPCTSTR pName)
 Finds the session by its remote session name.
virtual CNetComFindByTxName (LPCTSTR pName)
 Finds the session by its local session name.
DWORD GetNumConnections ()
 Returns the number of connected sessions.
void SetGlobalDescription (LPCTSTR pDescription)
 Sets the description of this network object.
LPCTSTR GetGlobalDescription ()
 Returns our network description string.
THList< GUID, CNetCom > * GetSessionList ()
 Returns a pointer to the network session list.
 operator CTlLock * ()
 Returns a pointer to the thread lock.

Static Public Member Functions

static long NetMsg (LPVOID pData, WPARAM wParam, LPARAM lParam, const GUID *pGuid)

Detailed Description

Top level network class.

Provides the network server and manages multiple connected clients. Routes communications and handles message callbacks.


Member Function Documentation

CNetCom * CNetMgr::AddSession const GUID *  guidId,
CNetCom pNc
 

Adds a session with the specified ID to the network.

Parameters:
[in] guidId - Session ID
[in] pNc - Session object to add to list
Returns:
Pointer to session object in pNc or NULL if error
See also:

CNetCom * CNetMgr::AddSession const GUID *  guidId  ) 
 

Adds a session with the specified ID to the network.

Parameters:
[in] guidId - Session ID
Returns:
Pointer to session object or NULL if failed
See also:

BOOL CNetMgr::AddUpdateNotification const GUID *  pguidNode,
const GUID *  pguidClass,
DWORD  dwCmd
 

Includes the specified session to receive described update messages.

Parameters:
[in] pguidNode - Session wanting updates
[in] pguidClass - Class ID
[in] dwCmd - Command ID
Returns:
Non-zero if success
See also:

void CNetMgr::BootNode const GUID *  pNode  )  [inline]
 

Disconnects the specified node.

Parameters:
[in] pNode - Network ID of session to boot

void CNetMgr::BootNode CNetCom pNode  )  [inline]
 

Disconnects the specified session.

Parameters:
[in] pNode - Pointer to session

BOOL CNetMgr::Cleanup  ) 
 

Removes disconnected sessions from the list.

Returns:
Non-zero if success
See also:

BOOL CNetMgr::CleanupNotifications  ) 
 

Removes invalid sessions from the message map.

Returns:
Non-zero if success

CNetCom * CNetMgr::CreateNewSession  ) 
 

Creates a new unconnected network session.

Returns:
See also:

virtual CNetCom* CNetMgr::CreateSessionObject  )  [pure virtual]
 

Create a new CNetCom derived session object.

Returns:
Pointer to new session object or NULL if failure
See also:

CNetCom * CNetMgr::FindByRxName LPCTSTR  pName  )  [virtual]
 

Finds the session by its remote session name.

Parameters:
[in] pName - Name of the remote session object.
Returns:
Pointer to network session or NULL if not found
See also:

Implements CNetCmd.

CNetCom * CNetMgr::FindByTxName LPCTSTR  pName  )  [virtual]
 

Finds the session by its local session name.

Parameters:
[in] pName - Name of the local session object.
Returns:
Pointer to network session or NULL if not found
See also:

Implements CNetCmd.

CNetCom * CNetMgr::FindSession const GUID *  guidId  ) 
 

Returns the session object for a given session ID.

Parameters:
[in] guidId - Session ID
Returns:
Pointer to session object or NULL if failed
See also:

LPCTSTR CNetMgr::GetGlobalDescription  )  [inline]
 

Returns our network description string.

Returns:
See also:

CNetCom * CNetMgr::GetNode const GUID *  pGuid  )  [virtual]
 

Returns a pointer to the specified session.

Parameters:
[in] pGuid - Session ID
Returns:
Pointer to network session or NULL if not found
See also:

Implements CNetCmd.

BOOL CNetMgr::InitSession CNetCom pNc  ) 
 

Initializes the specified network session object.

Parameters:
[in] pNc - Pointer to network session object
Returns:
Non-zero if success
See also:

long CNetMgr::NetMsg LPVOID  pData,
WPARAM  wParam,
LPARAM  lParam,
const GUID *  pGuid
[static]
 

Parameters:
[in] pData - User data, usually class pointer.
[in] wParam - Message WPARAM
[in] lParam - Message LPARAM
[in] pGuid - Class ID
Returns:
Message specific return code

BOOL CNetMgr::NotifyNetwork const GUID *  pguidClass,
DWORD  dwCmd
[virtual]
 

Sends the specified notification message to network.

Parameters:
[in] pguidClass - Class ID
[in] dwCmd - Command ID
Returns:
Non-zero if success
See also:

Reimplemented from CNetCmd.

virtual BOOL CNetMgr::OnAuthenticate CNetCom pNc  )  [inline, virtual]
 

Over-ride to supply custom authentication.

Parameters:
[in] pNc - Network session to authenticate
Over-ride this function and provide custom login functionality. Query the session object for attributes and return non-zero to allow the connection. Zero will cause an 'Access Denied' message to be sent to the session, then it is immediately disconnected.

Returns:
Return non-zero to allow the session to connect
See also:

long CNetMgr::OnNetMsg WPARAM  wParam,
LPARAM  lParam,
const GUID *  pGuid
 

Relays network messages to appropriate dispatch objects.

Parameters:
[in] wParam - Message WPARAM
[in] lParam - Message LPARAM
[in] pGuid - Class ID
Returns:
Message specific return code
See also:

THList< GUID, CNetCom >::iterator CNetMgr::RemoveNode THList< GUID, CNetCom >::iterator  itNode  ) 
 

Disconnects and removes the specified network session.

Parameters:
[in] itNode - Network session
Returns:
Pointer to previous session
See also:

BOOL CNetMgr::RemoveUpdateNotification const GUID *  pguidNode,
const GUID *  pguidClass,
DWORD  dwCmd
 

Removes update notifications for the specified class and command.

Parameters:
[in] pguidNode - Session requesting removal
[in] pguidClass - Class ID of unwanted message
[in] dwCmd - Unwanted command ID
Returns:
Non-zero if success
See also:

void CNetMgr::SetGlobalDescription LPCTSTR  pDescription  )  [inline]
 

Sets the description of this network object.

Parameters:
[in] pDescription - Our session description.
This is the description other networks will receive upon connecting to our machine.


The documentation for this class was generated from the following files:
  • inc/NetMgr.h
  • NetMgr.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL