1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\e32cmn.h
27 A Nanokernel utility function that compares two memory buffers for equality.
29 The two buffers are considered equal only if:
31 1. the buffers have the same length
35 2. the binary content of both buffers is the same.
37 @param aLeft The start address of the first buffer in the comparison.
38 @param aLeftLen The length of the first buffer in the comparison.
39 @param aRight The start address of the second buffer in the comparison.
40 @param aRightLen The length of the second buffer in the comparison.
42 @return Zero if both buffers are equal; non-zero, otherwise.
44 @panic USER 88 In debug mode only, if aLeftL is negative,
45 and the function is called on the user side.
46 @panic KERN-COMMON 88 In debug mode only, if aLeftL is negative,
47 and the function is called on the kernel side.
48 @panic USER 89 In debug mode only, if aRightL is negative,
49 and the function is called on the user side.
50 @panic KERN-COMMON 89 In debug mode only, if aRightL is negative,
51 and the function is called on the kernel side.
53 IMPORT_C TInt memcompare(const TUint8* aLeft, TInt aLeftLen, const TUint8* aRight, TInt aRightLen);
62 A Nanokernel utility function that moves (copies) bytes in memory.
64 The function assumes that the addresses are aligned on word boundaries,
65 and that the length value is a multiple of 4.
67 @param aTrg The target address.
68 @param aSrc The source address.
69 @param aLength The number of bytes to be moved.
71 @return The target address.
73 @panic USER 91 In debug mode only, if aLength is not a multiple of 4,
74 and the function is called on the user side.
75 @panic KERN-COMMON 91 In debug mode only, if aLength is not a multiple of 4,
76 and the function is called on the kernel side.
77 @panic USER 92 In debug mode only, if aSrc is not aligned on a word boundary,
78 and the function is called on the user side.
79 @panic KERN-COMMON 92 In debug mode only, if aSrc is not aligned on a word boundary,
80 and the function is called on the kernel side.
81 @panic USER 93 In debug mode only, if aTrg is not aligned on a word boundary,
82 and the function is called on the user side.
83 @panic KERN-COMMON 93 In debug mode only, if aTrg is not aligned on a word boundary,
84 and the function is called on the kernel side.
86 IMPORT_C TAny* wordmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
95 A Nanokernel utility function that sets the specified number of bytes
98 @param aTrg The start address.
99 @param aLength The number of bytes to be set.
101 @return The target address.
103 IMPORT_C TAny* memclr(TAny* aTrg, unsigned int aLength);
115 A Nanokernel utility function that sets all of the specified number of bytes to
116 the specified fill value.
118 @param aTrg The start address.
119 @param aValue The fill value (the first or junior byte).
120 @param aLength The number of bytes to be set.
122 @return The target address.
124 IMPORT_C TAny* memset(TAny* aTrg, TInt aValue, unsigned int aLength);
133 A Nanokernel utility function that copies bytes in memory.
135 @param aTrg The target address.
136 @param aSrc The source address.
137 @param aLength The number of bytes to be moved.
139 @return The target address.
141 IMPORT_C TAny* memcpy(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
150 A Nanokernel utility function that moves (copies) bytes in memory.
152 @param aTrg The target address.
153 @param aSrc The source address.
154 @param aLength The number of bytes to be moved.
156 @return The target address.
158 IMPORT_C TAny* memmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength);
171 Tests whether the specified value is less than or equal to the
172 specified upper limit.
174 @param aVal The value to be tested.
175 @param aLimit The upper limit.
177 @return True, if the value is less than or equal to the specified upper limit;
180 inline TInt Lim(TInt aVal,TUint aLimit)
181 {return(((TUint)aVal)<=aLimit);}
190 Tests whether the specified value is strictly less than the
191 specified upper limit.
193 @param aVal The value to be tested.
194 @param aLimit The upper limit.
196 @return True, if the value is strictly less than the specified upper limit;
199 inline TInt LimX(TInt aVal,TUint aLimit)
200 {return(((TUint)aVal)<aLimit);}
209 Returns the smaller of two values.
211 @param aLeft The first value to be compared.
212 @param aRight The second value to be compared.
214 @return The smaller value.
217 inline T Min(T aLeft,T aRight)
218 {return(aLeft<aRight ? aLeft : aRight);}
227 Returns the smaller of two objects, where the right hand object is a treated
228 as a TInt for the purpose of comparison.
230 @param aLeft The first value to be compared.
231 @param aRight The second value to be compared.
233 @return The smaller value.
236 inline T Min(T aLeft,TUint aRight)
237 {return(aLeft<(TInt)aRight ? aLeft : (T)aRight);}
246 Returns the larger of two values.
248 @param aLeft The first value to be compared.
249 @param aRight The second value to be compared.
251 @return The larger value.
254 inline T Max(T aLeft,T aRight)
255 {return(aLeft<aRight ? aRight : aLeft);}
264 Returns the larger of two objects, where the right hand object is a treated
265 as a TInt for the purpose of comparison.
267 @param aLeft The first value to be compared.
268 @param aRight The second value to be compared.
270 @return The larger value.
273 inline T Max(T aLeft,TUint aRight)
274 {return(aLeft<(TInt)aRight ? (TInt)aRight : aLeft);}
283 Returns an absolute value.
285 @param aVal The source value.
287 @return The absolute value
291 {return(aVal<0 ? -aVal : aVal);}
300 Determines whether a specified value lies within a defined range of values.
302 @param aMin The lower value of the range.
303 @param aVal The value to be compared.
304 @param aMax The higher value of the range.
306 @return True, if the specified value lies within the range; false, otherwise.
309 inline TBool Rng(T aMin,T aVal,T aMax)
310 {return(aVal>=aMin && aVal<=aMax);}
319 Adds a value to a pointer.
321 @param aPtr Pointer to an object of type T.
322 @param aVal The value to be added.
324 @return The resulting pointer value, as a pointer to a type T.
326 template <class T,class S>
327 inline T* PtrAdd(T* aPtr,S aVal)
328 {return((T*)(((TUint8*)aPtr)+aVal));}
337 Subtracts a value from a pointer.
339 @param aPtr Pointer to an object of type T.
340 @param aVal The value to be added.
342 @return The resulting pointer value, as a pointer to a type T.
344 template <class T,class S>
345 inline T* PtrSub(T* aPtr,S aVal)
346 {return((T*)(((TUint8*)aPtr)-aVal));}
355 Aligns the specified value onto a 2-byte boundary.
357 @param aValue The value to be aligned.
359 @return The aligned value.
362 inline T Align2(T aValue)
363 {return((T)((((TUint)aValue)+sizeof(TUint16)-1)&~(sizeof(TUint16)-1)));}
372 Aligns the specified value onto a 4-byte boundary.
374 @param aValue The value to be aligned.
376 @return The aligned value.
379 inline T Align4(T aValue)
380 {return((T)((((TUint)aValue)+sizeof(TUint32)-1)&~(sizeof(TUint32)-1)));}
389 A templated class which encapsulates a reference to an object within a wrapper.
391 The wrapper object can be passed to a function as a value type. This allows
392 a reference to be passed to a function as a value type.
394 This wrapper object is commonly termed a value reference.
400 inline TRefByValue(T& aRef);
401 inline operator T&();
403 TRefByValue& operator=(TRefByValue aRef);
411 #if !defined (__KERNEL_MODE__)
412 class TDesC16; // forward declaration for TChar member functions
413 class TPtrC16; // forward declaration for TChar member functions
423 Holds a character value and provides a number of utility functions to
424 manipulate it and test its properties.
426 For example, there are functions to convert the character
427 to uppercase and test whether or not it is a control character.
429 The character value is stored as a 32-bit unsigned integer. The shorthand
430 "TChar value" is used to describe the character value wrapped by a TChar
433 TChar can be used to represent Unicode values outside plane 0 (that is, the
434 extended Unicode range from 0x10000 to 0xFFFFF). This differentiates it from
435 TText which can only be used for 16-bit Unicode character values.
445 General Unicode character category.
447 The high nibble encodes the major category (Mark, Number, etc.) and a low
448 nibble encodes the subdivisions of that category.
450 The category codes can be used in three ways:
452 (i) as unique constants: there is one for each Unicode category, with a
461 is the category name given by
462 the Unicode database (e.g., the constant ELuCategory is used for lowercase
463 letters, category Lu);
465 (ii) as numbers in certain ranges: letter categories are all <= EMaxLetterCategory;
467 (iii) as codes in which the upper nibble gives the category group
468 (e.g., punctuation categories all yield TRUE for
469 the test (category & 0xF0) ==EPunctuationGroup).
476 Includes ELuCategory, ELlCategory and ELtCategory.
484 Includes ELoCategory.
486 ELetterOtherGroup = 0x10,
492 Includes ELmCategory.
494 ELetterModifierGroup = 0x20,
500 Includes EMnCategory, EMcCategory and EMeCategory.
508 Includes ENdCategory, ENlCategory and ENoCategory.
516 IncludesEPcCategory, PdCategory, EpeCategory, EPsCategory and EPoCategory.
518 EPunctuationGroup = 0x50,
524 Includes ESmCategory, EScCategory, ESkCategory and ESoCategory.
532 Includes EZsCategory, EZlCategory and EZlpCategory.
534 ESeparatorGroup = 0x70,
538 Control, format, private use, unassigned.
540 Includes ECcCategory, ECtCategory, ECsCategory,
541 ECoCategory and ECnCategory.
543 EControlGroup = 0x80,
547 The highest possible groups category.
549 EMaxAssignedGroup = 0xE0,
553 Unassigned to any other group.
555 EUnassignedGroup = 0xF0,
561 ELuCategory = EAlphaGroup | 0,
567 ELlCategory = EAlphaGroup | 1,
573 ELtCategory = EAlphaGroup | 2,
579 ELoCategory = ELetterOtherGroup | 0,
583 The highest possible (non-modifier) letter category.
585 EMaxLetterCategory = ELetterOtherGroup | 0x0F,
590 ELmCategory = ELetterModifierGroup | 0,
594 The highest possible letter category.
596 EMaxLetterOrLetterModifierCategory = ELetterModifierGroup | 0x0F,
601 EMnCategory = EMarkGroup | 0,
607 EMcCategory = EMarkGroup | 1,
613 EMeCategory = EMarkGroup | 2,
617 Number, Decimal Digit.
619 ENdCategory = ENumberGroup | 0,
625 ENlCategory = ENumberGroup | 1,
631 ENoCategory = ENumberGroup | 2,
635 Punctuation, Connector.
637 EPcCategory = EPunctuationGroup | 0,
643 EPdCategory = EPunctuationGroup | 1,
649 EPsCategory = EPunctuationGroup | 2,
655 EPeCategory = EPunctuationGroup | 3,
659 Punctuation, Initial Quote
661 EPiCategory = EPunctuationGroup | 4,
665 Punctuation, Final Quote
667 EPfCategory = EPunctuationGroup | 5,
673 EPoCategory = EPunctuationGroup | 6,
679 ESmCategory = ESymbolGroup | 0,
685 EScCategory = ESymbolGroup | 1,
691 ESkCategory = ESymbolGroup | 2,
697 ESoCategory = ESymbolGroup | 3,
701 The highest possible graphic character category.
703 EMaxGraphicCategory = ESymbolGroup | 0x0F,
709 EZsCategory = ESeparatorGroup | 0,
713 The highest possible printable character category.
715 EMaxPrintableCategory = EZsCategory,
721 EZlCategory = ESeparatorGroup | 1,
725 Separator, Paragraph.
727 EZpCategory = ESeparatorGroup | 2,
733 ECcCategory = EControlGroup | 0,
739 ECfCategory = EControlGroup | 1,
743 The highest possible category for assigned 16-bit characters; does not
744 include surrogates, which are interpreted as pairs and have no meaning
747 EMaxAssignedCategory = EMaxAssignedGroup | 0x0F,
753 ECsCategory = EUnassignedGroup | 0,
759 ECoCategory = EUnassignedGroup | 1,
765 ECnCategory = EUnassignedGroup | 2
770 The bi-directional Unicode character category.
772 For more information on the bi-directional algorithm, see Unicode Technical
773 Report No. 9 available at: http://www.unicode.org/unicode/reports/tr9.
780 ELeftToRight, // L Left-to-Right
784 Left to right embedding.
786 ELeftToRightEmbedding, // LRE Left-to-Right Embedding
790 Left-to-Right Override.
792 ELeftToRightOverride, // LRO Left-to-Right Override
798 ERightToLeft, // R Right-to-Left
802 Right to left Arabic.
804 ERightToLeftArabic, // AL Right-to-Left Arabic
808 Right to left embedding.
810 ERightToLeftEmbedding, // RLE Right-to-Left Embedding
814 Right-to-Left Override.
816 ERightToLeftOverride, // RLO Right-to-Left Override
820 Pop Directional Format.
822 EPopDirectionalFormat, // PDF Pop Directional Format
828 EEuropeanNumber, // EN European Number
832 European number separator.
834 EEuropeanNumberSeparator, // ES European Number Separator
838 European number terminator.
840 EEuropeanNumberTerminator, // ET European Number Terminator
846 EArabicNumber, // AN Arabic Number
850 Common number separator.
852 ECommonNumberSeparator, // CS Common Number Separator
858 ENonSpacingMark, // NSM Non-Spacing Mark
864 EBoundaryNeutral, // BN Boundary Neutral
870 EParagraphSeparator, // B Paragraph Separator
876 ESegmentSeparator, // S Segment Separator
882 EWhitespace, // WS Whitespace
886 Other neutrals; all other characters: punctuation, symbols.
888 EOtherNeutral // ON Other Neutrals
893 Notional character width as known to East Asian (Chinese, Japanese,
894 Korean (CJK)) coding systems.
899 Includes 'ambiguous width' defined in Unicode Technical Report 11: East Asian Width
905 Character which occupies a single cell.
907 EHalfWidth, // other categories are as defined in the report
911 Character which occupies 2 cells.
917 Characters that are always narrow and have explicit full-width
918 counterparts. All of ASCII is an example of East Asian Narrow
924 Characters that are always wide. This category includes characters that
925 have explicit half-width counterparts.
934 Encoding systems used by the translation functions.
939 The Unicode encoding.
945 The shift-JIS encoding (used in Japan).
952 Flags defining operations to be performed using TChar::Fold().
954 The flag values are passed to the Fold() funtion.
961 Convert characters to their lower case form if any.
973 Convert digits representing values 0..9 to characters '0'..'9'
979 Convert all spaces (ordinary, fixed-width, ideographic, etc.) to ' '
985 Convert hiragana to katakana.
991 Fold fullwidth and halfwidth variants to their standard forms
997 Perform standard folding operations, i.e.those done by Fold() with no argument
999 EFoldStandard = EFoldCase | EFoldAccents | EFoldDigits | EFoldSpaces,
1003 Perform all possible folding operations
1011 A structure to hold information about a Unicode character.
1013 An object of this type is passed to TChar::GetInfo().
1021 TCategory iCategory;
1025 Bi-directional category.
1027 TBdCategory iBdCategory;
1031 Combining class: number (currently) in the range 0..234
1033 TInt iCombiningClass;
1055 True, if the character is mirrored.
1061 Integer numeric value: -1 if none, -2 if a fraction.
1067 inline TChar(TUint aChar);
1068 inline TChar& operator-=(TUint aChar);
1069 inline TChar& operator+=(TUint aChar);
1070 inline TChar operator-(TUint aChar);
1071 inline TChar operator+(TUint aChar);
1072 inline operator TUint() const;
1073 #ifndef __KERNEL_MODE__
1075 inline void LowerCase();
1076 inline void UpperCase();
1077 inline TBool Eos() const;
1078 IMPORT_C TUint GetUpperCase() const;
1079 IMPORT_C TUint GetLowerCase() const;
1080 IMPORT_C TBool IsLower() const;
1081 IMPORT_C TBool IsUpper() const;
1082 IMPORT_C TBool IsAlpha() const;
1083 IMPORT_C TBool IsDigit() const;
1084 IMPORT_C TBool IsAlphaDigit() const;
1085 IMPORT_C TBool IsHexDigit() const;
1086 IMPORT_C TBool IsSpace() const;
1087 IMPORT_C TBool IsPunctuation() const;
1088 IMPORT_C TBool IsGraph() const;
1089 IMPORT_C TBool IsPrint() const;
1090 IMPORT_C TBool IsControl() const;
1091 inline void Fold(TInt aFlags);
1092 inline void TitleCase();
1093 IMPORT_C TUint GetTitleCase() const;
1094 IMPORT_C TBool IsTitle() const;
1095 IMPORT_C TBool IsAssigned() const;
1096 IMPORT_C void GetInfo(TCharInfo& aInfo) const;
1097 IMPORT_C TCategory GetCategory() const;
1098 IMPORT_C TBdCategory GetBdCategory() const;
1099 IMPORT_C TInt GetCombiningClass() const;
1100 IMPORT_C TBool IsMirrored() const;
1101 IMPORT_C TInt GetNumericValue() const;
1102 IMPORT_C TCjkWidth GetCjkWidth() const;
1103 IMPORT_C static TBool Compose(TUint& aResult,const TDesC16& aSource);
1104 IMPORT_C TBool Decompose(TPtrC16& aResult) const;
1107 inline void SetChar(TUint aChar);
1114 #include <e32des8.h>
1115 #ifndef __KERNEL_MODE__
1116 #include <e32des16.h>
1122 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1123 #define __Size (sizeof(TUint)/sizeof(TUint16))
1128 Defines a build-independent non-modifiable descriptor.
1130 A 16-bit build variant is generated for a Unicode, non-kernel
1133 A build-independent type should always be used unless an explicit 8-bit
1134 or 16-bit type is required.
1139 typedef TDesC16 TDesC;
1148 Defines a build-independent non-modifiable pointer descriptor.
1150 A 16-bit build variant is generated for a Unicode, non-kernel
1153 A build-independent type should always be used unless an explicit 8-bit
1154 or 16-bit type is required.
1159 typedef TPtrC16 TPtrC;
1168 Defines a build-independent modifiable descriptor.
1170 A 16-bit build variant is generated for a Unicode, non-kernel
1173 A build-independent type should always be used unless an explicit 8-bit
1174 or 16-bit type is required.
1179 typedef TDes16 TDes;
1188 Defines a build-independent modifiable pointer descriptor.
1190 A 16-bit build variant is generated for a Unicode, non-kernel
1193 A build-independent type should always be used unless an explicit 8-bit
1194 or 16-bit type is required.
1199 typedef TPtr16 TPtr;
1204 #ifndef __KERNEL_MODE__
1209 Defines a build-independent heap descriptor.
1211 A 16-bit build variant is generated for a Unicode, non-kernel
1214 A build-independent type should always be used unless an explicit 8-bit
1215 or 16-bit type is required.
1220 typedef HBufC16 HBufC;
1229 Defines a build-independent descriptor overflow handler.
1231 A 16-bit build variant is generated for a Unicode, non-kernel
1234 A build-independent type should always be used unless an explicit 8-bit
1235 or 16-bit type is required.
1240 typedef TDes16Overflow TDesOverflow;
1247 Defines a build-independent resizable buffer descriptor.
1249 A 16-bit build variant is generated for a Unicode, non-kernel mode build.
1251 A build-independent type should always be used unless an explicit 8-bit
1252 or 16-bit type is required.
1257 typedef RBuf16 RBuf;
1261 #define __Size (sizeof(TUint)/sizeof(TUint8))
1270 Defines a build-independent non-modifiable descriptor.
1272 An 8-bit build variant is generated for a non-Unicode build.
1274 This build-independent type should always be used unless an explicit 8-bit
1275 or 16-bit build variant is required.
1280 typedef TDesC8 TDesC;
1289 Defines a build-independent non-modifiable pointer descriptor.
1291 An 8-bit build variant is generated for a non-Unicode build.
1293 This build-independent type should always be used unless an explicit 8-bit
1294 or 16-bit build variant is required.
1299 typedef TPtrC8 TPtrC;
1308 Defines a build-independent modifiable descriptor.
1310 An 8-bit build variant is generated for a non-Unicode build.
1312 This build-independent type should always be used unless an explicit 8-bit
1313 or 16-bit build variant is required.
1327 Defines a build-independent modifiable pointer descriptor.
1329 An 8-bit build variant is generated for a non-Unicode build.
1331 This build-independent type should always be used unless an explicit 8-bit
1332 or 16-bit build variant is required.
1338 #ifndef __KERNEL_MODE__
1347 Defines a build-independent heap descriptor.
1349 An 8-bit build variant is generated for a non-Unicode, non-kernel
1352 This build-independent type should always be used unless an explicit 8-bit
1353 or 16-bit build variant is required.
1358 typedef HBufC8 HBufC;
1367 Defines a build-independent descriptor overflow handler.
1369 An 8-bit build variant is generated for a non-Unicode, non-kernel
1372 This build-independent type should always be used unless an explicit 8-bit
1373 or 16-bit build variant is required.
1378 typedef TDes8Overflow TDesOverflow;
1385 Defines a build-independent resizable buffer descriptor.
1387 An 8-bit build variant is generated for a non-Unicode, non-kernel mode build.
1389 This build-independent type should always be used unless an explicit 8-bit
1390 or 16-bit build variant is required.
1401 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1402 typedef TBufCBase16 TBufCBase;
1404 typedef TBufCBase8 TBufCBase;
1411 A build-independent non-modifiable buffer descriptor.
1413 This is a descriptor class which provides a buffer of fixed length for
1414 containing and accessing TUint16 or TUint8 data, depending on the build.
1416 The class intended for instantiation. The data that the descriptor represents
1417 is part of the descriptor object itself.
1419 The class is templated, based on an integer value which defines the size of
1420 the descriptor's data area.
1422 The data is intended to be accessed, but not modified; however, it can be
1423 completely replaced using the assignment operators of this class. The base
1424 class provides the functions through which the data is accessed.
1426 This class derives from TBufCBase16 for a Unicode, non-kernel build, but
1427 derives from TBufCBase8 for a non-Unicode build.
1439 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1440 class TBufC : public TBufCBase16
1442 class TBufC : public TBufCBase8
1447 inline TBufC(const TText* aString);
1448 inline TBufC(const TDesC& aDes);
1449 inline TBufC<S>& operator=(const TText* aString);
1450 inline TBufC<S>& operator=(const TDesC& aDes);
1453 TText iBuf[__Align(S)];
1462 A build-independent modifiable buffer descriptor.
1464 This is a descriptor class which provides a buffer of fixed length for
1465 containing, accessing and manipulating TUint16 or TUint8 data, depending
1468 The class is intended for instantiation. The data that the descriptor represents
1469 is part of the descriptor object itself.
1471 The class is templated, based on an integer value which determines the size
1472 of the data area created as part of the buffer descriptor object; this is
1473 also the maximum length of the descriptor.
1475 The data is intended to be both accessed and modified. The base classes provide
1476 the functions through which the data is accessed.
1478 This class derives from TBufCBase16 for a Unicode, non-kernel build, but
1479 derives from TBufCBase8 for a non-Unicode build.
1492 #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
1493 class TBuf : public TBufBase16
1495 class TBuf : public TBufBase8
1500 inline explicit TBuf(TInt aLength);
1501 inline TBuf(const TText* aString);
1502 inline TBuf(const TDesC& aDes);
1503 inline TBuf<S>& operator=(const TText* aString);
1504 inline TBuf<S>& operator=(const TDesC& aDes);
1505 inline TBuf<S>& operator=(const TBuf<S>& aBuf);
1507 TText iBuf[__Align(S)];
1517 Value reference used in operator TLitC::__TRefDesC().
1521 typedef TRefByValue<const TDesC> __TRefDesC;
1530 Encapsulates literal text.
1532 This is always constructed using an _LIT macro.
1534 This class is build independent; i.e. for a non-Unicode build, an 8-bit build
1535 variant is generated; for a Unicode build, a 16 bit build variant is generated.
1537 The class has no explicit constructors. See the _LIT macro definition.
1546 enum {BufferSize=S-1};
1547 inline const TDesC* operator&() const;
1548 inline operator const TDesC&() const;
1549 inline const TDesC& operator()() const;
1550 inline operator const __TRefDesC() const;
1552 #if !defined(_UNICODE) || defined(__KERNEL_MODE__)
1557 typedef TUint8 __TText;
1558 #elif defined(__GCC32__)
1563 typedef wchar_t __TText;
1564 #elif defined(__VC32__)
1569 typedef TUint16 __TText;
1571 #elif defined(__CW32__)
1576 typedef TUint16 __TText;
1577 #elif !defined(__TText_defined)
1578 #error no typedef for __TText
1589 __TText iBuf[__Align(S)];
1597 Defines an empty or null literal descriptor.
1599 This is the build independent form.
1600 An 8 bit build variant is generated for a non-Unicode build;
1601 a 16 bit build variant is generated for a Unicode build.
1611 Defines an empty or null literal descriptor for use with 8-bit descriptors.
1613 _LIT8(KNullDesC8,"");
1614 #ifndef __KERNEL_MODE__
1622 Defines an empty or null literal descriptor for use with 16-bit descriptors
1624 _LIT16(KNullDesC16,"");
1634 Packages a non-modifiable pointer descriptor which represents an object of
1637 The template parameter defines the type of object.
1639 The object represented by the packaged pointer descriptor is accessible through
1640 the package but cannot be changed. */
1642 class TPckgC : public TPtrC8
1645 inline TPckgC(const T& aRef);
1646 inline const T& operator()() const;
1648 TPckgC<T>& operator=(const TPckgC<T>& aRef);
1658 Packages a modifiable pointer descriptor which represents an object of specific
1661 The template parameter defines the type of object.
1663 The object represented by the packaged pointer descriptor is accessible through
1667 class TPckg : public TPtr8
1670 inline TPckg(const T& aRef);
1671 inline T& operator()();
1673 TPckg<T>& operator=(const TPckg<T>& aRef);
1683 Packages an object into a modifiable buffer descriptor.
1685 The template parameter defines the type of object to be packaged.
1687 The package provides a type safe way of transferring an object or data structure
1688 which is contained within a modifiable buffer descriptor. Typically, a package
1689 is used for passing data via inter thread communication.
1691 The contained object is accessible through the package.
1694 class TPckgBuf : public TAlignedBuf8<sizeof(T)>
1698 inline TPckgBuf(const T& aRef);
1699 inline TPckgBuf& operator=(const TPckgBuf<T>& aRef);
1700 inline T& operator=(const T& aRef);
1701 inline T& operator()();
1702 inline const T& operator()() const;
1712 Defines a modifiable buffer descriptor that can contain the name of a reference
1718 typedef TBuf<KMaxName> TName;
1726 typedef TBuf<KMaxKernelName> TKName;
1732 typedef TBuf<KMaxInfoName> TInfoName;
1741 Defines a modifiable buffer descriptor that can contain the full name of a
1742 reference counting object.
1747 typedef TBuf<KMaxFullName> TFullName;
1755 Defines a modifiable buffer descriptor to contain the category name identifying
1756 the cause of thread or process termination. The buffer takes a maximum length
1757 of KMaxExitCategoryName.
1759 @see RThread::ExitCategory
1760 @see RThread::ExitCategory
1762 typedef TBuf<KMaxExitCategoryName> TExitCategoryName;
1770 A buffer that can contain the name of a file.
1771 The name can have a maximum length of KMaxFileName
1772 (currently 256 but check the definition of KMaxFileName).
1776 typedef TBuf<KMaxFileName> TFileName;
1784 A buffer that can contain the name of a path.
1785 The name can have a maximum length of KMaxPath
1786 (currently 256 but check the definition of KMaxPath).
1790 typedef TBuf<KMaxPath> TPath;
1797 typedef TBuf<KMaxDeviceInfo> TDeviceInfo;
1807 This is a buffer descriptor with a maximum length of KMaxVersionName.
1808 A TVersion object returns the formatted character representation of its version
1809 information in a descriptor of this type.
1813 typedef TBuf<KMaxVersionName> TVersionName;
1818 typedef TBuf<KMaxPassword> TPassword;
1827 Defines a modifiable buffer descriptor for the text form of the UID.
1828 The descriptor has a maximum length of KMaxUidName and is used to contain
1829 the standard text format returned by the function TUid::Name().
1833 typedef TBuf<KMaxUidName> TUidName;
1844 #define KNullUid TUid::Null()
1853 A globally unique 32-bit number.
1858 #ifndef __KERNEL_MODE__
1859 IMPORT_C TBool operator==(const TUid& aUid) const;
1860 IMPORT_C TBool operator!=(const TUid& aUid) const;
1861 IMPORT_C TUidName Name() const;
1863 static inline TUid Uid(TInt aUid);
1864 static inline TUid Null();
1867 The 32-bit integer UID value.
1879 Encapsulates a set of three unique identifiers (UIDs) which, in combination,
1880 identify a system object such as a GUI application or a DLL. The three
1881 component UIDs are referred to as UID1, UID2 and UID3.
1883 An object of this type is referred to as a compound identifier or a UID type.
1888 #ifndef __KERNEL_MODE__
1889 IMPORT_C TUidType();
1890 IMPORT_C TUidType(TUid aUid1);
1891 IMPORT_C TUidType(TUid aUid1,TUid aUid2);
1892 IMPORT_C TUidType(TUid aUid1,TUid aUid2,TUid aUid3);
1893 IMPORT_C TBool operator==(const TUidType& aUidType) const;
1894 IMPORT_C TBool operator!=(const TUidType& aUidType) const;
1895 IMPORT_C const TUid& operator[](TInt anIndex) const;
1896 IMPORT_C TUid MostDerived() const;
1897 IMPORT_C TBool IsPresent(TUid aUid) const;
1898 IMPORT_C TBool IsValid() const;
1901 TUid iUid[KMaxCheckedUid];
1908 A class used to represent the Secure ID of a process or executable image.
1910 Constructors and conversion operators are provided to enable conversion
1911 of this class to and from both TUint32 and TUid objects.
1913 Because this class has non-default constructors, compilers will not initialise
1914 this objects at compile time, instead code will be generated to construct the object
1915 at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1916 such uninitialised data. To overcome these problems a macro is provided to construct
1917 a const object which behaves like a TSecureId. This is _LIT_SECURE_ID.
1918 This macro should be used where it is desirable to define const TSecureId objects,
1919 like in header files. E.g. Instead of writing:
1921 const TSecureId MyId=0x1234567
1925 _LIT_SECURE_ID(MyId,0x1234567)
1937 inline TSecureId(TUint32 aId);
1938 inline operator TUint32() const;
1939 inline TSecureId(TUid aId);
1940 inline operator TUid() const;
1949 A class used to represent the Vendor ID of a process or executable image
1951 Constructors and conversion operators are provided to enable conversion
1952 of this class to and from both TUint32 and TUid objects.
1954 Because this class has non-default constructors, compilers will not initialise
1955 this objects at compile time, instead code will be generated to construct the object
1956 at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1957 such uninitialised data. To overcome these problems a macro is provided to construct
1958 a const object which behaves like a TSecureId. This is _LIT_VENDOR_ID.
1959 This macro should be used where it is desirable to define const TSecureId objects,
1960 like in header files. E.g. Instead of writing:
1962 const TVendorId MyId=0x1234567
1966 _LIT_VENDOR_ID(MyId,0x1234567)
1978 inline TVendorId(TUint32 aId);
1979 inline operator TUint32() const;
1980 inline TVendorId(TUid aId);
1981 inline operator TUid() const;
1989 Structure for compile-time definition of a secure ID
1995 inline const TSecureId* operator&() const;
1996 inline operator const TSecureId&() const;
1997 inline operator TUint32() const;
1998 inline operator TUid() const;
2007 Structure for compile-time definition of a vendor ID
2013 inline const TVendorId* operator&() const;
2014 inline operator const TVendorId&() const;
2015 inline operator TUint32() const;
2016 inline operator TUid() const;
2025 Macro for compile-time definition of a secure ID
2026 @param name Name to use for secure ID
2027 @param value Value of secure ID
2031 #define _LIT_SECURE_ID(name,value) const SSecureId name={value}
2037 Macro for compile-time definition of a vendor ID
2038 @param name Name to use for vendor ID
2039 @param value Value of vendor ID
2043 #define _LIT_VENDOR_ID(name,value) const SVendorId name={value}
2052 Contains version information.
2054 A version is defined by a set of three numbers:
2056 1. the major version number, ranging from 0 to 127, inclusive
2058 2. the minor version number, ranging from 0 to 99 inclusive
2060 3. the build number, ranging from 0 to 32767 inclusive.
2062 The class provides a constructor for setting all three numbers.
2063 It also provides a member function to build a character representation of
2064 this information in a TVersionName descriptor.
2071 IMPORT_C TVersion();
2072 IMPORT_C TVersion(TInt aMajor,TInt aMinor,TInt aBuild);
2073 IMPORT_C TVersionName Name() const;
2076 The major version number.
2082 The minor version number.
2100 Indicates the completion status of a request made to a service provider.
2102 When a thread makes a request, it passes a request status as a parameter.
2103 On completion, the provider signals the requesting thread's request semaphore
2104 and stores a completion code in the request status. Typically, this is KErrNone
2105 or one of the other system-wide error codes.
2107 This class is not intended for user derivation.
2109 class TRequestStatus
2112 inline TRequestStatus();
2113 inline TRequestStatus(TInt aVal);
2114 inline TInt operator=(TInt aVal);
2115 inline TBool operator==(TInt aVal) const;
2116 inline TBool operator!=(TInt aVal) const;
2117 inline TBool operator>=(TInt aVal) const;
2118 inline TBool operator<=(TInt aVal) const;
2119 inline TBool operator>(TInt aVal) const;
2120 inline TBool operator<(TInt aVal) const;
2121 inline TInt Int() const;
2126 ERequestPending = 2, //bit1
2130 friend class CActive;
2131 friend class CActiveScheduler;
2132 friend class CServer2;
2143 Stores a two-dimensional point in Cartesian co-ordinates.
2145 Its data members (iX and iY) are public and can be manipulated directly, or
2146 by means of the functions provided. Functions are provided to set and manipulate
2147 the point, and to compare points for equality.
2152 #ifndef __KERNEL_MODE__
2153 enum TUninitialized { EUninitialized };
2155 Constructs default point, initialising its iX and iY members to zero.
2157 TPoint(TUninitialized) {}
2159 inline TPoint(TInt aX,TInt aY);
2160 IMPORT_C TBool operator==(const TPoint& aPoint) const;
2161 IMPORT_C TBool operator!=(const TPoint& aPoint) const;
2162 IMPORT_C TPoint& operator-=(const TPoint& aPoint);
2163 IMPORT_C TPoint& operator+=(const TPoint& aPoint);
2164 IMPORT_C TPoint& operator-=(const TSize& aSize);
2165 IMPORT_C TPoint& operator+=(const TSize& aSize);
2166 IMPORT_C TPoint operator-(const TPoint& aPoint) const;
2167 IMPORT_C TPoint operator+(const TPoint& aPoint) const;
2168 IMPORT_C TPoint operator-(const TSize& aSize) const;
2169 IMPORT_C TPoint operator+(const TSize& aSize) const;
2170 IMPORT_C TPoint operator-() const;
2171 IMPORT_C void SetXY(TInt aX,TInt aY);
2172 IMPORT_C TSize AsSize() const;
2187 @prototype For now, only intended to be used by TRwEvent and the Windows Server
2189 Stores a three-dimensional point in Cartesian or polar co-ordinates.
2191 Its data members (iX, iY and iZ) are public and can be manipulated directly.
2212 @prototype For now, only intended to be used by TRwEvent and the Windows Server
2214 Stores the angular spherical coordinates (Phi,Theta) of a three-dimensional point.
2216 Its data members (iPhi, iTheta) are public and can be manipulated directly.
2222 The Phi co-ordinate (angle between X-axis and the line that links the projection of the point on the X-Y plane and the origin).
2226 The Theta co-ordinate (angle between the Z-axis and the line that links the point and the origin).
2236 Stores a two-dimensional size as a width and a height value.
2238 Its data members are public and can be manipulated directly, or by means of
2239 the functions provided.
2244 #ifndef __KERNEL_MODE__
2245 enum TUninitialized { EUninitialized };
2247 Constructs the size object with its iWidth and iHeight members set to zero.
2249 TSize(TUninitialized) {}
2251 inline TSize(TInt aWidth,TInt aHeight);
2252 IMPORT_C TBool operator==(const TSize& aSize) const;
2253 IMPORT_C TBool operator!=(const TSize& aSize) const;
2254 IMPORT_C TSize& operator-=(const TSize& aSize);
2255 IMPORT_C TSize& operator-=(const TPoint& aPoint);
2256 IMPORT_C TSize& operator+=(const TSize& aSize);
2257 IMPORT_C TSize& operator+=(const TPoint& aPoint);
2258 IMPORT_C TSize operator-(const TSize& aSize) const;
2259 IMPORT_C TSize operator-(const TPoint& aPoint) const;
2260 IMPORT_C TSize operator+(const TSize& aSize) const;
2261 IMPORT_C TSize operator+(const TPoint& aPoint) const;
2262 IMPORT_C TSize operator-() const;
2263 IMPORT_C void SetSize(TInt aWidth,TInt aHeight);
2264 IMPORT_C TPoint AsPoint() const;
2268 The width of this TSize object.
2272 The height of this TSize object.
2284 Information about a kernel object.
2286 This type of object is passed to RHandleBase::HandleInfo(). The function
2287 fetches information on the usage of the kernel object associated with that
2288 handle and stores the information in the THandleInfo object.
2290 The class contains four data members and no explicitly defined function
2297 The number of times that the kernel object is open in the current process.
2299 TInt iNumOpenInProcess;
2302 The number of times that the kernel object is open in the current thread.
2304 TInt iNumOpenInThread;
2307 The number of processes which have a handle on the kernel object.
2312 The number of threads which have a handle on the kernel object.
2326 inline TFindHandle();
2327 inline TInt Handle() const;
2328 #ifdef __KERNEL_MODE__
2329 inline TInt Index() const;
2330 inline TInt UniqueID() const;
2331 inline TUint64 ObjectID() const;
2332 inline void Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId);
2335 inline void Reset();
2347 class TFindHandleBase;
2348 class TFindSemaphore;
2353 A handle to an object.
2355 The class encapsulates the basic behaviour of a handle, hiding the
2356 handle-number which identifies the object which the handle represents.
2358 The class is abstract in the sense that a RHandleBase object is never
2359 explicitly instantiated. It is always a base class to a concrete handle class;
2360 for example, RSemaphore, RThread, RProcess, RCriticalSection etc.
2372 EDirectReadAccess=0x4,
2373 EDirectWriteAccess=0x8,
2376 inline RHandleBase();
2377 inline TInt Handle() const;
2378 inline void SetHandle(TInt aHandle);
2379 inline TInt SetReturnedHandle(TInt aHandleOrError);
2380 static void DoExtendedClose();
2381 #ifndef __KERNEL_MODE__
2382 IMPORT_C void Close();
2383 IMPORT_C TName Name() const;
2384 IMPORT_C TFullName FullName() const;
2385 IMPORT_C void FullName(TDes& aName) const;
2386 IMPORT_C void SetHandleNC(TInt aHandle);
2387 IMPORT_C TInt Duplicate(const RThread& aSrc,TOwnerType aType=EOwnerProcess);
2388 IMPORT_C void HandleInfo(THandleInfo* anInfo);
2389 IMPORT_C TUint Attributes() const;
2390 IMPORT_C TInt BTraceId() const;
2391 IMPORT_C void NotifyDestruction(TRequestStatus& aStatus); /**< @internalTechnology */
2393 inline RHandleBase(TInt aHandle);
2394 IMPORT_C TInt Open(const TFindHandleBase& aHandle,TOwnerType aType);
2395 static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle);
2396 TInt OpenByName(const TDesC &aName,TOwnerType aOwnerType,TInt aObjectType);
2399 static void DoExtendedCloseL();
2412 A handle to a semaphore.
2414 The semaphore itself is a Kernel side object.
2416 As with all handles, they should be closed after use. RHandleBase provides
2417 the necessary Close() function, which should be called when the handle is
2420 @see RHandleBase::Close
2422 class RSemaphore : public RHandleBase
2425 #ifndef __KERNEL_MODE__
2426 inline TInt Open(const TFindSemaphore& aFind,TOwnerType aType=EOwnerProcess);
2427 IMPORT_C TInt CreateLocal(TInt aCount,TOwnerType aType=EOwnerProcess);
2428 IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aCount,TOwnerType aType=EOwnerProcess);
2429 IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess);
2430 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
2431 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
2432 IMPORT_C void Wait();
2433 IMPORT_C TInt Wait(TInt aTimeout); // timeout in microseconds
2434 IMPORT_C void Signal();
2435 IMPORT_C void Signal(TInt aCount);
2448 This is a layer over a standard semaphore, and only calls into the kernel side
2449 if there is contention.
2451 class RFastLock : public RSemaphore
2455 IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess);
2456 IMPORT_C void Wait();
2457 IMPORT_C void Signal();
2469 The user-side handle to a logical channel.
2471 The class provides functions that are used to open a channel
2472 to a device driver, and to make requests. A device driver provides
2473 a derived class to give the user-side a tailored interface to the driver.
2475 class RBusLogicalChannel : public RHandleBase
2478 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
2479 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
2481 inline TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* anInfo, TOwnerType aType=EOwnerProcess, TBool aProtected=EFalse);
2482 IMPORT_C void DoCancel(TUint aReqMask);
2483 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus);
2484 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1);
2485 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1,TAny* a2);
2486 IMPORT_C TInt DoControl(TInt aFunction);
2487 IMPORT_C TInt DoControl(TInt aFunction,TAny* a1);
2488 IMPORT_C TInt DoControl(TInt aFunction,TAny* a1,TAny* a2);
2489 inline TInt DoSvControl(TInt aFunction) { return DoControl(aFunction); }
2490 inline TInt DoSvControl(TInt aFunction,TAny* a1) { return DoControl(aFunction, a1); }
2491 inline TInt DoSvControl(TInt aFunction,TAny* a1,TAny* a2) { return DoControl(aFunction, a1, a2); }
2493 IMPORT_C TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TInt aType);
2495 // Padding for Binary Compatibility purposes
2506 Base class for memory allocators.
2508 // Put pure virtual functions into a separate base class so that vptr is at same
2509 // place in both GCC98r2 and EABI builds.
2513 virtual TAny* Alloc(TInt aSize)=0;
2514 virtual void Free(TAny* aPtr)=0;
2515 virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0)=0;
2516 virtual TInt AllocLen(const TAny* aCell) const =0;
2517 virtual TInt Compress()=0;
2518 virtual void Reset()=0;
2519 virtual TInt AllocSize(TInt& aTotalAllocSize) const =0;
2520 virtual TInt Available(TInt& aBiggestBlock) const =0;
2521 virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL)=0;
2522 virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0;
2532 Base class for heaps.
2534 class RAllocator : public MAllocator
2540 A set of heap allocation failure flags.
2542 This enumeration indicates how to simulate heap allocation failure.
2544 @see RAllocator::__DbgSetAllocFail()
2548 Attempts to allocate from this heap fail at a random rate;
2549 however, the interval pattern between failures is the same
2550 every time simulation is started.
2556 Attempts to allocate from this heap fail at a random rate.
2557 The interval pattern between failures may be different every
2558 time the simulation is started.
2564 Attempts to allocate from this heap fail at a rate aRate;
2565 for example, if aRate is 3, allocation fails at every
2572 Cancels simulated heap allocation failure.
2578 An allocation from this heap will fail after the next aRate - 1
2579 allocation attempts. For example, if aRate = 1 then the next
2580 attempt to allocate from this heap will fail.
2585 Cancels simulated heap allocation failure, and sets
2586 the nesting level for all allocated cells to zero.
2591 aBurst allocations from this heap fail at a random rate;
2592 however, the interval pattern between failures is the same
2593 every time the simulation is started.
2599 aBurst allocations from this heap fail at a random rate.
2600 The interval pattern between failures may be different every
2601 time the simulation is started.
2607 aBurst allocations from this heap fail at a rate aRate.
2608 For example, if aRate is 10 and aBurst is 2, then 2 allocations
2609 will fail at every tenth attempt.
2611 EBurstDeterministic,
2614 aBurst allocations from this heap will fail after the next aRate - 1
2615 allocation attempts have occurred. For example, if aRate = 1 and
2616 aBurst = 3 then the next 3 attempts to allocate from this heap will fail.
2621 Use this to determine how many times the current debug
2622 failure mode has failed so far.
2623 @see RAllocator::__DbgCheckFailure()
2630 Heap debug checking type flag.
2634 The heap is a user heap.
2639 The heap is the Kernel heap.
2645 enum TAllocDebugOp {ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail};
2649 Flags controlling reallocation.
2653 A reallocation of a cell must not change
2654 the start address of the cell.
2659 Allows the start address of the cell to change
2660 if the cell shrinks in size.
2662 EAllowMoveOnShrink=2
2666 enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4};
2667 struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;};
2668 struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];}; /**< @internalComponent*/
2669 enum {EMaxHandles=32};
2671 inline RAllocator();
2672 #ifndef __KERNEL_MODE__
2673 IMPORT_C TInt Open();
2674 IMPORT_C void Close();
2675 IMPORT_C TAny* AllocZ(TInt aSize);
2676 IMPORT_C TAny* AllocZL(TInt aSize);
2677 IMPORT_C TAny* AllocL(TInt aSize);
2678 IMPORT_C TAny* AllocLC(TInt aSize);
2679 IMPORT_C void FreeZ(TAny*& aCell);
2680 IMPORT_C TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0);
2681 IMPORT_C TInt Count() const;
2682 IMPORT_C TInt Count(TInt& aFreeCount) const;
2684 UIMPORT_C void Check() const;
2685 UIMPORT_C void __DbgMarkStart();
2686 UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount);
2687 UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum);
2688 inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum);
2689 UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate);
2690 UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst);
2691 UIMPORT_C TUint __DbgCheckFailure();
2693 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
2694 #ifndef __KERNEL_MODE__
2695 IMPORT_C virtual void DoClose();
2703 TInt iTotalAllocSize;
2714 Represents the default implementation for a heap.
2716 The default implementation uses an address-ordered first fit type algorithm.
2718 The heap itself is contained in a chunk and may be the only occupant of the
2719 chunk or may share the chunk with the program stack.
2721 The class contains member functions for allocating, adjusting, freeing individual
2722 cells and generally managing the heap.
2724 The class is not a handle in the same sense that RChunk is a handle; i.e.
2725 there is no Kernel object which corresponds to the heap.
2727 class RHeap : public RAllocator
2731 The structure of a heap cell header for a heap cell on the free list.
2735 The length of the cell, which includes the length of
2742 A pointer to the next cell in the free list.
2749 The structure of a heap cell header for an allocated heap cell in a debug build.
2753 The length of the cell, which includes the length of
2766 The cumulative number of allocated cells
2774 struct _s_align {char c; double d;};
2780 struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; };
2784 The default cell alignment.
2786 enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
2790 Size of a free cell header.
2792 enum {EFreeCellSize = sizeof(SCell)};
2797 Size of an allocated cell header in a debug build.
2799 enum {EAllocCellSize = sizeof(SDebugCell)};
2802 Size of an allocated cell header in a release build.
2804 enum {EAllocCellSize = sizeof(SCell*)};
2811 enum TDebugOp {EWalk=128};
2818 {EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress,
2819 EBadFreeCellAddress, EBadFreeCellSize};
2825 enum TDebugHeapId {EUser=0, EKernel=1};
2830 enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
2835 typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt);
2837 UIMPORT_C virtual TAny* Alloc(TInt aSize);
2838 UIMPORT_C virtual void Free(TAny* aPtr);
2839 UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
2840 UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const;
2841 #ifndef __KERNEL_MODE__
2842 UIMPORT_C virtual TInt Compress();
2843 UIMPORT_C virtual void Reset();
2844 UIMPORT_C virtual TInt AllocSize(TInt& aTotalAllocSize) const;
2845 UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const;
2847 UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
2849 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
2851 UIMPORT_C RHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
2852 UIMPORT_C RHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
2853 UIMPORT_C TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
2854 inline void operator delete(TAny* aPtr, TAny* aBase);
2855 inline TUint8* Base() const;
2856 inline TInt Size() const;
2857 inline TInt MaxLength() const;
2858 inline TInt Align(TInt a) const;
2859 inline const TAny* Align(const TAny* a) const;
2860 inline TBool IsLastCell(const SCell* aCell) const;
2861 inline void Lock() const;
2862 inline void Unlock() const;
2863 inline TInt ChunkHandle() const;
2867 SCell* DoAlloc(TInt aSize, SCell*& aLastFree);
2868 void DoFree(SCell* pC);
2869 TInt TryToGrowHeap(TInt aSize, SCell* aLastFree);
2870 inline void FindFollowingFreeCell(SCell* aCell, SCell*& pPrev, SCell*& aNext);
2871 TInt TryToGrowCell(SCell* pC, SCell* pP, SCell* pE, TInt aSize);
2872 TInt Reduce(SCell* aCell);
2873 UIMPORT_C SCell* GetAddress(const TAny* aCell) const;
2874 void CheckCell(const SCell* aCell) const;
2875 void Walk(TWalkFunc aFunc, TAny* aPtr);
2876 static void WalkCheckCell(TAny* aPtr, TCellType aType, TAny* aCell, TInt aLen);
2877 TInt DoCountAllocFree(TInt& aFree);
2878 TInt DoCheckHeap(SCheckInfo* aInfo);
2880 TUint32 DoMarkEnd(TInt aExpected);
2881 void DoSetAllocFail(TAllocFail aType, TInt aRate);
2882 TBool CheckForSimulatedAllocFail();
2883 inline TInt SetBrk(TInt aBrk);
2884 inline TAny* ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode);
2885 void DoSetAllocFail(TAllocFail aType, TInt aRate, TUint aBurst);
2902 TAllocFail iFailType;
2905 TInt iFailAllocCount;
2909 friend class UserHeap;
2916 class OnlyCreateWithNull;
2918 /** @internalTechnology */
2919 typedef void (OnlyCreateWithNull::* __NullPMF)();
2921 /** @internalTechnology */
2922 class OnlyCreateWithNull
2925 inline OnlyCreateWithNull(__NullPMF /*aPointerToNull*/) {}
2932 A handle to a message sent by the client to the server.
2934 A server's interaction with its clients is channelled through an RMessagePtr2
2935 object, which acts as a handle to a message sent by the client.
2936 The details of the original message are kept by the kernel allowing it enforce
2937 correct usage of the member functions of this class.
2944 inline RMessagePtr2();
2945 inline TBool IsNull() const;
2946 inline TInt Handle() const;
2947 #ifndef __KERNEL_MODE__
2948 IMPORT_C void Complete(TInt aReason) const;
2949 IMPORT_C void Complete(RHandleBase aHandle) const;
2950 IMPORT_C TInt GetDesLength(TInt aParam) const;
2951 IMPORT_C TInt GetDesLengthL(TInt aParam) const;
2952 IMPORT_C TInt GetDesMaxLength(TInt aParam) const;
2953 IMPORT_C TInt GetDesMaxLengthL(TInt aParam) const;
2954 IMPORT_C void ReadL(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
2955 IMPORT_C void ReadL(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
2956 IMPORT_C void WriteL(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
2957 IMPORT_C void WriteL(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
2958 IMPORT_C TInt Read(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
2959 IMPORT_C TInt Read(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
2960 IMPORT_C TInt Write(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
2961 IMPORT_C TInt Write(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
2962 IMPORT_C void Panic(const TDesC& aCategory,TInt aReason) const;
2963 IMPORT_C void Kill(TInt aReason) const;
2964 IMPORT_C void Terminate(TInt aReason) const;
2965 IMPORT_C TInt SetProcessPriority(TProcessPriority aPriority) const;
2966 inline void SetProcessPriorityL(TProcessPriority aPriority) const;
2967 IMPORT_C TInt Client(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
2968 inline void ClientL(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
2969 IMPORT_C TUint ClientProcessFlags() const;
2970 IMPORT_C const TRequestStatus* ClientStatus() const;
2973 Return the Secure ID of the process which sent this message.
2975 If an intended use of this method is to check that the Secure ID is
2976 a given value, then the use of a TSecurityPolicy object should be
2977 considered. E.g. Instead of something like:
2980 RMessagePtr2& message;
2981 TInt error = message.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied;
2987 RMessagePtr2& message;
2988 static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId);
2989 TInt error = mySidPolicy().CheckPolicy(message);
2992 This has the benefit that the TSecurityPolicy::CheckPolicy methods are
2993 configured by the system wide Platform Security configuration. I.e. are
2994 capable of emitting diagnostic messages when a check fails and/or the
2995 check can be forced to always pass.
2997 @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
2998 @see _LIT_SECURITY_POLICY_S0
3000 @return The Secure ID.
3005 IMPORT_C TSecureId SecureId() const;
3008 Return the Vendor ID of the process which sent this message.
3010 If an intended use of this method is to check that the Vendor ID is
3011 a given value, then the use of a TSecurityPolicy object should be
3012 considered. E.g. Instead of something like:
3015 RMessagePtr2& message;
3016 TInt error = message.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied;
3022 RMessagePtr2& message;
3023 static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId);
3024 TInt error = myVidPolicy().CheckPolicy(message);
3027 This has the benefit that the TSecurityPolicy::CheckPolicy methods are
3028 configured by the system wide Platform Security configuration. I.e. are
3029 capable of emitting diagnostic messages when a check fails and/or the
3030 check can be forced to always pass.
3032 @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
3033 @see _LIT_SECURITY_POLICY_V0
3035 @return The Vendor ID.
3039 IMPORT_C TVendorId VendorId() const;
3042 Check if the process which sent this message has a given capability.
3044 When a check fails the action taken is determined by the system wide Platform Security
3045 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3046 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
3049 @param aCapability The capability to test.
3050 @param aDiagnostic A string that will be emitted along with any diagnostic message
3051 that may be issued if the test finds the capability is not present.
3052 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3053 which enables it to be easily removed from the system.
3054 @return ETrue if process which sent this message has the capability, EFalse otherwise.
3058 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3059 inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const;
3060 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3061 // Only available to NULL arguments
3062 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const;
3063 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3064 // For things using KSuppressPlatSecDiagnostic
3065 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3066 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3067 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3070 Check if the process which sent this message has a given capability.
3072 When a check fails the action taken is determined by the system wide Platform Security
3073 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3074 If PlatSecEnforcement is OFF, then this function will not leave even though the
3077 @param aCapability The capability to test.
3078 @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
3079 that may be issued if the test finds the capability is not present.
3080 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3081 which enables it to be easily removed from the system.
3082 @leave KErrPermissionDenied, if the process does not have the capability.
3086 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3087 inline void HasCapabilityL(TCapability aCapability, const char* aDiagnosticMessage=0) const;
3088 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3089 // Only available to NULL arguments
3090 inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
3091 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3092 // For things using KSuppressPlatSecDiagnostic
3093 inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3094 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3095 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3098 Check if the process which sent this message has both of the given capabilities.
3100 When a check fails the action taken is determined by the system wide Platform Security
3101 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3102 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
3105 @param aCapability1 The first capability to test.
3106 @param aCapability2 The second capability to test.
3107 @param aDiagnostic A string that will be emitted along with any diagnostic message
3108 that may be issued if the test finds a capability is not present.
3109 This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3110 which enables it to be easily removed from the system.
3111 @return ETrue if the process which sent this message has both the capabilities, EFalse otherwise.
3115 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3116 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const;
3117 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3118 // Only available to NULL arguments
3119 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const;
3120 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3121 // For things using KSuppressPlatSecDiagnostic
3122 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3123 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3124 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3127 Check if the process which sent this message has both of the given capabilities.
3129 When a check fails the action taken is determined by the system wide Platform Security
3130 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3131 If PlatSecEnforcement is OFF, then this function will not leave even though the
3134 @param aCapability1 The first capability to test.
3135 @param aCapability2 The second capability to test.
3136 @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
3137 that may be issued if the test finds a capability is not present.
3138 This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3139 which enables it to be easily removed from the system.
3140 @leave KErrPermissionDenied, if the process does not have the capabilities.
3144 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3145 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, const char* aDiagnosticMessage=0) const;
3146 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3147 // Only available to NULL arguments
3148 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
3149 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3150 // For things using KSuppressPlatSecDiagnostic
3151 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3152 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3153 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3156 @deprecated Use SecureId()
3158 inline TUid Identity() const { return SecureId(); }
3162 // Implementations of functions with diagnostics
3163 IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const;
3164 IMPORT_C TBool DoHasCapability(TCapability aCapability) const;
3165 IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2, const char* aDiagnostic) const;
3166 IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2) const;
3171 inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight);
3172 inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight);
3176 #define __IPC_V2_PRESENT__
3182 An object that encapsulates the details of a client request.
3184 class RMessage2 : public RMessagePtr2
3186 friend class CServer2;
3190 Defines internal message types.
3192 enum TSessionMessages {
3194 A message type used internally that means connect.
3199 A message type used internally that means disconnect.
3205 #ifndef __KERNEL_MODE__
3206 IMPORT_C explicit RMessage2(const RMessagePtr2& aPtr);
3207 void SetAuthorised() const;
3208 void ClearAuthorised() const;
3209 TBool Authorised() const;
3211 inline TInt Function() const;
3212 inline TInt Int0() const;
3213 inline TInt Int1() const;
3214 inline TInt Int2() const;
3215 inline TInt Int3() const;
3216 inline const TAny* Ptr0() const;
3217 inline const TAny* Ptr1() const;
3218 inline const TAny* Ptr2() const;
3219 inline const TAny* Ptr3() const;
3220 inline CSession2* Session() const;
3229 A copy of the message arguments.
3231 TInt iArgs[KMaxMessageArguments];
3238 const TAny* iSessionPtr;
3240 mutable TInt iFlags;// Currently only used for *Authorised above
3241 TInt iSpare3; // Reserved for future use
3243 friend class RMessage;
3253 Defines an 8-bit modifiable buffer descriptor to contain passwords when dealing
3254 with password security support in a file server session.
3256 The descriptor takes a maximum length of KMaxMediaPassword.
3258 @see KMaxMediaPassword
3260 typedef TBuf8<KMaxMediaPassword> TMediaPassword; // 128 bit
3267 A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
3268 set signifies that a buffer offset list follows the buffer configuration class. This list holds the offset of each buffer.
3270 const TUint KScFlagBufOffsetListInUse=0x00000001;
3275 A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
3276 set is a suggestion that the shared chunk should be configured leaving guard pages around each buffers.
3278 const TUint KScFlagUseGuardPages=0x00000002;
3283 The shared chunk buffer configuration class (used by the multimedia device drivers). This is used to hold information
3284 on the current buffer configuration within a shared chunk.
3286 class TSharedChunkBufConfigBase
3289 inline TSharedChunkBufConfigBase();
3291 /** The number of buffers. */
3293 /** The size of each buffer in bytes. */
3294 TInt iBufferSizeInBytes;
3295 /** Reserved field. */
3297 /** Shared chunk buffer flag settings. */
3302 /** Default value to clear all data to committed to a chunk to.
3303 @see TChunkCreateInfo::SetClearByte()
3304 @see RChunk::Create()
3307 const TUint8 KChunkClearByteDefault = 0x3;
3310 Values that specify the attributes of a chunk to be created.
3312 @see RChunk::Create()
3315 enum TChunkCreateAttributes
3317 /** Force local chunk to be named. Internal as only required for
3318 thread heap chunks, all other local chunks should be nameless.
3320 EChunkAttLocalNamed = 0x400,
3322 EChunkAttMask = EChunkAttLocalNamed,
3325 /**@internalComponent */
3326 const TUint32 KEmulatorImageFlagAllowDllData = 0x01;
3328 /** Maximum size of capability set
3332 const TInt KCapabilitySetMaxSize = (((TInt)ECapability_HardLimit + 7)>>3);
3334 /** Maximum size of any future extension to TSecurityPolicy
3338 const TInt KMaxSecurityPolicySize = KCapabilitySetMaxSize + 3*sizeof(TUint32);
3340 /** Class representing an arbitrary set of capabilities.
3342 This class can only contain capabilities supported by the current OS version.
3347 class TCapabilitySet
3350 inline TCapabilitySet();
3351 inline TCapabilitySet(TCapability aCapability);
3352 IMPORT_C TCapabilitySet(TCapability aCapability1, TCapability aCapability2);
3353 IMPORT_C void SetEmpty();
3354 inline void Set(TCapability aCapability);
3355 inline void Set(TCapability aCapability1, TCapability aCapability2);
3356 IMPORT_C void SetAllSupported();
3357 IMPORT_C void AddCapability(TCapability aCapability);
3358 IMPORT_C void RemoveCapability(TCapability aCapability);
3359 IMPORT_C void Union(const TCapabilitySet& aCapabilities);
3360 IMPORT_C void Intersection(const TCapabilitySet& aCapabilities);
3361 IMPORT_C void Remove(const TCapabilitySet& aCapabilities);
3362 IMPORT_C TBool HasCapability(TCapability aCapability) const;
3363 IMPORT_C TBool HasCapabilities(const TCapabilitySet& aCapabilities) const;
3366 Make this set consist of the capabilities which are disabled on this platform.
3369 IMPORT_C void SetDisabled();
3373 TBool NotEmpty() const;
3375 TUint32 iCaps[KCapabilitySetMaxSize / sizeof(TUint32)];
3378 #ifndef __SECURITY_INFO_DEFINED__
3379 #define __SECURITY_INFO_DEFINED__
3383 struct SCapabilitySet
3387 inline void AddCapability(TCapability aCap1) {((TCapabilitySet*)this)->AddCapability(aCap1);}
3388 inline void Remove(const SCapabilitySet& aCaps) {((TCapabilitySet*)this)->Remove(*((TCapabilitySet*)&aCaps));}
3389 inline TBool NotEmpty() const {return ((TCapabilitySet*)this)->NotEmpty();}
3391 inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
3392 inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
3394 TUint32 iCaps[ENCapW];
3400 struct SSecurityInfo
3404 SCapabilitySet iCaps; // Capabilities re. platform security
3409 /** Define this macro to reference the set of all capabilities.
3412 #ifdef __REFERENCE_ALL_SUPPORTED_CAPABILITIES__
3414 extern const SCapabilitySet AllSupportedCapabilities;
3416 #endif //__REFERENCE_ALL_SUPPORTED_CAPABILITIES__
3418 /** Define this macro to include the set of all capabilities.
3421 #ifdef __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
3423 /** The set of all capabilities.
3426 const SCapabilitySet AllSupportedCapabilities = {
3428 ECapability_Limit<32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0xffffffffu
3430 ECapability_Limit>=32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0u
3434 #endif // __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
3436 #ifndef __KERNEL_MODE__
3446 /** Class representing all security attributes of a process or DLL.
3447 These comprise a set of capabilities, a Secure ID and a Vendor ID.
3455 inline TSecurityInfo();
3456 #ifndef __KERNEL_MODE__
3457 IMPORT_C TSecurityInfo(RProcess aProcess);
3458 IMPORT_C TSecurityInfo(RThread aThread);
3459 IMPORT_C TSecurityInfo(RMessagePtr2 aMesPtr);
3460 inline void Set(RProcess aProcess);
3461 inline void Set(RThread aThread);
3462 inline void Set(RMessagePtr2 aMsgPtr);
3463 TInt Set(RSessionBase aSession); /**< @internalComponent */
3464 inline void SetToCurrentInfo();
3465 IMPORT_C void SetToCreatorInfo();
3466 #endif //__KERNEL_MODE__
3468 TSecureId iSecureId; /**< Secure ID */
3469 TVendorId iVendorId; /**< Vendor ID */
3470 TCapabilitySet iCaps; /**< Capability Set */
3474 /** Class representing a generic security policy
3476 This class can specify a security policy consisting of either:
3478 -# A check for between 0 and 7 capabilities
3479 -# A check for a given Secure ID along with 0-3 capabilities
3480 -# A check for a given Vendor ID along with 0-3 capabilities
3482 If multiple capabilities are specified, all of them must be present for the
3483 security check to succeed ('AND' relation).
3485 The envisaged use case for this class is to specify access rights to an object
3486 managed either by the kernel or by a server but in principle owned by a client
3487 and usable in a limited way by other clients. For example
3488 - Publish and Subscribe properties
3491 In these cases the owning client would pass one (or more) of these objects to
3492 the server to specify which security checks should be done on other clients
3493 before allowing access to the object.
3495 To pass a TSecurityPolicy object via IPC, a client should obtain a descriptor
3496 for the object using Package() and send this. When a server receives this descriptor
3497 it should read the descriptor contents into a TSecurityPolicyBuf and then
3498 Set() should be used to create a policy object from this.
3500 Because this class has non-default constructors, compilers will not initialise
3501 this object at compile time, instead code will be generated to construct the object
3502 at run-time. This is wasteful - and Symbian OS DLLs are not permitted to have
3503 such uninitialised data. To overcome these problems a set of macros are provided to
3504 construct a const object which behaves like a TSecurityPolicy. These are:
3506 _LIT_SECURITY_POLICY_C1 through _LIT_SECURITY_POLICY_C7,
3507 _LIT_SECURITY_POLICY_S0 through _LIT_SECURITY_POLICY_S3 and
3508 _LIT_SECURITY_POLICY_V0 through _LIT_SECURITY_POLICY_V3.
3510 Also, the macros _LIT_SECURITY_POLICY_PASS and _LIT_SECURITY_POLICY_FAIL are provided
3511 in order to allow easy construction of a const object which can be used as a
3512 TSecuityPolicy which always passes or always fails, respectively.
3514 If a security policy object is needed to be embedded in another class then the
3515 TStaticSecurityPolicy structure can be used. This behaves in the same way as a
3516 TSecurityPolicy object but may be initialised at compile time.
3518 @see TStaticSecurityPolicy
3519 @see TSecurityPolicyBuf
3520 @see _LIT_SECURITY_POLICY_PASS
3521 @see _LIT_SECURITY_POLICY_FAIL
3522 @see _LIT_SECURITY_POLICY_C1
3523 @see _LIT_SECURITY_POLICY_C2
3524 @see _LIT_SECURITY_POLICY_C3
3525 @see _LIT_SECURITY_POLICY_C4
3526 @see _LIT_SECURITY_POLICY_C5
3527 @see _LIT_SECURITY_POLICY_C6
3528 @see _LIT_SECURITY_POLICY_C7
3529 @see _LIT_SECURITY_POLICY_S0
3530 @see _LIT_SECURITY_POLICY_S1
3531 @see _LIT_SECURITY_POLICY_S2
3532 @see _LIT_SECURITY_POLICY_S3
3533 @see _LIT_SECURITY_POLICY_V0
3534 @see _LIT_SECURITY_POLICY_V1
3535 @see _LIT_SECURITY_POLICY_V2
3536 @see _LIT_SECURITY_POLICY_V3
3541 class TSecurityPolicy
3551 inline TSecurityPolicy();
3552 IMPORT_C TSecurityPolicy(TSecPolicyType aType);
3553 IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3554 IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2, TCapability aCap3, TCapability aCap4, TCapability aCap5 = ECapability_None, TCapability aCap6 = ECapability_None, TCapability aCap7 = ECapability_None);
3555 IMPORT_C TSecurityPolicy(TSecureId aSecureId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3556 IMPORT_C TSecurityPolicy(TVendorId aVendorId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3557 IMPORT_C TInt Set(const TDesC8& aDes);
3558 IMPORT_C TPtrC8 Package() const;
3560 #ifdef __KERNEL_MODE__
3562 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3563 inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const;
3564 inline TBool CheckPolicy(DThread* aThread, const char* aDiagnostic=0) const;
3565 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3566 // Only available to NULL arguments
3567 inline TBool CheckPolicy(DProcess* aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3568 inline TBool CheckPolicy(DThread* aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3569 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3571 #else // !__KERNEL_MODE__
3573 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3574 inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
3575 inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
3576 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
3577 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
3578 inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
3579 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3580 // Only available to NULL arguments
3581 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3582 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3583 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
3584 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
3585 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
3586 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3587 // For things using KSuppressPlatSecDiagnostic
3588 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3589 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3590 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3591 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3592 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3593 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3594 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3595 TInt CheckPolicy(RSessionBase aSession) const; /**< @internalComponent */
3597 #endif //__KERNEL_MODE__
3599 TBool Validate() const;
3602 #ifdef __KERNEL_MODE__
3603 IMPORT_C TBool DoCheckPolicy(DProcess* aProcess, const char* aDiagnostic) const;
3604 IMPORT_C TBool DoCheckPolicy(DProcess* aProcess) const;
3605 IMPORT_C TBool DoCheckPolicy(DThread* aThread, const char* aDiagnostic) const;
3606 IMPORT_C TBool DoCheckPolicy(DThread* aThread) const;
3607 #else // !__KERNEL_MODE__
3608 IMPORT_C TBool DoCheckPolicy(RProcess aProcess, const char* aDiagnostic) const;
3609 IMPORT_C TBool DoCheckPolicy(RProcess aProcess) const;
3610 IMPORT_C TBool DoCheckPolicy(RThread aThread, const char* aDiagnostic) const;
3611 IMPORT_C TBool DoCheckPolicy(RThread aThread) const;
3612 IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const;
3613 IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr) const;
3614 IMPORT_C TBool DoCheckPolicyCreator(const char* aDiagnostic) const;
3615 IMPORT_C TBool DoCheckPolicyCreator() const;
3616 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3617 TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const;
3618 #endif //__REMOVE_PLATSEC_DIAGNOSTICS__
3619 TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing) const;
3620 #endif //__KERNEL_MODE__
3623 /** Constants to specify the type of TSecurityPolicy objects.
3627 ETypeFail=0, /**< Always fail*/
3628 ETypePass=1, /**< Always pass*/
3629 ETypeC3=2, /**< Up to 3 capabilities*/
3630 ETypeC7=3, /**< Up to 7 capabilities*/
3631 ETypeS3=4, /**< Secure ID and up to 3 capabilities*/
3632 ETypeV3=5, /**< Vendor ID and up to 3 capabilities*/
3634 /** The number of possible TSecurityPolicy types
3635 This is intended of internal Symbian use only.
3640 // other values may be added to indicate expanded policy objects (future extensions)
3643 TBool CheckPolicy(const SSecurityInfo& aSecInfo, SSecurityInfo& aMissing) const;
3645 void ConstructAndCheck3(TCapability aCap1, TCapability aCap2, TCapability aCap3);
3648 TUint8 iCaps[3]; // missing capabilities are set to 0xff
3653 TUint8 iExtraCaps[4]; // missing capabilities are set to 0xff
3655 friend class TCompiledSecurityPolicy;
3658 /** Provides a TPkcgBuf wrapper for a descriptorised TSecurityPolicy. This a
3659 suitable container for passing a security policy across IPC.
3663 typedef TPckgBuf<TSecurityPolicy> TSecurityPolicyBuf;
3666 /** Structure for compile-time initialisation of a security policy.
3668 This structure behaves in the same way as a TSecurityPolicy object but has
3669 the advantage that it may be initialised at compile time. E.g.
3670 the following line defines a security policy 'KSecurityPolictReadUserData'
3671 which checks ReadUserData capability.
3674 _LIT_SECURITY_POLICY_C1(KSecurityPolictReadUserData,ECapabilityReadUserData)
3677 Or, an array of security policies may be created like this:
3679 static const TStaticSecurityPolicy MyPolicies[] =
3681 _INIT_SECURITY_POLICY_C1(ECapabilityReadUserData),
3682 _INIT_SECURITY_POLICY_PASS(),
3683 _INIT_SECURITY_POLICY_S0(0x1234567)
3687 This class should not be initialised directly, instead one of the following
3688 macros should be used:
3690 - _INIT_SECURITY_POLICY_PASS
3691 - _INIT_SECURITY_POLICY_FAIL
3692 - _INIT_SECURITY_POLICY_C1
3693 - _INIT_SECURITY_POLICY_C2
3694 - _INIT_SECURITY_POLICY_C3
3695 - _INIT_SECURITY_POLICY_C4
3696 - _INIT_SECURITY_POLICY_C5
3697 - _INIT_SECURITY_POLICY_C6
3698 - _INIT_SECURITY_POLICY_C7
3699 - _INIT_SECURITY_POLICY_S0
3700 - _INIT_SECURITY_POLICY_S1
3701 - _INIT_SECURITY_POLICY_S2
3702 - _INIT_SECURITY_POLICY_S3
3703 - _INIT_SECURITY_POLICY_V0
3704 - _INIT_SECURITY_POLICY_V1
3705 - _INIT_SECURITY_POLICY_V2
3706 - _INIT_SECURITY_POLICY_V3
3707 - _LIT_SECURITY_POLICY_PASS
3708 - _LIT_SECURITY_POLICY_FAIL
3709 - _LIT_SECURITY_POLICY_C1
3710 - _LIT_SECURITY_POLICY_C2
3711 - _LIT_SECURITY_POLICY_C3
3712 - _LIT_SECURITY_POLICY_C4
3713 - _LIT_SECURITY_POLICY_C5
3714 - _LIT_SECURITY_POLICY_C6
3715 - _LIT_SECURITY_POLICY_C7
3716 - _LIT_SECURITY_POLICY_S0
3717 - _LIT_SECURITY_POLICY_S1
3718 - _LIT_SECURITY_POLICY_S2
3719 - _LIT_SECURITY_POLICY_S3
3720 - _LIT_SECURITY_POLICY_V0
3721 - _LIT_SECURITY_POLICY_V1
3722 - _LIT_SECURITY_POLICY_V2
3723 - _LIT_SECURITY_POLICY_V3
3725 @see TSecurityPolicy
3729 struct TStaticSecurityPolicy
3731 inline const TSecurityPolicy* operator&() const;
3732 inline operator const TSecurityPolicy&() const;
3733 inline const TSecurityPolicy& operator()() const;
3735 #ifndef __KERNEL_MODE__
3736 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3737 inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
3738 inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
3739 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
3740 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
3741 inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
3742 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3743 // Only available to NULL arguments
3744 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3745 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3746 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
3747 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
3748 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
3749 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3750 // For things using KSuppressPlatSecDiagnostic
3751 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3752 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3753 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3754 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3755 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3756 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3757 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3758 #endif // !__KERNEL_MODE__
3760 TUint32 iA; /**< @internalComponent */
3761 TUint32 iB; /**< @internalComponent */
3766 A dummy enum for use by the CAPABILITY_AS_TUINT8 macro
3769 enum __invalid_capability_value {};
3772 A macro to cast a TCapability to a TUint8.
3774 If an invlid capability value is specified then, dependant on the compiler,
3775 a compile time error or warning will be produced which includes the label
3776 "__invalid_capability_value"
3778 @param cap The capability value
3781 #define CAPABILITY_AS_TUINT8(cap) \
3783 (cap)==ECapability_None \
3784 ? (__invalid_capability_value(*)[1])(ECapability_None) \
3785 : (__invalid_capability_value(*)[((TUint)(cap+1)<=(TUint)ECapability_Limit)?1:2])(cap) \
3790 A macro to construct a TUint32 from four TUint8s. The TUint32 is in BigEndian
3791 ordering useful for class layout rather than number generation.
3793 @param i1 The first TUint8
3794 @param i2 The second TUint8
3795 @param i3 The third TUint8
3796 @param i4 The fourth TUint8
3799 #define FOUR_TUINT8(i1,i2,i3,i4) \
3803 (TUint8)i3 << 16 | \
3808 /** Macro for compile-time initialisation of a security policy object that
3809 always fails. That is, checks against this policy will always fail,
3810 irrespective of the security attributes of the item being checked.
3812 The object declared has an implicit conversion to const TSecurityPolicy&.
3813 Taking the address of the object will return a const TSecurityPolicy*.
3814 Explicit conversion to const TSecurityPolicy& may be effected by using the
3815 function call operator n().
3819 #define _INIT_SECURITY_POLICY_FAIL \
3822 (TUint8)TSecurityPolicy::ETypeFail, \
3827 (TUint32)0xffffffff \
3831 /** Macro for compile-time definition of a security policy object that always
3832 fails. That is, checks against this policy will always fail, irrespective of
3833 the security attributes of the item being checked.
3835 The object declared has an implicit conversion to const TSecurityPolicy&.
3836 Taking the address of the object will return a const TSecurityPolicy*.
3837 Explicit conversion to const TSecurityPolicy& may be effected by using the
3838 function call operator n().
3839 @param n Name to use for policy object
3843 #define _LIT_SECURITY_POLICY_FAIL(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_FAIL
3846 /** Macro for compile-time initialisation of a security policy object that
3847 always passes. That is, checks against this policy will always pass,
3848 irrespective of the security attributes of the item being checked.
3850 The object declared has an implicit conversion to const TSecurityPolicy&.
3851 Taking the address of the object will return a const TSecurityPolicy*.
3852 Explicit conversion to const TSecurityPolicy& may be effected by using the
3853 function call operator n().
3857 #define _INIT_SECURITY_POLICY_PASS \
3860 (TUint8)TSecurityPolicy::ETypePass, \
3865 (TUint32)0xffffffff \
3869 /** Macro for compile-time definition of a security policy object that always
3870 passes. That is, checks against this policy will always pass, irrespective of
3871 the security attributes of the item being checked.
3873 The object declared has an implicit conversion to const TSecurityPolicy&.
3874 Taking the address of the object will return a const TSecurityPolicy*.
3875 Explicit conversion to const TSecurityPolicy& may be effected by using the
3876 function call operator n().
3877 @param n Name to use for policy object
3881 #define _LIT_SECURITY_POLICY_PASS(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_PASS
3884 /** Macro for compile-time initialisation of a security policy object
3885 The policy will check for seven capabilities.
3887 The object declared has an implicit conversion to const TSecurityPolicy&.
3888 Taking the address of the object will return a const TSecurityPolicy*.
3889 Explicit conversion to const TSecurityPolicy& may be effected by using the
3890 function call operator n().
3892 If an invlid capability value is specified then, dependant on the compiler,
3893 a compile time error or warning will be produced which includes the label
3894 "__invalid_capability_value"
3896 @param c1 The first capability to check (enumerator of TCapability)
3897 @param c2 The second capability to check (enumerator of TCapability)
3898 @param c3 The third capability to check (enumerator of TCapability)
3899 @param c4 The fourth capability to check (enumerator of TCapability)
3900 @param c5 The fifth capability to check (enumerator of TCapability)
3901 @param c6 The sixth capability to check (enumerator of TCapability)
3902 @param c7 The seventh capability to check (enumerator of TCapability)
3907 #define _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7) \
3910 (TUint8)TSecurityPolicy::ETypeC7, \
3911 CAPABILITY_AS_TUINT8(c1), \
3912 CAPABILITY_AS_TUINT8(c2), \
3913 CAPABILITY_AS_TUINT8(c3) \
3916 CAPABILITY_AS_TUINT8(c4), \
3917 CAPABILITY_AS_TUINT8(c5), \
3918 CAPABILITY_AS_TUINT8(c6), \
3919 CAPABILITY_AS_TUINT8(c7) \
3924 /** Macro for compile-time definition of a security policy object
3925 The policy will check for seven capabilities.
3927 The object declared has an implicit conversion to const TSecurityPolicy&.
3928 Taking the address of the object will return a const TSecurityPolicy*.
3929 Explicit conversion to const TSecurityPolicy& may be effected by using the
3930 function call operator n().
3932 If an invlid capability value is specified then, dependant on the compiler,
3933 a compile time error or warning will be produced which includes the label
3934 "__invalid_capability_value"
3936 @param n Name to use for policy object
3937 @param c1 The first capability to check (enumerator of TCapability)
3938 @param c2 The second capability to check (enumerator of TCapability)
3939 @param c3 The third capability to check (enumerator of TCapability)
3940 @param c4 The fourth capability to check (enumerator of TCapability)
3941 @param c5 The fifth capability to check (enumerator of TCapability)
3942 @param c6 The sixth capability to check (enumerator of TCapability)
3943 @param c7 The seventh capability to check (enumerator of TCapability)
3948 #define _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,c7) \
3949 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7)
3952 /** Macro for compile-time initialisation of a security policy object
3953 The policy will check for six capabilities.
3955 The object declared has an implicit conversion to const TSecurityPolicy&.
3956 Taking the address of the object will return a const TSecurityPolicy*.
3957 Explicit conversion to const TSecurityPolicy& may be effected by using the
3958 function call operator n().
3960 If an invlid capability value is specified then, dependant on the compiler,
3961 a compile time error or warning will be produced which includes the label
3962 "__invalid_capability_value"
3964 @param c1 The first capability to check (enumerator of TCapability)
3965 @param c2 The second capability to check (enumerator of TCapability)
3966 @param c3 The third capability to check (enumerator of TCapability)
3967 @param c4 The fourth capability to check (enumerator of TCapability)
3968 @param c5 The fifth capability to check (enumerator of TCapability)
3969 @param c6 The sixth capability to check (enumerator of TCapability)
3974 #define _INIT_SECURITY_POLICY_C6(c1,c2,c3,c4,c5,c6) \
3975 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,ECapability_None)
3978 /** Macro for compile-time definition of a security policy object
3979 The policy will check for six capabilities.
3981 The object declared has an implicit conversion to const TSecurityPolicy&.
3982 Taking the address of the object will return a const TSecurityPolicy*.
3983 Explicit conversion to const TSecurityPolicy& may be effected by using the
3984 function call operator n().
3986 If an invlid capability value is specified then, dependant on the compiler,
3987 a compile time error or warning will be produced which includes the label
3988 "__invalid_capability_value"
3990 @param n Name to use for policy object
3991 @param c1 The first capability to check (enumerator of TCapability)
3992 @param c2 The second capability to check (enumerator of TCapability)
3993 @param c3 The third capability to check (enumerator of TCapability)
3994 @param c4 The fourth capability to check (enumerator of TCapability)
3995 @param c5 The fifth capability to check (enumerator of TCapability)
3996 @param c6 The sixth capability to check (enumerator of TCapability)
4001 #define _LIT_SECURITY_POLICY_C6(n,c1,c2,c3,c4,c5,c6) \
4002 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,ECapability_None)
4005 /** Macro for compile-time initialisation of a security policy object
4006 The policy will check for five capabilities.
4008 The object declared has an implicit conversion to const TSecurityPolicy&.
4009 Taking the address of the object will return a const TSecurityPolicy*.
4010 Explicit conversion to const TSecurityPolicy& may be effected by using the
4011 function call operator n().
4013 If an invlid capability value is specified then, dependant on the compiler,
4014 a compile time error or warning will be produced which includes the label
4015 "__invalid_capability_value"
4017 @param c1 The first capability to check (enumerator of TCapability)
4018 @param c2 The second capability to check (enumerator of TCapability)
4019 @param c3 The third capability to check (enumerator of TCapability)
4020 @param c4 The fourth capability to check (enumerator of TCapability)
4021 @param c5 The fifth capability to check (enumerator of TCapability)
4026 #define _INIT_SECURITY_POLICY_C5(c1,c2,c3,c4,c5) \
4027 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
4030 /** Macro for compile-time definition of a security policy object
4031 The policy will check for five capabilities.
4033 The object declared has an implicit conversion to const TSecurityPolicy&.
4034 Taking the address of the object will return a const TSecurityPolicy*.
4035 Explicit conversion to const TSecurityPolicy& may be effected by using the
4036 function call operator n().
4038 If an invlid capability value is specified then, dependant on the compiler,
4039 a compile time error or warning will be produced which includes the label
4040 "__invalid_capability_value"
4042 @param n Name to use for policy object
4043 @param c1 The first capability to check (enumerator of TCapability)
4044 @param c2 The second capability to check (enumerator of TCapability)
4045 @param c3 The third capability to check (enumerator of TCapability)
4046 @param c4 The fourth capability to check (enumerator of TCapability)
4047 @param c5 The fifth capability to check (enumerator of TCapability)
4052 #define _LIT_SECURITY_POLICY_C5(n,c1,c2,c3,c4,c5) \
4053 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
4056 /** Macro for compile-time initialisation of a security policy object
4057 The policy will check for four capabilities.
4059 The object declared has an implicit conversion to const TSecurityPolicy&.
4060 Taking the address of the object will return a const TSecurityPolicy*.
4061 Explicit conversion to const TSecurityPolicy& may be effected by using the
4062 function call operator n().
4064 If an invlid capability value is specified then, dependant on the compiler,
4065 a compile time error or warning will be produced which includes the label
4066 "__invalid_capability_value"
4068 @param c1 The first capability to check (enumerator of TCapability)
4069 @param c2 The second capability to check (enumerator of TCapability)
4070 @param c3 The third capability to check (enumerator of TCapability)
4071 @param c4 The fourth capability to check (enumerator of TCapability)
4076 #define _INIT_SECURITY_POLICY_C4(c1,c2,c3,c4) \
4077 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
4080 /** Macro for compile-time definition of a security policy object
4081 The policy will check for four capabilities.
4083 The object declared has an implicit conversion to const TSecurityPolicy&.
4084 Taking the address of the object will return a const TSecurityPolicy*.
4085 Explicit conversion to const TSecurityPolicy& may be effected by using the
4086 function call operator n().
4088 If an invlid capability value is specified then, dependant on the compiler,
4089 a compile time error or warning will be produced which includes the label
4090 "__invalid_capability_value"
4092 @param n Name to use for policy object
4093 @param c1 The first capability to check (enumerator of TCapability)
4094 @param c2 The second capability to check (enumerator of TCapability)
4095 @param c3 The third capability to check (enumerator of TCapability)
4096 @param c4 The fourth capability to check (enumerator of TCapability)
4101 #define _LIT_SECURITY_POLICY_C4(n,c1,c2,c3,c4) \
4102 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
4105 /** Macro for compile-time initialisation of a security policy object
4106 The policy will check for three capabilities.
4108 The object declared has an implicit conversion to const TSecurityPolicy&.
4109 Taking the address of the object will return a const TSecurityPolicy*.
4110 Explicit conversion to const TSecurityPolicy& may be effected by using the
4111 function call operator n().
4113 If an invlid capability value is specified then, dependant on the compiler,
4114 a compile time error or warning will be produced which includes the label
4115 "__invalid_capability_value"
4117 @param c1 The first capability to check (enumerator of TCapability)
4118 @param c2 The second capability to check (enumerator of TCapability)
4119 @param c3 The third capability to check (enumerator of TCapability)
4124 #define _INIT_SECURITY_POLICY_C3(c1,c2,c3) \
4127 (TUint8)TSecurityPolicy::ETypeC3, \
4128 CAPABILITY_AS_TUINT8(c1), \
4129 CAPABILITY_AS_TUINT8(c2), \
4130 CAPABILITY_AS_TUINT8(c3) \
4132 (TUint32)0xffffffff \
4136 /** Macro for compile-time definition of a security policy object
4137 The policy will check for three capabilities.
4139 The object declared has an implicit conversion to const TSecurityPolicy&.
4140 Taking the address of the object will return a const TSecurityPolicy*.
4141 Explicit conversion to const TSecurityPolicy& may be effected by using the
4142 function call operator n().
4144 If an invlid capability value is specified then, dependant on the compiler,
4145 a compile time error or warning will be produced which includes the label
4146 "__invalid_capability_value"
4148 @param n Name to use for policy object
4149 @param c1 The first capability to check (enumerator of TCapability)
4150 @param c2 The second capability to check (enumerator of TCapability)
4151 @param c3 The third capability to check (enumerator of TCapability)
4156 #define _LIT_SECURITY_POLICY_C3(n,c1,c2,c3) \
4157 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C3(c1,c2,c3)
4160 /** Macro for compile-time initialisation of a security policy object
4161 The policy will check for two capabilities.
4163 The object declared has an implicit conversion to const TSecurityPolicy&.
4164 Taking the address of the object will return a const TSecurityPolicy*.
4165 Explicit conversion to const TSecurityPolicy& may be effected by using the
4166 function call operator n().
4168 If an invlid capability value is specified then, dependant on the compiler,
4169 a compile time error or warning will be produced which includes the label
4170 "__invalid_capability_value"
4172 @param c1 The first capability to check (enumerator of TCapability)
4173 @param c2 The second capability to check (enumerator of TCapability)
4178 #define _INIT_SECURITY_POLICY_C2(c1,c2) \
4179 _INIT_SECURITY_POLICY_C3(c1,c2,ECapability_None)
4182 /** Macro for compile-time definition of a security policy object
4183 The policy will check for two capabilities.
4185 The object declared has an implicit conversion to const TSecurityPolicy&.
4186 Taking the address of the object will return a const TSecurityPolicy*.
4187 Explicit conversion to const TSecurityPolicy& may be effected by using the
4188 function call operator n().
4190 If an invlid capability value is specified then, dependant on the compiler,
4191 a compile time error or warning will be produced which includes the label
4192 "__invalid_capability_value"
4194 @param n Name to use for policy object
4195 @param c1 The first capability to check (enumerator of TCapability)
4196 @param c2 The second capability to check (enumerator of TCapability)
4201 #define _LIT_SECURITY_POLICY_C2(n,c1,c2) \
4202 _LIT_SECURITY_POLICY_C3(n,c1,c2,ECapability_None)
4205 /** Macro for compile-time initialisation of a security policy object
4206 The policy will check for one capability.
4208 The object declared has an implicit conversion to const TSecurityPolicy&.
4209 Taking the address of the object will return a const TSecurityPolicy*.
4210 Explicit conversion to const TSecurityPolicy& may be effected by using the
4211 function call operator n().
4213 If an invlid capability value is specified then, dependant on the compiler,
4214 a compile time error or warning will be produced which includes the label
4215 "__invalid_capability_value"
4217 @param c1 The first capability to check (enumerator of TCapability)
4223 #define _INIT_SECURITY_POLICY_C1(c1) \
4224 _INIT_SECURITY_POLICY_C3(c1,ECapability_None,ECapability_None)
4227 /** Macro for compile-time definition of a security policy object
4228 The policy will check for one capability.
4230 The object declared has an implicit conversion to const TSecurityPolicy&.
4231 Taking the address of the object will return a const TSecurityPolicy*.
4232 Explicit conversion to const TSecurityPolicy& may be effected by using the
4233 function call operator n().
4235 If an invlid capability value is specified then, dependant on the compiler,
4236 a compile time error or warning will be produced which includes the label
4237 "__invalid_capability_value"
4239 @param n Name to use for policy object
4240 @param c1 The first capability to check (enumerator of TCapability)
4245 #define _LIT_SECURITY_POLICY_C1(n,c1) \
4246 _LIT_SECURITY_POLICY_C3(n,c1,ECapability_None,ECapability_None)
4249 /** Macro for compile-time initialisation of a security policy object
4250 The policy will check for a secure ID and three capabilities.
4252 The object declared has an implicit conversion to const TSecurityPolicy&.
4253 Taking the address of the object will return a const TSecurityPolicy*.
4254 Explicit conversion to const TSecurityPolicy& may be effected by using the
4255 function call operator n().
4257 If an invlid capability value is specified then, dependant on the compiler,
4258 a compile time error or warning be produced which includes the label
4259 "__invalid_capability_value"
4261 @param sid The SID value to check for
4262 @param c1 The first capability to check (enumerator of TCapability)
4263 @param c2 The second capability to check (enumerator of TCapability)
4264 @param c3 The third capability to check (enumerator of TCapability)
4269 #define _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3) \
4272 (TUint8)TSecurityPolicy::ETypeS3, \
4273 CAPABILITY_AS_TUINT8(c1), \
4274 CAPABILITY_AS_TUINT8(c2), \
4275 CAPABILITY_AS_TUINT8(c3) \
4281 /** Macro for compile-time definition of a security policy object
4282 The policy will check for a secure ID and three capabilities.
4284 The object declared has an implicit conversion to const TSecurityPolicy&.
4285 Taking the address of the object will return a const TSecurityPolicy*.
4286 Explicit conversion to const TSecurityPolicy& may be effected by using the
4287 function call operator n().
4289 If an invlid capability value is specified then, dependant on the compiler,
4290 a compile time error or warning be produced which includes the label
4291 "__invalid_capability_value"
4293 @param n Name to use for policy object
4294 @param sid The SID value to check for
4295 @param c1 The first capability to check (enumerator of TCapability)
4296 @param c2 The second capability to check (enumerator of TCapability)
4297 @param c3 The third capability to check (enumerator of TCapability)
4302 #define _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,c3) \
4303 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3)
4306 /** Macro for compile-time initialisation of a security policy object
4307 The policy will check for a secure ID and two capabilities.
4309 The object declared has an implicit conversion to const TSecurityPolicy&.
4310 Taking the address of the object will return a const TSecurityPolicy*.
4311 Explicit conversion to const TSecurityPolicy& may be effected by using the
4312 function call operator n().
4314 If an invlid capability value is specified then, dependant on the compiler,
4315 a compile time error or warning be produced which includes the label
4316 "__invalid_capability_value"
4318 @param sid The SID value to check for
4319 @param c1 The first capability to check (enumerator of TCapability)
4320 @param c2 The second capability to check (enumerator of TCapability)
4325 #define _INIT_SECURITY_POLICY_S2(sid,c1,c2) \
4326 _INIT_SECURITY_POLICY_S3(sid,c1,c2,ECapability_None)
4329 /** Macro for compile-time definition of a security policy object
4330 The policy will check for a secure ID and two capabilities.
4332 The object declared has an implicit conversion to const TSecurityPolicy&.
4333 Taking the address of the object will return a const TSecurityPolicy*.
4334 Explicit conversion to const TSecurityPolicy& may be effected by using the
4335 function call operator n().
4337 If an invlid capability value is specified then, dependant on the compiler,
4338 a compile time error or warning be produced which includes the label
4339 "__invalid_capability_value"
4341 @param n Name to use for policy object
4342 @param sid The SID value to check for
4343 @param c1 The first capability to check (enumerator of TCapability)
4344 @param c2 The second capability to check (enumerator of TCapability)
4349 #define _LIT_SECURITY_POLICY_S2(n,sid,c1,c2) \
4350 _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,ECapability_None)
4353 /** Macro for compile-time initialisation of a security policy object
4354 The policy will check for a secure ID and one capability.
4356 The object declared has an implicit conversion to const TSecurityPolicy&.
4357 Taking the address of the object will return a const TSecurityPolicy*.
4358 Explicit conversion to const TSecurityPolicy& may be effected by using the
4359 function call operator n().
4361 If an invlid capability value is specified then, dependant on the compiler,
4362 a compile time error or warning be produced which includes the label
4363 "__invalid_capability_value"
4365 @param sid The SID value to check for
4366 @param c1 The first capability to check (enumerator of TCapability)
4371 #define _INIT_SECURITY_POLICY_S1(sid,c1) \
4372 _INIT_SECURITY_POLICY_S3(sid,c1,ECapability_None,ECapability_None)
4375 /** Macro for compile-time definition of a security policy object
4376 The policy will check for a secure ID and one capability.
4378 The object declared has an implicit conversion to const TSecurityPolicy&.
4379 Taking the address of the object will return a const TSecurityPolicy*.
4380 Explicit conversion to const TSecurityPolicy& may be effected by using the
4381 function call operator n().
4383 If an invlid capability value is specified then, dependant on the compiler,
4384 a compile time error or warning be produced which includes the label
4385 "__invalid_capability_value"
4387 @param n Name to use for policy object
4388 @param sid The SID value to check for
4389 @param c1 The first capability to check (enumerator of TCapability)
4394 #define _LIT_SECURITY_POLICY_S1(n,sid,c1) \
4395 _LIT_SECURITY_POLICY_S3(n,sid,c1,ECapability_None,ECapability_None)
4398 /** Macro for compile-time initialisation of a security policy object
4399 The policy will check for a secure ID.
4401 The object declared has an implicit conversion to const TSecurityPolicy&.
4402 Taking the address of the object will return a const TSecurityPolicy*.
4403 Explicit conversion to const TSecurityPolicy& may be effected by using the
4404 function call operator n().
4406 @param sid The SID value to check for
4411 #define _INIT_SECURITY_POLICY_S0(sid) \
4412 _INIT_SECURITY_POLICY_S3(sid,ECapability_None,ECapability_None,ECapability_None)
4415 /** Macro for compile-time definition of a security policy object
4416 The policy will check for a secure ID.
4418 The object declared has an implicit conversion to const TSecurityPolicy&.
4419 Taking the address of the object will return a const TSecurityPolicy*.
4420 Explicit conversion to const TSecurityPolicy& may be effected by using the
4421 function call operator n().
4423 @param n Name to use for policy object
4424 @param sid The SID value to check for
4429 #define _LIT_SECURITY_POLICY_S0(n,sid) \
4430 _LIT_SECURITY_POLICY_S3(n,sid,ECapability_None,ECapability_None,ECapability_None)
4433 /** Macro for compile-time initialisation of a security policy object
4434 The policy will check for a vendor ID and three capabilities.
4436 The object declared has an implicit conversion to const TSecurityPolicy&.
4437 Taking the address of the object will return a const TSecurityPolicy*.
4438 Explicit conversion to const TSecurityPolicy& may be effected by using the
4439 function call operator n().
4441 If an invlid capability value is specified then, dependant on the compiler,
4442 a compile time error or warning be produced which includes the label
4443 "__invalid_capability_value"
4445 @param vid The VID value to check for
4446 @param c1 The first capability to check (enumerator of TCapability)
4447 @param c2 The second capability to check (enumerator of TCapability)
4448 @param c3 The third capability to check (enumerator of TCapability)
4453 #define _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3) \
4456 (TUint8)TSecurityPolicy::ETypeV3, \
4457 CAPABILITY_AS_TUINT8(c1), \
4458 CAPABILITY_AS_TUINT8(c2), \
4459 CAPABILITY_AS_TUINT8(c3) \
4465 /** Macro for compile-time definition of a security policy object
4466 The policy will check for a vendor ID and three capabilities.
4468 The object declared has an implicit conversion to const TSecurityPolicy&.
4469 Taking the address of the object will return a const TSecurityPolicy*.
4470 Explicit conversion to const TSecurityPolicy& may be effected by using the
4471 function call operator n().
4473 If an invlid capability value is specified then, dependant on the compiler,
4474 a compile time error or warning be produced which includes the label
4475 "__invalid_capability_value"
4477 @param n Name to use for policy object
4478 @param vid The VID value to check for
4479 @param c1 The first capability to check (enumerator of TCapability)
4480 @param c2 The second capability to check (enumerator of TCapability)
4481 @param c3 The third capability to check (enumerator of TCapability)
4486 #define _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,c3) \
4487 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3)
4490 /** Macro for compile-time initialisation of a security policy object
4491 The policy will check for a vendor ID and two capabilities.
4493 The object declared has an implicit conversion to const TSecurityPolicy&.
4494 Taking the address of the object will return a const TSecurityPolicy*.
4495 Explicit conversion to const TSecurityPolicy& may be effected by using the
4496 function call operator n().
4498 If an invlid capability value is specified then, dependant on the compiler,
4499 a compile time error or warning be produced which includes the label
4500 "__invalid_capability_value"
4502 @param vid The VID value to check for
4503 @param c1 The first capability to check (enumerator of TCapability)
4504 @param c2 The second capability to check (enumerator of TCapability)
4509 #define _INIT_SECURITY_POLICY_V2(vid,c1,c2) \
4510 _INIT_SECURITY_POLICY_V3(vid,c1,c2,ECapability_None)
4513 /** Macro for compile-time definition of a security policy object
4514 The policy will check for a vendor ID and two capabilities.
4516 The object declared has an implicit conversion to const TSecurityPolicy&.
4517 Taking the address of the object will return a const TSecurityPolicy*.
4518 Explicit conversion to const TSecurityPolicy& may be effected by using the
4519 function call operator n().
4521 If an invlid capability value is specified then, dependant on the compiler,
4522 a compile time error or warning be produced which includes the label
4523 "__invalid_capability_value"
4525 @param n Name to use for policy object
4526 @param vid The VID value to check for
4527 @param c1 The first capability to check (enumerator of TCapability)
4528 @param c2 The second capability to check (enumerator of TCapability)
4533 #define _LIT_SECURITY_POLICY_V2(n,vid,c1,c2) \
4534 _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,ECapability_None)
4537 /** Macro for compile-time initialisation of a security policy object
4538 The policy will check for a vendor ID and one capability.
4540 The object declared has an implicit conversion to const TSecurityPolicy&.
4541 Taking the address of the object will return a const TSecurityPolicy*.
4542 Explicit conversion to const TSecurityPolicy& may be effected by using the
4543 function call operator n().
4545 If an invlid capability value is specified then, dependant on the compiler,
4546 a compile time error or warning be produced which includes the label
4547 "__invalid_capability_value"
4549 @param vid The VID value to check for
4550 @param c1 The first capability to check (enumerator of TCapability)
4555 #define _INIT_SECURITY_POLICY_V1(vid,c1) \
4556 _INIT_SECURITY_POLICY_V3(vid,c1,ECapability_None,ECapability_None)
4559 /** Macro for compile-time definition of a security policy object
4560 The policy will check for a vendor ID and one capability.
4562 The object declared has an implicit conversion to const TSecurityPolicy&.
4563 Taking the address of the object will return a const TSecurityPolicy*.
4564 Explicit conversion to const TSecurityPolicy& may be effected by using the
4565 function call operator n().
4567 If an invlid capability value is specified then, dependant on the compiler,
4568 a compile time error or warning be produced which includes the label
4569 "__invalid_capability_value"
4571 @param n Name to use for policy object
4572 @param vid The VID value to check for
4573 @param c1 The first capability to check (enumerator of TCapability)
4578 #define _LIT_SECURITY_POLICY_V1(n,vid,c1) \
4579 _LIT_SECURITY_POLICY_V3(n,vid,c1,ECapability_None,ECapability_None)
4582 /** Macro for compile-time initialisation of a security policy object
4583 The policy will check for a vendor ID.
4585 The object declared has an implicit conversion to const TSecurityPolicy&.
4586 Taking the address of the object will return a const TSecurityPolicy*.
4587 Explicit conversion to const TSecurityPolicy& may be effected by using the
4588 function call operator n().
4590 @param vid The VID value to check for
4595 #define _INIT_SECURITY_POLICY_V0(vid) \
4596 _INIT_SECURITY_POLICY_V3(vid,ECapability_None,ECapability_None,ECapability_None)
4599 /** Macro for compile-time definition of a security policy object
4600 The policy will check for a vendor ID.
4602 The object declared has an implicit conversion to const TSecurityPolicy&.
4603 Taking the address of the object will return a const TSecurityPolicy*.
4604 Explicit conversion to const TSecurityPolicy& may be effected by using the
4605 function call operator n().
4607 @param n Name to use for policy object
4608 @param vid The VID value to check for
4613 #define _LIT_SECURITY_POLICY_V0(n,vid) \
4614 _LIT_SECURITY_POLICY_V3(n,vid,ECapability_None,ECapability_None,ECapability_None)
4618 #ifdef __KERNEL_MODE__
4622 class TPlatSecDiagnostic;
4625 Class containing Platform Security related methods
4630 #ifndef __KERNEL_MODE__
4633 Tests whether a given Platform Security capability is enforced by the system.
4635 Capabilities may not be enforced for several reasons:
4636 -# The capability has been explicitly disabled on this system
4637 by use of the PlatSecDisabledCaps configuration parameter
4638 -# Platform Security checks have been globally disabled
4639 by use of the EPlatSecEnforcement configuration parameter
4640 -# The capability value is unknown. I.e. Is not part of the set of supported
4641 capabilities. See TCapabilitySet::SetAllSupported().
4643 @param aCapability The capability to test
4644 @return A non-zero value if the capability is enforced, zero if it is not.
4649 IMPORT_C static TBool IsCapabilityEnforced(TCapability aCapability);
4652 An enumeration used with PlatSecSetting()
4653 @see PlatSecSetting()
4659 EPlatSecEnforcement, /**< Used to request the value of the PlatSecEnforcement setting */
4660 EPlatSecDiagnotics, /**< Used to request the value of the PlatSecDiagnotics setting */
4661 EPlatSecProcessIsolation, /**< Used to request the value of the PlatSecProcessIsolation setting */
4662 EPlatSecEnforceSysBin, /**< Used to request the value of the PlatSecEnforceSysBin setting */
4663 EPlatSecLocked, /**< Used to request the value of the PlatSecLocked setting */
4667 A test function to return the state of a given Platform Security configuration setting.
4668 @param aSetting An enumerated value representing the required setting
4669 @return A value representing the setting. 0 represents 'OFF', 1 represents 'ON'
4670 Other values may be returned for some settings, these exceptions are documented
4671 in the description for individual enumerations of TConfigSetting.
4676 IMPORT_C static TInt ConfigSetting(TConfigSetting aSetting);
4678 #endif // Not __KERNEL_MODE__
4681 // All methods below here are internalTechnology
4684 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
4686 /** @internalTechnology */
4687 static inline TInt LoaderCapabilityViolation(const TDesC8& aImporterName, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
4688 #ifdef __KERNEL_MODE__
4689 /** @internalTechnology */
4690 static inline TInt CapabilityCheckFail(const DProcess* aViolatingProcess, TCapability aCapability, const char* aContextText);
4691 /** @internalTechnology */
4692 static inline TInt CapabilityCheckFail(const DThread* aViolatingThread, TCapability aCapability, const char* aContextText);
4693 /** @internalTechnology */
4694 static inline TInt SecureIdCheckFail(const DProcess* aViolatingProcess, TSecureId aSid, const char* aContextText);
4695 /** @internalTechnology */
4696 static inline TInt PolicyCheckFail(const DProcess* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
4697 /** @internalTechnology */
4698 static inline TInt PolicyCheckFail(const DThread* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
4699 /** @internalTechnology */
4700 static inline TInt ProcessIsolationFail(const char* aContextText);
4701 /** @internalTechnology */
4702 static inline TInt ProcessIsolationIPCFail(RMessageK* aMessage, const char* aContextText);
4703 #else // !__KERNEL_MODE__
4704 /** @internalTechnology */
4705 static inline TInt LoaderCapabilityViolation(RProcess aLoadingProcess, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
4706 /** @internalTechnology */
4707 static inline TInt CreatorCapabilityCheckFail(TCapability aCapability, const char* aContextText);
4708 /** @internalTechnology */
4709 static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps, const char* aContextText);
4710 /** @internalTechnology */
4711 static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability, const char* aContextText);
4712 /** @internalTechnology */
4713 static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps, const char* aContextText);
4714 /** @internalTechnology */
4715 static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing, const char* aContextText);
4716 /** @internalTechnology */
4717 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability, const char* aContextText);
4718 /** @internalTechnology */
4719 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps, const char* aContextText);
4720 /** @internalTechnology */
4721 static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps, const char* aContextText);
4722 /** @internalTechnology */
4723 static inline TInt PolicyCheckFail(RSessionBase aSession, const SSecurityInfo& aMissingCaps, const char* aContextText);
4724 /** @internalTechnology */
4725 static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps, const char* aContextText);
4726 /** @internalTechnology */
4727 static inline TInt CreatorCapabilityCheckFail(TCapability aCapability);
4728 /** @internalTechnology */
4729 static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps);
4730 /** @internalTechnology */
4731 static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability);
4732 /** @internalTechnology */
4733 static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps);
4734 /** @internalTechnology */
4735 static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing);
4736 /** @internalTechnology */
4737 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability);
4738 /** @internalTechnology */
4739 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps);
4740 /** @internalTechnology */
4741 static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps);
4742 /** @internalTechnology */
4743 static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps);
4744 #endif //__KERNEL_MODE__
4747 /** @internalTechnology */
4748 UIMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
4749 #else //__REMOVE_PLATSEC_DIAGNOSTICS__
4750 #ifndef __KERNEL_MODE__
4752 /** @internalTechnology */
4753 IMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
4754 #endif // !__KERNEL_MODE__
4755 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
4758 /** @internalTechnology */
4759 UIMPORT_C static TInt EmitDiagnostic();
4767 struct TEmulatorImageHeader
4769 TUid iUids[KMaxCheckedUid];
4770 TProcessPriority iPriority;
4774 TUint32 iModuleVersion;
4785 Contains information about the code and data sections belonging to a process.
4787 @see RProcess::GetMemoryInfo
4789 class TProcessMemoryInfo
4793 The code base address (.text).
4799 The size of the code section (.text).
4805 The base address of the constant data section (.radata).
4807 TUint32 iConstDataBase;
4811 The size of the constant data section (.radata).
4814 TUint32 iConstDataSize;
4818 The base address of the initialised data section (.data).
4820 TUint32 iInitialisedDataBase;
4824 The size of the initialised data section (.data).
4826 TUint32 iInitialisedDataSize;
4830 The base address of the uninitialised data section (.bss).
4832 TUint32 iUninitialisedDataBase;
4836 The size of the uninitialised data section (.bss).
4838 TUint32 iUninitialisedDataSize;
4848 Defines a more useful synonym for TProcessMemoryInfo.
4850 typedef TProcessMemoryInfo TModuleMemoryInfo; // more accurate name - remove old one later
4855 #ifndef __KERNEL_MODE__
4863 This class defines a generic array which can be constructed by any of the
4864 following templated concrete arrays:
4866 1. CArrayFixFlat<class T>
4868 2. CArrayFixSeg<class T>
4870 3. CArrayVarFlat<class T>
4872 4. CArrayVarSeg<class T>
4874 5. CArrayPakFlat<class T>
4878 7. RPointerArray<class T>
4880 and also by the following template specialisation classes:
4886 It allows a degree of polymorphism amongst the array classes. It permits the
4887 operator[] and the Count() member functions of an array to be invoked without
4888 knowing which array class has been used to construct that array.
4890 TArray allows access to elements of an array but does not permit changes to
4893 Use the Array() member function of an array to construct and return
4894 a TArray<class T> object for that array.
4896 A TArray<class T> type object is not intended to be constructed explicitly
4913 inline TArray(TInt (*aCount)(const CBase* aPtr),const TAny*(*anAt)(const CBase* aPtr,TInt anIndex),const CBase* aPtr);
4914 inline TInt Count() const;
4915 inline const T& operator[](TInt anIndex) const;
4918 TInt (*iCount)(const CBase* aPtr);
4919 const TAny*(*iAt)(const CBase* aPtr,TInt anIndex);
4930 Defines a function type used by a TIdentityRelation object.
4932 A function of this type implements an algorithm for determining whether
4935 @see TIdentityRelation
4937 typedef TBool (*TGeneralIdentityRelation)(const TAny*, const TAny*);
4946 Defines a function type used by a TLinearOrder object
4948 A function of this type implements an algorithm that determines
4949 the order of two objects.
4953 typedef TInt (*TGeneralLinearOrder)(const TAny*, const TAny*);
4962 A templated class which packages a function that determines whether two
4963 objects of a given class type match. During linear search operations the search
4964 term is always passed as the first argument and the second argument is an
4965 element of the array being searched.
4967 A TIdentityRelation<T> object is constructed and passed as a parameter to
4968 member functions of the array classes RArray<T> and RPointerArray<T>.
4974 class TIdentityRelation
4977 inline TIdentityRelation( TBool (*anIdentity)(const T&, const T&) );
4978 inline operator TGeneralIdentityRelation() const;
4980 TGeneralIdentityRelation iIdentity;
4989 A set of common identity relations for frequently occurring types.
4998 class DefaultIdentity
5001 IMPORT_C static TBool Integer(const TInt&, const TInt&);
5002 IMPORT_C static TBool Des8(const TDesC8&, const TDesC8&);
5003 IMPORT_C static TBool Des16(const TDesC16&, const TDesC16&);
5004 IMPORT_C static TBool IntegerPtr(TInt* const&, TInt* const&);
5005 IMPORT_C static TBool Des8Ptr(TDesC8* const&, TDesC8* const&);
5006 IMPORT_C static TBool Des16Ptr(TDesC16* const&, TDesC16* const&);
5016 A templated class which packages a function that determines the order of two
5017 objects of a given class type. During binary search operations the search term
5018 is always passed as the first argument and the second argument is an element
5019 of the array being searched.
5021 A TLinearOrder<T> object is constructed and passed as a parameter to member
5022 functions of the array classes RArray<T> and RPointerArray<T>.
5031 inline TLinearOrder( TInt(*anOrder)(const T&, const T&) );
5032 inline operator TGeneralLinearOrder() const;
5034 TGeneralLinearOrder iOrder;
5042 A set of values that tell array search functions which array element is to be
5043 returned when there are duplicate elements in the array.
5045 These values are used by RArray, RPointerArray, RArray<TInt>,
5046 and RArray<TUint> search functions.
5048 Examples of functions that take
5049 these enum values are: RPointerArray::SpecificFindInOrderL(),
5050 and RArray::SpecificFindInSignedKeyOrder().
5060 Indicates that any element in a block of duplicate elements can be
5061 returned by a search function.
5063 Note that using this mode, there can be no guarantee that the element
5064 returned by the search functions will be the same if the size of the array
5065 changes between successive calls to those functions.
5067 EArrayFindMode_Any = 0,
5070 Indicates that the first element in a block of duplicate elements
5073 EArrayFindMode_First = 1,
5076 Indicates that the first element after the last element in a block
5077 of duplicate elements is returned.
5079 EArrayFindMode_Last = 2,
5084 EArrayFindMode_Limit = 3
5091 Base class used in the derivation of RPointerArray, RArray<TInt>,
5094 The base class is inherited privately.
5096 The class is internal and is not intended for use.
5098 class RPointerArrayBase
5101 IMPORT_C RPointerArrayBase();
5102 IMPORT_C RPointerArrayBase(TInt aGranularity);
5103 IMPORT_C RPointerArrayBase(TInt aMinGrowBy, TInt aFactor);
5104 IMPORT_C void Close();
5105 IMPORT_C TInt Count() const;
5106 inline void ZeroCount() {iCount=0;}
5107 inline TAny** Entries() {return iEntries;}
5108 IMPORT_C TAny*& At(TInt anIndex) const;
5109 IMPORT_C TInt Append(const TAny* anEntry);
5110 IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
5111 IMPORT_C void Remove(TInt anIndex);
5112 IMPORT_C void Compress();
5113 IMPORT_C void Reset();
5114 IMPORT_C TInt Find(const TAny* anEntry) const;
5115 IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
5116 IMPORT_C TInt FindReverse(const TAny* aEntry) const;
5117 IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
5118 IMPORT_C TInt FindIsqSigned(TInt anEntry) const;
5119 IMPORT_C TInt FindIsqUnsigned(TUint anEntry) const;
5120 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
5121 IMPORT_C TInt FindIsqSigned(TInt anEntry, TInt aMode) const;
5122 IMPORT_C TInt FindIsqUnsigned(TUint anEntry, TInt aMode) const;
5123 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
5124 IMPORT_C TInt InsertIsqSigned(TInt anEntry, TBool aAllowRepeats);
5125 IMPORT_C TInt InsertIsqUnsigned(TUint anEntry, TBool aAllowRepeats);
5126 IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
5127 IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex) const;
5128 IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex) const;
5129 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
5130 IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex, TInt aMode) const;
5131 IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex, TInt aMode) const;
5132 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
5133 #ifndef __KERNEL_MODE__
5134 IMPORT_C RPointerArrayBase(TAny** aEntries, TInt aCount);
5135 IMPORT_C void GranularCompress();
5136 IMPORT_C TInt DoReserve(TInt aCount);
5137 IMPORT_C void HeapSortSigned();
5138 IMPORT_C void HeapSortUnsigned();
5139 IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
5140 IMPORT_C static TInt GetCount(const CBase* aPtr);
5141 IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
5149 TInt iGranularity; // positive means linear, negative means exponential growth
5161 A simple and efficient array of pointers to objects.
5163 The elements of the array are pointers to instances of a class; this class
5164 is specified as the template parameter T.
5166 The class offers standard array behaviour which includes insertion, appending
5167 and sorting of pointers.
5169 Derivation from RPointerArrayBase is private.
5172 class RPointerArray : private RPointerArrayBase
5175 inline RPointerArray();
5176 inline explicit RPointerArray(TInt aGranularity);
5177 inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
5178 inline void Close();
5179 inline TInt Count() const;
5180 inline T* const& operator[](TInt anIndex) const;
5181 inline T*& operator[](TInt anIndex);
5182 inline TInt Append(const T* anEntry);
5183 inline TInt Insert(const T* anEntry, TInt aPos);
5184 inline void Remove(TInt anIndex);
5185 inline void Compress();
5186 inline void Reset();
5187 void ResetAndDestroy();
5188 inline TInt Find(const T* anEntry) const;
5189 inline TInt Find(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5191 inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
5193 Finds the first object pointer in the array which matches aKey using
5194 the comparison algorithm provided by apfnCompare.
5196 The find operation always starts at the low index end of the array. There
5197 is no assumption about the order of objects in the array.
5199 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5200 @param apfnCompare A function defining the identity relation between the
5201 object pointers in the array, and their keys of type K. The
5202 function returns true if k and t match based on this relationship.
5204 @return The index of the first matching object pointer within the array.
5205 KErrNotFound, if no suitable object pointer can be found.
5207 { return RPointerArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
5208 inline TInt FindReverse(const T* anEntry) const;
5209 inline TInt FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5211 inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
5213 Finds the first object pointer in the array which matches aKey using
5214 the comparison algorithm provided by apfnCompare.
5216 The find operation always starts at the high index end of the array. There
5217 is no assumption about the order of objects in the array.
5219 @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
5220 @param apfnMatch A function defining the identity relation between the
5221 object pointers in the array, and their keys of type K. The
5222 function returns true if k and t match based on this relationship.
5224 @return The index of the first matching object pointer within the array.
5225 KErrNotFound, if no suitable object pointer can be found.
5228 { return RPointerArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
5229 inline TInt FindInAddressOrder(const T* anEntry) const;
5230 inline TInt FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const;
5231 inline TInt FindInAddressOrder(const T* anEntry, TInt& anIndex) const;
5232 inline TInt FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5234 inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
5236 Finds the object pointer in the array whose object matches the specified
5237 key, (Using the relationship defined within apfnCompare) using a binary search
5238 technique and an ordering algorithm.
5240 The function assumes that existing object pointers in the array are ordered
5241 so that the objects themselves are in object order as determined by an algorithm
5242 supplied by the caller and packaged as a TLinearOrder<T>.
5244 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5245 @param apfnCompare A function which defines the order that the array was sorted,
5246 where in it aKey (via the defined relationship) should fit, and if the key is present.
5248 @return The index of the matching object pointer within the array.
5249 KErrNotFound, if no suitable object pointer can be found.
5251 { return RPointerArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
5252 inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const;
5253 inline TInt SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5254 inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const;
5255 inline TInt SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5256 inline TInt InsertInAddressOrder(const T* anEntry);
5257 inline TInt InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder);
5258 inline TInt InsertInAddressOrderAllowRepeats(const T* anEntry);
5259 inline TInt InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder);
5260 #ifndef __KERNEL_MODE__
5261 inline void AppendL(const T* anEntry);
5262 inline void InsertL(const T* anEntry, TInt aPos);
5263 inline TInt FindL(const T* anEntry) const;
5264 inline TInt FindL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5265 inline TInt FindReverseL(const T* anEntry) const;
5266 inline TInt FindReverseL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5267 inline TInt FindInAddressOrderL(const T* anEntry) const;
5268 inline TInt FindInOrderL(const T* anEntry, TLinearOrder<T> anOrder) const;
5269 inline void FindInAddressOrderL(const T* anEntry, TInt& anIndex) const;
5270 inline void FindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5271 inline TInt SpecificFindInAddressOrderL(const T* anEntry, TInt aMode) const;
5272 inline TInt SpecificFindInOrderL(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5273 inline void SpecificFindInAddressOrderL(const T* anEntry, TInt& anIndex, TInt aMode) const;
5274 inline void SpecificFindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5275 inline void InsertInAddressOrderL(const T* anEntry);
5276 inline void InsertInOrderL(const T* anEntry, TLinearOrder<T> anOrder);
5277 inline void InsertInAddressOrderAllowRepeatsL(const T* anEntry);
5278 inline void InsertInOrderAllowRepeatsL(const T* anEntry, TLinearOrder<T> anOrder);
5280 inline RPointerArray(T** aEntries, TInt aCount);
5281 inline void GranularCompress();
5282 inline TInt Reserve(TInt aCount);
5283 inline void ReserveL(TInt aCount);
5284 inline void SortIntoAddressOrder();
5285 inline void Sort(TLinearOrder<T> anOrder);
5286 inline TArray<T*> Array() const;
5296 Array of raw pointers.
5298 The array is a simple and efficient specialized array of TAny pointers offering
5299 standard array behaviour.
5301 The derivation from RPointerArrayBase is private.
5303 TEMPLATE_SPECIALIZATION class RPointerArray<TAny> : private RPointerArrayBase
5306 inline RPointerArray();
5307 inline explicit RPointerArray(TInt aGranularity);
5308 inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
5309 inline void Close();
5310 inline TInt Count() const;
5311 inline TAny* const& operator[](TInt anIndex) const;
5312 inline TAny*& operator[](TInt anIndex);
5313 inline TInt Append(const TAny* anEntry);
5314 inline TInt Insert(const TAny* anEntry, TInt aPos);
5315 inline void Remove(TInt anIndex);
5316 inline void Compress();
5317 inline void Reset();
5318 inline TInt Find(const TAny* anEntry) const;
5319 inline TInt FindReverse(const TAny* anEntry) const;
5320 inline TInt FindInAddressOrder(const TAny* anEntry) const;
5321 inline TInt FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const;
5322 inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const;
5323 inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5324 inline TInt InsertInAddressOrder(const TAny* anEntry);
5325 inline TInt InsertInAddressOrderAllowRepeats(const TAny* anEntry);
5326 #ifndef __KERNEL_MODE__
5327 inline void AppendL(const TAny* anEntry);
5328 inline void InsertL(const TAny* anEntry, TInt aPos);
5329 inline TInt FindL(const TAny* anEntry) const;
5330 inline TInt FindReverseL(const TAny* anEntry) const;
5331 inline TInt FindInAddressOrderL(const TAny* anEntry) const;
5332 inline void FindInAddressOrderL(const TAny* anEntry, TInt& anIndex) const;
5333 inline TInt SpecificFindInAddressOrderL(const TAny* anEntry, TInt aMode) const;
5334 inline void SpecificFindInAddressOrderL(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5335 inline void InsertInAddressOrderL(const TAny* anEntry);
5336 inline void InsertInAddressOrderAllowRepeatsL(const TAny* anEntry);
5338 inline RPointerArray(TAny** aEntries, TInt aCount);
5339 inline void GranularCompress();
5340 inline void SortIntoAddressOrder();
5341 inline TArray<TAny*> Array() const;
5350 Base class used in the derivation of RArray.
5352 The base class is inherited privately.
5354 The class is internal and is not intended for use.
5359 IMPORT_C RArrayBase(TInt anEntrySize);
5360 IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity);
5361 IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity, TInt aKeyOffset);
5362 IMPORT_C RArrayBase(TInt anEntrySize, TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
5363 IMPORT_C RArrayBase(TInt aEntrySize,TAny* aEntries, TInt aCount);
5364 IMPORT_C void Close();
5365 IMPORT_C TInt Count() const;
5366 IMPORT_C TAny* At(TInt anIndex) const;
5367 IMPORT_C TInt Append(const TAny* anEntry);
5368 IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
5369 IMPORT_C void Remove(TInt anIndex);
5370 IMPORT_C void Compress();
5371 IMPORT_C void Reset();
5372 IMPORT_C TInt Find(const TAny* anEntry) const;
5373 IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
5374 IMPORT_C TInt FindReverse(const TAny* aEntry) const;
5375 IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
5376 IMPORT_C TInt FindIsqSigned(const TAny* anEntry) const;
5377 IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry) const;
5378 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
5379 IMPORT_C TInt FindIsqSigned(const TAny* anEntry, TInt aMode) const;
5380 IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry, TInt aMode) const;
5381 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
5382 IMPORT_C TInt InsertIsqSigned(const TAny* anEntry, TBool aAllowRepeats);
5383 IMPORT_C TInt InsertIsqUnsigned(const TAny* anEntry, TBool aAllowRepeats);
5384 IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
5385 IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex) const;
5386 IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex) const;
5387 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
5388 IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5389 IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5390 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
5391 #ifndef __KERNEL_MODE__
5392 IMPORT_C void GranularCompress();
5393 IMPORT_C TInt DoReserve(TInt aCount);
5394 IMPORT_C void HeapSortSigned();
5395 IMPORT_C void HeapSortUnsigned();
5396 IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
5397 IMPORT_C static TInt GetCount(const CBase* aPtr);
5398 IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
5408 TInt iGranularity; // positive means linear, negative means exponential growth
5420 A simple and efficient array of fixed length objects.
5422 The elements of the array are instances of a class; this class is specified
5423 as the template parameter T.
5425 The array offers standard array behaviour which includes insertion, appending
5426 and sorting of elements.
5430 1. where possible, this class should be used in preference to
5431 CArrayFixFlat<classT>.
5433 2. the derivation from RArrayBase is private.
5435 3. for performance reasons, RArray stores objects in the array as
5436 word (4 byte) aligned quantities. This means that some member functions
5437 do not work when RArray is instantiated for classes of less than 4 bytes
5438 in size, or when the class's alignment requirement is not 4.
5439 Be aware that it is possible to get an unhandled exception on hardware
5440 that enforces strict alignment.
5442 The affected functions are:
5444 3.1 the constructor: RArray(TInt, T*, TInt)
5446 3.2 Append(const T&)
5448 3.3 Insert(const T&, TInt)
5450 3.4 the [] operator, and then using the pointer to iterate through
5451 the array as you would with a C array.
5454 class RArray : private RArrayBase
5458 inline explicit RArray(TInt aGranularity);
5459 inline RArray(TInt aGranularity, TInt aKeyOffset);
5460 inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
5461 inline RArray(TInt aEntrySize,T* aEntries, TInt aCount);
5462 inline void Close();
5463 inline TInt Count() const;
5464 inline const T& operator[](TInt anIndex) const;
5465 inline T& operator[](TInt anIndex);
5466 inline TInt Append(const T& anEntry);
5467 inline TInt Insert(const T& anEntry, TInt aPos);
5468 inline void Remove(TInt anIndex);
5469 inline void Compress();
5470 inline void Reset();
5471 inline TInt Find(const T& anEntry) const;
5472 inline TInt Find(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5474 inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
5476 Finds the first object in the array which matches aKey using
5477 the comparison algorithm provided by apfnCompare.
5479 The find operation always starts at the low index end of the array. There
5480 is no assumption about the order of objects in the array.
5482 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5483 @param apfnCompare A function defining the identity relation between the
5484 object in the array, and their keys of type K. The function
5485 returns true if k and t match based on this relationship.
5487 @return The index of the first matching object within the array.
5488 KErrNotFound, if no suitable object can be found.
5490 { return RArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
5491 inline TInt FindReverse(const T& anEntry) const;
5492 inline TInt FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5494 inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
5496 Finds the first object in the array which matches aKey using the comparison
5497 algorithm provided by apfnCompare.
5499 The find operation always starts at the high index end of the array. There
5500 is no assumption about the order of objects in the array.
5502 @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
5503 @param apfnMatch A function defining the identity relation between the
5504 object in the array, and their keys of type K. The function
5505 returns true if k and t match based on this relationship.
5507 @return The index of the first matching object within the array.
5508 KErrNotFound, if no suitable object can be found.
5510 { return RArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
5511 inline TInt FindInSignedKeyOrder(const T& anEntry) const;
5512 inline TInt FindInUnsignedKeyOrder(const T& anEntry) const;
5513 inline TInt FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const;
5514 inline TInt FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const;
5515 inline TInt FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const;
5516 inline TInt FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5518 inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
5520 Finds the object in the array whose object matches the specified
5521 key, (Using the relationship defined within apfnCompare) using a binary search
5522 technique and an ordering algorithm.
5524 The function assumes that existing objects in the array are ordered so
5525 that the objects themselves are in object order as determined by an algorithm
5526 supplied by the caller and packaged as a TLinearOrder<T>.
5528 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5529 @param apfnCompare A function which defines the order that the array was sorted,
5530 where in it aKey (via the defined relationship) should fit, and if the key is present.
5532 @return The index of the matching object within the array.
5533 KErrNotFound, if no suitable object can be found.
5536 { return RArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
5537 inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const;
5538 inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const;
5539 inline TInt SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5540 inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
5541 inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
5542 inline TInt SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5543 inline TInt InsertInSignedKeyOrder(const T& anEntry);
5544 inline TInt InsertInUnsignedKeyOrder(const T& anEntry);
5545 inline TInt InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder);
5546 inline TInt InsertInSignedKeyOrderAllowRepeats(const T& anEntry);
5547 inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry);
5548 inline TInt InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder);
5549 #ifndef __KERNEL_MODE__
5550 inline void AppendL(const T& anEntry);
5551 inline void InsertL(const T& anEntry, TInt aPos);
5552 inline TInt FindL(const T& anEntry) const;
5553 inline TInt FindL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5554 inline TInt FindReverseL(const T& anEntry) const;
5555 inline TInt FindReverseL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5556 inline TInt FindInSignedKeyOrderL(const T& anEntry) const;
5557 inline TInt FindInUnsignedKeyOrderL(const T& anEntry) const;
5558 inline TInt FindInOrderL(const T& anEntry, TLinearOrder<T> anOrder) const;
5559 inline void FindInSignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
5560 inline void FindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
5561 inline void FindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5562 inline TInt SpecificFindInSignedKeyOrderL(const T& anEntry, TInt aMode) const;
5563 inline TInt SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt aMode) const;
5564 inline TInt SpecificFindInOrderL(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5565 inline void SpecificFindInSignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
5566 inline void SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
5567 inline void SpecificFindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5568 inline void InsertInSignedKeyOrderL(const T& anEntry);
5569 inline void InsertInUnsignedKeyOrderL(const T& anEntry);
5570 inline void InsertInOrderL(const T& anEntry, TLinearOrder<T> anOrder);
5571 inline void InsertInSignedKeyOrderAllowRepeatsL(const T& anEntry);
5572 inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T& anEntry);
5573 inline void InsertInOrderAllowRepeatsL(const T& anEntry, TLinearOrder<T> anOrder);
5575 inline void GranularCompress();
5576 inline TInt Reserve(TInt aCount);
5577 inline void ReserveL(TInt aCount);
5578 inline void SortSigned();
5579 inline void SortUnsigned();
5580 inline void Sort(TLinearOrder<T> anOrder);
5581 inline TArray<T> Array() const;
5592 A simple and efficient specialized array of signed integers offering standard
5595 Note that derivation from RPointerArrayBase is private.
5597 TEMPLATE_SPECIALIZATION class RArray<TInt> : private RPointerArrayBase
5601 inline explicit RArray(TInt aGranularity);
5602 inline RArray(TInt aMinGrowBy, TInt aFactor);
5603 inline void Close();
5604 inline TInt Count() const;
5605 inline const TInt& operator[](TInt anIndex) const;
5606 inline TInt& operator[](TInt anIndex);
5607 inline TInt Append(TInt anEntry);
5608 inline TInt Insert(TInt anEntry, TInt aPos);
5609 inline void Remove(TInt anIndex);
5610 inline void Compress();
5611 inline void Reset();
5612 inline TInt Find(TInt anEntry) const;
5613 inline TInt FindReverse(TInt anEntry) const;
5614 inline TInt FindInOrder(TInt anEntry) const;
5615 inline TInt FindInOrder(TInt anEntry, TInt& anIndex) const;
5616 inline TInt SpecificFindInOrder(TInt anEntry, TInt aMode) const;
5617 inline TInt SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const;
5618 inline TInt InsertInOrder(TInt anEntry);
5619 inline TInt InsertInOrderAllowRepeats(TInt anEntry);
5620 #ifndef __KERNEL_MODE__
5621 inline void AppendL(TInt anEntry);
5622 inline void InsertL(TInt anEntry, TInt aPos);
5623 inline TInt FindL(TInt anEntry) const;
5624 inline TInt FindReverseL(TInt anEntry) const;
5625 inline TInt FindInOrderL(TInt anEntry) const;
5626 inline void FindInOrderL(TInt anEntry, TInt& anIndex) const;
5627 inline TInt SpecificFindInOrderL(TInt anEntry, TInt aMode) const;
5628 inline void SpecificFindInOrderL(TInt anEntry, TInt& anIndex, TInt aMode) const;
5629 inline void InsertInOrderL(TInt anEntry);
5630 inline void InsertInOrderAllowRepeatsL(TInt anEntry);
5632 inline RArray(TInt* aEntries, TInt aCount);
5633 inline void GranularCompress();
5634 inline TInt Reserve(TInt aCount);
5635 inline void ReserveL(TInt aCount);
5637 inline TArray<TInt> Array() const;
5648 Array of unsigned integers.
5650 The array is a simple and efficient specialized array of unsigned integers
5651 offering standard array behaviour.
5653 The derivation from RPointerArrayBase is private.
5655 TEMPLATE_SPECIALIZATION class RArray<TUint> : private RPointerArrayBase
5659 inline explicit RArray(TInt aGranularity);
5660 inline RArray(TInt aMinGrowBy, TInt aFactor);
5661 inline void Close();
5662 inline TInt Count() const;
5663 inline const TUint& operator[](TInt anIndex) const;
5664 inline TUint& operator[](TInt anIndex);
5665 inline TInt Append(TUint anEntry);
5666 inline TInt Insert(TUint anEntry, TInt aPos);
5667 inline void Remove(TInt anIndex);
5668 inline void Compress();
5669 inline void Reset();
5670 inline TInt Find(TUint anEntry) const;
5671 inline TInt FindReverse(TUint anEntry) const;
5672 inline TInt FindInOrder(TUint anEntry) const;
5673 inline TInt FindInOrder(TUint anEntry, TInt& anIndex) const;
5674 inline TInt SpecificFindInOrder(TUint anEntry, TInt aMode) const;
5675 inline TInt SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const;
5676 inline TInt InsertInOrder(TUint anEntry);
5677 inline TInt InsertInOrderAllowRepeats(TUint anEntry);
5678 #ifndef __KERNEL_MODE__
5679 inline void AppendL(TUint anEntry);
5680 inline void InsertL(TUint anEntry, TInt aPos);
5681 inline TInt FindL(TUint anEntry) const;
5682 inline TInt FindReverseL(TUint anEntry) const;
5683 inline TInt FindInOrderL(TUint anEntry) const;
5684 inline void FindInOrderL(TUint anEntry, TInt& anIndex) const;
5685 inline TInt SpecificFindInOrderL(TUint anEntry, TInt aMode) const;
5686 inline void SpecificFindInOrderL(TUint anEntry, TInt& anIndex, TInt aMode) const;
5687 inline void InsertInOrderL(TUint anEntry);
5688 inline void InsertInOrderAllowRepeatsL(TUint anEntry);
5690 inline RArray(TUint* aEntries, TInt aCount);
5691 inline void GranularCompress();
5692 inline TInt Reserve(TInt aCount);
5693 inline void ReserveL(TInt aCount);
5695 inline TArray<TUint> Array() const;
5699 #ifndef __LEAVE_EQUALS_THROW__
5709 #ifndef __KERNEL_MODE__
5710 IMPORT_C TInt Trap(TInt& aResult);
5711 IMPORT_C static void UnTrap();
5714 enum {EMaxState=0x10};
5716 TInt iState[EMaxState];
5719 TTrapHandler* iHandler;
5728 Executes the set of C++ statements _s under a trap harness.
5730 Use this macro as a C++ statement.
5732 _r must be a TInt which has already been declared; if any of the
5733 C++ statements _s leaves, then the leave code is returned in _r,
5734 otherwise _r is set to KErrNone.
5736 _s can consist of multiple C++ statements; in theory, _s can consist
5737 of any legal C++ code but in practice, such statements consist of simple
5738 function calls, e.g. Foo() or an assignment of some value to the result of
5739 a function call, e.g. functionValue=GetFoo().
5741 A cleanup stack is constructed for the set of C++ statements _s.
5742 If any function in _s leaves, objects pushed to the cleanup stack are
5743 cleaned-up. In addition, if any of the C++ statements in _s leaves,
5744 then remaining C++ code in _s is not executed and any variables which
5745 are assigned within that remaining code are not defined.
5747 @param _r An lvalue, convertible to TInt&, which will receive the result of
5748 any User::Leave() executed within _s or, if no leave occurred,
5749 it will be set to KErrNone. The value of _r on entry is not used.
5751 @param _s C++ statements which will be executed under a trap harness.
5755 #define TRAP(_r,_s) {TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
5761 Executes the set of C++ statements _s under a trap harness.
5763 Use this macro in the same way as you would TRAP, except that the
5764 variable _r is defined as part of the macro (and is therefore valid for the
5765 rest of the block in which the macro occurs). Often, this saves a line of code.
5767 @param _r A name, which will be declared as a TInt, and will receive the result
5768 of any User::Leave() executed within _s or, if no leave occurred, it
5769 will be set to KErrNone. After the macro, _r remains in scope until
5770 the end of its enclosing block.
5772 @param _s C++ statements which will be executed under a trap harness.
5776 #define TRAPD(_r,_s) TInt _r;{TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
5782 Executes the set of C++ statements _s under a trap harness.
5783 Any leave code generated is ignored.
5785 Use this macro as a C++ statement.
5787 This macro is functionally equivalent to:
5796 where the value in 'x' is not used by any subsequent code.
5798 _s can consist of multiple C++ statements; in theory, _s can consist
5799 of any legal C++ code but in practice, such statements consist of simple
5800 function calls, e.g. Foo() or an assignment of some value to the result of
5801 a function call, e.g. functionValue=GetFoo().
5803 A cleanup stack is constructed for the set of C++ statements _s.
5804 If any function in _s leaves, objects pushed to the cleanup stack are
5805 cleaned-up. In addition, if any of the C++ statements in _s leaves,
5806 then remaining C++ code in _s is not executed and any variables which
5807 are assigned within that remaining code are not defined.
5809 @param _s C++ statements which will be executed under a trap harness.
5814 #define TRAP_IGNORE(_s) {TInt _ignore;TTrap __t;if (__t.Trap(_ignore)==0){_s;TTrap::UnTrap();}}
5817 #else //__LEAVE_EQUALS_THROW__
5820 /** @internalComponent */
5821 #define __WIN32SEHTRAP TWin32SEHTrap __trap; __trap.Trap();
5822 /** @internalComponent */
5823 #define __WIN32SEHUNTRAP __trap.UnTrap();
5824 IMPORT_C void EmptyFunction();
5825 #define __CALL_EMPTY_FUNCTION EmptyFunction();
5827 #define __WIN32SEHTRAP
5828 #define __WIN32SEHUNTRAP
5829 #define __CALL_EMPTY_FUNCTION
5833 This macro is used by the TRAP and TRAPD macros and provides a means
5834 of inserting code into uses of these.
5836 This macro is invoked before any 'trapped' code is called, and it should be
5837 redefined to do whatever task is required. E.g. this code:
5840 #undef TRAP_INSTRUMENTATION_START
5841 #define TRAP_INSTRUMENTATION_START DoMyLoging(__LINE__)
5844 Will cause all subsequent uses of the TRAP macros to behave in an
5848 DoMyLoging(__LINE__)
5849 TRAP(r,SomeCodeL());
5859 #define TRAP_INSTRUMENTATION_START
5864 This macro is used by the TRAP and TRAPD macros and provides a means
5865 of inserting code into uses of these.
5867 This macro is invoked if the 'trapped' code did not Leave.
5871 #undef TRAP_INSTRUMENTATION_NOLEAVE
5872 #define TRAP_INSTRUMENTATION_NOLEAVE DoMyLoging(__LINE__)
5875 Will cause all subsequent uses of the TRAP macros to behave in an
5879 TRAP(r,SomeCodeL());
5880 if(r==KErrNone) DoMyLoging(__LINE__);
5884 @param aLine The line number in the C++ source file where the TRAP or TRAPD
5893 #define TRAP_INSTRUMENTATION_NOLEAVE
5897 This macro is used by the TRAP and TRAPD macros and provides a means
5898 of inserting code into uses of these.
5900 This macro is invoked if the 'trapped' code did Leave. E.g. this code:
5903 #undef TRAP_INSTRUMENTATION_LEAVE
5904 #define TRAP_INSTRUMENTATION_LEAVE(aResult) DoMyLoging(aResult,__LINE__)
5907 Will cause all subsequent uses of the TRAP macros to behave in an
5911 TRAP(r,SomeCodeL());
5912 if(r!=KErrNone) DoMyLoging(r,__LINE__);
5916 @param aResult A reference to the result value used in the TRAP macro.
5925 #define TRAP_INSTRUMENTATION_LEAVE(aResult)
5930 This macro is used by the TRAP and TRAPD macros and provides a means
5931 of inserting code into uses of these.
5933 This macro is invoked after the 'trapped' code is called, regardless of whether
5934 or not it did Leave. It should be redefined to do whatever task is
5935 required. E.g. this code:
5938 #undef TRAP_INSTRUMENTATION_END
5939 #define TRAP_INSTRUMENTATION_END DoMyLoging(__LINE__)
5942 Will cause all subsequent uses of the TRAP macros to behave in an
5946 TRAP(r,SomeCodeL());
5947 DoMyLoging(__LINE__)
5957 #define TRAP_INSTRUMENTATION_END
5965 Executes the set of C++ statements _s under a trap harness.
5967 Use this macro as a C++ statement.
5969 _r must be a TInt which has already been declared; if any of the
5970 C++ statements _s leaves, then the leave code is returned in _r,
5971 otherwise _r is set to KErrNone.
5973 _s can consist of multiple C++ statements; in theory, _s can consist
5974 of any legal C++ code but in practice, such statements consist of simple
5975 function calls, e.g. Foo() or an assignment of some value to the result of
5976 a function call, e.g. functionValue=GetFoo().
5978 A cleanup stack is constructed for the set of C++ statements _s.
5979 If any function in _s leaves, objects pushed to the cleanup stack are
5980 cleaned-up. In addition, if any of the C++ statements in _s leaves,
5981 then remaining C++ code in _s is not executed and any variables which
5982 are assigned within that remaining code are not defined.
5984 @param _r An lvalue, convertible to TInt&, which will receive the result of
5985 any User::Leave() executed within _s or, if no leave occurred,
5986 it will be set to KErrNone. The value of _r on entry is not used.
5988 @param _s C++ statements which will be executed under a trap harness.
5993 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
5994 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
5995 trap handler to be invoked when multiple nested TRAP's were present and
5996 User::Leave(..) was called. */
5998 #define TRAP(_r, _s) \
6000 TInt& __rref = _r; \
6002 { TRAP_INSTRUMENTATION_START; } \
6005 TTrapHandler* ____t = User::MarkCleanupStack(); \
6007 User::UnMarkCleanupStack(____t); \
6008 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6011 catch (XLeaveException& l) \
6013 __rref = l.GetReason(); \
6014 { TRAP_INSTRUMENTATION_LEAVE(__rref); } \
6018 User::Invariant(); \
6020 __CALL_EMPTY_FUNCTION \
6021 { TRAP_INSTRUMENTATION_END; } \
6029 Executes the set of C++ statements _s under a trap harness.
6031 Use this macro in the same way as you would TRAP, except that the
6032 variable _r is defined as part of the macro (and is therefore valid for the
6033 rest of the block in which the macro occurs). Often, this saves a line of code.
6035 @param _r A name, which will be declared as a TInt, and will receive the result
6036 of any User::Leave() executed within _s or, if no leave occurred, it
6037 will be set to KErrNone. After the macro, _r remains in scope until
6038 the end of its enclosing block.
6040 @param _s C++ statements which will be executed under a trap harness.
6045 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
6046 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
6047 trap handler to be invoked when multiple nested TRAP's were present and
6048 User::Leave(..) was called. */
6051 #define TRAPD(_r, _s) \
6055 { TRAP_INSTRUMENTATION_START; } \
6058 TTrapHandler* ____t = User::MarkCleanupStack(); \
6060 User::UnMarkCleanupStack(____t); \
6061 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6064 catch (XLeaveException& l) \
6066 _r = l.GetReason(); \
6067 { TRAP_INSTRUMENTATION_LEAVE(_r); } \
6071 User::Invariant(); \
6073 __CALL_EMPTY_FUNCTION \
6074 { TRAP_INSTRUMENTATION_END; } \
6081 Executes the set of C++ statements _s under a trap harness.
6082 Any leave code generated is ignored.
6084 Use this macro as a C++ statement.
6086 This macro is functionally equivalent to:
6095 where the value in 'x' is not used by any subsequent code.
6097 Use this macro as a C++ statement.
6099 _s can consist of multiple C++ statements; in theory, _s can consist
6100 of any legal C++ code but in practice, such statements consist of simple
6101 function calls, e.g. Foo() or an assignment of some value to the result of
6102 a function call, e.g. functionValue=GetFoo().
6104 A cleanup stack is constructed for the set of C++ statements _s.
6105 If any function in _s leaves, objects pushed to the cleanup stack are
6106 cleaned-up. In addition, if any of the C++ statements in _s leaves,
6107 then remaining C++ code in _s is not executed and any variables which
6108 are assigned within that remaining code are not defined.
6110 @param _s C++ statements which will be executed under a trap harness.
6116 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
6117 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
6118 trap handler to be invoked when multiple nested TRAP's were present and
6119 User::Leave(..) was called. */
6121 #define TRAP_IGNORE(_s) \
6123 { TRAP_INSTRUMENTATION_START; } \
6126 TTrapHandler* ____t = User::MarkCleanupStack(); \
6128 User::UnMarkCleanupStack(____t); \
6129 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6132 catch (XLeaveException& l) \
6135 { TRAP_INSTRUMENTATION_LEAVE(l.Reason()); } \
6139 User::Invariant(); \
6141 __CALL_EMPTY_FUNCTION \
6142 { TRAP_INSTRUMENTATION_END; } \
6146 #endif //__LEAVE_EQUALS_THROW__
6152 GLREF_C TAny* operator new(TUint aSize) __NO_THROW;
6158 GLREF_C TAny* operator new(TUint aSize,TUint anExtraSize) __NO_THROW;
6164 GLREF_C void operator delete(TAny* aPtr) __NO_THROW;
6166 #ifndef __PLACEMENT_VEC_NEW_INLINE
6171 GLREF_C TAny* operator new[](TUint aSize) __NO_THROW;
6177 GLREF_C void operator delete[](TAny* aPtr) __NO_THROW;
6184 inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
6186 #ifndef __PLACEMENT_VEC_NEW_INLINE
6191 inline TAny* operator new[](TUint aSize, TAny* aBase) __NO_THROW;
6193 #endif // !__PLACEMENT_VEC_NEW_INLINE
6199 inline void operator delete(TAny* aPtr, TAny* aBase) __NO_THROW;
6201 #ifndef __PLACEMENT_VEC_NEW_INLINE
6206 inline void operator delete[](TAny* aPtr, TAny* aBase) __NO_THROW;
6208 #endif // !__PLACEMENT_VEC_NEW_INLINE
6210 #if !defined(__BOOL_NO_TRUE_TRAP__)
6216 TBool operator==(TTrue,volatile const TBool);
6222 TBool operator==(volatile const TBool,TTrue);
6228 TBool operator!=(TTrue,volatile const TBool);
6234 TBool operator!=(volatile const TBool,TTrue);
6244 A Version 2 client/server class that clients use to package
6245 the arguments to be sent to a server.
6247 The object can package up to 4 arguments together with information about each
6248 argument's type, width and accessibility; it is also possible for
6249 the package to contain zero arguments. In addition to the default constructor,
6250 the class has four templated constructors, allowing an object of this type to
6251 be constructed for 0, 1, 2, 3 or 4 arguments.
6253 Internally, the arguments are stored in a simple TInt array.
6254 Consecutive arguments in a constructor's parameter list are put into
6255 consecutive slots in the array. The Set() overloaded functions can be used
6256 to set argument values into specific slots within this array.
6264 Argument types; some of these may be ORed together to specify
6265 type, accessibility, and width.
6269 EUnspecified = 0, /**< Type not specified.*/
6270 EHandle = 1, /**< Handle type.*/
6271 EFlagDes = 4, /**< Descriptor type.*/
6272 EFlagConst = 2, /**< Read only type.*/
6273 EFlag16Bit = 1, /**< 16 bit rather than 8 bit.*/
6274 EDes8 = EFlagDes, /**< 8 bit read/write descriptor.*/
6275 EDes16 = EFlagDes|EFlag16Bit, /**< 16 bit read/write descriptor.*/
6276 EDesC8 = EFlagDes|EFlagConst, /**< 8 bit read only descriptor.*/
6277 EDesC16 = EFlagDes|EFlagConst|EFlag16Bit, /**< 16 bit read only descriptor.*/
6284 Bit width of type information.
6287 KBitsPerType=3 /** Number of bits of type information used for each of the 4 arguments. */
6292 Indicates a Null argument.
6296 An enum value that can be used to indicate an empty or
6297 unused argument to a server. For example:
6300 TIpcArgs args(arg1, TIpcArgs::ENothing, arg2);
6303 This argument will have an undefined value when the server
6304 receives the message.
6310 Default constructor.
6312 An argument package constructed using this constructor has no arguments;
6313 however, arguments can subsequently be set into this argument package object
6314 using the Set() member functions.
6322 A templated constructor that constructs the argument package; it takes
6325 @param a0 An argument of general class type T0 to be contained by
6329 inline explicit TIpcArgs(T0 a0)
6331 Assign(iArgs[0],a0);
6332 iFlags=(Type(a0)<<(0*KBitsPerType));
6337 A templated constructor that constructs the argument package; it takes
6340 @param a0 An argument of general class type T0 to be contained by
6342 @param a1 An argument of general class type T1 to be contained by
6345 template <class T0,class T1>
6346 inline TIpcArgs(T0 a0,T1 a1)
6348 Assign(iArgs[0],a0);
6349 Assign(iArgs[1],a1);
6350 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType));
6355 A templated constructor that constructs the argument package; it takes
6358 @param a0 An argument of general class type T0 to be contained by
6360 @param a1 An argument of general class type T1 to be contained by
6362 @param a2 An argument of general class type T2 to be contained by
6365 template <class T0,class T1,class T2>
6366 inline TIpcArgs(T0 a0,T1 a1,T2 a2)
6368 Assign(iArgs[0],a0);
6369 Assign(iArgs[1],a1);
6370 Assign(iArgs[2],a2);
6371 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType));
6376 A templated constructor that constructs the argument package; it takes
6379 @param a0 An argument of general class type T0 to be contained by
6381 @param a1 An argument of general class type T1 to be contained by
6383 @param a2 An argument of general class type T2 to be contained by
6385 @param a3 An argument of general class type T3 to be contained by
6388 template <class T0,class T1,class T2,class T3>
6389 inline TIpcArgs(T0 a0,T1 a1,T2 a2,T3 a3)
6391 Assign(iArgs[0],a0);
6392 Assign(iArgs[1],a1);
6393 Assign(iArgs[2],a2);
6394 Assign(iArgs[3],a3);
6395 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType))|(Type(a3)<<(3*KBitsPerType));
6398 inline void Set(TInt aIndex,TNothing);
6399 inline void Set(TInt aIndex,TInt aValue);
6400 inline void Set(TInt aIndex,const TAny* aValue);
6401 inline void Set(TInt aIndex,RHandleBase aValue);
6402 inline void Set(TInt aIndex,const TDesC8* aValue);
6403 #ifndef __KERNEL_MODE__
6404 inline void Set(TInt aIndex,const TDesC16* aValue);
6406 inline void Set(TInt aIndex,TDes8* aValue);
6407 #ifndef __KERNEL_MODE__
6408 inline void Set(TInt aIndex,TDes16* aValue);
6411 inline static TArgType Type(TNothing);
6412 inline static TArgType Type(TInt);
6413 inline static TArgType Type(const TAny*);
6414 inline static TArgType Type(RHandleBase aValue);
6415 inline static TArgType Type(const TDesC8*);
6416 #ifndef __KERNEL_MODE__
6417 inline static TArgType Type(const TDesC16*);
6419 inline static TArgType Type(TDes8*);
6420 #ifndef __KERNEL_MODE__
6421 inline static TArgType Type(TDes16*);
6424 inline static void Assign(TInt&,TNothing);
6425 inline static void Assign(TInt& aArg,TInt aValue);
6426 inline static void Assign(TInt& aArg,const TAny* aValue);
6427 inline static void Assign(TInt& aArg,RHandleBase aValue);
6428 inline static void Assign(TInt& aArg,const TDesC8* aValue);
6429 #ifndef __KERNEL_MODE__
6430 inline static void Assign(TInt& aArg,const TDesC16* aValue);
6432 inline static void Assign(TInt& aArg,TDes8* aValue);
6433 #ifndef __KERNEL_MODE__
6434 inline static void Assign(TInt& aArg,TDes16* aValue);
6439 The location where the message arguments are stored.
6441 There is no reason to access this data member directly and it should be
6442 considered as internal.
6444 TInt iArgs[KMaxMessageArguments];
6447 The location where the flag bits describing the argument types are stored.
6449 The symbolic values describing the argument types are internal to Symbian,
6450 and there is therefore no reason to access this data member directly.
6451 It should be considered as internal.
6456 // Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
6465 inline SInt64(Int64 a);
6466 inline SInt64& operator=(Int64 a);
6467 inline operator Int64() const;
6469 TUint32 iData[2]; // little endian
6479 inline SUint64(Uint64 a);
6480 inline SUint64& operator=(Uint64 a);
6481 inline operator Uint64() const;
6483 TUint32 iData[2]; // little endian
6493 inline SDouble(TReal a);
6494 inline SDouble& operator=(TReal a);
6495 inline operator TReal() const;
6497 TUint32 iData[2]; // always little endian
6504 Stores information about a thread's stack.
6506 Note, on the emulator, the memory between iLimit and the thread's current stack pointer
6507 may not actually be committed.
6509 @see RThread::StackInfo()
6511 class TThreadStackInfo
6515 The address which the stack pointer would contain if the stack were empty.
6520 The address which the stack pointer would contain if the stack were full,
6521 (The lowest valid address).
6526 The limit value for the stack if it were expanded to its maximum size.
6528 Currently expanding stacks is not supported so iExpandLimit==iLimit
6530 TLinAddr iExpandLimit;
6536 #ifdef __SUPPORT_CPP_EXCEPTIONS__
6541 The class used to implement User::Leave in term of throw and TRAP in terms of catch.
6544 class XLeaveException
6547 inline XLeaveException() {}
6548 inline XLeaveException(TInt aReason) {iR = aReason;}
6549 inline TInt Reason() const {return iR;}
6550 IMPORT_C TInt GetReason() const;
6552 #if __ARMCC_VERSION >= 220000
6553 // From rvct 2.2 onwards we want the class impedimenta to be shared, so create a key function.
6554 // Unfortunately we can't make this the key function the dtor since this would make it impossible for existing 2.1
6555 // derived binaries to be 'BC' with 2.2 binaries (in the general case (which I wont attempt to describe coz its
6556 // too complex) so its best to be safe). As a clue: if 2.1 is used to compile with a key function its not possible
6557 // for catch handlers to work :-( (see the old code).
6558 virtual void ForceKeyFunction();
6561 #if __ARMCC_VERSION < 220000
6562 TAny* iVtable; // reserve space for vtable
6567 // The standard header file <exception> defines the following guard macro for EDG and CW, VC++, GCC respectively.
6568 // The guard below is ugly. It will surely come back and bite us unless we resolve the whole issue of standard headers
6569 // when we move to supporting Standard C++.
6570 #if !defined(_EXCEPTION) && !defined(_EXCEPTION_) && !defined(__EXCEPTION__)
6571 // Declare standard C++ functions relating to exceptions here
6573 bool uncaught_exception(void);
6574 void terminate(void);
6575 void unexpected(void);
6576 typedef void (*terminate_handler)();
6577 terminate_handler set_terminate(terminate_handler h) throw();
6578 typedef void (*unexpected_handler)();
6579 unexpected_handler set_unexpected(unexpected_handler h) throw();
6583 #endif //__SUPPORT_CPP_EXCEPTIONS__
6587 #ifndef __WIN32_SEH_TYPES_KNOWN__
6588 class __UnknownWindowsType1;
6589 class __UnknownWindowsType2;
6592 class TWin32SEHTrap;
6595 * Typedef for the SEH handler function
6596 * @internalComponent
6598 typedef TUint32 (TWin32SEHExceptionHandler)(__UnknownWindowsType1* aExceptionRecord, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
6601 * @internalComponent
6606 // Prevent copy/assign
6607 TWin32SEHTrap(TWin32SEHTrap const &);
6608 TWin32SEHTrap& operator=(TWin32SEHTrap const &);
6610 #ifdef __KERNEL_MODE__
6612 // Kernel-side functions for nkern exception handler
6615 /** Find final exception handler in SEH chain */
6616 static TWin32SEHTrap* IterateForFinal();
6618 /** Access exception handler */
6619 TWin32SEHExceptionHandler* ExceptionHandler();
6623 #else // !__KERNEL_MODE__
6625 // User-side functions for use in TRAP(...)
6628 UIMPORT_C TWin32SEHTrap();
6631 /** Add object to SEH chain */
6632 UIMPORT_C void Trap();
6634 /** Remove object from SEH chain */
6635 UIMPORT_C void UnTrap();
6637 #ifndef __IN_SEH_CPP__
6640 /** Handle Win32 exceptions */
6641 static TUint32 ExceptionHandler(__UnknownWindowsType1* aException, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
6643 #endif //__KERNEL_MODE__
6646 // NB: This is really an _EXCEPTION_REGISTRATION_RECORD
6648 TWin32SEHTrap* iPrevExceptionRegistrationRecord; /** Link to previous SEH record */
6649 TWin32SEHExceptionHandler* iExceptionHandler; /** SEH handler function */
6652 TUint32 iPadding[254]; // discourage the compiler from putting this in reused function parameter space
6659 * @internalComponent
6664 UIMPORT_C TWin32SEHTrap();
6665 UIMPORT_C void Trap();
6666 UIMPORT_C void UnTrap();
6671 #include <e32cmn.inl>
6673 #endif //__E32CMN_H__