quick_recipes (779892), страница 12

Файл №779892 quick_recipes (Symbian Books) 12 страницаquick_recipes (779892) страница 122018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 12)

Once the process startsrunning, it cannot change its capabilities, nor can the loader or any otherprocess or DLL that loads into it affect the capability set of the process.PLATFORM SECURITY: CAPABILITIES61Table 3.4 Platform Security Capabilities on Symbian OSCapabilitytypeCapability nameDescriptionSigning optionsUsercapabilitiesLocalServicesLocationNetworkServicesReadUserDataUserEnvironmentWriteUserDataSelf-signing.All signing optionsfrom Symbian Signed.SystemcapabilitiesPowerMgmtProtServReadDeviceDataSurroundingsDDSwEventTrustedUIWriteDeviceDataCommDDDiskAdminNetworkControlMultimediaDDSymbian signing is notessential if thesecapabilities are used – theuser is instead able to grantpermissions to applicationsthat use the capabilities,although they will bewarned that the software isuntrusted.(Warning: Different devicemanufacturers may havedifferent policies.)System capabilities thatprotect system services,device settings and somehardware features.System capabilities thatprotect file system,communications andmultimedia deviceservices.Capabilities that requiredevice manufacturers’approval.Open Signing withPublisher ID andCertified Signed only.RestrictedsystemcapabilitiesDevicemanufacturercapabilitiesAllFilesDRMTCBAll signing optionsfrom Symbian Signed.No self-signing isallowed.Requires approval fromdevice manufacturers.For Symbian OS DLLs, capabilities are also declared in the MMP file,but they have a different meaning: they represent to a loading process theamount of trust that can be placed in a DLL.

An EXE cannot load a DLLif it possesses more capabilities than the DLL, because then the DLL maynot be trustworthy to run securely within the process. A process can onlyload a DLL if that DLL is trusted with at least the same capabilities as thatprocess.However, a process can load a DLL which has been assigned morecapabilities than itself, but that DLL will only be allowed to use thecapabilities of the process in which it runs – it doesn’t add trust to theprocess. This means that DLL code cannot assume it will always berunning with the capabilities it needs, since these are dependent on theprocess it has been loaded into.

If a DLL requires a particular capability,this should be clearly specified in its documentation.623.12SYMBIAN OS DEVELOPMENT BASICSPlatform Security: Data CagingThe Symbian OS file system is partitioned to protect system files (critical tothe operation of the phone), application data (to prevent other applicationsfrom stealing copyrighted content or accidentally corrupting data) anddata files personal to the user (which should remain confidential).

Thispartitioning is called data caging. It is not used on the entire file system;there are some public areas for which no capabilities are required.However, some directories in the file system can only be accessed usingcertain capabilities.Table 3.5 shows how data caging is related to capabilities.Table 3.5 Data Caging and CapabilitiesDirectory\resource\sys\private\<ownSID>\private\<otherSID>\<anyOther>CapabilitiesReadWriteReadWriteReadWriteReadWriteReadWriteNoneAllFilesTCBAllFiles+TCB××××××××××Each Symbian OS process has its own private folder, which can becreated on internal memory or removable media. The folder name isbased on the Secure Identifier (SID) of the process.

A SID is required toidentify each EXE on the phone and is used to create its private directory.The SID is similar to the UID3 identifier described in Section 3.10.3, andthe default value of the SID is the UID3 value if a SID is not explicitlyspecified by use of the SECUREID keyword in the MMP file. It is usuallyrecommended not to specify a SID, but simply allow it to default to theUID3 value as assigned by Symbian Signed.3.13Stack Size and Heap SizeOn Symbian OS, by default, the default stack size for an applicationis 8 KB.

However, it can be adjusted by using the EPOCSTACKSIZEkeyword in the project’s MMP file. For example:EPOCSTACKSIZE 0x5000STREAMS63The statement above changes the stack size of the executable to20 KB (0 × 5000 bytes in hexadecimal or 20,480 byes in decimal). Themaximum stack size is 80 KB.The default minimum heap size for an application is 4 KB. The defaultmaximum heap size is 1 MB. Both can be adjusted, again in the project’sMMP file, using the macro EPOCHEAPSIZE.

