rtp/srtpstack/inc/srtppacketsrtp.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004 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:    SRTP packet class (SRTP)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __SRTP_PACKET_SRTP_H__
       
    22 #define __SRTP_PACKET_SRTP_H__
       
    23 
       
    24 // INCLUDES
       
    25 #include <in_sock.h>
       
    26 #include "srtppacket.h"
       
    27 #include "srtppacketrtp.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CSRTPCryptoHandler;
       
    32 /**
       
    33 * Contains general SRTP-specific packet routines
       
    34 */
       
    35 class CSRTPPacketSRTP : public CSRTPPacketRTP
       
    36     {
       
    37     public:
       
    38     
       
    39         /**
       
    40 	    * Constructor.
       
    41 	    * @param aPacket a SRTP packet
       
    42 	    * @param aHandler the cryptohandler for this packet
       
    43 	    * @leave KErrNone if success, system-wide error code otherwise
       
    44 	    */
       
    45     	static CSRTPPacketSRTP* NewL(const TDesC8& aPacket,
       
    46                       CSRTPCryptoHandler& aHandler);
       
    47 
       
    48 
       
    49         /**
       
    50         * Get authentication tag
       
    51         * @return authentication tag
       
    52         */                                      
       
    53         TPtrC8 AuthenticationTag();                      
       
    54 
       
    55         /**
       
    56         * Get master key identifier
       
    57         * @return TPtrC8 master key identifier
       
    58         */                                      
       
    59         TPtrC8 MasterKeyIdentifier();
       
    60 
       
    61         /**
       
    62         * Allocate size for decrypted packet and copy payload + header
       
    63         * @return HBufC8* decrypted packet
       
    64         */                                      
       
    65         HBufC8* CreateDecryptedPacketL(TUint8* aDecryptedPayloadPtr);
       
    66 
       
    67     private: //methods
       
    68 
       
    69         CSRTPPacketSRTP (const TDesC8& aPacket,
       
    70                       CSRTPCryptoHandler& aHandler);
       
    71         ~CSRTPPacketSRTP();                
       
    72                         
       
    73         void ConstructL();          
       
    74 
       
    75         /**
       
    76         * Update payload length information
       
    77         * @return void
       
    78         */                              
       
    79         void UpdatePayloadLengthL();
       
    80 
       
    81         /**
       
    82         * Update authentication tag
       
    83         * @return void
       
    84         */                                      
       
    85         void UpdateAuthenticationTagL();        
       
    86 
       
    87         /**
       
    88         * Update master key identifier
       
    89         * @return void
       
    90         */                                      
       
    91         void UpdateMasterKeyIdentifier();            
       
    92 
       
    93         /**
       
    94         * Count size of the decrypted packet
       
    95         * @return TUint size of the decrypted packet
       
    96         */                                      
       
    97         TUint CountDecryptedPacketSize();    
       
    98         
       
    99                 
       
   100         /*
       
   101         * Read Master Key Identifier (MKI) from packet
       
   102         * @return TPtrC8 pointer to MKI
       
   103         */                                            
       
   104         TPtrC8 GetAuthenticationTagL();   
       
   105         
       
   106         /*
       
   107         * Read Master Key Identifier (MKI) from packet
       
   108         * @return TPtrC8 pointer to MKI
       
   109         */                                            
       
   110         TPtrC8 GetMasterKeyIdentifier();        
       
   111                           
       
   112                     
       
   113     private: //data
       
   114         TPtrC8                 iAuthenticationTag;   // auth. tag
       
   115         TPtrC8                 iMasterKeyIdentifier; // MKI
       
   116     
       
   117     };
       
   118 
       
   119 #endif // __SRTP_PACKET_SRTP_H__
       
   120 
       
   121