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 "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: MBPProtocol interface, defines basics for all the protocols |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MBPPROTOCOL_H |
|
21 #define MBPPROTOCOL_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32def.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "MSocketWriter.h" |
|
28 |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * MBPProtocol interface. |
|
34 */ |
|
35 NONSHARABLE_CLASS( MBPProtocol ) |
|
36 { |
|
37 |
|
38 public: // Abstract functions |
|
39 |
|
40 /** |
|
41 * Tries to handle the message, responds if it can do it |
|
42 * |
|
43 * @param aData Data to be interpreted |
|
44 * @param aStartPos The index from where the message frame begins |
|
45 * @param aLength Length of the message |
|
46 * @return ETrue if protocol can handle the msg, otherwise EFalse |
|
47 */ |
|
48 virtual TBool HandleReceivedDataL( TDes8& aData, |
|
49 TInt& aStartPos, |
|
50 TInt& aLength ) = 0; |
|
51 |
|
52 /** |
|
53 * Packs data to frame and sends the frame. |
|
54 * @param aSocketWriter Object that executes the writing. |
|
55 * @param aPeerPort Peer's TCP port. |
|
56 * @param aOriginalPort Original TCP port. |
|
57 * @param aData Data to be sent. |
|
58 */ |
|
59 virtual void WriteFrameL( MSocketWriter& aSocketWriter, |
|
60 TUint aPeerPort, TUint aOriginalPort, const TDesC8& aData ) const = 0; |
|
61 |
|
62 /** Virtual destructor |
|
63 * |
|
64 */ |
|
65 virtual ~MBPProtocol() {}; |
|
66 }; |
|
67 |
|
68 #endif // MBPPROTOCOL_H |
|
69 |
|
70 // End of File |
|