connectivity/com.nokia.tcf/native/TCFNative/TCFServer/ServerManager.h
changeset 60 9d2210c8eed2
equal deleted inserted replaced
59:c892c53c664e 60:9d2210c8eed2
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 // ServerManager.h: interface for the CServerManager class.
       
    18 //
       
    19 // Only one of these exists
       
    20 //
       
    21 //////////////////////////////////////////////////////////////////////
       
    22 
       
    23 #if !defined(AFX_SERVERMANAGER_H__30A5EF01_35BA_4B83_AA68_91F7DA0249B7__INCLUDED_)
       
    24 #define AFX_SERVERMANAGER_H__30A5EF01_35BA_4B83_AA68_91F7DA0249B7__INCLUDED_
       
    25 
       
    26 #include "ServerClient.h"
       
    27 #include "TCErrorConstants.h"
       
    28 #include "TCDebugLog.h"
       
    29 #include "Connection.h"
       
    30 #include "Client.h"
       
    31 #include "ProtocolRegistryItem.h"
       
    32 #include "CommRegistryItem.h"
       
    33 #include <vector>
       
    34 
       
    35 #if _MSC_VER > 1000
       
    36 #pragma once
       
    37 #endif // _MSC_VER > 1000
       
    38 
       
    39 typedef std::vector<CConnection*> ConnectionList;
       
    40 typedef std::vector<CClient*> ClientList;
       
    41 typedef std::vector<CProtocolRegistryItem*> ProtocolRegistry;
       
    42 typedef std::vector<CCommRegistryItem*> CommRegistry;
       
    43 
       
    44 #define MAX_EXEPATHNAME (2048)
       
    45 
       
    46 #ifdef _WIN32
       
    47 #define PATH_DELIMITER '\\'
       
    48 #else
       
    49 #error not Windows
       
    50 #endif
       
    51 
       
    52 class CServerManager  
       
    53 {
       
    54 public:
       
    55 	CServerManager();
       
    56 	virtual ~CServerManager();
       
    57 	CServerManager(const char* exeLocation);
       
    58 
       
    59 	void CommandThread();
       
    60 	CConnection* FindConnection(pConnectData pConData);
       
    61 	CConnection* FindConnection(long index);
       
    62 	CClient* FindClient(DWORD id);
       
    63 	BOOL RemoveClient(CClient* client);		// remove from m_ClientList
       
    64 	BOOL RemoveConnection(CConnection* conn);	// remove from m_ConnectionList
       
    65 	void DoShutdown();
       
    66 private:
       
    67 	void RegisterAllProtocols();
       
    68 	void RegisterAllComms();
       
    69 	void UnRegisterAllProtocols();
       
    70 	void UnRegisterAllComms();
       
    71 	const char* FindProtocolPath(char* protocolType);
       
    72 	const char* FindCommPath(char* commType);
       
    73 
       
    74 public:
       
    75 	CServerCommand* m_Server;			// client/server commands/responses
       
    76 	TCDebugLog* m_DebugLog;
       
    77 	ConnectionList* m_ConnectionList;	// all connections
       
    78 	ClientList* m_ClientList;			// all clients
       
    79 	DWORD m_NextClientId;				// next client ID
       
    80 	DWORD m_NextConnectionId;			// next connection ID
       
    81 	char m_Version[MAX_VERSION_STRING]; // our version string
       
    82 	ProtocolRegistry* m_ProtocolList;	// protocols (e.g., OST, etc)
       
    83 	CommRegistry* m_CommList;			// comm connections (e.g., TCP, etc)
       
    84 	char* m_ExeLocation;				// current location of TCFServer
       
    85 };
       
    86 
       
    87 #endif // !defined(AFX_SERVERMANAGER_H__30A5EF01_35BA_4B83_AA68_91F7DA0249B7__INCLUDED_)