connectivity/com.nokia.tcf/native/TCFNative/TCFCommTCP/TCFCommTCP.cpp
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 // TCFCommTCP.cpp : Defines the entry point for the DLL application.
       
    18 //
       
    19 
       
    20 #include "stdafx.h"
       
    21 #include <sys/stat.h>
       
    22 #include "TCFCommTCP.h"
       
    23 #include "TcpComm.h"
       
    24 
       
    25 static const char* pCommType="tcp";
       
    26 static CBaseCom* pCommClass=NULL;
       
    27 #ifdef _DEBUG
       
    28 BOOL gDoLogging = FALSE;
       
    29 #endif
       
    30 
       
    31 BOOL APIENTRY DllMain( HANDLE hModule, 
       
    32                        DWORD  ul_reason_for_call, 
       
    33                        LPVOID lpReserved
       
    34 					 )
       
    35 {
       
    36     switch (ul_reason_for_call)
       
    37 	{
       
    38 		case DLL_PROCESS_ATTACH:
       
    39 			{
       
    40 #ifdef _DEBUG
       
    41 				struct _stat buf;
       
    42 				char* dirname = "c:\\tcf";
       
    43 				int result = _stat(dirname, &buf);
       
    44 				if (result == 0) // exists
       
    45 				{
       
    46 					gDoLogging = TRUE;
       
    47 				}
       
    48 				else
       
    49 				{
       
    50 					gDoLogging = FALSE;
       
    51 				}
       
    52 #endif
       
    53 			}
       
    54 			break;
       
    55 		case DLL_THREAD_ATTACH:
       
    56 		case DLL_THREAD_DETACH:
       
    57 		case DLL_PROCESS_DETACH:
       
    58 			break;
       
    59     }
       
    60     return TRUE;
       
    61 }
       
    62 
       
    63 // register this connection type
       
    64 TCFCOMMTCP_API const char* RegisterComm()
       
    65 {
       
    66 	return pCommType;
       
    67 }
       
    68 
       
    69 // create this connection type
       
    70 TCFCOMMTCP_API CBaseCom* CreateComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol)
       
    71 {
       
    72 	pCommClass = new CTcpComm(connectSettings, connectionId, protocol);
       
    73 
       
    74 	return pCommClass;
       
    75 }
       
    76