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