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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.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;
1725 Defines a modifiable buffer descriptor that can contain the full name of a
1726 reference counting object.
1731 typedef TBuf<KMaxFullName> TFullName;
1739 Defines a modifiable buffer descriptor to contain the category name identifying
1740 the cause of thread or process termination. The buffer takes a maximum length
1741 of KMaxExitCategoryName.
1743 @see RThread::ExitCategory
1744 @see RThread::ExitCategory
1746 typedef TBuf<KMaxExitCategoryName> TExitCategoryName;
1754 A buffer that can contain the name of a file.
1755 The name can have a maximum length of KMaxFileName
1756 (currently 256 but check the definition of KMaxFileName).
1760 typedef TBuf<KMaxFileName> TFileName;
1768 A buffer that can contain the name of a path.
1769 The name can have a maximum length of KMaxPath
1770 (currently 256 but check the definition of KMaxPath).
1774 typedef TBuf<KMaxPath> TPath;
1785 This is a buffer descriptor with a maximum length of KMaxVersionName.
1786 A TVersion object returns the formatted character representation of its version
1787 information in a descriptor of this type.
1791 typedef TBuf<KMaxVersionName> TVersionName;
1800 Defines a modifiable buffer descriptor for the text form of the UID.
1801 The descriptor has a maximum length of KMaxUidName and is used to contain
1802 the standard text format returned by the function TUid::Name().
1806 typedef TBuf<KMaxUidName> TUidName;
1817 #define KNullUid TUid::Null()
1826 A globally unique 32-bit number.
1831 #ifndef __KERNEL_MODE__
1832 IMPORT_C TBool operator==(const TUid& aUid) const;
1833 IMPORT_C TBool operator!=(const TUid& aUid) const;
1834 IMPORT_C TUidName Name() const;
1836 static inline TUid Uid(TInt aUid);
1837 static inline TUid Null();
1840 The 32-bit integer UID value.
1852 Encapsulates a set of three unique identifiers (UIDs) which, in combination,
1853 identify a system object such as a GUI application or a DLL. The three
1854 component UIDs are referred to as UID1, UID2 and UID3.
1856 An object of this type is referred to as a compound identifier or a UID type.
1861 #ifndef __KERNEL_MODE__
1862 IMPORT_C TUidType();
1863 IMPORT_C TUidType(TUid aUid1);
1864 IMPORT_C TUidType(TUid aUid1,TUid aUid2);
1865 IMPORT_C TUidType(TUid aUid1,TUid aUid2,TUid aUid3);
1866 IMPORT_C TBool operator==(const TUidType& aUidType) const;
1867 IMPORT_C TBool operator!=(const TUidType& aUidType) const;
1868 IMPORT_C const TUid& operator[](TInt anIndex) const;
1869 IMPORT_C TUid MostDerived() const;
1870 IMPORT_C TBool IsPresent(TUid aUid) const;
1871 IMPORT_C TBool IsValid() const;
1874 TUid iUid[KMaxCheckedUid];
1881 A class used to represent the Secure ID of a process or executable image.
1883 Constructors and conversion operators are provided to enable conversion
1884 of this class to and from both TUint32 and TUid objects.
1886 Because this class has non-default constructors, compilers will not initialise
1887 this objects at compile time, instead code will be generated to construct the object
1888 at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1889 such uninitialised data. To overcome these problems a macro is provided to construct
1890 a const object which behaves like a TSecureId. This is _LIT_SECURE_ID.
1891 This macro should be used where it is desirable to define const TSecureId objects,
1892 like in header files. E.g. Instead of writing:
1894 const TSecureId MyId=0x1234567
1898 _LIT_SECURE_ID(MyId,0x1234567)
1910 inline TSecureId(TUint32 aId);
1911 inline operator TUint32() const;
1912 inline TSecureId(TUid aId);
1913 inline operator TUid() const;
1922 A class used to represent the Vendor ID of a process or executable image
1924 Constructors and conversion operators are provided to enable conversion
1925 of this class to and from both TUint32 and TUid objects.
1927 Because this class has non-default constructors, compilers will not initialise
1928 this objects at compile time, instead code will be generated to construct the object
1929 at run-time. This is wastefull, and Symbian OS DLLs are not permitted to have
1930 such uninitialised data. To overcome these problems a macro is provided to construct
1931 a const object which behaves like a TSecureId. This is _LIT_VENDOR_ID.
1932 This macro should be used where it is desirable to define const TSecureId objects,
1933 like in header files. E.g. Instead of writing:
1935 const TVendorId MyId=0x1234567
1939 _LIT_VENDOR_ID(MyId,0x1234567)
1951 inline TVendorId(TUint32 aId);
1952 inline operator TUint32() const;
1953 inline TVendorId(TUid aId);
1954 inline operator TUid() const;
1962 Structure for compile-time definition of a secure ID
1968 inline const TSecureId* operator&() const;
1969 inline operator const TSecureId&() const;
1970 inline operator TUint32() const;
1971 inline operator TUid() const;
1980 Structure for compile-time definition of a vendor ID
1986 inline const TVendorId* operator&() const;
1987 inline operator const TVendorId&() const;
1988 inline operator TUint32() const;
1989 inline operator TUid() const;
1998 Macro for compile-time definition of a secure ID
1999 @param name Name to use for secure ID
2000 @param value Value of secure ID
2004 #define _LIT_SECURE_ID(name,value) const SSecureId name={value}
2010 Macro for compile-time definition of a vendor ID
2011 @param name Name to use for vendor ID
2012 @param value Value of vendor ID
2016 #define _LIT_VENDOR_ID(name,value) const SVendorId name={value}
2025 Contains version information.
2027 A version is defined by a set of three numbers:
2029 1. the major version number, ranging from 0 to 127, inclusive
2031 2. the minor version number, ranging from 0 to 99 inclusive
2033 3. the build number, ranging from 0 to 32767 inclusive.
2035 The class provides a constructor for setting all three numbers.
2036 It also provides a member function to build a character representation of
2037 this information in a TVersionName descriptor.
2044 IMPORT_C TVersion();
2045 IMPORT_C TVersion(TInt aMajor,TInt aMinor,TInt aBuild);
2046 IMPORT_C TVersionName Name() const;
2049 The major version number.
2055 The minor version number.
2073 Indicates the completion status of a request made to a service provider.
2075 When a thread makes a request, it passes a request status as a parameter.
2076 On completion, the provider signals the requesting thread's request semaphore
2077 and stores a completion code in the request status. Typically, this is KErrNone
2078 or one of the other system-wide error codes.
2080 This class is not intended for user derivation.
2082 class TRequestStatus
2085 inline TRequestStatus();
2086 inline TRequestStatus(TInt aVal);
2087 inline TInt operator=(TInt aVal);
2088 inline TBool operator==(TInt aVal) const;
2089 inline TBool operator!=(TInt aVal) const;
2090 inline TBool operator>=(TInt aVal) const;
2091 inline TBool operator<=(TInt aVal) const;
2092 inline TBool operator>(TInt aVal) const;
2093 inline TBool operator<(TInt aVal) const;
2094 inline TInt Int() const;
2099 ERequestPending = 2, //bit1
2103 friend class CActive;
2104 friend class CActiveScheduler;
2105 friend class CServer2;
2116 Stores a two-dimensional point in Cartesian co-ordinates.
2118 Its data members (iX and iY) are public and can be manipulated directly, or
2119 by means of the functions provided. Functions are provided to set and manipulate
2120 the point, and to compare points for equality.
2125 #ifndef __KERNEL_MODE__
2126 enum TUninitialized { EUninitialized };
2128 Constructs default point, initialising its iX and iY members to zero.
2130 TPoint(TUninitialized) {}
2132 inline TPoint(TInt aX,TInt aY);
2133 IMPORT_C TBool operator==(const TPoint& aPoint) const;
2134 IMPORT_C TBool operator!=(const TPoint& aPoint) const;
2135 IMPORT_C TPoint& operator-=(const TPoint& aPoint);
2136 IMPORT_C TPoint& operator+=(const TPoint& aPoint);
2137 IMPORT_C TPoint& operator-=(const TSize& aSize);
2138 IMPORT_C TPoint& operator+=(const TSize& aSize);
2139 IMPORT_C TPoint operator-(const TPoint& aPoint) const;
2140 IMPORT_C TPoint operator+(const TPoint& aPoint) const;
2141 IMPORT_C TPoint operator-(const TSize& aSize) const;
2142 IMPORT_C TPoint operator+(const TSize& aSize) const;
2143 IMPORT_C TPoint operator-() const;
2144 IMPORT_C void SetXY(TInt aX,TInt aY);
2145 IMPORT_C TSize AsSize() const;
2165 Stores a three-dimensional point in Cartesian or polar co-ordinates.
2166 Its data members (iX, iY and iZ) are public and can be manipulated directly.
2172 #ifndef __KERNEL_MODE__
2173 enum TUninitialized { EUninitialized };
2176 TUninitialized Constructor
2178 TPoint3D(TUninitialized) {}
2180 Constructs default TPoint3D, initialising its iX , iY and iZ members to zero.
2184 Constructs TPoint3D with the specified x,y and z co-ordinates.
2186 inline TPoint3D(TInt aX,TInt aY,TInt aZ);
2188 Copy Construct from TPoint , initialises Z co-ordinate to Zero
2190 inline TPoint3D(const TPoint& aPoint);
2192 IMPORT_C TBool operator==(const TPoint3D& aPoint3D) const;
2193 IMPORT_C TBool operator!=(const TPoint3D& aPoint3D) const;
2195 IMPORT_C TPoint3D& operator-=(const TPoint3D& aPoint3D);
2196 IMPORT_C TPoint3D& operator-=(const TPoint& aPoint);
2198 IMPORT_C TPoint3D& operator+=(const TPoint3D& aPoint3D);
2199 IMPORT_C TPoint3D& operator+=(const TPoint& aPoint);
2201 IMPORT_C TPoint3D operator-(const TPoint3D& aPoint3D) const;
2202 IMPORT_C TPoint3D operator-(const TPoint& aPoint) const;
2204 IMPORT_C TPoint3D operator+(const TPoint3D& aPoint3D) const;
2205 IMPORT_C TPoint3D operator+(const TPoint& aPoint) const;
2207 Unary minus operator. The operator returns the negation of this Point3D
2209 IMPORT_C TPoint3D operator-() const;
2212 Set Method to set the xyz co-ordinates of TPoint3D
2214 IMPORT_C void SetXYZ(TInt aX,TInt aY,TInt aZ);
2217 TPoint3D from TPoint, sets the Z co-ordinate to Zero
2219 IMPORT_C void SetPoint(const TPoint& aPoint);
2222 Returns TPoint from TPoint3D
2224 IMPORT_C TPoint AsPoint() const;
2245 @prototype For now, only intended to be used by TRwEvent and the Windows Server
2247 Stores the angular spherical coordinates (Phi,Theta) of a three-dimensional point.
2249 Its data members (iPhi, iTheta) are public and can be manipulated directly.
2255 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).
2259 The Theta co-ordinate (angle between the Z-axis and the line that links the point and the origin).
2269 Stores a two-dimensional size as a width and a height value.
2271 Its data members are public and can be manipulated directly, or by means of
2272 the functions provided.
2277 #ifndef __KERNEL_MODE__
2278 enum TUninitialized { EUninitialized };
2280 Constructs the size object with its iWidth and iHeight members set to zero.
2282 TSize(TUninitialized) {}
2284 inline TSize(TInt aWidth,TInt aHeight);
2285 IMPORT_C TBool operator==(const TSize& aSize) const;
2286 IMPORT_C TBool operator!=(const TSize& aSize) const;
2287 IMPORT_C TSize& operator-=(const TSize& aSize);
2288 IMPORT_C TSize& operator-=(const TPoint& aPoint);
2289 IMPORT_C TSize& operator+=(const TSize& aSize);
2290 IMPORT_C TSize& operator+=(const TPoint& aPoint);
2291 IMPORT_C TSize operator-(const TSize& aSize) const;
2292 IMPORT_C TSize operator-(const TPoint& aPoint) const;
2293 IMPORT_C TSize operator+(const TSize& aSize) const;
2294 IMPORT_C TSize operator+(const TPoint& aPoint) const;
2295 IMPORT_C TSize operator-() const;
2296 IMPORT_C void SetSize(TInt aWidth,TInt aHeight);
2297 IMPORT_C TPoint AsPoint() const;
2301 The width of this TSize object.
2305 The height of this TSize object.
2317 Information about a kernel object.
2319 This type of object is passed to RHandleBase::HandleInfo(). The function
2320 fetches information on the usage of the kernel object associated with that
2321 handle and stores the information in the THandleInfo object.
2323 The class contains four data members and no explicitly defined function
2330 The number of times that the kernel object is open in the current process.
2332 TInt iNumOpenInProcess;
2335 The number of times that the kernel object is open in the current thread.
2337 TInt iNumOpenInThread;
2340 The number of processes which have a handle on the kernel object.
2345 The number of threads which have a handle on the kernel object.
2359 inline TFindHandle();
2360 inline TInt Handle() const;
2361 #ifdef __KERNEL_MODE__
2362 inline TInt Index() const;
2363 inline TInt UniqueID() const;
2364 inline TUint64 ObjectID() const;
2365 inline void Set(TInt aIndex, TInt aUniqueId, TUint64 aObjectId);
2368 inline void Reset();
2380 class TFindHandleBase;
2381 class TFindSemaphore;
2386 A handle to an object.
2388 The class encapsulates the basic behaviour of a handle, hiding the
2389 handle-number which identifies the object which the handle represents.
2391 The class is abstract in the sense that a RHandleBase object is never
2392 explicitly instantiated. It is always a base class to a concrete handle class;
2393 for example, RSemaphore, RThread, RProcess, RCriticalSection etc.
2402 Read/Write attributes for the handle.
2408 EDirectReadAccess=0x4,
2409 EDirectWriteAccess=0x8,
2412 inline RHandleBase();
2413 inline TInt Handle() const;
2414 inline void SetHandle(TInt aHandle);
2415 inline TInt SetReturnedHandle(TInt aHandleOrError);
2416 static void DoExtendedClose();
2417 #ifndef __KERNEL_MODE__
2418 IMPORT_C void Close();
2419 IMPORT_C TName Name() const;
2420 IMPORT_C TFullName FullName() const;
2421 IMPORT_C void FullName(TDes& aName) const;
2422 IMPORT_C void SetHandleNC(TInt aHandle);
2423 IMPORT_C TInt Duplicate(const RThread& aSrc,TOwnerType aType=EOwnerProcess);
2424 IMPORT_C void HandleInfo(THandleInfo* anInfo);
2425 IMPORT_C TUint Attributes() const;
2426 IMPORT_C TInt BTraceId() const;
2427 IMPORT_C void NotifyDestruction(TRequestStatus& aStatus); /**< @internalTechnology */
2429 inline RHandleBase(TInt aHandle);
2430 IMPORT_C TInt Open(const TFindHandleBase& aHandle,TOwnerType aType);
2431 static TInt SetReturnedHandle(TInt aHandleOrError,RHandleBase& aHandle);
2432 TInt OpenByName(const TDesC &aName,TOwnerType aOwnerType,TInt aObjectType);
2435 static void DoExtendedCloseL();
2448 A handle to a semaphore.
2450 The semaphore itself is a Kernel side object.
2452 As with all handles, they should be closed after use. RHandleBase provides
2453 the necessary Close() function, which should be called when the handle is
2456 @see RHandleBase::Close
2458 class RSemaphore : public RHandleBase
2461 #ifndef __KERNEL_MODE__
2462 inline TInt Open(const TFindSemaphore& aFind,TOwnerType aType=EOwnerProcess);
2463 IMPORT_C TInt CreateLocal(TInt aCount,TOwnerType aType=EOwnerProcess);
2464 IMPORT_C TInt CreateGlobal(const TDesC& aName,TInt aCount,TOwnerType aType=EOwnerProcess);
2465 IMPORT_C TInt OpenGlobal(const TDesC& aName,TOwnerType aType=EOwnerProcess);
2466 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
2467 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
2468 IMPORT_C void Wait();
2469 IMPORT_C TInt Wait(TInt aTimeout); // timeout in microseconds
2470 IMPORT_C void Signal();
2471 IMPORT_C void Signal(TInt aCount);
2484 This is a layer over a standard semaphore, and only calls into the kernel side
2485 if there is contention.
2487 class RFastLock : public RSemaphore
2491 IMPORT_C TInt CreateLocal(TOwnerType aType=EOwnerProcess);
2492 IMPORT_C void Wait();
2493 IMPORT_C void Signal();
2507 This is a lock for co-ordinating readers and writers to shared resources.
2508 It is designed to allow multiple concurrent readers.
2509 It is not a kernel side object and so does not inherit from RHandleBase.
2511 class RReadWriteLock
2514 enum TReadWriteLockPriority
2516 /** Pending writers always get the lock before pending readers */
2518 /** Lock is given alternately to pending readers and writers */
2520 /** Pending readers always get the lock before pending writers - beware writer starvation! */
2523 enum TReadWriteLockClientCategoryLimit
2525 /** Maximum number of clients in each category: read locked, read lock pending, write lock pending */
2526 EReadWriteLockClientCategoryLimit = KMaxTUint16
2530 inline RReadWriteLock();
2531 IMPORT_C TInt CreateLocal(TReadWriteLockPriority aPriority = EWriterPriority);
2532 IMPORT_C void Close();
2534 IMPORT_C void ReadLock();
2535 IMPORT_C void WriteLock();
2536 IMPORT_C TBool TryReadLock();
2537 IMPORT_C TBool TryWriteLock();
2538 IMPORT_C TBool TryUpgradeReadLock();
2539 IMPORT_C void DowngradeWriteLock();
2540 IMPORT_C void Unlock();
2543 RReadWriteLock(const RReadWriteLock& aLock);
2544 RReadWriteLock& operator=(const RReadWriteLock& aLock);
2546 TInt UnlockWriter();
2547 TInt UnlockAlternate();
2548 TInt UnlockReader();
2551 volatile TUint64 iValues; // Bits 0-15: readers; bit 16: writer; bits 32-47: readersPending; bits 48-63: writersPending
2552 TReadWriteLockPriority iPriority;
2553 RSemaphore iReaderSem;
2554 RSemaphore iWriterSem;
2555 TUint32 iSpare[4]; // Reserved for future development
2565 The user-side handle to a logical channel.
2567 The class provides functions that are used to open a channel
2568 to a device driver, and to make requests. A device driver provides
2569 a derived class to give the user-side a tailored interface to the driver.
2571 class RBusLogicalChannel : public RHandleBase
2574 IMPORT_C TInt Open(RMessagePtr2 aMessage,TInt aParam,TOwnerType aType=EOwnerProcess);
2575 IMPORT_C TInt Open(TInt aArgumentIndex, TOwnerType aType=EOwnerProcess);
2577 inline TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* anInfo, TOwnerType aType=EOwnerProcess, TBool aProtected=EFalse);
2578 IMPORT_C void DoCancel(TUint aReqMask);
2579 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus);
2580 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1);
2581 IMPORT_C void DoRequest(TInt aReqNo,TRequestStatus& aStatus,TAny* a1,TAny* a2);
2582 IMPORT_C TInt DoControl(TInt aFunction);
2583 IMPORT_C TInt DoControl(TInt aFunction,TAny* a1);
2584 IMPORT_C TInt DoControl(TInt aFunction,TAny* a1,TAny* a2);
2585 inline TInt DoSvControl(TInt aFunction) { return DoControl(aFunction); }
2586 inline TInt DoSvControl(TInt aFunction,TAny* a1) { return DoControl(aFunction, a1); }
2587 inline TInt DoSvControl(TInt aFunction,TAny* a1,TAny* a2) { return DoControl(aFunction, a1, a2); }
2589 IMPORT_C TInt DoCreate(const TDesC& aDevice, const TVersion& aVer, TInt aUnit, const TDesC* aDriver, const TDesC8* aInfo, TInt aType);
2591 // Padding for Binary Compatibility purposes
2602 Base class for memory allocators.
2604 // Put pure virtual functions into a separate base class so that vptr is at same
2605 // place in both GCC98r2 and EABI builds.
2609 virtual TAny* Alloc(TInt aSize)=0;
2610 virtual void Free(TAny* aPtr)=0;
2611 virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0)=0;
2612 virtual TInt AllocLen(const TAny* aCell) const =0;
2613 virtual TInt Compress()=0;
2614 virtual void Reset()=0;
2615 virtual TInt AllocSize(TInt& aTotalAllocSize) const =0;
2616 virtual TInt Available(TInt& aBiggestBlock) const =0;
2617 virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL)=0;
2618 virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1)=0;
2628 Base class for heaps.
2630 class RAllocator : public MAllocator
2636 A set of heap allocation failure flags.
2638 This enumeration indicates how to simulate heap allocation failure.
2640 @see RAllocator::__DbgSetAllocFail()
2644 Attempts to allocate from this heap fail at a random rate;
2645 however, the interval pattern between failures is the same
2646 every time simulation is started.
2652 Attempts to allocate from this heap fail at a random rate.
2653 The interval pattern between failures may be different every
2654 time the simulation is started.
2660 Attempts to allocate from this heap fail at a rate aRate;
2661 for example, if aRate is 3, allocation fails at every
2668 Cancels simulated heap allocation failure.
2674 An allocation from this heap will fail after the next aRate - 1
2675 allocation attempts. For example, if aRate = 1 then the next
2676 attempt to allocate from this heap will fail.
2681 Cancels simulated heap allocation failure, and sets
2682 the nesting level for all allocated cells to zero.
2687 aBurst allocations from this heap fail at a random rate;
2688 however, the interval pattern between failures is the same
2689 every time the simulation is started.
2695 aBurst allocations from this heap fail at a random rate.
2696 The interval pattern between failures may be different every
2697 time the simulation is started.
2703 aBurst allocations from this heap fail at a rate aRate.
2704 For example, if aRate is 10 and aBurst is 2, then 2 allocations
2705 will fail at every tenth attempt.
2707 EBurstDeterministic,
2710 aBurst allocations from this heap will fail after the next aRate - 1
2711 allocation attempts have occurred. For example, if aRate = 1 and
2712 aBurst = 3 then the next 3 attempts to allocate from this heap will fail.
2717 Use this to determine how many times the current debug
2718 failure mode has failed so far.
2719 @see RAllocator::__DbgCheckFailure()
2726 Heap debug checking type flag.
2730 The heap is a user heap.
2735 The heap is the Kernel heap.
2741 enum TAllocDebugOp {ECount, EMarkStart, EMarkEnd, ECheck, ESetFail, ECopyDebugInfo, ESetBurstFail};
2745 Flags controlling reallocation.
2749 A reallocation of a cell must not change
2750 the start address of the cell.
2755 Allows the start address of the cell to change
2756 if the cell shrinks in size.
2758 EAllowMoveOnShrink=2
2762 enum TFlags {ESingleThreaded=1, EFixedSize=2, ETraceAllocs=4, EMonitorMemory=8,};
2763 struct SCheckInfo {TBool iAll; TInt iCount; const TDesC8* iFileName; TInt iLineNum;};
2764 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
2765 struct SRAllocatorBurstFail {TInt iBurst; TInt iRate; TInt iUnused[2];};
2767 enum {EMaxHandles=32};
2770 inline RAllocator();
2771 #ifndef __KERNEL_MODE__
2772 IMPORT_C TInt Open();
2773 IMPORT_C void Close();
2774 IMPORT_C TAny* AllocZ(TInt aSize);
2775 IMPORT_C TAny* AllocZL(TInt aSize);
2776 IMPORT_C TAny* AllocL(TInt aSize);
2777 IMPORT_C TAny* AllocLC(TInt aSize);
2778 IMPORT_C void FreeZ(TAny*& aCell);
2779 IMPORT_C TAny* ReAllocL(TAny* aCell, TInt aSize, TInt aMode=0);
2780 IMPORT_C TInt Count() const;
2781 IMPORT_C TInt Count(TInt& aFreeCount) const;
2783 UIMPORT_C void Check() const;
2784 UIMPORT_C void __DbgMarkStart();
2785 UIMPORT_C TUint32 __DbgMarkEnd(TInt aCount);
2786 UIMPORT_C TInt __DbgMarkCheck(TBool aCountAll, TInt aCount, const TDesC8& aFileName, TInt aLineNum);
2787 inline void __DbgMarkCheck(TBool aCountAll, TInt aCount, const TUint8* aFileName, TInt aLineNum);
2788 UIMPORT_C void __DbgSetAllocFail(TAllocFail aType, TInt aRate);
2789 UIMPORT_C void __DbgSetBurstAllocFail(TAllocFail aType, TUint aRate, TUint aBurst);
2790 UIMPORT_C TUint __DbgCheckFailure();
2792 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
2793 #ifndef __KERNEL_MODE__
2794 IMPORT_C virtual void DoClose();
2802 TInt iTotalAllocSize;
2813 Represents the default implementation for a heap.
2815 The default implementation uses an address-ordered first fit type algorithm.
2817 The heap itself is contained in a chunk and may be the only occupant of the
2818 chunk or may share the chunk with the program stack.
2820 The class contains member functions for allocating, adjusting, freeing individual
2821 cells and generally managing the heap.
2823 The class is not a handle in the same sense that RChunk is a handle; i.e.
2824 there is no Kernel object which corresponds to the heap.
2826 class RHeap : public RAllocator
2830 The structure of a heap cell header for a heap cell on the free list.
2834 The length of the cell, which includes the length of
2841 A pointer to the next cell in the free list.
2848 The structure of a heap cell header for an allocated heap cell in a debug build.
2852 The length of the cell, which includes the length of
2865 The cumulative number of allocated cells
2873 struct SHeapCellInfo { RHeap* iHeap; TInt iTotalAlloc; TInt iTotalAllocSize; TInt iTotalFree; TInt iLevelAlloc; SDebugCell* iStranded; };
2878 struct _s_align {char c; double d;};
2881 The default cell alignment.
2883 enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
2886 Size of a free cell header.
2888 enum {EFreeCellSize = sizeof(SCell)};
2893 Size of an allocated cell header in a debug build.
2895 enum {EAllocCellSize = sizeof(SDebugCell)};
2898 Size of an allocated cell header in a release build.
2900 enum {EAllocCellSize = sizeof(SCell*)};
2907 enum TDebugOp {EWalk=128};
2914 {EGoodAllocatedCell, EGoodFreeCell, EBadAllocatedCellSize, EBadAllocatedCellAddress,
2915 EBadFreeCellAddress, EBadFreeCellSize};
2921 enum TDebugHeapId {EUser=0, EKernel=1};
2926 enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
2928 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
2935 typedef void (*TWalkFunc)(TAny*, TCellType, TAny*, TInt);
2938 UIMPORT_C virtual TAny* Alloc(TInt aSize);
2939 UIMPORT_C virtual void Free(TAny* aPtr);
2940 UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
2941 UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const;
2942 #ifndef __KERNEL_MODE__
2943 UIMPORT_C virtual TInt Compress();
2944 UIMPORT_C virtual void Reset();
2945 UIMPORT_C virtual TInt AllocSize(TInt& aTotalAllocSize) const;
2946 UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const;
2948 UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
2950 UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
2952 UIMPORT_C RHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
2953 UIMPORT_C RHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
2954 UIMPORT_C TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
2955 inline void operator delete(TAny* aPtr, TAny* aBase);
2956 inline TUint8* Base() const;
2957 inline TInt Size() const;
2958 inline TInt MaxLength() const;
2959 inline TInt Align(TInt a) const;
2960 inline const TAny* Align(const TAny* a) const;
2961 inline TBool IsLastCell(const SCell* aCell) const;
2962 inline void Lock() const;
2963 inline void Unlock() const;
2964 inline TInt ChunkHandle() const;
2968 SCell* DoAlloc(TInt aSize, SCell*& aLastFree);
2969 void DoFree(SCell* pC);
2970 TInt TryToGrowHeap(TInt aSize, SCell* aLastFree);
2971 inline void FindFollowingFreeCell(SCell* aCell, SCell*& pPrev, SCell*& aNext);
2972 TInt TryToGrowCell(SCell* pC, SCell* pP, SCell* pE, TInt aSize);
2973 TInt Reduce(SCell* aCell);
2974 UIMPORT_C SCell* GetAddress(const TAny* aCell) const;
2975 void CheckCell(const SCell* aCell) const;
2976 void Walk(TWalkFunc aFunc, TAny* aPtr);
2977 static void WalkCheckCell(TAny* aPtr, TCellType aType, TAny* aCell, TInt aLen);
2978 TInt DoCountAllocFree(TInt& aFree);
2979 TInt DoCheckHeap(SCheckInfo* aInfo);
2981 TUint32 DoMarkEnd(TInt aExpected);
2982 void DoSetAllocFail(TAllocFail aType, TInt aRate);
2983 TBool CheckForSimulatedAllocFail();
2984 inline TInt SetBrk(TInt aBrk);
2985 inline TAny* ReAllocImpl(TAny* aPtr, TInt aSize, TInt aMode);
2986 void DoSetAllocFail(TAllocFail aType, TInt aRate, TUint aBurst);
3003 TAllocFail iFailType;
3006 TInt iFailAllocCount;
3010 friend class UserHeap;
3017 class OnlyCreateWithNull;
3019 /** @internalTechnology */
3020 typedef void (OnlyCreateWithNull::* __NullPMF)();
3022 /** @internalTechnology */
3023 class OnlyCreateWithNull
3026 inline OnlyCreateWithNull(__NullPMF /*aPointerToNull*/) {}
3033 A handle to a message sent by the client to the server.
3035 A server's interaction with its clients is channelled through an RMessagePtr2
3036 object, which acts as a handle to a message sent by the client.
3037 The details of the original message are kept by the kernel allowing it enforce
3038 correct usage of the member functions of this class.
3045 inline RMessagePtr2();
3046 inline TBool IsNull() const;
3047 inline TInt Handle() const;
3048 #ifndef __KERNEL_MODE__
3049 IMPORT_C void Complete(TInt aReason) const;
3050 IMPORT_C void Complete(RHandleBase aHandle) const;
3051 IMPORT_C TInt GetDesLength(TInt aParam) const;
3052 IMPORT_C TInt GetDesLengthL(TInt aParam) const;
3053 IMPORT_C TInt GetDesMaxLength(TInt aParam) const;
3054 IMPORT_C TInt GetDesMaxLengthL(TInt aParam) const;
3055 IMPORT_C void ReadL(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
3056 IMPORT_C void ReadL(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
3057 IMPORT_C void WriteL(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
3058 IMPORT_C void WriteL(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
3059 IMPORT_C TInt Read(TInt aParam,TDes8& aDes,TInt aOffset=0) const;
3060 IMPORT_C TInt Read(TInt aParam,TDes16 &aDes,TInt aOffset=0) const;
3061 IMPORT_C TInt Write(TInt aParam,const TDesC8& aDes,TInt aOffset=0) const;
3062 IMPORT_C TInt Write(TInt aParam,const TDesC16& aDes,TInt aOffset=0) const;
3063 IMPORT_C void Panic(const TDesC& aCategory,TInt aReason) const;
3064 IMPORT_C void Kill(TInt aReason) const;
3065 IMPORT_C void Terminate(TInt aReason) const;
3066 IMPORT_C TInt SetProcessPriority(TProcessPriority aPriority) const;
3067 inline void SetProcessPriorityL(TProcessPriority aPriority) const;
3068 IMPORT_C TInt Client(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
3069 inline void ClientL(RThread& aClient, TOwnerType aOwnerType=EOwnerProcess) const;
3070 IMPORT_C TUint ClientProcessFlags() const;
3071 IMPORT_C const TRequestStatus* ClientStatus() const;
3072 IMPORT_C TBool ClientIsRealtime() const;
3075 Return the Secure ID of the process which sent this message.
3077 If an intended use of this method is to check that the Secure ID is
3078 a given value, then the use of a TSecurityPolicy object should be
3079 considered. E.g. Instead of something like:
3082 RMessagePtr2& message;
3083 TInt error = message.SecureId()==KRequiredSecureId ? KErrNone : KErrPermissionDenied;
3089 RMessagePtr2& message;
3090 static _LIT_SECURITY_POLICY_S0(mySidPolicy, KRequiredSecureId);
3091 TBool pass = mySidPolicy().CheckPolicy(message);
3094 This has the benefit that the TSecurityPolicy::CheckPolicy methods are
3095 configured by the system wide Platform Security configuration. I.e. are
3096 capable of emitting diagnostic messages when a check fails and/or the
3097 check can be forced to always pass.
3099 @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
3100 @see _LIT_SECURITY_POLICY_S0
3102 @return The Secure ID.
3107 IMPORT_C TSecureId SecureId() const;
3110 Return the Vendor ID of the process which sent this message.
3112 If an intended use of this method is to check that the Vendor ID is
3113 a given value, then the use of a TSecurityPolicy object should be
3114 considered. E.g. Instead of something like:
3117 RMessagePtr2& message;
3118 TInt error = message.VendorId()==KRequiredVendorId ? KErrNone : KErrPermissionDenied;
3124 RMessagePtr2& message;
3125 static _LIT_SECURITY_POLICY_V0(myVidPolicy, KRequiredVendorId);
3126 TBool pass = myVidPolicy().CheckPolicy(message);
3129 This has the benefit that the TSecurityPolicy::CheckPolicy methods are
3130 configured by the system wide Platform Security configuration. I.e. are
3131 capable of emitting diagnostic messages when a check fails and/or the
3132 check can be forced to always pass.
3134 @see TSecurityPolicy::CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const
3135 @see _LIT_SECURITY_POLICY_V0
3137 @return The Vendor ID.
3141 IMPORT_C TVendorId VendorId() const;
3144 Check if the process which sent this message has a given capability.
3146 When a check fails the action taken is determined by the system wide Platform Security
3147 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3148 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
3151 @param aCapability The capability to test.
3152 @param aDiagnostic A string that will be emitted along with any diagnostic message
3153 that may be issued if the test finds the capability is not present.
3154 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3155 which enables it to be easily removed from the system.
3156 @return ETrue if process which sent this message has the capability, EFalse otherwise.
3160 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3161 inline TBool HasCapability(TCapability aCapability, const char* aDiagnostic=0) const;
3162 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3163 // Only available to NULL arguments
3164 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic=NULL) const;
3165 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3166 // For things using KSuppressPlatSecDiagnostic
3167 inline TBool HasCapability(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3168 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3169 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3172 Check if the process which sent this message has a given capability.
3174 When a check fails the action taken is determined by the system wide Platform Security
3175 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3176 If PlatSecEnforcement is OFF, then this function will not leave even though the
3179 @param aCapability The capability to test.
3180 @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
3181 that may be issued if the test finds the capability is not present.
3182 This string must be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3183 which enables it to be easily removed from the system.
3184 @leave KErrPermissionDenied, if the process does not have the capability.
3188 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3189 inline void HasCapabilityL(TCapability aCapability, const char* aDiagnosticMessage=0) const;
3190 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3191 // Only available to NULL arguments
3192 inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
3193 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3194 // For things using KSuppressPlatSecDiagnostic
3195 inline void HasCapabilityL(TCapability aCapability, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3196 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3197 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3200 Check if the process which sent this message has both of the given capabilities.
3202 When a check fails the action taken is determined by the system wide Platform Security
3203 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3204 If PlatSecEnforcement is OFF, then this function will return ETrue even though the
3207 @param aCapability1 The first capability to test.
3208 @param aCapability2 The second capability to test.
3209 @param aDiagnostic A string that will be emitted along with any diagnostic message
3210 that may be issued if the test finds a capability is not present.
3211 This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3212 which enables it to be easily removed from the system.
3213 @return ETrue if the process which sent this message has both the capabilities, EFalse otherwise.
3217 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3218 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, const char* aDiagnostic=0) const;
3219 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3220 // Only available to NULL arguments
3221 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic=NULL) const;
3222 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3223 // For things using KSuppressPlatSecDiagnostic
3224 inline TBool HasCapability(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3225 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3226 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3229 Check if the process which sent this message has both of the given capabilities.
3231 When a check fails the action taken is determined by the system wide Platform Security
3232 configuration. If PlatSecDiagnostics is ON, then a diagnostic message is emitted.
3233 If PlatSecEnforcement is OFF, then this function will not leave even though the
3236 @param aCapability1 The first capability to test.
3237 @param aCapability2 The second capability to test.
3238 @param aDiagnosticMessage A string that will be emitted along with any diagnostic message
3239 that may be issued if the test finds a capability is not present.
3240 This string should be enclosed in the __PLATSEC_DIAGNOSTIC_STRING macro
3241 which enables it to be easily removed from the system.
3242 @leave KErrPermissionDenied, if the process does not have the capabilities.
3246 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3247 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, const char* aDiagnosticMessage=0) const;
3248 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3249 // Only available to NULL arguments
3250 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnosticMessage=NULL) const;
3251 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3252 // For things using KSuppressPlatSecDiagnostic
3253 inline void HasCapabilityL(TCapability aCapability1, TCapability aCapability2, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3254 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3255 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3258 @deprecated Use SecureId()
3260 inline TUid Identity() const { return SecureId(); }
3264 // Implementations of functions with diagnostics
3265 IMPORT_C TBool DoHasCapability(TCapability aCapability, const char* aDiagnostic) const;
3266 IMPORT_C TBool DoHasCapability(TCapability aCapability) const;
3267 IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2, const char* aDiagnostic) const;
3268 IMPORT_C TBool DoHasCapability(TCapability aCapability, TCapability aCapability2) const;
3273 inline TBool operator==(RMessagePtr2 aLeft,RMessagePtr2 aRight);
3274 inline TBool operator!=(RMessagePtr2 aLeft,RMessagePtr2 aRight);
3278 #define __IPC_V2_PRESENT__
3284 An object that encapsulates the details of a client request.
3286 class RMessage2 : public RMessagePtr2
3288 friend class CServer2;
3292 Defines internal message types.
3294 enum TSessionMessages {
3296 A message type used internally that means connect.
3301 A message type used internally that means disconnect.
3307 #ifndef __KERNEL_MODE__
3308 IMPORT_C explicit RMessage2(const RMessagePtr2& aPtr);
3309 void SetAuthorised() const;
3310 void ClearAuthorised() const;
3311 TBool Authorised() const;
3313 inline TInt Function() const;
3314 inline TInt Int0() const;
3315 inline TInt Int1() const;
3316 inline TInt Int2() const;
3317 inline TInt Int3() const;
3318 inline const TAny* Ptr0() const;
3319 inline const TAny* Ptr1() const;
3320 inline const TAny* Ptr2() const;
3321 inline const TAny* Ptr3() const;
3322 inline CSession2* Session() const;
3331 A copy of the message arguments.
3333 TInt iArgs[KMaxMessageArguments];
3340 const TAny* iSessionPtr;
3342 mutable TInt iFlags;// Currently only used for *Authorised above
3343 TInt iSpare3; // Reserved for future use
3345 friend class RMessage;
3355 Defines an 8-bit modifiable buffer descriptor to contain passwords when dealing
3356 with password security support in a file server session.
3358 The descriptor takes a maximum length of KMaxMediaPassword.
3360 @see KMaxMediaPassword
3362 typedef TBuf8<KMaxMediaPassword> TMediaPassword; // 128 bit
3369 A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
3370 set signifies that a buffer offset list follows the buffer configuration class. This list holds the offset of each buffer.
3372 const TUint KScFlagBufOffsetListInUse=0x00000001;
3377 A configuration flag for the shared chunk buffer configuration class (used by the multimedia device drivers). This being
3378 set is a suggestion that the shared chunk should be configured leaving guard pages around each buffers.
3380 const TUint KScFlagUseGuardPages=0x00000002;
3385 The shared chunk buffer configuration class (used by the multimedia device drivers). This is used to hold information
3386 on the current buffer configuration within a shared chunk.
3388 class TSharedChunkBufConfigBase
3391 inline TSharedChunkBufConfigBase();
3393 /** The number of buffers. */
3395 /** The size of each buffer in bytes. */
3396 TInt iBufferSizeInBytes;
3397 /** Reserved field. */
3399 /** Shared chunk buffer flag settings. */
3404 /** Maximum size of capability set
3408 const TInt KCapabilitySetMaxSize = (((TInt)ECapability_HardLimit + 7)>>3);
3410 /** Maximum size of any future extension to TSecurityPolicy
3414 const TInt KMaxSecurityPolicySize = KCapabilitySetMaxSize + 3*sizeof(TUint32);
3417 /** Class representing an arbitrary set of capabilities.
3419 This class can only contain capabilities supported by the current OS version.
3424 class TCapabilitySet
3427 inline TCapabilitySet();
3428 inline TCapabilitySet(TCapability aCapability);
3429 IMPORT_C TCapabilitySet(TCapability aCapability1, TCapability aCapability2);
3430 IMPORT_C void SetEmpty();
3431 inline void Set(TCapability aCapability);
3432 inline void Set(TCapability aCapability1, TCapability aCapability2);
3433 IMPORT_C void SetAllSupported();
3434 IMPORT_C void AddCapability(TCapability aCapability);
3435 IMPORT_C void RemoveCapability(TCapability aCapability);
3436 IMPORT_C void Union(const TCapabilitySet& aCapabilities);
3437 IMPORT_C void Intersection(const TCapabilitySet& aCapabilities);
3438 IMPORT_C void Remove(const TCapabilitySet& aCapabilities);
3439 IMPORT_C TBool HasCapability(TCapability aCapability) const;
3440 IMPORT_C TBool HasCapabilities(const TCapabilitySet& aCapabilities) const;
3443 Make this set consist of the capabilities which are disabled on this platform.
3446 IMPORT_C void SetDisabled();
3450 TBool NotEmpty() const;
3453 TUint32 iCaps[KCapabilitySetMaxSize / sizeof(TUint32)];
3456 #ifndef __SECURITY_INFO_DEFINED__
3457 #define __SECURITY_INFO_DEFINED__
3461 struct SCapabilitySet
3465 inline void AddCapability(TCapability aCap1) {((TCapabilitySet*)this)->AddCapability(aCap1);}
3466 inline void Remove(const SCapabilitySet& aCaps) {((TCapabilitySet*)this)->Remove(*((TCapabilitySet*)&aCaps));}
3467 inline TBool NotEmpty() const {return ((TCapabilitySet*)this)->NotEmpty();}
3469 inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
3470 inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
3472 TUint32 iCaps[ENCapW];
3478 struct SSecurityInfo
3482 SCapabilitySet iCaps; // Capabilities re. platform security
3487 /** Define this macro to reference the set of all capabilities.
3490 #ifdef __REFERENCE_ALL_SUPPORTED_CAPABILITIES__
3492 extern const SCapabilitySet AllSupportedCapabilities;
3494 #endif //__REFERENCE_ALL_SUPPORTED_CAPABILITIES__
3496 /** Define this macro to include the set of all capabilities.
3499 #ifdef __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
3501 /** The set of all capabilities.
3504 const SCapabilitySet AllSupportedCapabilities = {
3506 ECapability_Limit<32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0xffffffffu
3508 ECapability_Limit>=32 ? (TUint32)((1u<<(ECapability_Limit&31))-1u) : 0u
3512 #endif // __INCLUDE_ALL_SUPPORTED_CAPABILITIES__
3514 #ifndef __KERNEL_MODE__
3524 /** Class representing all security attributes of a process or DLL.
3525 These comprise a set of capabilities, a Secure ID and a Vendor ID.
3533 inline TSecurityInfo();
3534 #ifdef __KERNEL_MODE__
3535 IMPORT_C TSecurityInfo(DProcess* aProcess);
3536 IMPORT_C TSecurityInfo(DThread* aThread);
3538 IMPORT_C TSecurityInfo(RProcess aProcess);
3539 IMPORT_C TSecurityInfo(RThread aThread);
3540 IMPORT_C TSecurityInfo(RMessagePtr2 aMesPtr);
3541 inline void Set(RProcess aProcess);
3542 inline void Set(RThread aThread);
3543 inline void Set(RMessagePtr2 aMsgPtr);
3544 TInt Set(RSessionBase aSession); /**< @internalComponent */
3545 inline void SetToCurrentInfo();
3546 IMPORT_C void SetToCreatorInfo();
3547 #endif //__KERNEL_MODE__
3549 TSecureId iSecureId; /**< Secure ID */
3550 TVendorId iVendorId; /**< Vendor ID */
3551 TCapabilitySet iCaps; /**< Capability Set */
3555 /** Class representing a generic security policy
3557 This class can specify a security policy consisting of either:
3559 -# A check for between 0 and 7 capabilities
3560 -# A check for a given Secure ID along with 0-3 capabilities
3561 -# A check for a given Vendor ID along with 0-3 capabilities
3563 If multiple capabilities are specified, all of them must be present for the
3564 security check to succeed ('AND' relation).
3566 The envisaged use case for this class is to specify access rights to an object
3567 managed either by the kernel or by a server but in principle owned by a client
3568 and usable in a limited way by other clients. For example
3569 - Publish and Subscribe properties
3572 In these cases the owning client would pass one (or more) of these objects to
3573 the server to specify which security checks should be done on other clients
3574 before allowing access to the object.
3576 To pass a TSecurityPolicy object via IPC, a client should obtain a descriptor
3577 for the object using Package() and send this. When a server receives this descriptor
3578 it should read the descriptor contents into a TSecurityPolicyBuf and then
3579 Set() should be used to create a policy object from this.
3581 Because this class has non-default constructors, compilers will not initialise
3582 this object at compile time, instead code will be generated to construct the object
3583 at run-time. This is wasteful - and Symbian OS DLLs are not permitted to have
3584 such uninitialised data. To overcome these problems a set of macros are provided to
3585 construct a const object which behaves like a TSecurityPolicy. These are:
3587 _LIT_SECURITY_POLICY_C1 through _LIT_SECURITY_POLICY_C7,
3588 _LIT_SECURITY_POLICY_S0 through _LIT_SECURITY_POLICY_S3 and
3589 _LIT_SECURITY_POLICY_V0 through _LIT_SECURITY_POLICY_V3.
3591 Also, the macros _LIT_SECURITY_POLICY_PASS and _LIT_SECURITY_POLICY_FAIL are provided
3592 in order to allow easy construction of a const object which can be used as a
3593 TSecuityPolicy which always passes or always fails, respectively.
3595 If a security policy object is needed to be embedded in another class then the
3596 TStaticSecurityPolicy structure can be used. This behaves in the same way as a
3597 TSecurityPolicy object but may be initialised at compile time.
3599 @see TStaticSecurityPolicy
3600 @see TSecurityPolicyBuf
3601 @see _LIT_SECURITY_POLICY_PASS
3602 @see _LIT_SECURITY_POLICY_FAIL
3603 @see _LIT_SECURITY_POLICY_C1
3604 @see _LIT_SECURITY_POLICY_C2
3605 @see _LIT_SECURITY_POLICY_C3
3606 @see _LIT_SECURITY_POLICY_C4
3607 @see _LIT_SECURITY_POLICY_C5
3608 @see _LIT_SECURITY_POLICY_C6
3609 @see _LIT_SECURITY_POLICY_C7
3610 @see _LIT_SECURITY_POLICY_S0
3611 @see _LIT_SECURITY_POLICY_S1
3612 @see _LIT_SECURITY_POLICY_S2
3613 @see _LIT_SECURITY_POLICY_S3
3614 @see _LIT_SECURITY_POLICY_V0
3615 @see _LIT_SECURITY_POLICY_V1
3616 @see _LIT_SECURITY_POLICY_V2
3617 @see _LIT_SECURITY_POLICY_V3
3622 class TSecurityPolicy
3632 inline TSecurityPolicy();
3633 IMPORT_C TSecurityPolicy(TSecPolicyType aType);
3634 IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3635 IMPORT_C TSecurityPolicy(TCapability aCap1, TCapability aCap2, TCapability aCap3, TCapability aCap4, TCapability aCap5 = ECapability_None, TCapability aCap6 = ECapability_None, TCapability aCap7 = ECapability_None);
3636 IMPORT_C TSecurityPolicy(TSecureId aSecureId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3637 IMPORT_C TSecurityPolicy(TVendorId aVendorId, TCapability aCap1 = ECapability_None, TCapability aCap2 = ECapability_None, TCapability aCap3 = ECapability_None);
3638 IMPORT_C TInt Set(const TDesC8& aDes);
3639 IMPORT_C TPtrC8 Package() const;
3641 #ifdef __KERNEL_MODE__
3643 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3644 inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const;
3645 inline TBool CheckPolicy(DThread* aThread, const char* aDiagnostic=0) const;
3646 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3647 // Only available to NULL arguments
3648 inline TBool CheckPolicy(DProcess* aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3649 inline TBool CheckPolicy(DThread* aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3650 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3652 #else // !__KERNEL_MODE__
3654 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3655 inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
3656 inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
3657 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
3658 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
3659 inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
3660 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3661 // Only available to NULL arguments
3662 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3663 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3664 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
3665 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
3666 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
3667 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3668 // For things using KSuppressPlatSecDiagnostic
3669 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3670 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3671 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3672 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3673 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3674 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3675 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3676 TInt CheckPolicy(RSessionBase aSession) const; /**< @internalComponent */
3678 #endif //__KERNEL_MODE__
3680 TBool Validate() const;
3683 #ifdef __KERNEL_MODE__
3684 IMPORT_C TBool DoCheckPolicy(DProcess* aProcess, const char* aDiagnostic) const;
3685 IMPORT_C TBool DoCheckPolicy(DProcess* aProcess) const;
3686 IMPORT_C TBool DoCheckPolicy(DThread* aThread, const char* aDiagnostic) const;
3687 IMPORT_C TBool DoCheckPolicy(DThread* aThread) const;
3688 #else // !__KERNEL_MODE__
3689 IMPORT_C TBool DoCheckPolicy(RProcess aProcess, const char* aDiagnostic) const;
3690 IMPORT_C TBool DoCheckPolicy(RProcess aProcess) const;
3691 IMPORT_C TBool DoCheckPolicy(RThread aThread, const char* aDiagnostic) const;
3692 IMPORT_C TBool DoCheckPolicy(RThread aThread) const;
3693 IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic) const;
3694 IMPORT_C TBool DoCheckPolicy(RMessagePtr2 aMsgPtr) const;
3695 IMPORT_C TBool DoCheckPolicyCreator(const char* aDiagnostic) const;
3696 IMPORT_C TBool DoCheckPolicyCreator() const;
3697 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3698 TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic) const;
3699 #endif //__REMOVE_PLATSEC_DIAGNOSTICS__
3700 TBool DoCheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing) const;
3701 #endif //__KERNEL_MODE__
3704 /** Constants to specify the type of TSecurityPolicy objects.
3708 ETypeFail=0, /**< Always fail*/
3709 ETypePass=1, /**< Always pass*/
3710 ETypeC3=2, /**< Up to 3 capabilities*/
3711 ETypeC7=3, /**< Up to 7 capabilities*/
3712 ETypeS3=4, /**< Secure ID and up to 3 capabilities*/
3713 ETypeV3=5, /**< Vendor ID and up to 3 capabilities*/
3715 /** The number of possible TSecurityPolicy types
3716 This is intended for internal Symbian use only.
3721 // other values may be added to indicate expanded policy objects (future extensions)
3724 TBool CheckPolicy(const SSecurityInfo& aSecInfo, SSecurityInfo& aMissing) const;
3726 void ConstructAndCheck3(TCapability aCap1, TCapability aCap2, TCapability aCap3);
3729 TUint8 iCaps[3]; // missing capabilities are set to 0xff
3734 TUint8 iExtraCaps[4]; // missing capabilities are set to 0xff
3736 friend class TCompiledSecurityPolicy;
3739 /** Provides a TPkcgBuf wrapper for a descriptorised TSecurityPolicy. This a
3740 suitable container for passing a security policy across IPC.
3744 typedef TPckgBuf<TSecurityPolicy> TSecurityPolicyBuf;
3747 /** Structure for compile-time initialisation of a security policy.
3749 This structure behaves in the same way as a TSecurityPolicy object but has
3750 the advantage that it may be initialised at compile time. E.g.
3751 the following line defines a security policy 'KSecurityPolictReadUserData'
3752 which checks ReadUserData capability.
3755 _LIT_SECURITY_POLICY_C1(KSecurityPolictReadUserData,ECapabilityReadUserData)
3758 Or, an array of security policies may be created like this:
3760 static const TStaticSecurityPolicy MyPolicies[] =
3762 _INIT_SECURITY_POLICY_C1(ECapabilityReadUserData),
3763 _INIT_SECURITY_POLICY_PASS(),
3764 _INIT_SECURITY_POLICY_S0(0x1234567)
3768 This class should not be initialised directly, instead one of the following
3769 macros should be used:
3771 - _INIT_SECURITY_POLICY_PASS
3772 - _INIT_SECURITY_POLICY_FAIL
3773 - _INIT_SECURITY_POLICY_C1
3774 - _INIT_SECURITY_POLICY_C2
3775 - _INIT_SECURITY_POLICY_C3
3776 - _INIT_SECURITY_POLICY_C4
3777 - _INIT_SECURITY_POLICY_C5
3778 - _INIT_SECURITY_POLICY_C6
3779 - _INIT_SECURITY_POLICY_C7
3780 - _INIT_SECURITY_POLICY_S0
3781 - _INIT_SECURITY_POLICY_S1
3782 - _INIT_SECURITY_POLICY_S2
3783 - _INIT_SECURITY_POLICY_S3
3784 - _INIT_SECURITY_POLICY_V0
3785 - _INIT_SECURITY_POLICY_V1
3786 - _INIT_SECURITY_POLICY_V2
3787 - _INIT_SECURITY_POLICY_V3
3788 - _LIT_SECURITY_POLICY_PASS
3789 - _LIT_SECURITY_POLICY_FAIL
3790 - _LIT_SECURITY_POLICY_C1
3791 - _LIT_SECURITY_POLICY_C2
3792 - _LIT_SECURITY_POLICY_C3
3793 - _LIT_SECURITY_POLICY_C4
3794 - _LIT_SECURITY_POLICY_C5
3795 - _LIT_SECURITY_POLICY_C6
3796 - _LIT_SECURITY_POLICY_C7
3797 - _LIT_SECURITY_POLICY_S0
3798 - _LIT_SECURITY_POLICY_S1
3799 - _LIT_SECURITY_POLICY_S2
3800 - _LIT_SECURITY_POLICY_S3
3801 - _LIT_SECURITY_POLICY_V0
3802 - _LIT_SECURITY_POLICY_V1
3803 - _LIT_SECURITY_POLICY_V2
3804 - _LIT_SECURITY_POLICY_V3
3806 @see TSecurityPolicy
3810 struct TStaticSecurityPolicy
3812 inline const TSecurityPolicy* operator&() const;
3813 inline operator const TSecurityPolicy&() const;
3814 inline const TSecurityPolicy& operator()() const;
3816 #ifndef __KERNEL_MODE__
3817 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3818 inline TBool CheckPolicy(RProcess aProcess, const char* aDiagnostic=0) const;
3819 inline TBool CheckPolicy(RThread aThread, const char* aDiagnostic=0) const;
3820 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, const char* aDiagnostic=0) const;
3821 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, const char* aDiagnostic=0) const;
3822 inline TBool CheckPolicyCreator(const char* aDiagnostic=0) const;
3823 #else //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3824 // Only available to NULL arguments
3825 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic=NULL) const;
3826 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic=NULL) const;
3827 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic=NULL) const;
3828 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic=NULL) const;
3829 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic=NULL) const;
3830 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
3831 // For things using KSuppressPlatSecDiagnostic
3832 inline TBool CheckPolicy(RProcess aProcess, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3833 inline TBool CheckPolicy(RThread aThread, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3834 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3835 inline TBool CheckPolicy(RMessagePtr2 aMsgPtr, TSecurityInfo& aMissing, OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3836 inline TBool CheckPolicyCreator(OnlyCreateWithNull aDiagnostic, OnlyCreateWithNull aSuppress) const;
3837 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
3838 #endif // !__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__
3839 #endif // !__KERNEL_MODE__
3841 TUint32 iA; /**< @internalComponent */
3842 TUint32 iB; /**< @internalComponent */
3847 A dummy enum for use by the CAPABILITY_AS_TUINT8 macro
3850 enum __invalid_capability_value {};
3853 A macro to cast a TCapability to a TUint8.
3855 If an invlid capability value is specified then, dependant on the compiler,
3856 a compile time error or warning will be produced which includes the label
3857 "__invalid_capability_value"
3859 @param cap The capability value
3862 #define CAPABILITY_AS_TUINT8(cap) \
3864 (cap)==ECapability_None \
3865 ? (__invalid_capability_value(*)[1])(ECapability_None) \
3866 : (__invalid_capability_value(*)[((TUint)(cap+1)<=(TUint)ECapability_Limit)?1:2])(cap) \
3871 A macro to construct a TUint32 from four TUint8s. The TUint32 is in BigEndian
3872 ordering useful for class layout rather than number generation.
3874 @param i1 The first TUint8
3875 @param i2 The second TUint8
3876 @param i3 The third TUint8
3877 @param i4 The fourth TUint8
3880 #define FOUR_TUINT8(i1,i2,i3,i4) \
3884 (TUint8)i3 << 16 | \
3889 /** Macro for compile-time initialisation of a security policy object that
3890 always fails. That is, checks against this policy will always fail,
3891 irrespective of the security attributes of the item being checked.
3893 The object declared has an implicit conversion to const TSecurityPolicy&.
3894 Taking the address of the object will return a const TSecurityPolicy*.
3895 Explicit conversion to const TSecurityPolicy& may be effected by using the
3896 function call operator n().
3900 #define _INIT_SECURITY_POLICY_FAIL \
3903 (TUint8)TSecurityPolicy::ETypeFail, \
3908 (TUint32)0xffffffff \
3912 /** Macro for compile-time definition of a security policy object that always
3913 fails. That is, checks against this policy will always fail, irrespective of
3914 the security attributes of the item being checked.
3916 The object declared has an implicit conversion to const TSecurityPolicy&.
3917 Taking the address of the object will return a const TSecurityPolicy*.
3918 Explicit conversion to const TSecurityPolicy& may be effected by using the
3919 function call operator n().
3920 @param n Name to use for policy object
3924 #define _LIT_SECURITY_POLICY_FAIL(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_FAIL
3927 /** Macro for compile-time initialisation of a security policy object that
3928 always passes. That is, checks against this policy will always pass,
3929 irrespective of the security attributes of the item being checked.
3931 The object declared has an implicit conversion to const TSecurityPolicy&.
3932 Taking the address of the object will return a const TSecurityPolicy*.
3933 Explicit conversion to const TSecurityPolicy& may be effected by using the
3934 function call operator n().
3938 #define _INIT_SECURITY_POLICY_PASS \
3941 (TUint8)TSecurityPolicy::ETypePass, \
3946 (TUint32)0xffffffff \
3950 /** Macro for compile-time definition of a security policy object that always
3951 passes. That is, checks against this policy will always pass, irrespective of
3952 the security attributes of the item being checked.
3954 The object declared has an implicit conversion to const TSecurityPolicy&.
3955 Taking the address of the object will return a const TSecurityPolicy*.
3956 Explicit conversion to const TSecurityPolicy& may be effected by using the
3957 function call operator n().
3958 @param n Name to use for policy object
3962 #define _LIT_SECURITY_POLICY_PASS(n) const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_PASS
3965 /** Macro for compile-time initialisation of a security policy object
3966 The policy will check for seven capabilities.
3968 The object declared has an implicit conversion to const TSecurityPolicy&.
3969 Taking the address of the object will return a const TSecurityPolicy*.
3970 Explicit conversion to const TSecurityPolicy& may be effected by using the
3971 function call operator n().
3973 If an invlid capability value is specified then, dependant on the compiler,
3974 a compile time error or warning will be produced which includes the label
3975 "__invalid_capability_value"
3977 @param c1 The first capability to check (enumerator of TCapability)
3978 @param c2 The second capability to check (enumerator of TCapability)
3979 @param c3 The third capability to check (enumerator of TCapability)
3980 @param c4 The fourth capability to check (enumerator of TCapability)
3981 @param c5 The fifth capability to check (enumerator of TCapability)
3982 @param c6 The sixth capability to check (enumerator of TCapability)
3983 @param c7 The seventh capability to check (enumerator of TCapability)
3988 #define _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7) \
3991 (TUint8)TSecurityPolicy::ETypeC7, \
3992 CAPABILITY_AS_TUINT8(c1), \
3993 CAPABILITY_AS_TUINT8(c2), \
3994 CAPABILITY_AS_TUINT8(c3) \
3997 CAPABILITY_AS_TUINT8(c4), \
3998 CAPABILITY_AS_TUINT8(c5), \
3999 CAPABILITY_AS_TUINT8(c6), \
4000 CAPABILITY_AS_TUINT8(c7) \
4005 /** Macro for compile-time definition of a security policy object
4006 The policy will check for seven 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 n Name to use for policy object
4018 @param c1 The first capability to check (enumerator of TCapability)
4019 @param c2 The second capability to check (enumerator of TCapability)
4020 @param c3 The third capability to check (enumerator of TCapability)
4021 @param c4 The fourth capability to check (enumerator of TCapability)
4022 @param c5 The fifth capability to check (enumerator of TCapability)
4023 @param c6 The sixth capability to check (enumerator of TCapability)
4024 @param c7 The seventh capability to check (enumerator of TCapability)
4029 #define _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,c7) \
4030 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,c7)
4033 /** Macro for compile-time initialisation of a security policy object
4034 The policy will check for six capabilities.
4036 The object declared has an implicit conversion to const TSecurityPolicy&.
4037 Taking the address of the object will return a const TSecurityPolicy*.
4038 Explicit conversion to const TSecurityPolicy& may be effected by using the
4039 function call operator n().
4041 If an invlid capability value is specified then, dependant on the compiler,
4042 a compile time error or warning will be produced which includes the label
4043 "__invalid_capability_value"
4045 @param c1 The first capability to check (enumerator of TCapability)
4046 @param c2 The second capability to check (enumerator of TCapability)
4047 @param c3 The third capability to check (enumerator of TCapability)
4048 @param c4 The fourth capability to check (enumerator of TCapability)
4049 @param c5 The fifth capability to check (enumerator of TCapability)
4050 @param c6 The sixth capability to check (enumerator of TCapability)
4055 #define _INIT_SECURITY_POLICY_C6(c1,c2,c3,c4,c5,c6) \
4056 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,c6,ECapability_None)
4059 /** Macro for compile-time definition of a security policy object
4060 The policy will check for six capabilities.
4062 The object declared has an implicit conversion to const TSecurityPolicy&.
4063 Taking the address of the object will return a const TSecurityPolicy*.
4064 Explicit conversion to const TSecurityPolicy& may be effected by using the
4065 function call operator n().
4067 If an invlid capability value is specified then, dependant on the compiler,
4068 a compile time error or warning will be produced which includes the label
4069 "__invalid_capability_value"
4071 @param n Name to use for policy object
4072 @param c1 The first capability to check (enumerator of TCapability)
4073 @param c2 The second capability to check (enumerator of TCapability)
4074 @param c3 The third capability to check (enumerator of TCapability)
4075 @param c4 The fourth capability to check (enumerator of TCapability)
4076 @param c5 The fifth capability to check (enumerator of TCapability)
4077 @param c6 The sixth capability to check (enumerator of TCapability)
4082 #define _LIT_SECURITY_POLICY_C6(n,c1,c2,c3,c4,c5,c6) \
4083 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,c6,ECapability_None)
4086 /** Macro for compile-time initialisation of a security policy object
4087 The policy will check for five capabilities.
4089 The object declared has an implicit conversion to const TSecurityPolicy&.
4090 Taking the address of the object will return a const TSecurityPolicy*.
4091 Explicit conversion to const TSecurityPolicy& may be effected by using the
4092 function call operator n().
4094 If an invlid capability value is specified then, dependant on the compiler,
4095 a compile time error or warning will be produced which includes the label
4096 "__invalid_capability_value"
4098 @param c1 The first capability to check (enumerator of TCapability)
4099 @param c2 The second capability to check (enumerator of TCapability)
4100 @param c3 The third capability to check (enumerator of TCapability)
4101 @param c4 The fourth capability to check (enumerator of TCapability)
4102 @param c5 The fifth capability to check (enumerator of TCapability)
4107 #define _INIT_SECURITY_POLICY_C5(c1,c2,c3,c4,c5) \
4108 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
4111 /** Macro for compile-time definition of a security policy object
4112 The policy will check for five capabilities.
4114 The object declared has an implicit conversion to const TSecurityPolicy&.
4115 Taking the address of the object will return a const TSecurityPolicy*.
4116 Explicit conversion to const TSecurityPolicy& may be effected by using the
4117 function call operator n().
4119 If an invlid capability value is specified then, dependant on the compiler,
4120 a compile time error or warning will be produced which includes the label
4121 "__invalid_capability_value"
4123 @param n Name to use for policy object
4124 @param c1 The first capability to check (enumerator of TCapability)
4125 @param c2 The second capability to check (enumerator of TCapability)
4126 @param c3 The third capability to check (enumerator of TCapability)
4127 @param c4 The fourth capability to check (enumerator of TCapability)
4128 @param c5 The fifth capability to check (enumerator of TCapability)
4133 #define _LIT_SECURITY_POLICY_C5(n,c1,c2,c3,c4,c5) \
4134 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,c5,ECapability_None,ECapability_None)
4137 /** Macro for compile-time initialisation of a security policy object
4138 The policy will check for four capabilities.
4140 The object declared has an implicit conversion to const TSecurityPolicy&.
4141 Taking the address of the object will return a const TSecurityPolicy*.
4142 Explicit conversion to const TSecurityPolicy& may be effected by using the
4143 function call operator n().
4145 If an invlid capability value is specified then, dependant on the compiler,
4146 a compile time error or warning will be produced which includes the label
4147 "__invalid_capability_value"
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)
4152 @param c4 The fourth capability to check (enumerator of TCapability)
4157 #define _INIT_SECURITY_POLICY_C4(c1,c2,c3,c4) \
4158 _INIT_SECURITY_POLICY_C7(c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
4161 /** Macro for compile-time definition of a security policy object
4162 The policy will check for four capabilities.
4164 The object declared has an implicit conversion to const TSecurityPolicy&.
4165 Taking the address of the object will return a const TSecurityPolicy*.
4166 Explicit conversion to const TSecurityPolicy& may be effected by using the
4167 function call operator n().
4169 If an invlid capability value is specified then, dependant on the compiler,
4170 a compile time error or warning will be produced which includes the label
4171 "__invalid_capability_value"
4173 @param n Name to use for policy object
4174 @param c1 The first capability to check (enumerator of TCapability)
4175 @param c2 The second capability to check (enumerator of TCapability)
4176 @param c3 The third capability to check (enumerator of TCapability)
4177 @param c4 The fourth capability to check (enumerator of TCapability)
4182 #define _LIT_SECURITY_POLICY_C4(n,c1,c2,c3,c4) \
4183 _LIT_SECURITY_POLICY_C7(n,c1,c2,c3,c4,ECapability_None,ECapability_None,ECapability_None)
4186 /** Macro for compile-time initialisation of a security policy object
4187 The policy will check for three capabilities.
4189 The object declared has an implicit conversion to const TSecurityPolicy&.
4190 Taking the address of the object will return a const TSecurityPolicy*.
4191 Explicit conversion to const TSecurityPolicy& may be effected by using the
4192 function call operator n().
4194 If an invlid capability value is specified then, dependant on the compiler,
4195 a compile time error or warning will be produced which includes the label
4196 "__invalid_capability_value"
4198 @param c1 The first capability to check (enumerator of TCapability)
4199 @param c2 The second capability to check (enumerator of TCapability)
4200 @param c3 The third capability to check (enumerator of TCapability)
4205 #define _INIT_SECURITY_POLICY_C3(c1,c2,c3) \
4208 (TUint8)TSecurityPolicy::ETypeC3, \
4209 CAPABILITY_AS_TUINT8(c1), \
4210 CAPABILITY_AS_TUINT8(c2), \
4211 CAPABILITY_AS_TUINT8(c3) \
4213 (TUint32)0xffffffff \
4217 /** Macro for compile-time definition of a security policy object
4218 The policy will check for three capabilities.
4220 The object declared has an implicit conversion to const TSecurityPolicy&.
4221 Taking the address of the object will return a const TSecurityPolicy*.
4222 Explicit conversion to const TSecurityPolicy& may be effected by using the
4223 function call operator n().
4225 If an invlid capability value is specified then, dependant on the compiler,
4226 a compile time error or warning will be produced which includes the label
4227 "__invalid_capability_value"
4229 @param n Name to use for policy object
4230 @param c1 The first capability to check (enumerator of TCapability)
4231 @param c2 The second capability to check (enumerator of TCapability)
4232 @param c3 The third capability to check (enumerator of TCapability)
4237 #define _LIT_SECURITY_POLICY_C3(n,c1,c2,c3) \
4238 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_C3(c1,c2,c3)
4241 /** Macro for compile-time initialisation of a security policy object
4242 The policy will check for two capabilities.
4244 The object declared has an implicit conversion to const TSecurityPolicy&.
4245 Taking the address of the object will return a const TSecurityPolicy*.
4246 Explicit conversion to const TSecurityPolicy& may be effected by using the
4247 function call operator n().
4249 If an invlid capability value is specified then, dependant on the compiler,
4250 a compile time error or warning will be produced which includes the label
4251 "__invalid_capability_value"
4253 @param c1 The first capability to check (enumerator of TCapability)
4254 @param c2 The second capability to check (enumerator of TCapability)
4259 #define _INIT_SECURITY_POLICY_C2(c1,c2) \
4260 _INIT_SECURITY_POLICY_C3(c1,c2,ECapability_None)
4263 /** Macro for compile-time definition of a security policy object
4264 The policy will check for two capabilities.
4266 The object declared has an implicit conversion to const TSecurityPolicy&.
4267 Taking the address of the object will return a const TSecurityPolicy*.
4268 Explicit conversion to const TSecurityPolicy& may be effected by using the
4269 function call operator n().
4271 If an invlid capability value is specified then, dependant on the compiler,
4272 a compile time error or warning will be produced which includes the label
4273 "__invalid_capability_value"
4275 @param n Name to use for policy object
4276 @param c1 The first capability to check (enumerator of TCapability)
4277 @param c2 The second capability to check (enumerator of TCapability)
4282 #define _LIT_SECURITY_POLICY_C2(n,c1,c2) \
4283 _LIT_SECURITY_POLICY_C3(n,c1,c2,ECapability_None)
4286 /** Macro for compile-time initialisation of a security policy object
4287 The policy will check for one capability.
4289 The object declared has an implicit conversion to const TSecurityPolicy&.
4290 Taking the address of the object will return a const TSecurityPolicy*.
4291 Explicit conversion to const TSecurityPolicy& may be effected by using the
4292 function call operator n().
4294 If an invlid capability value is specified then, dependant on the compiler,
4295 a compile time error or warning will be produced which includes the label
4296 "__invalid_capability_value"
4298 @param c1 The first capability to check (enumerator of TCapability)
4304 #define _INIT_SECURITY_POLICY_C1(c1) \
4305 _INIT_SECURITY_POLICY_C3(c1,ECapability_None,ECapability_None)
4308 /** Macro for compile-time definition of a security policy object
4309 The policy will check for one capability.
4311 The object declared has an implicit conversion to const TSecurityPolicy&.
4312 Taking the address of the object will return a const TSecurityPolicy*.
4313 Explicit conversion to const TSecurityPolicy& may be effected by using the
4314 function call operator n().
4316 If an invlid capability value is specified then, dependant on the compiler,
4317 a compile time error or warning will be produced which includes the label
4318 "__invalid_capability_value"
4320 @param n Name to use for policy object
4321 @param c1 The first capability to check (enumerator of TCapability)
4326 #define _LIT_SECURITY_POLICY_C1(n,c1) \
4327 _LIT_SECURITY_POLICY_C3(n,c1,ECapability_None,ECapability_None)
4330 /** Macro for compile-time initialisation of a security policy object
4331 The policy will check for a secure ID and three capabilities.
4333 The object declared has an implicit conversion to const TSecurityPolicy&.
4334 Taking the address of the object will return a const TSecurityPolicy*.
4335 Explicit conversion to const TSecurityPolicy& may be effected by using the
4336 function call operator n().
4338 If an invlid capability value is specified then, dependant on the compiler,
4339 a compile time error or warning be produced which includes the label
4340 "__invalid_capability_value"
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)
4345 @param c3 The third capability to check (enumerator of TCapability)
4350 #define _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3) \
4353 (TUint8)TSecurityPolicy::ETypeS3, \
4354 CAPABILITY_AS_TUINT8(c1), \
4355 CAPABILITY_AS_TUINT8(c2), \
4356 CAPABILITY_AS_TUINT8(c3) \
4362 /** Macro for compile-time definition of a security policy object
4363 The policy will check for a secure ID and three capabilities.
4365 The object declared has an implicit conversion to const TSecurityPolicy&.
4366 Taking the address of the object will return a const TSecurityPolicy*.
4367 Explicit conversion to const TSecurityPolicy& may be effected by using the
4368 function call operator n().
4370 If an invlid capability value is specified then, dependant on the compiler,
4371 a compile time error or warning be produced which includes the label
4372 "__invalid_capability_value"
4374 @param n Name to use for policy object
4375 @param sid The SID value to check for
4376 @param c1 The first capability to check (enumerator of TCapability)
4377 @param c2 The second capability to check (enumerator of TCapability)
4378 @param c3 The third capability to check (enumerator of TCapability)
4383 #define _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,c3) \
4384 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_S3(sid,c1,c2,c3)
4387 /** Macro for compile-time initialisation of a security policy object
4388 The policy will check for a secure ID and two capabilities.
4390 The object declared has an implicit conversion to const TSecurityPolicy&.
4391 Taking the address of the object will return a const TSecurityPolicy*.
4392 Explicit conversion to const TSecurityPolicy& may be effected by using the
4393 function call operator n().
4395 If an invlid capability value is specified then, dependant on the compiler,
4396 a compile time error or warning be produced which includes the label
4397 "__invalid_capability_value"
4399 @param sid The SID value to check for
4400 @param c1 The first capability to check (enumerator of TCapability)
4401 @param c2 The second capability to check (enumerator of TCapability)
4406 #define _INIT_SECURITY_POLICY_S2(sid,c1,c2) \
4407 _INIT_SECURITY_POLICY_S3(sid,c1,c2,ECapability_None)
4410 /** Macro for compile-time definition of a security policy object
4411 The policy will check for a secure ID and two capabilities.
4413 The object declared has an implicit conversion to const TSecurityPolicy&.
4414 Taking the address of the object will return a const TSecurityPolicy*.
4415 Explicit conversion to const TSecurityPolicy& may be effected by using the
4416 function call operator n().
4418 If an invlid capability value is specified then, dependant on the compiler,
4419 a compile time error or warning be produced which includes the label
4420 "__invalid_capability_value"
4422 @param n Name to use for policy object
4423 @param sid The SID value to check for
4424 @param c1 The first capability to check (enumerator of TCapability)
4425 @param c2 The second capability to check (enumerator of TCapability)
4430 #define _LIT_SECURITY_POLICY_S2(n,sid,c1,c2) \
4431 _LIT_SECURITY_POLICY_S3(n,sid,c1,c2,ECapability_None)
4434 /** Macro for compile-time initialisation of a security policy object
4435 The policy will check for a secure ID and one capability.
4437 The object declared has an implicit conversion to const TSecurityPolicy&.
4438 Taking the address of the object will return a const TSecurityPolicy*.
4439 Explicit conversion to const TSecurityPolicy& may be effected by using the
4440 function call operator n().
4442 If an invlid capability value is specified then, dependant on the compiler,
4443 a compile time error or warning be produced which includes the label
4444 "__invalid_capability_value"
4446 @param sid The SID value to check for
4447 @param c1 The first capability to check (enumerator of TCapability)
4452 #define _INIT_SECURITY_POLICY_S1(sid,c1) \
4453 _INIT_SECURITY_POLICY_S3(sid,c1,ECapability_None,ECapability_None)
4456 /** Macro for compile-time definition of a security policy object
4457 The policy will check for a secure ID and one capability.
4459 The object declared has an implicit conversion to const TSecurityPolicy&.
4460 Taking the address of the object will return a const TSecurityPolicy*.
4461 Explicit conversion to const TSecurityPolicy& may be effected by using the
4462 function call operator n().
4464 If an invlid capability value is specified then, dependant on the compiler,
4465 a compile time error or warning be produced which includes the label
4466 "__invalid_capability_value"
4468 @param n Name to use for policy object
4469 @param sid The SID value to check for
4470 @param c1 The first capability to check (enumerator of TCapability)
4475 #define _LIT_SECURITY_POLICY_S1(n,sid,c1) \
4476 _LIT_SECURITY_POLICY_S3(n,sid,c1,ECapability_None,ECapability_None)
4479 /** Macro for compile-time initialisation of a security policy object
4480 The policy will check for a secure ID.
4482 The object declared has an implicit conversion to const TSecurityPolicy&.
4483 Taking the address of the object will return a const TSecurityPolicy*.
4484 Explicit conversion to const TSecurityPolicy& may be effected by using the
4485 function call operator n().
4487 @param sid The SID value to check for
4492 #define _INIT_SECURITY_POLICY_S0(sid) \
4493 _INIT_SECURITY_POLICY_S3(sid,ECapability_None,ECapability_None,ECapability_None)
4496 /** Macro for compile-time definition of a security policy object
4497 The policy will check for a secure ID.
4499 The object declared has an implicit conversion to const TSecurityPolicy&.
4500 Taking the address of the object will return a const TSecurityPolicy*.
4501 Explicit conversion to const TSecurityPolicy& may be effected by using the
4502 function call operator n().
4504 @param n Name to use for policy object
4505 @param sid The SID value to check for
4510 #define _LIT_SECURITY_POLICY_S0(n,sid) \
4511 _LIT_SECURITY_POLICY_S3(n,sid,ECapability_None,ECapability_None,ECapability_None)
4514 /** Macro for compile-time initialisation of a security policy object
4515 The policy will check for a vendor ID and three capabilities.
4517 The object declared has an implicit conversion to const TSecurityPolicy&.
4518 Taking the address of the object will return a const TSecurityPolicy*.
4519 Explicit conversion to const TSecurityPolicy& may be effected by using the
4520 function call operator n().
4522 If an invlid capability value is specified then, dependant on the compiler,
4523 a compile time error or warning be produced which includes the label
4524 "__invalid_capability_value"
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)
4529 @param c3 The third capability to check (enumerator of TCapability)
4534 #define _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3) \
4537 (TUint8)TSecurityPolicy::ETypeV3, \
4538 CAPABILITY_AS_TUINT8(c1), \
4539 CAPABILITY_AS_TUINT8(c2), \
4540 CAPABILITY_AS_TUINT8(c3) \
4546 /** Macro for compile-time definition of a security policy object
4547 The policy will check for a vendor ID and three capabilities.
4549 The object declared has an implicit conversion to const TSecurityPolicy&.
4550 Taking the address of the object will return a const TSecurityPolicy*.
4551 Explicit conversion to const TSecurityPolicy& may be effected by using the
4552 function call operator n().
4554 If an invlid capability value is specified then, dependant on the compiler,
4555 a compile time error or warning be produced which includes the label
4556 "__invalid_capability_value"
4558 @param n Name to use for policy object
4559 @param vid The VID value to check for
4560 @param c1 The first capability to check (enumerator of TCapability)
4561 @param c2 The second capability to check (enumerator of TCapability)
4562 @param c3 The third capability to check (enumerator of TCapability)
4567 #define _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,c3) \
4568 const TStaticSecurityPolicy n = _INIT_SECURITY_POLICY_V3(vid,c1,c2,c3)
4571 /** Macro for compile-time initialisation of a security policy object
4572 The policy will check for a vendor ID and two capabilities.
4574 The object declared has an implicit conversion to const TSecurityPolicy&.
4575 Taking the address of the object will return a const TSecurityPolicy*.
4576 Explicit conversion to const TSecurityPolicy& may be effected by using the
4577 function call operator n().
4579 If an invlid capability value is specified then, dependant on the compiler,
4580 a compile time error or warning be produced which includes the label
4581 "__invalid_capability_value"
4583 @param vid The VID value to check for
4584 @param c1 The first capability to check (enumerator of TCapability)
4585 @param c2 The second capability to check (enumerator of TCapability)
4590 #define _INIT_SECURITY_POLICY_V2(vid,c1,c2) \
4591 _INIT_SECURITY_POLICY_V3(vid,c1,c2,ECapability_None)
4594 /** Macro for compile-time definition of a security policy object
4595 The policy will check for a vendor ID and two capabilities.
4597 The object declared has an implicit conversion to const TSecurityPolicy&.
4598 Taking the address of the object will return a const TSecurityPolicy*.
4599 Explicit conversion to const TSecurityPolicy& may be effected by using the
4600 function call operator n().
4602 If an invlid capability value is specified then, dependant on the compiler,
4603 a compile time error or warning be produced which includes the label
4604 "__invalid_capability_value"
4606 @param n Name to use for policy object
4607 @param vid The VID value to check for
4608 @param c1 The first capability to check (enumerator of TCapability)
4609 @param c2 The second capability to check (enumerator of TCapability)
4614 #define _LIT_SECURITY_POLICY_V2(n,vid,c1,c2) \
4615 _LIT_SECURITY_POLICY_V3(n,vid,c1,c2,ECapability_None)
4618 /** Macro for compile-time initialisation of a security policy object
4619 The policy will check for a vendor ID and one capability.
4621 The object declared has an implicit conversion to const TSecurityPolicy&.
4622 Taking the address of the object will return a const TSecurityPolicy*.
4623 Explicit conversion to const TSecurityPolicy& may be effected by using the
4624 function call operator n().
4626 If an invlid capability value is specified then, dependant on the compiler,
4627 a compile time error or warning be produced which includes the label
4628 "__invalid_capability_value"
4630 @param vid The VID value to check for
4631 @param c1 The first capability to check (enumerator of TCapability)
4636 #define _INIT_SECURITY_POLICY_V1(vid,c1) \
4637 _INIT_SECURITY_POLICY_V3(vid,c1,ECapability_None,ECapability_None)
4640 /** Macro for compile-time definition of a security policy object
4641 The policy will check for a vendor ID and one capability.
4643 The object declared has an implicit conversion to const TSecurityPolicy&.
4644 Taking the address of the object will return a const TSecurityPolicy*.
4645 Explicit conversion to const TSecurityPolicy& may be effected by using the
4646 function call operator n().
4648 If an invlid capability value is specified then, dependant on the compiler,
4649 a compile time error or warning be produced which includes the label
4650 "__invalid_capability_value"
4652 @param n Name to use for policy object
4653 @param vid The VID value to check for
4654 @param c1 The first capability to check (enumerator of TCapability)
4659 #define _LIT_SECURITY_POLICY_V1(n,vid,c1) \
4660 _LIT_SECURITY_POLICY_V3(n,vid,c1,ECapability_None,ECapability_None)
4663 /** Macro for compile-time initialisation of a security policy object
4664 The policy will check for a vendor ID.
4666 The object declared has an implicit conversion to const TSecurityPolicy&.
4667 Taking the address of the object will return a const TSecurityPolicy*.
4668 Explicit conversion to const TSecurityPolicy& may be effected by using the
4669 function call operator n().
4671 @param vid The VID value to check for
4676 #define _INIT_SECURITY_POLICY_V0(vid) \
4677 _INIT_SECURITY_POLICY_V3(vid,ECapability_None,ECapability_None,ECapability_None)
4680 /** Macro for compile-time definition of a security policy object
4681 The policy will check for a vendor ID.
4683 The object declared has an implicit conversion to const TSecurityPolicy&.
4684 Taking the address of the object will return a const TSecurityPolicy*.
4685 Explicit conversion to const TSecurityPolicy& may be effected by using the
4686 function call operator n().
4688 @param n Name to use for policy object
4689 @param vid The VID value to check for
4694 #define _LIT_SECURITY_POLICY_V0(n,vid) \
4695 _LIT_SECURITY_POLICY_V3(n,vid,ECapability_None,ECapability_None,ECapability_None)
4699 #ifdef __KERNEL_MODE__
4703 class TPlatSecDiagnostic;
4706 Class containing Platform Security related methods
4711 #ifndef __KERNEL_MODE__
4714 Tests whether a given Platform Security capability is enforced by the system.
4716 Capabilities may not be enforced for several reasons:
4717 -# The capability has been explicitly disabled on this system
4718 by use of the PlatSecDisabledCaps configuration parameter
4719 -# Platform Security checks have been globally disabled
4720 by use of the EPlatSecEnforcement configuration parameter
4721 -# The capability value is unknown. I.e. Is not part of the set of supported
4722 capabilities. See TCapabilitySet::SetAllSupported().
4724 @param aCapability The capability to test
4725 @return A non-zero value if the capability is enforced, zero if it is not.
4730 IMPORT_C static TBool IsCapabilityEnforced(TCapability aCapability);
4733 An enumeration used with PlatSecSetting()
4734 @see PlatSecSetting()
4740 EPlatSecEnforcement, /**< Used to request the value of the PlatSecEnforcement setting */
4741 EPlatSecDiagnotics, /**< Used to request the value of the PlatSecDiagnotics setting */
4742 EPlatSecProcessIsolation, /**< Used to request the value of the PlatSecProcessIsolation setting */
4743 EPlatSecEnforceSysBin, /**< Used to request the value of the PlatSecEnforceSysBin setting */
4744 EPlatSecLocked, /**< Used to request the value of the PlatSecLocked setting */
4748 A test function to return the state of a given Platform Security configuration setting.
4749 @param aSetting An enumerated value representing the required setting
4750 @return A value representing the setting. 0 represents 'OFF', 1 represents 'ON'
4751 Other values may be returned for some settings, these exceptions are documented
4752 in the description for individual enumerations of TConfigSetting.
4757 IMPORT_C static TInt ConfigSetting(TConfigSetting aSetting);
4759 #endif // Not __KERNEL_MODE__
4762 // All methods below here are internalTechnology
4765 #ifndef __REMOVE_PLATSEC_DIAGNOSTICS__
4767 /** @internalTechnology */
4768 static inline TInt LoaderCapabilityViolation(const TDesC8& aImporterName, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
4769 #ifdef __KERNEL_MODE__
4770 /** @internalTechnology */
4771 static inline TInt CapabilityCheckFail(const DProcess* aViolatingProcess, TCapability aCapability, const char* aContextText);
4772 /** @internalTechnology */
4773 static inline TInt CapabilityCheckFail(const DThread* aViolatingThread, TCapability aCapability, const char* aContextText);
4774 /** @internalTechnology */
4775 static inline TInt SecureIdCheckFail(const DProcess* aViolatingProcess, TSecureId aSid, const char* aContextText);
4776 /** @internalTechnology */
4777 static inline TInt PolicyCheckFail(const DProcess* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
4778 /** @internalTechnology */
4779 static inline TInt PolicyCheckFail(const DThread* aProcess, const SSecurityInfo& aMissing, const char* aContextText);
4780 /** @internalTechnology */
4781 static inline TInt ProcessIsolationFail(const char* aContextText);
4782 /** @internalTechnology */
4783 static inline TInt ProcessIsolationIPCFail(RMessageK* aMessage, const char* aContextText);
4784 #else // !__KERNEL_MODE__
4785 /** @internalTechnology */
4786 static inline TInt LoaderCapabilityViolation(RProcess aLoadingProcess, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps);
4787 /** @internalTechnology */
4788 static inline TInt CreatorCapabilityCheckFail(TCapability aCapability, const char* aContextText);
4789 /** @internalTechnology */
4790 static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps, const char* aContextText);
4791 /** @internalTechnology */
4792 static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability, const char* aContextText);
4793 /** @internalTechnology */
4794 static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps, const char* aContextText);
4795 /** @internalTechnology */
4796 static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing, const char* aContextText);
4797 /** @internalTechnology */
4798 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability, const char* aContextText);
4799 /** @internalTechnology */
4800 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps, const char* aContextText);
4801 /** @internalTechnology */
4802 static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps, const char* aContextText);
4803 /** @internalTechnology */
4804 static inline TInt PolicyCheckFail(RSessionBase aSession, const SSecurityInfo& aMissingCaps, const char* aContextText);
4805 /** @internalTechnology */
4806 static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps, const char* aContextText);
4807 /** @internalTechnology */
4808 static inline TInt CreatorCapabilityCheckFail(TCapability aCapability);
4809 /** @internalTechnology */
4810 static inline TInt CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps);
4811 /** @internalTechnology */
4812 static inline TInt CapabilityCheckFail(TInt aHandle, TCapability aCapability);
4813 /** @internalTechnology */
4814 static inline TInt CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps);
4815 /** @internalTechnology */
4816 static inline TInt PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissing);
4817 /** @internalTechnology */
4818 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability);
4819 /** @internalTechnology */
4820 static inline TInt CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps);
4821 /** @internalTechnology */
4822 static inline TInt PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissingCaps);
4823 /** @internalTechnology */
4824 static inline TInt CreatorPolicyCheckFail(const SSecurityInfo& aMissingCaps);
4825 #endif //__KERNEL_MODE__
4828 UIMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
4829 #else //__REMOVE_PLATSEC_DIAGNOSTICS__
4830 #ifndef __KERNEL_MODE__
4832 IMPORT_C static TInt EmitDiagnostic(TPlatSecDiagnostic& aDiagnostic, const char* aContextText);
4833 #endif // !__KERNEL_MODE__
4834 #endif // !__REMOVE_PLATSEC_DIAGNOSTICS__
4837 /** @internalTechnology */
4838 UIMPORT_C static TInt EmitDiagnostic();
4842 #define KMaxSerialNumLength 64
4843 typedef TBuf8<KMaxSerialNumLength> TMediaSerialNumber;
4850 Contains information about the code and data sections belonging to a process.
4852 @see RProcess::GetMemoryInfo
4854 class TProcessMemoryInfo
4858 The code base address (.text).
4864 The size of the code section (.text).
4870 The base address of the constant data section (.radata).
4872 TUint32 iConstDataBase;
4876 The size of the constant data section (.radata).
4879 TUint32 iConstDataSize;
4883 The base address of the initialised data section (.data).
4885 TUint32 iInitialisedDataBase;
4889 The size of the initialised data section (.data).
4891 TUint32 iInitialisedDataSize;
4895 The base address of the uninitialised data section (.bss).
4897 TUint32 iUninitialisedDataBase;
4901 The size of the uninitialised data section (.bss).
4903 TUint32 iUninitialisedDataSize;
4913 Defines a more useful synonym for TProcessMemoryInfo.
4915 typedef TProcessMemoryInfo TModuleMemoryInfo; // more accurate name - remove old one later
4920 #ifndef __KERNEL_MODE__
4928 This class defines a generic array which can be constructed by any of the
4929 following templated concrete arrays:
4931 1. CArrayFixFlat<class T>
4933 2. CArrayFixSeg<class T>
4935 3. CArrayVarFlat<class T>
4937 4. CArrayVarSeg<class T>
4939 5. CArrayPakFlat<class T>
4943 7. RPointerArray<class T>
4945 and also by the following template specialisation classes:
4951 It allows a degree of polymorphism amongst the array classes. It permits the
4952 operator[] and the Count() member functions of an array to be invoked without
4953 knowing which array class has been used to construct that array.
4955 TArray allows access to elements of an array but does not permit changes to
4958 Use the Array() member function of an array to construct and return
4959 a TArray<class T> object for that array.
4961 A TArray<class T> type object is not intended to be constructed explicitly
4978 inline TArray(TInt (*aCount)(const CBase* aPtr),const TAny*(*anAt)(const CBase* aPtr,TInt anIndex),const CBase* aPtr);
4979 inline TInt Count() const;
4980 inline const T& operator[](TInt anIndex) const;
4983 TInt (*iCount)(const CBase* aPtr);
4984 const TAny*(*iAt)(const CBase* aPtr,TInt anIndex);
4995 Defines a function type used by a TIdentityRelation object.
4997 A function of this type implements an algorithm for determining whether
5000 @see TIdentityRelation
5002 typedef TBool (*TGeneralIdentityRelation)(const TAny*, const TAny*);
5011 Defines a function type used by a TLinearOrder object
5013 A function of this type implements an algorithm that determines
5014 the order of two objects.
5018 typedef TInt (*TGeneralLinearOrder)(const TAny*, const TAny*);
5027 A templated class which packages a function that determines whether two
5028 objects of a given class type match. During linear search operations the search
5029 term is always passed as the first argument and the second argument is an
5030 element of the array being searched.
5032 A TIdentityRelation<T> object is constructed and passed as a parameter to
5033 member functions of the array classes RArray<T> and RPointerArray<T>.
5039 class TIdentityRelation
5042 inline TIdentityRelation();
5043 inline TIdentityRelation( TBool (*anIdentity)(const T&, const T&) );
5044 inline operator TGeneralIdentityRelation() const;
5046 inline static TBool EqualityOperatorCompare(const T& aLeft, const T& aRight);
5048 TGeneralIdentityRelation iIdentity;
5057 A set of common identity relations for frequently occurring types.
5066 class DefaultIdentity
5069 IMPORT_C static TBool Integer(const TInt&, const TInt&);
5070 IMPORT_C static TBool Des8(const TDesC8&, const TDesC8&);
5071 IMPORT_C static TBool Des16(const TDesC16&, const TDesC16&);
5072 IMPORT_C static TBool IntegerPtr(TInt* const&, TInt* const&);
5073 IMPORT_C static TBool Des8Ptr(TDesC8* const&, TDesC8* const&);
5074 IMPORT_C static TBool Des16Ptr(TDesC16* const&, TDesC16* const&);
5084 A templated class which packages a function that determines the order of two
5085 objects of a given class type. During binary search operations the search term
5086 is always passed as the first argument and the second argument is an element
5087 of the array being searched.
5089 A TLinearOrder<T> object is constructed and passed as a parameter to member
5090 functions of the array classes RArray<T> and RPointerArray<T>.
5099 inline TLinearOrder( TInt(*anOrder)(const T&, const T&) );
5100 inline operator TGeneralLinearOrder() const;
5102 TGeneralLinearOrder iOrder;
5110 A set of values that tell array search functions which array element is to be
5111 returned when there are duplicate elements in the array.
5113 These values are used by RArray, RPointerArray, RArray<TInt>,
5114 and RArray<TUint> search functions.
5116 Examples of functions that take
5117 these enum values are: RPointerArray::SpecificFindInOrderL(),
5118 and RArray::SpecificFindInSignedKeyOrder().
5128 Indicates that any element in a block of duplicate elements can be
5129 returned by a search function.
5131 Note that using this mode, there can be no guarantee that the element
5132 returned by the search functions will be the same if the size of the array
5133 changes between successive calls to those functions.
5135 EArrayFindMode_Any = 0,
5138 Indicates that the first element in a block of duplicate elements
5141 EArrayFindMode_First = 1,
5144 Indicates that the first element after the last element in a block
5145 of duplicate elements is returned.
5147 EArrayFindMode_Last = 2,
5152 EArrayFindMode_Limit = 3
5159 Base class used in the derivation of RPointerArray, RArray<TInt>,
5162 The base class is inherited privately.
5164 The class is internal and is not intended for use.
5166 class RPointerArrayBase
5169 IMPORT_C RPointerArrayBase();
5170 IMPORT_C RPointerArrayBase(TInt aGranularity);
5171 IMPORT_C RPointerArrayBase(TInt aMinGrowBy, TInt aFactor);
5172 IMPORT_C void Close();
5173 IMPORT_C TInt Count() const;
5174 inline void ZeroCount() {iCount=0;}
5175 inline TAny** Entries() {return iEntries;}
5176 IMPORT_C TAny*& At(TInt anIndex) const;
5177 IMPORT_C TInt Append(const TAny* anEntry);
5178 IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
5179 IMPORT_C void Remove(TInt anIndex);
5180 IMPORT_C void Compress();
5181 IMPORT_C void Reset();
5182 IMPORT_C TInt Find(const TAny* anEntry) const;
5183 IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
5184 IMPORT_C TInt FindReverse(const TAny* aEntry) const;
5185 IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
5186 IMPORT_C TInt FindIsqSigned(TInt anEntry) const;
5187 IMPORT_C TInt FindIsqUnsigned(TUint anEntry) const;
5188 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
5189 IMPORT_C TInt FindIsqSigned(TInt anEntry, TInt aMode) const;
5190 IMPORT_C TInt FindIsqUnsigned(TUint anEntry, TInt aMode) const;
5191 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
5192 IMPORT_C TInt InsertIsqSigned(TInt anEntry, TBool aAllowRepeats);
5193 IMPORT_C TInt InsertIsqUnsigned(TUint anEntry, TBool aAllowRepeats);
5194 IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
5195 IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex) const;
5196 IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex) const;
5197 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
5198 IMPORT_C TInt BinarySearchSigned(TInt anEntry, TInt& anIndex, TInt aMode) const;
5199 IMPORT_C TInt BinarySearchUnsigned(TUint anEntry, TInt& anIndex, TInt aMode) const;
5200 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
5201 #ifndef __KERNEL_MODE__
5202 IMPORT_C RPointerArrayBase(TAny** aEntries, TInt aCount);
5203 IMPORT_C void GranularCompress();
5204 IMPORT_C TInt DoReserve(TInt aCount);
5205 IMPORT_C void HeapSortSigned();
5206 IMPORT_C void HeapSortUnsigned();
5207 IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
5208 IMPORT_C static TInt GetCount(const CBase* aPtr);
5209 IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
5217 TInt iGranularity; // positive means linear, negative means exponential growth
5229 A simple and efficient array of pointers to objects.
5231 The elements of the array are pointers to instances of a class; this class
5232 is specified as the template parameter T.
5234 The class offers standard array behaviour which includes insertion, appending
5235 and sorting of pointers.
5237 Derivation from RPointerArrayBase is private.
5240 class RPointerArray : private RPointerArrayBase
5243 inline RPointerArray();
5244 inline explicit RPointerArray(TInt aGranularity);
5245 inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
5246 inline void Close();
5247 inline TInt Count() const;
5248 inline T* const& operator[](TInt anIndex) const;
5249 inline T*& operator[](TInt anIndex);
5250 inline TInt Append(const T* anEntry);
5251 inline TInt Insert(const T* anEntry, TInt aPos);
5252 inline void Remove(TInt anIndex);
5253 inline void Compress();
5254 inline void Reset();
5255 void ResetAndDestroy();
5256 inline TInt Find(const T* anEntry) const;
5257 inline TInt Find(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5259 inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
5261 Finds the first object pointer in the array which matches aKey using
5262 the comparison algorithm provided by apfnCompare.
5264 The find operation always starts at the low index end of the array. There
5265 is no assumption about the order of objects in the array.
5267 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5268 @param apfnCompare A function defining the identity relation between the
5269 object pointers in the array, and their keys of type K. The
5270 function returns true if k and t match based on this relationship.
5272 @return The index of the first matching object pointer within the array.
5273 KErrNotFound, if no suitable object pointer can be found.
5275 { return RPointerArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
5276 inline TInt FindReverse(const T* anEntry) const;
5277 inline TInt FindReverse(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5279 inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
5281 Finds the first object pointer in the array which matches aKey using
5282 the comparison algorithm provided by apfnCompare.
5284 The find operation always starts at the high index end of the array. There
5285 is no assumption about the order of objects in the array.
5287 @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
5288 @param apfnMatch A function defining the identity relation between the
5289 object pointers in the array, and their keys of type K. The
5290 function returns true if k and t match based on this relationship.
5292 @return The index of the first matching object pointer within the array.
5293 KErrNotFound, if no suitable object pointer can be found.
5296 { return RPointerArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
5297 inline TInt FindInAddressOrder(const T* anEntry) const;
5298 inline TInt FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const;
5299 inline TInt FindInAddressOrder(const T* anEntry, TInt& anIndex) const;
5300 inline TInt FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5302 inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
5304 Finds the object pointer in the array whose object matches the specified
5305 key, (Using the relationship defined within apfnCompare) using a binary search
5306 technique and an ordering algorithm.
5308 The function assumes that existing object pointers in the array are ordered
5309 so that the objects themselves are in object order as determined by an algorithm
5310 supplied by the caller and packaged as a TLinearOrder<T>.
5312 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5313 @param apfnCompare A function which defines the order that the array was sorted,
5314 where in it aKey (via the defined relationship) should fit, and if the key is present.
5316 @return The index of the matching object pointer within the array.
5317 KErrNotFound, if no suitable object pointer can be found.
5319 { return RPointerArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
5320 inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt aMode) const;
5321 inline TInt SpecificFindInOrder(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5322 inline TInt SpecificFindInAddressOrder(const T* anEntry, TInt& anIndex, TInt aMode) const;
5323 inline TInt SpecificFindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5324 inline TInt InsertInAddressOrder(const T* anEntry);
5325 inline TInt InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder);
5326 inline TInt InsertInAddressOrderAllowRepeats(const T* anEntry);
5327 inline TInt InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder);
5328 #ifndef __KERNEL_MODE__
5329 inline void AppendL(const T* anEntry);
5330 inline void InsertL(const T* anEntry, TInt aPos);
5331 inline TInt FindL(const T* anEntry) const;
5332 inline TInt FindL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5333 inline TInt FindReverseL(const T* anEntry) const;
5334 inline TInt FindReverseL(const T* anEntry, TIdentityRelation<T> anIdentity) const;
5335 inline TInt FindInAddressOrderL(const T* anEntry) const;
5336 inline TInt FindInOrderL(const T* anEntry, TLinearOrder<T> anOrder) const;
5337 inline void FindInAddressOrderL(const T* anEntry, TInt& anIndex) const;
5338 inline void FindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5339 inline TInt SpecificFindInAddressOrderL(const T* anEntry, TInt aMode) const;
5340 inline TInt SpecificFindInOrderL(const T* anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5341 inline void SpecificFindInAddressOrderL(const T* anEntry, TInt& anIndex, TInt aMode) const;
5342 inline void SpecificFindInOrderL(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5343 inline void InsertInAddressOrderL(const T* anEntry);
5344 inline void InsertInOrderL(const T* anEntry, TLinearOrder<T> anOrder);
5345 inline void InsertInAddressOrderAllowRepeatsL(const T* anEntry);
5346 inline void InsertInOrderAllowRepeatsL(const T* anEntry, TLinearOrder<T> anOrder);
5348 inline RPointerArray(T** aEntries, TInt aCount);
5349 inline void GranularCompress();
5350 inline TInt Reserve(TInt aCount);
5351 inline void ReserveL(TInt aCount);
5352 inline void SortIntoAddressOrder();
5353 inline void Sort(TLinearOrder<T> anOrder);
5354 inline TArray<T*> Array() const;
5364 Array of raw pointers.
5366 The array is a simple and efficient specialized array of TAny pointers offering
5367 standard array behaviour.
5369 The derivation from RPointerArrayBase is private.
5371 TEMPLATE_SPECIALIZATION class RPointerArray<TAny> : private RPointerArrayBase
5374 inline RPointerArray();
5375 inline explicit RPointerArray(TInt aGranularity);
5376 inline RPointerArray(TInt aMinGrowBy, TInt aFactor);
5377 inline void Close();
5378 inline TInt Count() const;
5379 inline TAny* const& operator[](TInt anIndex) const;
5380 inline TAny*& operator[](TInt anIndex);
5381 inline TInt Append(const TAny* anEntry);
5382 inline TInt Insert(const TAny* anEntry, TInt aPos);
5383 inline void Remove(TInt anIndex);
5384 inline void Compress();
5385 inline void Reset();
5386 inline TInt Find(const TAny* anEntry) const;
5387 inline TInt FindReverse(const TAny* anEntry) const;
5388 inline TInt FindInAddressOrder(const TAny* anEntry) const;
5389 inline TInt FindInAddressOrder(const TAny* anEntry, TInt& anIndex) const;
5390 inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt aMode) const;
5391 inline TInt SpecificFindInAddressOrder(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5392 inline TInt InsertInAddressOrder(const TAny* anEntry);
5393 inline TInt InsertInAddressOrderAllowRepeats(const TAny* anEntry);
5394 #ifndef __KERNEL_MODE__
5395 inline void AppendL(const TAny* anEntry);
5396 inline void InsertL(const TAny* anEntry, TInt aPos);
5397 inline TInt FindL(const TAny* anEntry) const;
5398 inline TInt FindReverseL(const TAny* anEntry) const;
5399 inline TInt FindInAddressOrderL(const TAny* anEntry) const;
5400 inline void FindInAddressOrderL(const TAny* anEntry, TInt& anIndex) const;
5401 inline TInt SpecificFindInAddressOrderL(const TAny* anEntry, TInt aMode) const;
5402 inline void SpecificFindInAddressOrderL(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5403 inline void InsertInAddressOrderL(const TAny* anEntry);
5404 inline void InsertInAddressOrderAllowRepeatsL(const TAny* anEntry);
5406 inline RPointerArray(TAny** aEntries, TInt aCount);
5407 inline void GranularCompress();
5408 inline void SortIntoAddressOrder();
5409 inline TArray<TAny*> Array() const;
5418 Base class used in the derivation of RArray.
5420 The base class is inherited privately.
5422 The class is internal and is not intended for use.
5427 IMPORT_C RArrayBase(TInt anEntrySize);
5428 IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity);
5429 IMPORT_C RArrayBase(TInt anEntrySize, TInt aGranularity, TInt aKeyOffset);
5430 IMPORT_C RArrayBase(TInt anEntrySize, TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
5431 IMPORT_C RArrayBase(TInt aEntrySize,TAny* aEntries, TInt aCount);
5432 IMPORT_C void Close();
5433 IMPORT_C TInt Count() const;
5434 IMPORT_C TAny* At(TInt anIndex) const;
5435 IMPORT_C TInt Append(const TAny* anEntry);
5436 IMPORT_C TInt Insert(const TAny* anEntry, TInt aPos);
5437 IMPORT_C void Remove(TInt anIndex);
5438 IMPORT_C void Compress();
5439 IMPORT_C void Reset();
5440 IMPORT_C TInt Find(const TAny* anEntry) const;
5441 IMPORT_C TInt Find(const TAny* anEntry, TGeneralIdentityRelation anIdentity) const;
5442 IMPORT_C TInt FindReverse(const TAny* aEntry) const;
5443 IMPORT_C TInt FindReverse(const TAny* aEntry, TGeneralIdentityRelation aIdentity) const;
5444 IMPORT_C TInt FindIsqSigned(const TAny* anEntry) const;
5445 IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry) const;
5446 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder) const;
5447 IMPORT_C TInt FindIsqSigned(const TAny* anEntry, TInt aMode) const;
5448 IMPORT_C TInt FindIsqUnsigned(const TAny* anEntry, TInt aMode) const;
5449 IMPORT_C TInt FindIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TInt aMode) const;
5450 IMPORT_C TInt InsertIsqSigned(const TAny* anEntry, TBool aAllowRepeats);
5451 IMPORT_C TInt InsertIsqUnsigned(const TAny* anEntry, TBool aAllowRepeats);
5452 IMPORT_C TInt InsertIsq(const TAny* anEntry, TGeneralLinearOrder anOrder, TBool aAllowRepeats);
5453 IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex) const;
5454 IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex) const;
5455 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder) const;
5456 IMPORT_C TInt BinarySearchSigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5457 IMPORT_C TInt BinarySearchUnsigned(const TAny* anEntry, TInt& anIndex, TInt aMode) const;
5458 IMPORT_C TInt BinarySearch(const TAny* anEntry, TInt& anIndex, TGeneralLinearOrder anOrder, TInt aMode) const;
5459 #ifndef __KERNEL_MODE__
5460 IMPORT_C void GranularCompress();
5461 IMPORT_C TInt DoReserve(TInt aCount);
5462 IMPORT_C void HeapSortSigned();
5463 IMPORT_C void HeapSortUnsigned();
5464 IMPORT_C void HeapSort(TGeneralLinearOrder anOrder);
5465 IMPORT_C static TInt GetCount(const CBase* aPtr);
5466 IMPORT_C static const TAny* GetElementPtr(const CBase* aPtr, TInt aIndex);
5476 TInt iGranularity; // positive means linear, negative means exponential growth
5488 A simple and efficient array of fixed length objects.
5490 The elements of the array are instances of a class; this class is specified
5491 as the template parameter T.
5493 The array offers standard array behaviour which includes insertion, appending
5494 and sorting of elements.
5498 1. where possible, this class should be used in preference to
5499 CArrayFixFlat<classT>.
5501 2. the derivation from RArrayBase is private.
5503 3. for performance reasons, RArray stores objects in the array as
5504 word (4 byte) aligned quantities. This means that some member functions
5505 do not work when RArray is instantiated for classes of less than 4 bytes
5506 in size, or when the class's alignment requirement is not 4.
5507 Be aware that it is possible to get an unhandled exception on hardware
5508 that enforces strict alignment.
5510 The affected functions are:
5512 3.1 the constructor: RArray(TInt, T*, TInt)
5514 3.2 Append(const T&)
5516 3.3 Insert(const T&, TInt)
5518 3.4 the [] operator, and then using the pointer to iterate through
5519 the array as you would with a C array.
5522 class RArray : private RArrayBase
5526 inline explicit RArray(TInt aGranularity);
5527 inline RArray(TInt aGranularity, TInt aKeyOffset);
5528 inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
5529 inline RArray(TInt aEntrySize,T* aEntries, TInt aCount);
5530 inline void Close();
5531 inline TInt Count() const;
5532 inline const T& operator[](TInt anIndex) const;
5533 inline T& operator[](TInt anIndex);
5534 inline TInt Append(const T& anEntry);
5535 inline TInt Insert(const T& anEntry, TInt aPos);
5536 inline void Remove(TInt anIndex);
5537 inline void Compress();
5538 inline void Reset();
5539 inline TInt Find(const T& anEntry) const;
5540 inline TInt Find(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5542 inline TInt Find(const K& aKey, TBool (*apfnCompare)(const K* k, const T& t)) const
5544 Finds the first object in the array which matches aKey using
5545 the comparison algorithm provided by apfnCompare.
5547 The find operation always starts at the low index end of the array. There
5548 is no assumption about the order of objects in the array.
5550 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5551 @param apfnCompare A function defining the identity relation between the
5552 object in the array, and their keys of type K. The function
5553 returns true if k and t match based on this relationship.
5555 @return The index of the first matching object within the array.
5556 KErrNotFound, if no suitable object can be found.
5558 { return RArrayBase::Find((T*)&aKey,*(TIdentityRelation<T>*)&apfnCompare); }
5559 inline TInt FindReverse(const T& anEntry) const;
5560 inline TInt FindReverse(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5562 inline TInt FindReverse(const K& aKey, TInt (*apfnMatch)(const K* k, const T& t)) const
5564 Finds the first object in the array which matches aKey using the comparison
5565 algorithm provided by apfnCompare.
5567 The find operation always starts at the high index end of the array. There
5568 is no assumption about the order of objects in the array.
5570 @param aKey The key of type K to be compared with the elements of the array using apfnMatch.
5571 @param apfnMatch A function defining the identity relation between the
5572 object in the array, and their keys of type K. The function
5573 returns true if k and t match based on this relationship.
5575 @return The index of the first matching object within the array.
5576 KErrNotFound, if no suitable object can be found.
5578 { return RArrayBase::FindReverse((T*)&aKey,*(TIdentityRelation<T>*)&apfnMatch); }
5579 inline TInt FindInSignedKeyOrder(const T& anEntry) const;
5580 inline TInt FindInUnsignedKeyOrder(const T& anEntry) const;
5581 inline TInt FindInOrder(const T& anEntry, TLinearOrder<T> anOrder) const;
5582 inline TInt FindInSignedKeyOrder(const T& anEntry, TInt& anIndex) const;
5583 inline TInt FindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex) const;
5584 inline TInt FindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5586 inline TInt FindInOrder(const K& aKey, TInt (*apfnCompare)(const K* k, const T& t)) const
5588 Finds the object in the array whose object matches the specified
5589 key, (Using the relationship defined within apfnCompare) using a binary search
5590 technique and an ordering algorithm.
5592 The function assumes that existing objects in the array are ordered so
5593 that the objects themselves are in object order as determined by an algorithm
5594 supplied by the caller and packaged as a TLinearOrder<T>.
5596 @param aKey The key of type K to be compared with the elements of the array using apfnCompare.
5597 @param apfnCompare A function which defines the order that the array was sorted,
5598 where in it aKey (via the defined relationship) should fit, and if the key is present.
5600 @return The index of the matching object within the array.
5601 KErrNotFound, if no suitable object can be found.
5604 { return RArrayBase::FindIsq((T*)&aKey,*(TLinearOrder<T>*)&apfnCompare); }
5605 inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt aMode) const;
5606 inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt aMode) const;
5607 inline TInt SpecificFindInOrder(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5608 inline TInt SpecificFindInSignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
5609 inline TInt SpecificFindInUnsignedKeyOrder(const T& anEntry, TInt& anIndex, TInt aMode) const;
5610 inline TInt SpecificFindInOrder(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5611 inline TInt InsertInSignedKeyOrder(const T& anEntry);
5612 inline TInt InsertInUnsignedKeyOrder(const T& anEntry);
5613 inline TInt InsertInOrder(const T& anEntry, TLinearOrder<T> anOrder);
5614 inline TInt InsertInSignedKeyOrderAllowRepeats(const T& anEntry);
5615 inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T& anEntry);
5616 inline TInt InsertInOrderAllowRepeats(const T& anEntry, TLinearOrder<T> anOrder);
5617 #ifndef __KERNEL_MODE__
5618 inline void AppendL(const T& anEntry);
5619 inline void InsertL(const T& anEntry, TInt aPos);
5620 inline TInt FindL(const T& anEntry) const;
5621 inline TInt FindL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5622 inline TInt FindReverseL(const T& anEntry) const;
5623 inline TInt FindReverseL(const T& anEntry, TIdentityRelation<T> anIdentity) const;
5624 inline TInt FindInSignedKeyOrderL(const T& anEntry) const;
5625 inline TInt FindInUnsignedKeyOrderL(const T& anEntry) const;
5626 inline TInt FindInOrderL(const T& anEntry, TLinearOrder<T> anOrder) const;
5627 inline void FindInSignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
5628 inline void FindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex) const;
5629 inline void FindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
5630 inline TInt SpecificFindInSignedKeyOrderL(const T& anEntry, TInt aMode) const;
5631 inline TInt SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt aMode) const;
5632 inline TInt SpecificFindInOrderL(const T& anEntry, TLinearOrder<T> anOrder, TInt aMode) const;
5633 inline void SpecificFindInSignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
5634 inline void SpecificFindInUnsignedKeyOrderL(const T& anEntry, TInt& anIndex, TInt aMode) const;
5635 inline void SpecificFindInOrderL(const T& anEntry, TInt& anIndex, TLinearOrder<T> anOrder, TInt aMode) const;
5636 inline void InsertInSignedKeyOrderL(const T& anEntry);
5637 inline void InsertInUnsignedKeyOrderL(const T& anEntry);
5638 inline void InsertInOrderL(const T& anEntry, TLinearOrder<T> anOrder);
5639 inline void InsertInSignedKeyOrderAllowRepeatsL(const T& anEntry);
5640 inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T& anEntry);
5641 inline void InsertInOrderAllowRepeatsL(const T& anEntry, TLinearOrder<T> anOrder);
5643 inline void GranularCompress();
5644 inline TInt Reserve(TInt aCount);
5645 inline void ReserveL(TInt aCount);
5646 inline void SortSigned();
5647 inline void SortUnsigned();
5648 inline void Sort(TLinearOrder<T> anOrder);
5649 inline TArray<T> Array() const;
5660 A simple and efficient specialized array of signed integers offering standard
5663 Note that derivation from RPointerArrayBase is private.
5665 TEMPLATE_SPECIALIZATION class RArray<TInt> : private RPointerArrayBase
5669 inline explicit RArray(TInt aGranularity);
5670 inline RArray(TInt aMinGrowBy, TInt aFactor);
5671 inline void Close();
5672 inline TInt Count() const;
5673 inline const TInt& operator[](TInt anIndex) const;
5674 inline TInt& operator[](TInt anIndex);
5675 inline TInt Append(TInt anEntry);
5676 inline TInt Insert(TInt anEntry, TInt aPos);
5677 inline void Remove(TInt anIndex);
5678 inline void Compress();
5679 inline void Reset();
5680 inline TInt Find(TInt anEntry) const;
5681 inline TInt FindReverse(TInt anEntry) const;
5682 inline TInt FindInOrder(TInt anEntry) const;
5683 inline TInt FindInOrder(TInt anEntry, TInt& anIndex) const;
5684 inline TInt SpecificFindInOrder(TInt anEntry, TInt aMode) const;
5685 inline TInt SpecificFindInOrder(TInt anEntry, TInt& anIndex, TInt aMode) const;
5686 inline TInt InsertInOrder(TInt anEntry);
5687 inline TInt InsertInOrderAllowRepeats(TInt anEntry);
5688 #ifndef __KERNEL_MODE__
5689 inline void AppendL(TInt anEntry);
5690 inline void InsertL(TInt anEntry, TInt aPos);
5691 inline TInt FindL(TInt anEntry) const;
5692 inline TInt FindReverseL(TInt anEntry) const;
5693 inline TInt FindInOrderL(TInt anEntry) const;
5694 inline void FindInOrderL(TInt anEntry, TInt& anIndex) const;
5695 inline TInt SpecificFindInOrderL(TInt anEntry, TInt aMode) const;
5696 inline void SpecificFindInOrderL(TInt anEntry, TInt& anIndex, TInt aMode) const;
5697 inline void InsertInOrderL(TInt anEntry);
5698 inline void InsertInOrderAllowRepeatsL(TInt anEntry);
5700 inline RArray(TInt* aEntries, TInt aCount);
5701 inline void GranularCompress();
5702 inline TInt Reserve(TInt aCount);
5703 inline void ReserveL(TInt aCount);
5705 inline TArray<TInt> Array() const;
5716 Array of unsigned integers.
5718 The array is a simple and efficient specialized array of unsigned integers
5719 offering standard array behaviour.
5721 The derivation from RPointerArrayBase is private.
5723 TEMPLATE_SPECIALIZATION class RArray<TUint> : private RPointerArrayBase
5727 inline explicit RArray(TInt aGranularity);
5728 inline RArray(TInt aMinGrowBy, TInt aFactor);
5729 inline void Close();
5730 inline TInt Count() const;
5731 inline const TUint& operator[](TInt anIndex) const;
5732 inline TUint& operator[](TInt anIndex);
5733 inline TInt Append(TUint anEntry);
5734 inline TInt Insert(TUint anEntry, TInt aPos);
5735 inline void Remove(TInt anIndex);
5736 inline void Compress();
5737 inline void Reset();
5738 inline TInt Find(TUint anEntry) const;
5739 inline TInt FindReverse(TUint anEntry) const;
5740 inline TInt FindInOrder(TUint anEntry) const;
5741 inline TInt FindInOrder(TUint anEntry, TInt& anIndex) const;
5742 inline TInt SpecificFindInOrder(TUint anEntry, TInt aMode) const;
5743 inline TInt SpecificFindInOrder(TUint anEntry, TInt& anIndex, TInt aMode) const;
5744 inline TInt InsertInOrder(TUint anEntry);
5745 inline TInt InsertInOrderAllowRepeats(TUint anEntry);
5746 #ifndef __KERNEL_MODE__
5747 inline void AppendL(TUint anEntry);
5748 inline void InsertL(TUint anEntry, TInt aPos);
5749 inline TInt FindL(TUint anEntry) const;
5750 inline TInt FindReverseL(TUint anEntry) const;
5751 inline TInt FindInOrderL(TUint anEntry) const;
5752 inline void FindInOrderL(TUint anEntry, TInt& anIndex) const;
5753 inline TInt SpecificFindInOrderL(TUint anEntry, TInt aMode) const;
5754 inline void SpecificFindInOrderL(TUint anEntry, TInt& anIndex, TInt aMode) const;
5755 inline void InsertInOrderL(TUint anEntry);
5756 inline void InsertInOrderAllowRepeatsL(TUint anEntry);
5758 inline RArray(TUint* aEntries, TInt aCount);
5759 inline void GranularCompress();
5760 inline TInt Reserve(TInt aCount);
5761 inline void ReserveL(TInt aCount);
5763 inline TArray<TUint> Array() const;
5767 #ifndef __LEAVE_EQUALS_THROW__
5777 #ifndef __KERNEL_MODE__
5778 IMPORT_C TInt Trap(TInt& aResult);
5779 IMPORT_C static void UnTrap();
5782 enum {EMaxState=0x10};
5784 TInt iState[EMaxState];
5787 TTrapHandler* iHandler;
5796 Executes the set of C++ statements _s under a trap harness.
5798 Use this macro as a C++ statement.
5800 _r must be a TInt which has already been declared; if any of the
5801 C++ statements _s leaves, then the leave code is returned in _r,
5802 otherwise _r is set to KErrNone.
5804 _s can consist of multiple C++ statements; in theory, _s can consist
5805 of any legal C++ code but in practice, such statements consist of simple
5806 function calls, e.g. Foo() or an assignment of some value to the result of
5807 a function call, e.g. functionValue=GetFoo().
5809 A cleanup stack is constructed for the set of C++ statements _s.
5810 If any function in _s leaves, objects pushed to the cleanup stack are
5811 cleaned-up. In addition, if any of the C++ statements in _s leaves,
5812 then remaining C++ code in _s is not executed and any variables which
5813 are assigned within that remaining code are not defined.
5815 @param _r An lvalue, convertible to TInt&, which will receive the result of
5816 any User::Leave() executed within _s or, if no leave occurred,
5817 it will be set to KErrNone. The value of _r on entry is not used.
5819 @param _s C++ statements which will be executed under a trap harness.
5823 #define TRAP(_r,_s) {TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
5829 Executes the set of C++ statements _s under a trap harness.
5831 Use this macro in the same way as you would TRAP, except that the
5832 variable _r is defined as part of the macro (and is therefore valid for the
5833 rest of the block in which the macro occurs). Often, this saves a line of code.
5835 @param _r A name, which will be declared as a TInt, and will receive the result
5836 of any User::Leave() executed within _s or, if no leave occurred, it
5837 will be set to KErrNone. After the macro, _r remains in scope until
5838 the end of its enclosing block.
5840 @param _s C++ statements which will be executed under a trap harness.
5844 #define TRAPD(_r,_s) TInt _r;{TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}
5850 Executes the set of C++ statements _s under a trap harness.
5851 Any leave code generated is ignored.
5853 Use this macro as a C++ statement.
5855 This macro is functionally equivalent to:
5864 where the value in 'x' is not used by any subsequent code.
5866 _s can consist of multiple C++ statements; in theory, _s can consist
5867 of any legal C++ code but in practice, such statements consist of simple
5868 function calls, e.g. Foo() or an assignment of some value to the result of
5869 a function call, e.g. functionValue=GetFoo().
5871 A cleanup stack is constructed for the set of C++ statements _s.
5872 If any function in _s leaves, objects pushed to the cleanup stack are
5873 cleaned-up. In addition, if any of the C++ statements in _s leaves,
5874 then remaining C++ code in _s is not executed and any variables which
5875 are assigned within that remaining code are not defined.
5877 @param _s C++ statements which will be executed under a trap harness.
5882 #define TRAP_IGNORE(_s) {TInt _ignore;TTrap __t;if (__t.Trap(_ignore)==0){_s;TTrap::UnTrap();}}
5885 #else //__LEAVE_EQUALS_THROW__
5888 /** @internalComponent */
5889 #define __WIN32SEHTRAP TWin32SEHTrap __trap; __trap.Trap();
5890 /** @internalComponent */
5891 #define __WIN32SEHUNTRAP __trap.UnTrap();
5892 IMPORT_C void EmptyFunction();
5893 #define __CALL_EMPTY_FUNCTION EmptyFunction();
5895 #define __WIN32SEHTRAP
5896 #define __WIN32SEHUNTRAP
5897 #define __CALL_EMPTY_FUNCTION
5901 This macro is used by the TRAP and TRAPD macros and provides a means
5902 of inserting code into uses of these.
5904 This macro is invoked before any 'trapped' code is called, and it should be
5905 redefined to do whatever task is required. E.g. this code:
5908 #undef TRAP_INSTRUMENTATION_START
5909 #define TRAP_INSTRUMENTATION_START DoMyLoging(__LINE__)
5912 Will cause all subsequent uses of the TRAP macros to behave in an
5916 DoMyLoging(__LINE__)
5917 TRAP(r,SomeCodeL());
5927 #define TRAP_INSTRUMENTATION_START
5932 This macro is used by the TRAP and TRAPD macros and provides a means
5933 of inserting code into uses of these.
5935 This macro is invoked if the 'trapped' code did not Leave.
5939 #undef TRAP_INSTRUMENTATION_NOLEAVE
5940 #define TRAP_INSTRUMENTATION_NOLEAVE DoMyLoging(__LINE__)
5943 Will cause all subsequent uses of the TRAP macros to behave in an
5947 TRAP(r,SomeCodeL());
5948 if(r==KErrNone) DoMyLoging(__LINE__);
5952 @param aLine The line number in the C++ source file where the TRAP or TRAPD
5961 #define TRAP_INSTRUMENTATION_NOLEAVE
5965 This macro is used by the TRAP and TRAPD macros and provides a means
5966 of inserting code into uses of these.
5968 This macro is invoked if the 'trapped' code did Leave. E.g. this code:
5971 #undef TRAP_INSTRUMENTATION_LEAVE
5972 #define TRAP_INSTRUMENTATION_LEAVE(aResult) DoMyLoging(aResult,__LINE__)
5975 Will cause all subsequent uses of the TRAP macros to behave in an
5979 TRAP(r,SomeCodeL());
5980 if(r!=KErrNone) DoMyLoging(r,__LINE__);
5984 @param aResult A reference to the result value used in the TRAP macro.
5993 #define TRAP_INSTRUMENTATION_LEAVE(aResult)
5998 This macro is used by the TRAP and TRAPD macros and provides a means
5999 of inserting code into uses of these.
6001 This macro is invoked after the 'trapped' code is called, regardless of whether
6002 or not it did Leave. It should be redefined to do whatever task is
6003 required. E.g. this code:
6006 #undef TRAP_INSTRUMENTATION_END
6007 #define TRAP_INSTRUMENTATION_END DoMyLoging(__LINE__)
6010 Will cause all subsequent uses of the TRAP macros to behave in an
6014 TRAP(r,SomeCodeL());
6015 DoMyLoging(__LINE__)
6025 #define TRAP_INSTRUMENTATION_END
6033 Executes the set of C++ statements _s under a trap harness.
6035 Use this macro as a C++ statement.
6037 _r must be a TInt which has already been declared; if any of the
6038 C++ statements _s leaves, then the leave code is returned in _r,
6039 otherwise _r is set to KErrNone.
6041 _s can consist of multiple C++ statements; in theory, _s can consist
6042 of any legal C++ code but in practice, such statements consist of simple
6043 function calls, e.g. Foo() or an assignment of some value to the result of
6044 a function call, e.g. functionValue=GetFoo().
6046 A cleanup stack is constructed for the set of C++ statements _s.
6047 If any function in _s leaves, objects pushed to the cleanup stack are
6048 cleaned-up. In addition, if any of the C++ statements in _s leaves,
6049 then remaining C++ code in _s is not executed and any variables which
6050 are assigned within that remaining code are not defined.
6052 @param _r An lvalue, convertible to TInt&, which will receive the result of
6053 any User::Leave() executed within _s or, if no leave occurred,
6054 it will be set to KErrNone. The value of _r on entry is not used.
6056 @param _s C++ statements which will be executed under a trap harness.
6061 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
6062 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
6063 trap handler to be invoked when multiple nested TRAP's were present and
6064 User::Leave(..) was called. */
6066 #define TRAP(_r, _s) \
6068 TInt& __rref = _r; \
6070 { TRAP_INSTRUMENTATION_START; } \
6073 TTrapHandler* ____t = User::MarkCleanupStack(); \
6075 User::UnMarkCleanupStack(____t); \
6076 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6079 catch (XLeaveException& l) \
6081 __rref = l.GetReason(); \
6082 { TRAP_INSTRUMENTATION_LEAVE(__rref); } \
6086 User::Invariant(); \
6088 __CALL_EMPTY_FUNCTION \
6089 { TRAP_INSTRUMENTATION_END; } \
6097 Executes the set of C++ statements _s under a trap harness.
6099 Use this macro in the same way as you would TRAP, except that the
6100 variable _r is defined as part of the macro (and is therefore valid for the
6101 rest of the block in which the macro occurs). Often, this saves a line of code.
6103 @param _r A name, which will be declared as a TInt, and will receive the result
6104 of any User::Leave() executed within _s or, if no leave occurred, it
6105 will be set to KErrNone. After the macro, _r remains in scope until
6106 the end of its enclosing block.
6108 @param _s C++ statements which will be executed under a trap harness.
6113 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
6114 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
6115 trap handler to be invoked when multiple nested TRAP's were present and
6116 User::Leave(..) was called. */
6119 #define TRAPD(_r, _s) \
6123 { TRAP_INSTRUMENTATION_START; } \
6126 TTrapHandler* ____t = User::MarkCleanupStack(); \
6128 User::UnMarkCleanupStack(____t); \
6129 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6132 catch (XLeaveException& l) \
6134 _r = l.GetReason(); \
6135 { TRAP_INSTRUMENTATION_LEAVE(_r); } \
6139 User::Invariant(); \
6141 __CALL_EMPTY_FUNCTION \
6142 { TRAP_INSTRUMENTATION_END; } \
6149 Executes the set of C++ statements _s under a trap harness.
6150 Any leave code generated is ignored.
6152 Use this macro as a C++ statement.
6154 This macro is functionally equivalent to:
6163 where the value in 'x' is not used by any subsequent code.
6165 Use this macro as a C++ statement.
6167 _s can consist of multiple C++ statements; in theory, _s can consist
6168 of any legal C++ code but in practice, such statements consist of simple
6169 function calls, e.g. Foo() or an assignment of some value to the result of
6170 a function call, e.g. functionValue=GetFoo().
6172 A cleanup stack is constructed for the set of C++ statements _s.
6173 If any function in _s leaves, objects pushed to the cleanup stack are
6174 cleaned-up. In addition, if any of the C++ statements in _s leaves,
6175 then remaining C++ code in _s is not executed and any variables which
6176 are assigned within that remaining code are not defined.
6178 @param _s C++ statements which will be executed under a trap harness.
6184 /*__CALL_EMPTY_FUNCTION(call to a function with an empty body) was added as a
6185 workaround to a compiler bug (mwccsym2 - winscw ) which caused an incorrect
6186 trap handler to be invoked when multiple nested TRAP's were present and
6187 User::Leave(..) was called. */
6189 #define TRAP_IGNORE(_s) \
6191 { TRAP_INSTRUMENTATION_START; } \
6194 TTrapHandler* ____t = User::MarkCleanupStack(); \
6196 User::UnMarkCleanupStack(____t); \
6197 { TRAP_INSTRUMENTATION_NOLEAVE; } \
6200 catch (XLeaveException& l) \
6203 { TRAP_INSTRUMENTATION_LEAVE(l.Reason()); } \
6207 User::Invariant(); \
6209 __CALL_EMPTY_FUNCTION \
6210 { TRAP_INSTRUMENTATION_END; } \
6214 #endif //__LEAVE_EQUALS_THROW__
6216 /* The macro __SYMBIAN_STDCPP_SUPPORT__ is defined when building a StdC++ target.
6217 * In this case, operator new and operator delete below should not be declared
6218 * to avoid clashing with StdC++ declarations.
6221 #ifndef __SYMBIAN_STDCPP_SUPPORT__
6223 #ifndef __OPERATOR_NEW_DECLARED__
6225 /* Some operator new and operator delete overloads may be declared in compiler
6226 * pre-include files.
6228 * __OPERATOR_NEW_DECLARED__ is #defined if they are, so that we can avoid
6229 * re-declaring them here.
6232 #define __OPERATOR_NEW_DECLARED__
6238 GLREF_C TAny* operator new(TUint aSize) __NO_THROW;
6244 GLREF_C TAny* operator new(TUint aSize,TUint anExtraSize) __NO_THROW;
6250 GLREF_C void operator delete(TAny* aPtr) __NO_THROW;
6252 #ifndef __OMIT_VEC_OPERATOR_NEW_DECL__
6257 GLREF_C TAny* operator new[](TUint aSize) __NO_THROW;
6263 GLREF_C void operator delete[](TAny* aPtr) __NO_THROW;
6264 #endif // !__OMIT_VEC_OPERATOR_NEW_DECL__
6266 #endif // !__OPERATOR_NEW_DECLARED__
6268 #endif // !__SYMBIAN_STDCPP_SUPPORT__
6274 inline TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
6280 inline void operator delete(TAny* aPtr, TAny* aBase) __NO_THROW;
6282 #ifndef __PLACEMENT_VEC_NEW_INLINE
6287 inline TAny* operator new[](TUint aSize, TAny* aBase) __NO_THROW;
6293 inline void operator delete[](TAny* aPtr, TAny* aBase) __NO_THROW;
6295 #endif // !__PLACEMENT_VEC_NEW_INLINE
6297 #if !defined(__BOOL_NO_TRUE_TRAP__)
6303 TBool operator==(TTrue,volatile const TBool);
6309 TBool operator==(volatile const TBool,TTrue);
6315 TBool operator!=(TTrue,volatile const TBool);
6321 TBool operator!=(volatile const TBool,TTrue);
6331 A Version 2 client/server class that clients use to package
6332 the arguments to be sent to a server.
6334 The object can package up to 4 arguments together with information about each
6335 argument's type, width and accessibility; it is also possible for
6336 the package to contain zero arguments. In addition to the default constructor,
6337 the class has four templated constructors, allowing an object of this type to
6338 be constructed for 0, 1, 2, 3 or 4 arguments.
6340 Internally, the arguments are stored in a simple TInt array.
6341 Consecutive arguments in a constructor's parameter list are put into
6342 consecutive slots in the array. The Set() overloaded functions can be used
6343 to set argument values into specific slots within this array.
6351 Argument types; some of these may be ORed together to specify
6352 type, accessibility, and width.
6356 EUnspecified = 0, /**< Type not specified.*/
6357 EHandle = 1, /**< Handle type.*/
6358 EFlagDes = 4, /**< Descriptor type.*/
6359 EFlagConst = 2, /**< Read only type.*/
6360 EFlag16Bit = 1, /**< 16 bit rather than 8 bit.*/
6361 EDes8 = EFlagDes, /**< 8 bit read/write descriptor.*/
6362 EDes16 = EFlagDes|EFlag16Bit, /**< 16 bit read/write descriptor.*/
6363 EDesC8 = EFlagDes|EFlagConst, /**< 8 bit read only descriptor.*/
6364 EDesC16 = EFlagDes|EFlagConst|EFlag16Bit, /**< 16 bit read only descriptor.*/
6373 KBitsPerType = 3, /**< Number of bits of type information used for each of the 4 arguments.*/
6374 KPinArgShift = KBitsPerType*KMaxMessageArguments, /**< Bit number of the start of the pin flags. */
6375 KPinArg0 = 1<<(KPinArgShift+0), /**< Set to pin argument at index 0.*/
6376 KPinArg1 = 1<<(KPinArgShift+1), /**< Set to pin argument at index 1.*/
6377 KPinArg2 = 1<<(KPinArgShift+2), /**< Set to pin argument at index 2.*/
6378 KPinArg3 = 1<<(KPinArgShift+3), /**< Set to pin argument at index 3.*/
6379 KPinMask = 0xf<<KPinArgShift, /**< The bits used for the pinning attributes of each argument.*/
6384 Indicates a Null argument.
6388 An enum value that can be used to indicate an empty or
6389 unused argument to a server. For example:
6392 TIpcArgs args(arg1, TIpcArgs::ENothing, arg2);
6395 This argument will have an undefined value when the server
6396 receives the message.
6402 Default constructor.
6404 An argument package constructed using this constructor has no arguments;
6405 however, arguments can subsequently be set into this argument package object
6406 using the Set() member functions.
6414 A templated constructor that constructs the argument package; it takes
6417 @param a0 An argument of general class type T0 to be contained by
6421 inline explicit TIpcArgs(T0 a0)
6423 Assign(iArgs[0],a0);
6424 iFlags=(Type(a0)<<(0*KBitsPerType));
6429 A templated constructor that constructs the argument package; it takes
6432 @param a0 An argument of general class type T0 to be contained by
6434 @param a1 An argument of general class type T1 to be contained by
6437 template <class T0,class T1>
6438 inline TIpcArgs(T0 a0,T1 a1)
6440 Assign(iArgs[0],a0);
6441 Assign(iArgs[1],a1);
6442 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType));
6447 A templated constructor that constructs the argument package; it takes
6450 @param a0 An argument of general class type T0 to be contained by
6452 @param a1 An argument of general class type T1 to be contained by
6454 @param a2 An argument of general class type T2 to be contained by
6457 template <class T0,class T1,class T2>
6458 inline TIpcArgs(T0 a0,T1 a1,T2 a2)
6460 Assign(iArgs[0],a0);
6461 Assign(iArgs[1],a1);
6462 Assign(iArgs[2],a2);
6463 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType));
6468 A templated constructor that constructs the argument package; it takes
6471 @param a0 An argument of general class type T0 to be contained by
6473 @param a1 An argument of general class type T1 to be contained by
6475 @param a2 An argument of general class type T2 to be contained by
6477 @param a3 An argument of general class type T3 to be contained by
6480 template <class T0,class T1,class T2,class T3>
6481 inline TIpcArgs(T0 a0,T1 a1,T2 a2,T3 a3)
6483 Assign(iArgs[0],a0);
6484 Assign(iArgs[1],a1);
6485 Assign(iArgs[2],a2);
6486 Assign(iArgs[3],a3);
6487 iFlags=(Type(a0)<<(0*KBitsPerType))|(Type(a1)<<(1*KBitsPerType))|(Type(a2)<<(2*KBitsPerType))|(Type(a3)<<(3*KBitsPerType));
6490 inline void Set(TInt aIndex,TNothing);
6491 inline void Set(TInt aIndex,TInt aValue);
6492 inline void Set(TInt aIndex,const TAny* aValue);
6493 inline void Set(TInt aIndex,RHandleBase aValue);
6494 inline void Set(TInt aIndex,const TDesC8* aValue);
6495 #ifndef __KERNEL_MODE__
6496 inline void Set(TInt aIndex,const TDesC16* aValue);
6498 inline void Set(TInt aIndex,TDes8* aValue);
6499 #ifndef __KERNEL_MODE__
6500 inline void Set(TInt aIndex,TDes16* aValue);
6503 inline TIpcArgs& PinArgs(TBool aPinArg0=ETrue, TBool aPinArg1=ETrue, TBool aPinArg2=ETrue, TBool aPinArg3=ETrue);
6505 inline static TArgType Type(TNothing);
6506 inline static TArgType Type(TInt);
6507 inline static TArgType Type(const TAny*);
6508 inline static TArgType Type(RHandleBase aValue);
6509 inline static TArgType Type(const TDesC8*);
6510 #ifndef __KERNEL_MODE__
6511 inline static TArgType Type(const TDesC16*);
6513 inline static TArgType Type(TDes8*);
6514 #ifndef __KERNEL_MODE__
6515 inline static TArgType Type(TDes16*);
6518 inline static void Assign(TInt&,TNothing);
6519 inline static void Assign(TInt& aArg,TInt aValue);
6520 inline static void Assign(TInt& aArg,const TAny* aValue);
6521 inline static void Assign(TInt& aArg,RHandleBase aValue);
6522 inline static void Assign(TInt& aArg,const TDesC8* aValue);
6523 #ifndef __KERNEL_MODE__
6524 inline static void Assign(TInt& aArg,const TDesC16* aValue);
6526 inline static void Assign(TInt& aArg,TDes8* aValue);
6527 #ifndef __KERNEL_MODE__
6528 inline static void Assign(TInt& aArg,TDes16* aValue);
6533 The location where the message arguments are stored.
6535 There is no reason to access this data member directly and it should be
6536 considered as internal.
6538 TInt iArgs[KMaxMessageArguments];
6541 The location where the flag bits describing the argument types are stored.
6543 The symbolic values describing the argument types are internal to Symbian,
6544 and there is therefore no reason to access this data member directly.
6545 It should be considered as internal.
6550 // Structures for passing 64 bit integers and doubles across GCC/EABI boundaries
6559 inline SInt64(Int64 a);
6560 inline SInt64& operator=(Int64 a);
6561 inline operator Int64() const;
6563 TUint32 iData[2]; // little endian
6573 inline SUint64(Uint64 a);
6574 inline SUint64& operator=(Uint64 a);
6575 inline operator Uint64() const;
6577 TUint32 iData[2]; // little endian
6587 inline SDouble(TReal a);
6588 inline SDouble& operator=(TReal a);
6589 inline operator TReal() const;
6591 TUint32 iData[2]; // always little endian
6598 Stores information about a thread's stack.
6600 Note, on the emulator, the memory between iLimit and the thread's current stack pointer
6601 may not actually be committed.
6603 @see RThread::StackInfo()
6605 class TThreadStackInfo
6609 The address which the stack pointer would contain if the stack were empty.
6614 The address which the stack pointer would contain if the stack were full,
6615 (The lowest valid address).
6620 The limit value for the stack if it were expanded to its maximum size.
6622 Currently expanding stacks is not supported so iExpandLimit==iLimit
6624 TLinAddr iExpandLimit;
6630 #ifdef __SUPPORT_CPP_EXCEPTIONS__
6635 The class used to implement User::Leave in term of throw and TRAP in terms of catch.
6638 class XLeaveException
6641 inline XLeaveException() {}
6642 inline XLeaveException(TInt aReason) {iR = aReason;}
6643 inline TInt Reason() const {return iR;}
6644 IMPORT_C TInt GetReason() const;
6646 #if __ARMCC_VERSION >= 220000
6647 // From rvct 2.2 onwards we want the class impedimenta to be shared, so create a key function.
6648 // Unfortunately we can't make this the key function the dtor since this would make it impossible for existing 2.1
6649 // derived binaries to be 'BC' with 2.2 binaries (in the general case (which I wont attempt to describe coz its
6650 // 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
6651 // for catch handlers to work :-( (see the old code).
6652 virtual void ForceKeyFunction();
6655 #if __ARMCC_VERSION < 220000
6656 TAny* iVtable; // reserve space for vtable
6661 // The standard header file <exception> defines the following guard macro for EDG and CW, VC++, GCC respectively.
6662 // The guard below is ugly. It will surely come back and bite us unless we resolve the whole issue of standard headers
6663 // when we move to supporting Standard C++.
6665 // The macro __SYMBIAN_STDCPP_SUPPORT__ is defined when building a StdC++ target.
6666 // In this case, we include the StdC++ specification <exception> rather than declaring uncaught_exception.
6668 #ifdef __SYMBIAN_STDCPP_SUPPORT__
6669 #include <stdapis/stlportv5/exception>
6670 #elif !defined(_EXCEPTION) && !defined(_EXCEPTION_) && !defined(__EXCEPTION__)
6671 // Declare standard C++ functions relating to exceptions here
6673 #if defined(__VC32__) || defined(__CW32__)
6674 bool uncaught_exception();
6676 IMPORT_C bool uncaught_exception();
6678 void terminate(void);
6679 void unexpected(void);
6680 typedef void (*terminate_handler)();
6681 terminate_handler set_terminate(terminate_handler h) throw();
6682 typedef void (*unexpected_handler)();
6683 unexpected_handler set_unexpected(unexpected_handler h) throw();
6687 #endif //__SUPPORT_CPP_EXCEPTIONS__
6691 #ifndef __WIN32_SEH_TYPES_KNOWN__
6692 class __UnknownWindowsType1;
6693 class __UnknownWindowsType2;
6696 class TWin32SEHTrap;
6699 * Typedef for the SEH handler function
6700 * @internalComponent
6702 typedef TUint32 (TWin32SEHExceptionHandler)(__UnknownWindowsType1* aExceptionRecord, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
6705 * @internalComponent
6710 // Prevent copy/assign
6711 TWin32SEHTrap(TWin32SEHTrap const &);
6712 TWin32SEHTrap& operator=(TWin32SEHTrap const &);
6714 #ifdef __KERNEL_MODE__
6716 // Kernel-side functions for nkern exception handler
6719 /** Find final exception handler in SEH chain */
6720 static TWin32SEHTrap* IterateForFinal();
6722 /** Access exception handler */
6723 TWin32SEHExceptionHandler* ExceptionHandler();
6727 #else // !__KERNEL_MODE__
6729 // User-side functions for use in TRAP(...)
6732 UIMPORT_C TWin32SEHTrap();
6735 /** Add object to SEH chain */
6736 UIMPORT_C void Trap();
6738 /** Remove object from SEH chain */
6739 UIMPORT_C void UnTrap();
6741 #ifndef __IN_SEH_CPP__
6744 /** Handle Win32 exceptions */
6745 static TUint32 ExceptionHandler(__UnknownWindowsType1* aException, TWin32SEHTrap* aRegistrationRecord, __UnknownWindowsType2* aContext);
6747 #endif //__KERNEL_MODE__
6750 // NB: This is really an _EXCEPTION_REGISTRATION_RECORD
6752 TWin32SEHTrap* iPrevExceptionRegistrationRecord; /** Link to previous SEH record */
6753 TWin32SEHExceptionHandler* iExceptionHandler; /** SEH handler function */
6756 TUint32 iPadding[254]; // discourage the compiler from putting this in reused function parameter space
6763 * @internalComponent
6768 UIMPORT_C TWin32SEHTrap();
6769 UIMPORT_C void Trap();
6770 UIMPORT_C void UnTrap();
6778 struct TEmulatorImageHeader
6780 TUid iUids[KMaxCheckedUid];
6781 TProcessPriority iPriority;
6785 TUint32 iModuleVersion;
6789 // forward declaration of shareable data buffers pool infomation
6792 #include <e32cmn.inl>
6794 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
6795 #include <e32cmn_private.h>
6798 #endif //__E32CMN_H__