rtp/rtpstack/inc/rtpstppacket.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004-2005 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:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __RTPSTPPACKET_H
       
    22 #define __RTPSTPPACKET_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <rtpstpheader.h>
       
    26 
       
    27 // FUNCTION PROTOTYPES
       
    28 void write16( TUint8* const aPointer, TUint32 aValue );
       
    29 TUint32 read16( const TUint8* const aPointer );
       
    30 void write32( TUint8* const aPointer, TUint32 aValue );
       
    31 TUint32 read32( const TUint8* const aPointer );
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  STP packet interface class 
       
    37 *
       
    38 *  @lib RtpStpPacket.dll
       
    39 */
       
    40 class MRtpPacketExt
       
    41     {
       
    42     public:
       
    43         virtual void ConstructL( TUint aPacketSize, TRtpId aSessionId ) = 0;
       
    44         virtual void Close() = 0;
       
    45         virtual void RtpPacketReset() = 0;
       
    46         virtual void RtpPacketResetPtr() = 0;  
       
    47 
       
    48         virtual TInt RtpPacketBuild( const TRtpSendHeader& aHeader, 
       
    49                                      const TDesC8& aPayload ) = 0;
       
    50 
       
    51         virtual TInt RtpPacketProcess( TUint8* aBuf, TInt* aLength ) = 0;
       
    52 
       
    53         virtual void RegisterRtpObserver( MRtpObserver& aObserver ) = 0;
       
    54         virtual void UnregisterRtpObserver() = 0;
       
    55         virtual void SetSize( TInt aSize ) = 0;
       
    56 
       
    57         virtual TInt Size() const = 0;
       
    58         virtual TUint8* Data() const = 0;
       
    59         virtual HBufC8* GetHBuf() const = 0;
       
    60         virtual const TPtrC8 Des() const = 0;
       
    61 
       
    62     };
       
    63 
       
    64 /**
       
    65 *  STP packet concrete class 
       
    66 *
       
    67 *  @lib RtpStpPacket.dll
       
    68 */
       
    69 class CRtpStpPacket : public CBase, public MRtpPacketExt
       
    70     {
       
    71     public:
       
    72         CRtpStpPacket();
       
    73         ~CRtpStpPacket();
       
    74         virtual void ConstructL( TUint aPacketSize, TRtpId aSessionId );
       
    75         virtual void Close();
       
    76 
       
    77         virtual void RtpPacketReset();
       
    78         virtual void RtpPacketResetPtr();  
       
    79 
       
    80         virtual TInt RtpPacketBuild( const TRtpSendHeader& aHeader, const TDesC8& aPayload );
       
    81         virtual TInt RtpPacketProcess( TUint8* aBuf, TInt* aLength );
       
    82 
       
    83         inline virtual void RegisterRtpObserver( MRtpObserver& aObserver );
       
    84         inline virtual void UnregisterRtpObserver();
       
    85         inline virtual void SetSize( TInt aSize );
       
    86         inline virtual TInt Size() const;
       
    87         inline virtual TUint8* Data() const;
       
    88         inline virtual HBufC8* GetHBuf() const;
       
    89         inline const TPtrC8 Des() const;
       
    90     
       
    91     private : 
       
    92         TUint32 read16( const TUint8* const aPointer );
       
    93         void write16( TUint8* const aPointer, TUint32 aValue );
       
    94         
       
    95     private:
       
    96         MRtpObserver* iObserver;
       
    97         HBufC8* iBuf;
       
    98         TInt iSize;   
       
    99         TUint8* iData;          // pointer to the beginning of the iBuf
       
   100         TUint8* iDataPtr;       // pointer to the beginning of date unhandled
       
   101         TRtpId iSessionId;      // session ID value
       
   102     };
       
   103 
       
   104 #include "rtpstppacket.inl"
       
   105 
       
   106 #endif  // __RTPSTPPACKET_H
       
   107 
       
   108 // End of File