|
1 /* |
|
2 * Copyright (c) 2006-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 * Name : CTlv.h |
|
16 * Part of : Series 60 / utility |
|
17 * Based on 3GPP TS 11.14 V8.8.0 |
|
18 * Version : 1.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #ifndef CTLV_H |
|
26 #define CTLV_H |
|
27 #include <e32base.h> // for class CBase |
|
28 #include <cstktsy/BerTlv_defs.h> // Ber tlv related constants |
|
29 |
|
30 // DESCRIPTION |
|
31 // TLV Base class. methods common for CTlv and CBerTlv |
|
32 |
|
33 class CTlvBase : public CBase |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Constructor |
|
39 */ |
|
40 CTlvBase(); |
|
41 |
|
42 /** |
|
43 * Get pointer to TLV data |
|
44 * @return Pointer to TLV data |
|
45 */ |
|
46 IMPORT_C TPtrC8 Data() const; |
|
47 |
|
48 /** |
|
49 * Set TLV data |
|
50 * @param aData: Data to be inserted |
|
51 * @return None |
|
52 */ |
|
53 IMPORT_C void SetData( TPtrC8 aData ); |
|
54 |
|
55 /** |
|
56 * Get total size, including tag |
|
57 * @return size |
|
58 */ |
|
59 IMPORT_C TInt GetSize() const; |
|
60 |
|
61 /** |
|
62 * Get tag part of TLV |
|
63 * @return tag value |
|
64 */ |
|
65 IMPORT_C TUint8 GetTag() const; |
|
66 |
|
67 /** |
|
68 * Returns true if comprehension flag is on |
|
69 * @return boolean |
|
70 */ |
|
71 IMPORT_C TBool GetComprehensionRequired() const; |
|
72 |
|
73 /** |
|
74 * Get length part of TLV |
|
75 * @return length |
|
76 */ |
|
77 IMPORT_C TUint8 GetLength () const; |
|
78 |
|
79 /** |
|
80 * Get value part of TLV |
|
81 * @return value |
|
82 */ |
|
83 IMPORT_C TPtrC8 GetValue() const; |
|
84 |
|
85 protected: // Data |
|
86 |
|
87 TPtrC8 iData; |
|
88 }; |
|
89 |
|
90 |
|
91 // DESCRIPTION |
|
92 // CTlv contains methods to read simple TLV data |
|
93 |
|
94 class CTlv : public CTlvBase |
|
95 { |
|
96 public: // Constructor |
|
97 |
|
98 /** |
|
99 * Default constructor |
|
100 */ |
|
101 IMPORT_C CTlv(); |
|
102 |
|
103 public: // Methods |
|
104 |
|
105 /** |
|
106 * Returns short info defined by aType. |
|
107 * @param aType: wanted data type. |
|
108 * @return wanted data. |
|
109 */ |
|
110 IMPORT_C TUint8 GetShortInfo( TTlvSpesificDataType aType ); |
|
111 |
|
112 /** |
|
113 * Returns the Data defined by aType. Index and length of the |
|
114 * data depends on data type. |
|
115 * @param aType: data type. |
|
116 * @return pointer to the data. |
|
117 */ |
|
118 IMPORT_C TPtrC8 GetData( TTlvSpesificDataType aType ); |
|
119 |
|
120 /** |
|
121 * Returns long info by aType. |
|
122 * @param aType: data type. |
|
123 * @return returned data |
|
124 */ |
|
125 IMPORT_C TUint16 GetLongInfo( TTlvSpesificDataType aType ); |
|
126 }; |
|
127 |
|
128 |
|
129 #endif // CTLV_H |
|
130 |
|
131 // End of File |