connectivity/com.nokia.tcf/native/TCFNative/TCFServer/BaseProtocol.h
changeset 60 9d2210c8eed2
child 458 70467d598794
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 // BaseProtocol.h: interface for the CBaseProtocol class.
       
    18 //
       
    19 //////////////////////////////////////////////////////////////////////
       
    20 
       
    21 #if !defined(AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_)
       
    22 #define AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_
       
    23 
       
    24 #if _MSC_VER > 1000
       
    25 #pragma once
       
    26 #endif // _MSC_VER > 1000
       
    27 
       
    28 class CBaseProtocol  
       
    29 {
       
    30 public:
       
    31 	CBaseProtocol();
       
    32 	virtual ~CBaseProtocol();
       
    33 
       
    34 	// used to decode a message into header/message parts
       
    35 	virtual BOOL DecodeMessage(BYTE* fullMessage, DWORD& fullLength, BYTE& msgId, BYTE*& rawMessage, DWORD& rawLength)=0;
       
    36 
       
    37 	// used to encode a raw message (prefixes any protocol headers)
       
    38 	virtual DWORD EncodeMessage(BYTE* rawMessage, DWORD rawLength, BYTE protocolVersion, BYTE msgId, BYTE* fullMessage, DWORD maxFullLength)=0;
       
    39 
       
    40 	// used to query how many bytes the header is so the caller can allocate enough memory
       
    41 	virtual DWORD GetHeaderLength()=0;
       
    42 
       
    43 };
       
    44 
       
    45 typedef const char* (*PROTOCOLREGISTER)(void);
       
    46 typedef CBaseProtocol* (*PROTOCOLCREATE)(void);
       
    47 
       
    48 #define PROTOCOLREGISTER_FNNAME	"RegisterProtocol"
       
    49 #define PROTOCOLCREATE_FNNAME	"CreateProtocol"
       
    50 
       
    51 #define PROTOCOLDLL_BASENAME	"TCFProt"
       
    52 
       
    53 #endif // !defined(AFX_BASEPROTOCOL_H__EABB80B6_353C_45AE_8976_AE0C0D93AC84__INCLUDED_)