For example:EPOCHEAPSIZE 0x5000 0x100000The statement above changes the default minimum heap size to20 KB (0 × 5000 bytes) and the maximum heap size to 1 MB (0 × 10000bytes). What does it mean?• The process cannot be started if the available memory is less than20 KB.• The process cannot consume heap memory more than 1 MB.3.14 StreamsA stream in Symbian OS is the object’s external representation. Theprocess of storing the object’s data into the stream is called externalization,and the opposite mechanism – internalization – reads the data from astream and reconstructs an object as appropriate. Streams are quite usefulfor storing simple data structures, and a stream may contain the data ofone or more objects.There are two base classes, which implement the concept of the streaming functionality: RReadStream and RWriteStream.

These classesprovide a set of methods to read and write operations for built-in integerand real types as well as for descriptors. They also have operators >> and<<, respectively, for internalizing and externalizing data. Please note thatafter creating the stream, you should call the stream’s PushL() methodrather than CleanupStack::PushL(), if you need to push it to thecleanup stack in order to make it leave-safe.Symbian OS has several concrete implementations of those streambase classes – each of them works with specific media; for instance, files,descriptors or memory buffers.

They always exist in pairs: one for readingand one for writing. The following list gives you an idea of some of theavailable stream classes:• RFileReadStream• RFileWriteStream• RDesReadStream64SYMBIAN OS DEVELOPMENT BASICS• RDesWriteStream• RBufReadStream• RBufWriteStream• RMemReadStream• RMemWriteStream.You should consult the API documentation for each class in theSymbian Developer Library.3.14.1 Externalize and InternalizeFor an object to be written to a stream, its class must implement anExternalizeL() method, while for an object to be read from a stream,its class must implement an InternalizeL() method.Here is an example of a class which supports both internalization andexternalization:#include <s32mem.h>class CSampleClass : public CBase{public:...void ExternalizeL(RWriteStream& aStream) const;void InternalizeL(RReadStream& aStream);...private:TInt iIntVal;TBuf<64> iBuffer;};// Assume we have the code for the rest of the classvoid CSampleClass::ExternalizeL(RWriteStream& aStream) const{aStream.WriteInt32L(iIntVal);aStream << iBuffer;}void CSampleClass::InternalizeL(RReadStream& aStream){iIntVal = aStream.ReadInt32L();aStream >> iBuffer;}...void SampleFuncL(TAny* aMemPtr, TInt aMaxLen){RBuf buf;buf.CreateL(64);buf.CleanupClosePushL();ACTIVE OBJECTS65buf.Append(KSampleBuffer1);CSampleClass* objVar = CSampleClass::NewLC(1,buf);RMemWriteStream writer;writer.PushL();writer.Open(aMemPtr, aMaxLen);writer << *objVar;writer.CommitL();CleanupStack::PopAndDestroy(&writer);...// Later on, read it into new objectbuf = KSampleBuffer2;CSampleClass* objVar2 = CSampleClass::NewLC(2,buf);RMemReadStream reader;reader.PushL();reader.Open(aMemPtr,aMaxLen);reader >> *objVar2;CleanupStack::PopAndDestroy(4);}Tip: Please note that a stream’s operators << and >> leave, so youhave to handle this fact in your code.It could be very inefficient to externalize a modifiable descriptorwhen its current length is well below its maximum length.

However,HBufC::NewL() has an overload that takes a RReadStream and isrecommended.3.15 Active ObjectsActive objects are used for lightweight event-driven multitasking onSymbian OS, and are fundamental for responsive and efficient eventhandling. They are used in preference to threads to minimize the numberof thread context switches that occur, and make efficient use of systemresources.

This section describes what active objects are, how to usethem, and how to avoid the most common programming errors that canoccur.Symbian OS uses event-driven code extensively for user interaction(which has a non-deterministic completion time) and in system code, forexample for asynchronous communications. An event-driven system isimportant on a battery-powered device. The alternative to responding toevents is for the submitter of an asynchronous event to keep polling to66SYMBIAN OS DEVELOPMENT BASICScheck if a request has completed.

On a mobile operating system this canlead to significant power drain because a tight polling loop prevents theOS from powering down all but the most essential resources.The ‘active object framework’ is used on Symbian OS to simplifyasynchronous programming. It is used to handle multiple asynchronoustasks in the same thread and provides a consistent way to write code tosubmit asynchronous requests and handle completion events.A Symbian OS application or server will usually consist of a single mainevent-handling thread with an associated active scheduler that runs a loopwaiting on completion events.

Характеристики

Тип файла
PDF-файл
Размер
1,59 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6376
Авторов
на СтудИзбе
309
Средний доход
с одного платного файла
Обучение Подробнее