SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Symbian OS Client-Server Framework v2.0a – 29 April 2008 1 Andreas Jakl, 2008
Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006.  Andreas Jakl, 2008 2
Contents Client-Server Framework Architecture Message Passing Servers and Sessions Andreas Jakl, 2008 3 Colour coding used in these slides: Client Server Kernel
Client-Server Framework Theory of the … Andreas Jakl, 2008 4
Client-Server Pattern Client makes use of services provided by a server Server: Receives request messages from its clients Handles requests (synchronously or asynchronously) Andreas Jakl, 2008 5 Client Server Messages
Client-Server Architecture Most of the system services in Symbian OS are client-server-based Examples: Window Server (UI, keypad) File Server Socket Server Telephony Server Andreas Jakl, 2008 6
Advantages: Plugins Extensibility: Plug-in modules for globally available new object types (e.g. new multimedia codecs, …) Andreas Jakl, 2008 7 File Server Local file system Flash filing system Sockets Server Infrared protocols TCP/IP SMS
Advantages Efficiency Multiple clients use a single server Security Server/Client in different threads (usually also different processes). Communication through messages client can not “crash” server Asynchronous Server uses Active Objects for return messages. No polling needed  good for our battery! Andreas Jakl, 2008 8
Structure – Example Andreas Jakl, 2008 9 myApp.exe Client Links efsrv.lib, uses API-methods like:RFs::Connect() Client-sideFile Server implementation efsrv.dll Client-Servercommunication (via Kernel) Process Boundary efile.exe File Server
R-type Classes For client-side implementation R: Owns external Resource handle (e.g. handle to a server session) Resource allocation: usually Open(), Create() or Initialize() Deallocation: usually Close() or Reset() The destructor doesn’t do it – most of the times, there is no destructor App. should release the resource as soon as possible Can be instantiated on the stack (automatic variable) or on the heap (instance variable) Andreas Jakl, 2008 10
Examplecode Andreas Jakl, 2008 11 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs);		// file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
Session Session = Communication channel between client and server Initiated by a client Kernel creates server-side representation Messages between client / server mediated by kernel Only onesynchronous request may be submitted at a time ... but multipleasynchronous requests may be outstanding Andreas Jakl, 2008 12
Client-side Representation Server is usually accessible through a public client class Handles details of establishing a session with its server Sends commands to the server Handles receiving responses Derives from RSessionBase  Hides implementation details of the private client-server communication protocol Example: Simple functions RFs::Delete() or RFs::GetDir() communicate with the file server and hide the more complex client-server communication protocol Andreas Jakl, 2008 13
Communication Andreas Jakl, 2008 14 Calls functions from the base class Establishsession Own, privateprotocol Disconnect
Communication Send data between processes: Message Passing: Used in all cases Inter-process communication (IPC): For large data packets, if needed Andreas Jakl, 2008 15 Kernel Client Server Process Boundary
Messages [1] Clients send messages to servers Each message is a request for a service Server processes request Performs work on behalf of the client Optionally sends a reply to the client Messages can be sent: synchronously, or asynchronously Andreas Jakl, 2008 16
Messages [2] Request message: Consists of five 32-bit numbers Function number Four 32-bit parameters Each of the four parameters can be: An integer (TInt) A pointer to a flat data structure, wrapped as a Symbian OS descriptor ( read using IPC) Andreas Jakl, 2008 17
MessagePassing Andreas Jakl, 2008 18 Server Client four 32-bit parameters x=RXxxSession::Foo(a,b,c) foo a b c - ServiceL(RMessage2 aMessage) Server processes the request... aMessage.Complete(x) x
Inter-ProcessCommunication Andreas Jakl, 2008 19 Server Client y=RXxxSession::Bar(a,b,c) bar p &q &r - ServiceL(RMessage1 aMessage) q aMessage.ReadL() r aMessage.WriteL() aMessage.Complete(y) y
Request-Handling Andreas Jakl, 2008 20 “2” – Symbian OS 9: Capability-Support Client Server RSessionBaseSendReceive() Functions for the client, converts requests to parameters CSession2ServiceL() Handling of requests, represents session server-side CServer2 (Active Obj)RunL() Receives requests, forward to corresponding session RMessage2Complete() For client/server data transfer DSessionLinks Client/Server, Cleanup Kernel
Server Lifetime Three options: System Server: Started with the mobile phone, essential for the OS (e.g. File Server, Window Server). Unexpected termination usually forces phone reboot. Application / Transient Server: Started on request of an application, closed when last client disconnects.If a second client starts a new server, no error is produced, existing server instance is used. Other Servers: Started and closed with an individual application. If used by multiple applications: each app. has its own private instance; e.g. POSIX server. Andreas Jakl, 2008 21
Server Lifetime Andreas Jakl, 2008 22 System System server connect disconnect Application 1 connect disconnect App. server connect disconnect Application 2 Other server
Processes & Servers 23 Same-processservers Privilegedcode Fixedprocesses ekern.exe(privileged)Kernelserver efsrv.exe(fixed)File server ewsrv.exe(fixed)Windowserver fbsrv.exe(fixed)Font & bitmapserver c32exe.exe(fixed)Comms, Sockets, Telephonyservers app1.exe Application xxx.exe…server edbsrv.exeDBMS server app2.exe Application app3.exe Application Private server Ordinaryapplications Ordinaryservers Private server Andreas Jakl, 2008
Sessions Andreas Jakl, 2008 24 Server thread Server can serve multiple clients A client can have multiple sessions with a server Each session requires resources  Server CServer2 Server side session CSession2 Server side session CSession2 Server side session CSession2 Client side session RSessionBase Client side session RSessionBase Client side session RSessionBase Client 1 (thread) Client 2 (thread)
Subsessions Solution: SubSessions e.g. File Server: One Session per Client (RFs), multiple files represent SubSessions (RFile)  no new session for every single file! Andreas Jakl, 2008 25 Server thread Server CServer2 Server side session CSession2 Client side session RSessionBase Subsession RSubSessionBase Subsession RSubSessionBase Client (thread)
API Example Andreas Jakl, 2008 26 class RFs : public RSessionBase {...} class RFsBase : public RSubSessionBase {...} class RFile : public RFsBase { public: IMPORT_C TInt Open(RFs& aFs, const TDesC& aName, TUintaFileMode); IMPORT_C TInt Read(TDes8& aDes) const; IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const; IMPORT_C TInt Write(const TDesC8& aDes); IMPORT_C void Write(const TDesC8& aDes, TRequestStatus& aStatus); [...] };
Examplecode (Revisited) Andreas Jakl, 2008 27 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs);		// file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
Performance Communication: Overhead through thread / process context switches Inter-process data transfer requires mapping client data area to server’s virtual address space Best practice: Transfer a large amount of data in a single transaction instead of performing a number of server accesses Example: Most Symbian OS components don’t use RFile::Read() / Write() directly, but instead use buffered streams (RReadStream() / RWriteStream()) Andreas Jakl, 2008 28
Is a Server Required? Need to share functionality or resources across a number of threads or processes? Require isolation between service provider and service user? Pre-emptive asynchronous processing desirable? Gains outweigh costs? Andreas Jakl, 2008 29
ASD-like Question – Easy  Which of the following statements correctly describe the client-server model in Symbian OS? A. A client and server always execute in separate threads. B. A client and server always execute in separate processes. C. A client initiates a server request by passing an integer to identify the request. It then sends any “payload” data separately. D. To return data to a client, the server writes directly into the client’s address space. E. At any time, there can only be one outstanding synchronous client request to a server. Andreas Jakl, 2008 30 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Correct.  B.	Incorrect. Most servers are executed in an own process, but it is not required.  C.Incorrect. The data is sent together with the function request as a parameter. D.	Incorrect. The return values are sent using a message object. E.	Correct.  Andreas Jakl, 2008 31
ASD-like Question – Medium For which of the following scenarios would a developer choose to implement a client and server on Symbian OS? A. To provide utility code, such as a 3D graphics library. B. To implement a system-wide “broadcast” notification system. C. To manage access to a hardware resource, such as the camera. D. To implement a Bluetooth game where the host player runs as a server and all other players are clients. E. To implement a user interface application for displaying weather information. Andreas Jakl, 2008 32 Copyright Meme Education, 2006 http://www.meme-education.com/
Solution A.	Incorrect. The performance overhead would be too high.  B.	Correct.  C.Correct. D.	Incorrect. This has nothing to do with the client/server communication within Symbian OS. E.	Incorrect. UI and application logic should be separated, but rather by using DLLs instead of implementing client/server communication. Andreas Jakl, 2008 33
Thanks for your attention That’s it! Andreas Jakl, 2008 34

