connectivity/com.nokia.tcf/native/TCFNative/TCFServer/Connection.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 // Connection.h: interface for the CConnection class.
       
    18 // Implemented by CConnectionImpl
       
    19 //
       
    20 // one of these per connection
       
    21 //
       
    22 //////////////////////////////////////////////////////////////////////
       
    23 
       
    24 #if !defined(AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_)
       
    25 #define AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_
       
    26 
       
    27 #if _MSC_VER > 1000
       
    28 #pragma once
       
    29 #endif // _MSC_VER > 1000
       
    30 
       
    31 #include "ServerClient.h"
       
    32 #include "TCErrorConstants.h"
       
    33 #include "Client.h"
       
    34 #include "Registry.h"
       
    35 #include "BaseCom.h"
       
    36 #include <vector>
       
    37 #include <time.h>
       
    38 
       
    39 // basename is suffixed with connection ID to make it unique per CConnection
       
    40 #define MESSAGEPROCESSOR_EXITEVENT_BASENAME	"TCFServerMessageProcessorExittedEvent"
       
    41 #define MESSAGEPROCESSOR_STOPEVENT_BASENAME	"TCFServerMessageProcessorStoppedEvent"
       
    42 #define MESSAGEPROCESSOR_STARTEVENT_BASENAME	"TCFServerMessageProcessorStartedEvent"
       
    43 #define MESSAGEPROCESSOR_EVENTWAIT_TIMEOUT	60000L
       
    44 
       
    45 typedef std::vector<CClient*> ClientList;
       
    46 
       
    47 // m_MessageProcessorState states
       
    48 #define MP_NONE (0)
       
    49 #define MP_EXIT (1)
       
    50 #define MP_START (2)
       
    51 #define MP_PAUSE (3)
       
    52 #define MP_PROCESSING (4)
       
    53 
       
    54 
       
    55 #define FLUSH_TIME		(100)		// 100 ms
       
    56 class CConnection  
       
    57 {
       
    58 public:
       
    59 	CConnection();
       
    60 	CConnection(ConnectData conData, DWORD connectionId);
       
    61 	virtual ~CConnection();
       
    62 
       
    63 	virtual BOOL IsEqual(CConnection* connection)=0;
       
    64 	virtual BOOL IsEqual(pConnectData pConData)=0;
       
    65 	virtual long GetConnectionId() { return m_ConnectionID; }
       
    66 	virtual BOOL ExitProcessing()=0;				// exit processing thread
       
    67 	virtual long DoDisconnect()=0;
       
    68 	virtual void NotifyClientsCommError(long tcfError, bool passOsError=false, DWORD osError=0)=0;
       
    69 	long m_ConnectionID;			// id for this connection
       
    70 
       
    71 	ConnectData* m_ConnectSettings;	// connection settings
       
    72 };
       
    73 
       
    74 #endif // !defined(AFX_CONNECTION_H__C7E97807_97B0_4BF7_AEC7_FA246A751509__INCLUDED_)