|
1 /** |
|
2 * Copyright (c) 2003-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: |
|
15 * SSL3.0 and TLS1.0 Record items header file. |
|
16 * This file contains definitions for SSL3.0 and TLS1.0 Record items. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 /** |
|
24 @file TlsRecordItem.h |
|
25 */ |
|
26 |
|
27 #include <comms-infras/recorditem.h> |
|
28 |
|
29 #ifndef _TLSRECORDITEM_H_ |
|
30 #define _TLSRECORDITEM_H_ |
|
31 |
|
32 // Enumeration values for the Record protocol's Content types |
|
33 enum ETlsRecordType |
|
34 { |
|
35 ETlsChangeCipherContentType = 20, /** Change Cipher Spec message */ |
|
36 ETlsAlertContentType = 21, /** Alert message */ |
|
37 ETlsHandshakeContentType = 22, /** Handshake message */ |
|
38 ETlsAppDataContentType = 23 /** Application data */ |
|
39 }; |
|
40 |
|
41 // Constants for a Record header object |
|
42 const TInt KTlsRecordHeaderSize = 5; // No. of bytes in Record Protocol header |
|
43 const TInt KTlsRecordTypeOffset = 0; // Offset of Record Content type within header: 1 byte |
|
44 const TInt KTlsRecordVersionOffset = 1; // Offset of Protocol version within header: 2 bytes |
|
45 const TInt KTlsRecordLengthOffset = 3; // Offset of Record length within header: 3 bytes |
|
46 const TInt KTlsRecordBodyLength = 2; // Size of Record body length, 2 bytes |
|
47 |
|
48 // Record protocol fragment sizes, these are RFC2246 specified values |
|
49 // Compression adds 1024 bytes to Plain text, but NULL compression is currently supported |
|
50 const TInt KTlsRecordCompressedText = 0x0000; |
|
51 const TInt KTlsRecordPlainText = 0x4000; |
|
52 const TInt KTlsRecordCipherText = 0x0400; // Ciphering adds 1024 bytes to Compressed text |
|
53 const TInt KTlsRecordMaxBodySize = KTlsRecordPlainText + KTlsRecordCompressedText + KTlsRecordCipherText; |
|
54 const TInt KTlsRecordPlainTextToSend = 0x800; //max recordbody to be send |
|
55 const TInt KTlsRecordPrealocate = KTlsRecordPlainTextToSend + KTlsRecordHeaderSize + KTlsRecordCompressedText + KTlsRecordCipherText; |
|
56 |
|
57 // Constants for message items |
|
58 const TInt KTlsRandomBodyLength = 32; // Length of client/server random value |
|
59 |
|
60 class CRecordHeader : public CItem< TConstant > |
|
61 { |
|
62 public: |
|
63 CRecordHeader( CItemBase* aNext ) : |
|
64 CItem< TConstant >( aNext, KTlsRecordHeaderSize ), |
|
65 iRecord( NULL ) |
|
66 { |
|
67 iRecord.iFirst = this; |
|
68 } |
|
69 |
|
70 public: |
|
71 TRecord iRecord; |
|
72 }; |
|
73 |
|
74 class CRandomItem : public CConstItem |
|
75 /** |
|
76 * @class This class represents a Client and Server Hello random value. |
|
77 * |
|
78 * @brief The Client random value is obtained via the TLS Provider API. This 32-byte |
|
79 * value has 4 bytes which represent the system time and 28 bytes obtained from a PRNG |
|
80 * (Pseudo-random number generator). The Server Random is obtained from a Server Hello |
|
81 * message. |
|
82 */ |
|
83 { |
|
84 public: |
|
85 CRandomItem( CItemBase* aNext ) : |
|
86 CConstItem( aNext, KTlsRandomBodyLength ) {} |
|
87 }; |
|
88 |
|
89 #endif |