rtp/rtpstack/inc/rtppacket.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 __RTPPACKET_H
       
    22 #define __RTPPACKET_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32def.h>
       
    26 #include "rtppacketparam.h"
       
    27 #include <rtpheader.h>
       
    28 #include "rtputil.h"
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 /**
       
    33 *  The class for RTP packet building and processing. 
       
    34 *
       
    35 *  @lib RtpService.dll
       
    36 */
       
    37 class CRtpPacket : public CBase
       
    38     {
       
    39     #if defined( _DEBUG ) && defined( RTP_UNIT_TEST )
       
    40 	    //Friend class used for testing
       
    41 	    friend class CRtpUtRtpPacket; 
       
    42 	    friend class CRtpUtRtpStream; 
       
    43     #endif 
       
    44     
       
    45     public:
       
    46         static CRtpPacket* NewL( TUint aPacketSize, const TUint32* aRtpTimeRates );
       
    47 
       
    48         ~CRtpPacket();
       
    49 
       
    50         void RtpPacketReset();  
       
    51         void RtpPacketResetPtr();
       
    52 
       
    53         TRtpSSRC RtpPacketGetSSRC();   
       
    54         TRtpPayloadType RtpPacketGetPayloadType();  
       
    55 
       
    56         TInt RtpPacketBuild( TRtpPacketStreamParam* aStreamParam, 
       
    57                              TRtpPacketIOParam* aInitParam );
       
    58         TRtpRtcpEnum RtpPacketProcessL( TRtpPacketStreamParam* aStreamParam, 
       
    59                                        TRtpPacketIOParam* aExtractParam );
       
    60                                        
       
    61 //        TInt RtpPacketBuildNonRtp( const TDesC8& aData, TUint aMaxPacketLength);
       
    62 
       
    63         inline void SetSize( TInt aSize );
       
    64         inline void SetType( TRtpPacketType aType );
       
    65 
       
    66         inline TInt Size() const;
       
    67         inline TUint8* Data();
       
    68         inline HBufC8* GetHBuf();
       
    69         inline TRtpPacketType Type() const;
       
    70         inline const TPtrC8 Des() const;
       
    71 
       
    72     private:
       
    73         TInt RtpPacketBuildRtp( TRtpPacketStreamParam* aStreamParam, 
       
    74                                 TRtpPacketIOParam* aInitParam );
       
    75 
       
    76         TInt RtpPacketBuildRtcp( TRtpPacketStreamParam* aStreamParam, 
       
    77                                  TRtpPacketIOParam* aInitParam );
       
    78 
       
    79         TInt RtpPacketBuildApp( TRtpPacketStreamParam* aStreamParam, 
       
    80                                 TRtpPacketIOParam* aInitParam );
       
    81 
       
    82         TInt RtpPacketBuildBye( TRtpPacketStreamParam* aStreamParam, 
       
    83                                 TRtpPacketIOParam* aInitParam );
       
    84 
       
    85         TInt RtpPacketBuildRr( TRtpPacketStreamParam* aStreamParam, 
       
    86                                TRtpPacketIOParam* aInitParam );
       
    87 
       
    88         TInt RtpPacketBuildSr( TRtpPacketStreamParam* aStreamParam, 
       
    89                                TRtpPacketIOParam* aInitParam );
       
    90 
       
    91         TInt RtpPacketBuildSdes( TRtpPacketStreamParam* aStreamParam, 
       
    92                                  TRtpPacketIOParam* aInitParam );
       
    93 
       
    94         TRtpRtcpEnum RtpPacketProcessRtpL( TRtpPacketStreamParam* aStreamParam,
       
    95                                           TRtpPacketIOParam* aExtractParam );
       
    96         TRtpRtcpEnum RtpPacketProcessRtcp( TRtpPacketStreamParam* aStreamParam,
       
    97                                           TRtpPacketIOParam* aExtractParam );
       
    98         TRtpRtcpEnum RtpPacketProcessAppL( TRtpPacketStreamParam* aStreamParam,
       
    99                                           TRtpPacketIOParam* aExtractParam );
       
   100         TRtpRtcpEnum RtpPacketProcessByeL( TRtpPacketStreamParam* aStreamParam,
       
   101                                           TRtpPacketIOParam* aExtractParam );
       
   102         TRtpRtcpEnum RtpPacketProcessRr( TRtpPacketStreamParam* aStreamParam,
       
   103                                          TRtpPacketIOParam* aExtractParam );
       
   104         TRtpRtcpEnum RtpPacketProcessSr( TRtpPacketStreamParam* aStreamParam,
       
   105                                          TRtpPacketIOParam* aExtractParam );
       
   106         TRtpRtcpEnum RtpPacketProcessSdesL( TRtpPacketStreamParam* aStreamParam,
       
   107                                           TRtpPacketIOParam* aExtractParam );
       
   108 
       
   109         CRtpPacket( const TUint32* aRtpTimeRates );
       
   110         void ConstructL( TUint aPacketSize );
       
   111 
       
   112         void Write16( TUint8* const aPointer, TUint16 aValue );
       
   113         TUint16 Read16( const TUint8* const aPointer );
       
   114         void Write24( TUint8* const aPointer, TUint32 aValue );
       
   115         TUint32 Read24( const TUint8* const aPointer );
       
   116         void Write32( TUint8 *const aPointer, TUint32 aValue );
       
   117         TUint32 Read32( const TUint8* const aPointer );
       
   118 
       
   119 	public:
       
   120 		TBool iExdataAlloc;
       
   121 		TBool iCsrcAlloc;
       
   122 		TRtpPacketIOParam* iExtractParam;
       
   123     private:
       
   124         HBufC8* iBuf;
       
   125         TInt iSize;   
       
   126         TUint8* iData;          // pointer to the beginning of the iBuf
       
   127         TUint8* iDataPtr;       // pointer to the beginning of date unhandled
       
   128         TRtpPacketType iType;   // an enum for packet type
       
   129         const TUint32* iProfileRTPTimeRates; //pointer to 
       
   130     private:    
       
   131     #ifdef EUNIT_TESTING
       
   132 	  friend class UT_CRtpPacket;
       
   133 	  friend class UT_CRtpStream;
       
   134 	  friend class UT_CRtpSession;
       
   135 	  friend class UT_CRtpTranStream;
       
   136 	#endif     	    
       
   137     };
       
   138 
       
   139 #include "rtppacket.inl"
       
   140 
       
   141 #endif  // __RTPPACKET_H
       
   142 
       
   143 // End of File