Weitere ähnliche Inhalte

Was ist angesagt?

BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal HarouniBSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
Shellmates
 

Was ist angesagt? (17)

Microkernel design
Microkernel designMicrokernel design
Microkernel design
 
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
XPDS16: A Paravirtualized Interface for Socket Syscalls - Dimitri Stiliadis, ...
 
Scale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen HypervisorScale 12x Securing Your Cloud with The Xen Hypervisor
Scale 12x Securing Your Cloud with The Xen Hypervisor
 
A Xen Case Study
A Xen Case StudyA Xen Case Study
A Xen Case Study
 
XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016XPDS16: Xen Project Weather Report 2016
XPDS16: Xen Project Weather Report 2016
 
CT
CTCT
CT
 
Distributed computing environment
Distributed computing environmentDistributed computing environment
Distributed computing environment
 
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal HarouniBSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
BSides Algiers - Linux Kernel and Recent Security Protections - Djallal Harouni
 
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
CIF16/Scale14x: The latest from the Xen Project (Lars Kurth, Chairman of Xen ...
 
From L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernelsFrom L3 to seL4: What have we learnt in 20 years of L4 microkernels
From L3 to seL4: What have we learnt in 20 years of L4 microkernels
 
Lab1
Lab1Lab1
Lab1
 
Microkernel
MicrokernelMicrokernel
Microkernel
 
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
Docker's Jérôme Petazzoni: Best Practices in Dev to Production Parity for Con...
 
Chapter16 new
Chapter16 newChapter16 new
Chapter16 new
 
Driver Programming Report
Driver Programming ReportDriver Programming Report
Driver Programming Report
 
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router12th Japan CloudStack User Group Meetup   MidoNet with scalable virtual router
12th Japan CloudStack User Group Meetup MidoNet with scalable virtual router
 
Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...Detecting virtual machine co residency in cloud computing with active traffic...
Detecting virtual machine co residency in cloud computing with active traffic...
 

Ähnlich wie Symbian OS - Client Server Framework

Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
tamilmani1020
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
magicshui
 

Ähnlich wie Symbian OS - Client Server Framework (20)

Symbian OS - Platform Security
Symbian OS - Platform SecuritySymbian OS - Platform Security
Symbian OS - Platform Security
 
Symbian OS - Communication And Messaging
Symbian OS - Communication And MessagingSymbian OS - Communication And Messaging
Symbian OS - Communication And Messaging
 
Java ME - 01 - Overview
Java ME - 01 - OverviewJava ME - 01 - Overview
Java ME - 01 - Overview
 
Introduction To AMF
Introduction To AMFIntroduction To AMF
Introduction To AMF
 
Dot net Introduction and their usabilities
Dot net Introduction and  their usabilitiesDot net Introduction and  their usabilities
Dot net Introduction and their usabilities
 
Symbian OS - Quick Start
Symbian OS - Quick StartSymbian OS - Quick Start
Symbian OS - Quick Start
 
Mina2
Mina2Mina2
Mina2
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01Windows Server 2008 R2 Dev Session 01
Windows Server 2008 R2 Dev Session 01
 
Usenix Invited Talk
Usenix Invited TalkUsenix Invited Talk
Usenix Invited Talk
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
 
Symbian Os Introduction
Symbian Os IntroductionSymbian Os Introduction
Symbian Os Introduction
 
As Pdotnet
As PdotnetAs Pdotnet
As Pdotnet
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
WIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s newsWIndows Embedded Compact 2013 – What’s news
WIndows Embedded Compact 2013 – What’s news
 
Symbian OS - Multimedia Framework
Symbian OS - Multimedia FrameworkSymbian OS - Multimedia Framework
Symbian OS - Multimedia Framework
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Search1 Win7 For Devs Fund Search
1 Win7 For Devs Fund Search
 
Tcp performance Final Report
Tcp performance Final Report Tcp performance Final Report
Tcp performance Final Report
 

Mehr von Andreas Jakl

Mehr von Andreas Jakl (20)

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented Reality
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with Unity
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App Management
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSON
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - Introduction
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web Technologies
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer Training
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App Scenarios
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Symbian OS - Client Server Framework

  • 1. Symbian OS Client-Server Framework v2.0a – 29 April 2008 1 Andreas Jakl, 2008
  • 2. Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Symbian OS courses at the University of Applied Sciences in Hagenberg, Austria ( http://www.fh-hagenberg.at/ ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. Parts of these materials are based on information from Symbian Press-books published by John Wiley & Sons, Ltd. This document contains copyright materials which are proprietary to Symbian, UIQ, Nokia and SonyEricsson. “S60™” is a trademark of Nokia. “UIQ™” is a trademark of UIQ Technology. Pictures of mobile phones or applications are copyright their respective manufacturers / developers. “Symbian ™”, “Symbian OS ™” and all other Symbian-based marks and logos are trademarks of Symbian Software Limited and are used under license. © Symbian Software Limited 2006. Andreas Jakl, 2008 2
  • 3. Contents Client-Server Framework Architecture Message Passing Servers and Sessions Andreas Jakl, 2008 3 Colour coding used in these slides: Client Server Kernel
  • 4. Client-Server Framework Theory of the … Andreas Jakl, 2008 4
  • 5. Client-Server Pattern Client makes use of services provided by a server Server: Receives request messages from its clients Handles requests (synchronously or asynchronously) Andreas Jakl, 2008 5 Client Server Messages
  • 6. Client-Server Architecture Most of the system services in Symbian OS are client-server-based Examples: Window Server (UI, keypad) File Server Socket Server Telephony Server Andreas Jakl, 2008 6
  • 7. Advantages: Plugins Extensibility: Plug-in modules for globally available new object types (e.g. new multimedia codecs, …) Andreas Jakl, 2008 7 File Server Local file system Flash filing system Sockets Server Infrared protocols TCP/IP SMS
  • 8. Advantages Efficiency Multiple clients use a single server Security Server/Client in different threads (usually also different processes). Communication through messages client can not “crash” server Asynchronous Server uses Active Objects for return messages. No polling needed  good for our battery! Andreas Jakl, 2008 8
  • 9. Structure – Example Andreas Jakl, 2008 9 myApp.exe Client Links efsrv.lib, uses API-methods like:RFs::Connect() Client-sideFile Server implementation efsrv.dll Client-Servercommunication (via Kernel) Process Boundary efile.exe File Server
  • 10. R-type Classes For client-side implementation R: Owns external Resource handle (e.g. handle to a server session) Resource allocation: usually Open(), Create() or Initialize() Deallocation: usually Close() or Reset() The destructor doesn’t do it – most of the times, there is no destructor App. should release the resource as soon as possible Can be instantiated on the stack (automatic variable) or on the heap (instance variable) Andreas Jakl, 2008 10
  • 11. Examplecode Andreas Jakl, 2008 11 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs); // file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
  • 12. Session Session = Communication channel between client and server Initiated by a client Kernel creates server-side representation Messages between client / server mediated by kernel Only onesynchronous request may be submitted at a time ... but multipleasynchronous requests may be outstanding Andreas Jakl, 2008 12
  • 13. Client-side Representation Server is usually accessible through a public client class Handles details of establishing a session with its server Sends commands to the server Handles receiving responses Derives from RSessionBase  Hides implementation details of the private client-server communication protocol Example: Simple functions RFs::Delete() or RFs::GetDir() communicate with the file server and hide the more complex client-server communication protocol Andreas Jakl, 2008 13
  • 14. Communication Andreas Jakl, 2008 14 Calls functions from the base class Establishsession Own, privateprotocol Disconnect
  • 15. Communication Send data between processes: Message Passing: Used in all cases Inter-process communication (IPC): For large data packets, if needed Andreas Jakl, 2008 15 Kernel Client Server Process Boundary
  • 16. Messages [1] Clients send messages to servers Each message is a request for a service Server processes request Performs work on behalf of the client Optionally sends a reply to the client Messages can be sent: synchronously, or asynchronously Andreas Jakl, 2008 16
  • 17. Messages [2] Request message: Consists of five 32-bit numbers Function number Four 32-bit parameters Each of the four parameters can be: An integer (TInt) A pointer to a flat data structure, wrapped as a Symbian OS descriptor ( read using IPC) Andreas Jakl, 2008 17
  • 18. MessagePassing Andreas Jakl, 2008 18 Server Client four 32-bit parameters x=RXxxSession::Foo(a,b,c) foo a b c - ServiceL(RMessage2 aMessage) Server processes the request... aMessage.Complete(x) x
  • 19. Inter-ProcessCommunication Andreas Jakl, 2008 19 Server Client y=RXxxSession::Bar(a,b,c) bar p &q &r - ServiceL(RMessage1 aMessage) q aMessage.ReadL() r aMessage.WriteL() aMessage.Complete(y) y
  • 20. Request-Handling Andreas Jakl, 2008 20 “2” – Symbian OS 9: Capability-Support Client Server RSessionBaseSendReceive() Functions for the client, converts requests to parameters CSession2ServiceL() Handling of requests, represents session server-side CServer2 (Active Obj)RunL() Receives requests, forward to corresponding session RMessage2Complete() For client/server data transfer DSessionLinks Client/Server, Cleanup Kernel
  • 21. Server Lifetime Three options: System Server: Started with the mobile phone, essential for the OS (e.g. File Server, Window Server). Unexpected termination usually forces phone reboot. Application / Transient Server: Started on request of an application, closed when last client disconnects.If a second client starts a new server, no error is produced, existing server instance is used. Other Servers: Started and closed with an individual application. If used by multiple applications: each app. has its own private instance; e.g. POSIX server. Andreas Jakl, 2008 21
  • 22. Server Lifetime Andreas Jakl, 2008 22 System System server connect disconnect Application 1 connect disconnect App. server connect disconnect Application 2 Other server
  • 23. Processes & Servers 23 Same-processservers Privilegedcode Fixedprocesses ekern.exe(privileged)Kernelserver efsrv.exe(fixed)File server ewsrv.exe(fixed)Windowserver fbsrv.exe(fixed)Font & bitmapserver c32exe.exe(fixed)Comms, Sockets, Telephonyservers app1.exe Application xxx.exe…server edbsrv.exeDBMS server app2.exe Application app3.exe Application Private server Ordinaryapplications Ordinaryservers Private server Andreas Jakl, 2008
  • 24. Sessions Andreas Jakl, 2008 24 Server thread Server can serve multiple clients A client can have multiple sessions with a server Each session requires resources Server CServer2 Server side session CSession2 Server side session CSession2 Server side session CSession2 Client side session RSessionBase Client side session RSessionBase Client side session RSessionBase Client 1 (thread) Client 2 (thread)
  • 25. Subsessions Solution: SubSessions e.g. File Server: One Session per Client (RFs), multiple files represent SubSessions (RFile)  no new session for every single file! Andreas Jakl, 2008 25 Server thread Server CServer2 Server side session CSession2 Client side session RSessionBase Subsession RSubSessionBase Subsession RSubSessionBase Client (thread)
  • 26. API Example Andreas Jakl, 2008 26 class RFs : public RSessionBase {...} class RFsBase : public RSubSessionBase {...} class RFile : public RFsBase { public: IMPORT_C TInt Open(RFs& aFs, const TDesC& aName, TUintaFileMode); IMPORT_C TInt Read(TDes8& aDes) const; IMPORT_C void Read(TDes8& aDes, TRequestStatus& aStatus) const; IMPORT_C TInt Write(const TDesC8& aDes); IMPORT_C void Write(const TDesC8& aDes, TRequestStatus& aStatus); [...] };
  • 27. Examplecode (Revisited) Andreas Jakl, 2008 27 // Establishconnectiontofile-server RFsfs; User::LeaveIfError(fs.Connect());CleanupClosePushL(fs); // Submit a requesttotheserver _LIT(KIniFile, „c:myini.ini“); User::LeaveIfError(fs.Delete(KIniFile)); // Create a subsession RFilefile; User::LeaveIfError(file.Create(fs, KIniFile, EFileRead | EFileWrite |EFileShareExclusive)); CleanupClosePushL(file); // Submit a requestusingthesubsession TBuf8<32> buf; User::LeaveIfError(file.Read(buf)); // Cleanup CleanupStack::PopAndDestroy(2, &fs); // file, fs Whendeleting: closeconnection to theserver (call Close()) WrapperforRSubSessionBase::SendReceive()
  • 28. Performance Communication: Overhead through thread / process context switches Inter-process data transfer requires mapping client data area to server’s virtual address space Best practice: Transfer a large amount of data in a single transaction instead of performing a number of server accesses Example: Most Symbian OS components don’t use RFile::Read() / Write() directly, but instead use buffered streams (RReadStream() / RWriteStream()) Andreas Jakl, 2008 28
  • 29. Is a Server Required? Need to share functionality or resources across a number of threads or processes? Require isolation between service provider and service user? Pre-emptive asynchronous processing desirable? Gains outweigh costs? Andreas Jakl, 2008 29
  • 30. ASD-like Question – Easy Which of the following statements correctly describe the client-server model in Symbian OS? A. A client and server always execute in separate threads. B. A client and server always execute in separate processes. C. A client initiates a server request by passing an integer to identify the request. It then sends any “payload” data separately. D. To return data to a client, the server writes directly into the client’s address space. E. At any time, there can only be one outstanding synchronous client request to a server. Andreas Jakl, 2008 30 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 31. Solution A. Correct. B. Incorrect. Most servers are executed in an own process, but it is not required. C.Incorrect. The data is sent together with the function request as a parameter. D. Incorrect. The return values are sent using a message object. E. Correct. Andreas Jakl, 2008 31
  • 32. ASD-like Question – Medium For which of the following scenarios would a developer choose to implement a client and server on Symbian OS? A. To provide utility code, such as a 3D graphics library. B. To implement a system-wide “broadcast” notification system. C. To manage access to a hardware resource, such as the camera. D. To implement a Bluetooth game where the host player runs as a server and all other players are clients. E. To implement a user interface application for displaying weather information. Andreas Jakl, 2008 32 Copyright Meme Education, 2006 http://www.meme-education.com/
  • 33. Solution A. Incorrect. The performance overhead would be too high. B. Correct. C.Correct. D. Incorrect. This has nothing to do with the client/server communication within Symbian OS. E. Incorrect. UI and application logic should be separated, but rather by using DLLs instead of implementing client/server communication. Andreas Jakl, 2008 33
  • 34. Thanks for your attention That’s it! Andreas Jakl, 2008 34