hti/HtiServicePlugins/HtiIpProxyServicePlugin/IPProxyEngine/Src/CProtocolUDP.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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:  UDP protocol implementation for IP proxy
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPROTOCOLUDP_H
       
    21 #define CPROTOCOLUDP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "MBPProtocol.h"
       
    25 #include "MBPExpression.h"
       
    26 #include "MExpressionObserverUDP.h"
       
    27 
       
    28 #include <e32base.h>
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class MProtocolObserverUDP;
       
    33 class MSocketWriter;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 * UDP protocol implementation. Writes and interpretes data in
       
    39 * protocol frame.
       
    40 */
       
    41 NONSHARABLE_CLASS( CProtocolUDP ) : public CBase, public MBPProtocol,
       
    42                                     public MExpressionObserver
       
    43     {
       
    44 
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         /**
       
    48         * Factory function.
       
    49         * @param aObserver Pointer to observer.
       
    50         * @return New CProtocol instance.
       
    51         */
       
    52         static CProtocolUDP* NewL( MProtocolObserverUDP* aObserver );
       
    53 
       
    54         /**
       
    55         * Factory function.
       
    56         * @param aObserver Pointer to observer.
       
    57         * @return New CProtocol instance.
       
    58         */
       
    59         static CProtocolUDP* NewLC( MProtocolObserverUDP* aObserver );
       
    60 
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         ~CProtocolUDP();
       
    65 
       
    66     public: // From MExpressionObserverUDP
       
    67 
       
    68         void FrameStarted();
       
    69         void FrameParsedL( TUint aPort, const TDesC8& aData );
       
    70         void ProtocolErrorL( TInt aErrorCode, const TDesC8& aReceivedData );
       
    71 
       
    72     public: // From MBPProtocol
       
    73 
       
    74         void WriteFrameL( MSocketWriter& aSocketWriter,
       
    75             TUint aPeerPort, TUint aOriginalPort, const TDesC8& aData ) const;
       
    76 
       
    77         TBool HandleReceivedDataL( TDes8& aData, TInt& aStartPos, TInt& aLength );
       
    78 
       
    79     protected:
       
    80 
       
    81         /**
       
    82         * Default constructor.
       
    83         * @param aObserver Pointer to observer.
       
    84         */
       
    85         CProtocolUDP( MProtocolObserverUDP* aObserver );
       
    86 
       
    87         /**
       
    88         * 2nd phase constructor.
       
    89         */
       
    90         void ConstructL();
       
    91 
       
    92 
       
    93     private:    // Owned data
       
    94 
       
    95         CArrayPtr<MBPExpression>* iExpressionArray;
       
    96 
       
    97     private:    // Not owned data
       
    98         MProtocolObserverUDP* iObserver;
       
    99 
       
   100     };
       
   101 
       
   102 #endif      // CPROTOCOLUDP_H
       
   103 
       
   104 // End of File