Update contrib.
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <ups/promptrequest.h>
21 using namespace UserPromptService;
23 EXPORT_C CPromptRequest* CPromptRequest::NewL(
24 const TSecureId& aClientSid, const TVendorId& aClientVid, const TThreadId& aClientThreadId, TProcessId &aClientProcessId,
25 const TSecureId& aServerSid, const TServiceId& aServiceId, RBuf& aDestination, RBuf8& aOpaqueData,
26 TBool aSecurityResult)
28 Creates a new prompt request object.\n
30 The ownership of the aDestination and aOpaqueData RBufs is transfered
31 to this class. The callers RBufs will be empty after this call.
34 @param aClientSid The SID of the client process requesting the service.
35 @param aClientVid The VID of the client process requesting the service.
36 @param aClientThreadId The id of the thread within the client process requesting the service.
37 @param aServerSid The SID of the system server that provides the service.
38 @param aServiceId The UID of the requested service.
39 @param aDestination The data that the service acts on E.g. A phone number, IAP, domain name
40 @param aOpaqueData Opaque data structure populated by the system server. Typically, this
41 contains extra information about the requested service.
42 @param aSecurityResult ETrue if client passed system server's security check; otherwise, EFalse.
44 @return A pointer to the new prompt request object.
47 CPromptRequest* self = CPromptRequest::NewLC(
48 aClientSid, aClientVid, aClientThreadId, aClientProcessId,
49 aServerSid, aServiceId, aDestination, aOpaqueData, aSecurityResult);
50 CleanupStack::Pop(self);
54 EXPORT_C CPromptRequest* CPromptRequest::NewLC(
55 const TSecureId& aClientSid, const TVendorId& aClientVid, const TThreadId& aClientThreadId, TProcessId &aClientProcessId,
56 const TSecureId& aServerSid, const TServiceId& aServiceId, RBuf& aDestination, RBuf8& aOpaqueData,
57 TBool aSecurityResult)
59 Creates a new prompt request object and places the pointer on the cleanup stack.\n
61 The ownership of the aDestination and aOpaqueData RBufs is transfered
62 to this class. The callers RBufs will be empty after this call.
64 @param aClientSid The SID of the client process requesting the service.
65 @param aClientVid The VID of the client process requesting the service.
66 @param aClientThreadId The id of the thread within the client process requesting the service.
67 @param aServerSid The SID of the system server that provides the service.
68 @param aServiceId The UID of the requested service.
69 @param aDestination The data that the service acts on E.g. A phone number, IAP, domain name
70 @param aOpaqueData Opaque data structure populated by the system server. Typically, this
71 contains extra information about the requested service.
72 @param aSecurityResult ETrue if client passed system server's security check; otherwise, EFalse.
74 @return A pointer to the new prompt request object.
77 CPromptRequest* self = new(ELeave)
78 CPromptRequest(aClientSid, aClientVid, aClientThreadId, aClientProcessId,
79 aServerSid, aServiceId, aDestination, aOpaqueData, aSecurityResult);
80 CleanupStack::PushL(self);
84 CPromptRequest::CPromptRequest(
85 const TSecureId& aClientSid, const TVendorId& aClientVid, const TThreadId& aClientThreadId, TProcessId &aClientProcessId,
86 const TSecureId& aServerSid, const TServiceId& aServiceId,
87 RBuf& aDestination, RBuf8& aOpaqueData,
88 TBool aSecurityResult)
91 @param aClientSid The client's SID
92 @param aClientVid The client's VID
93 @param aClientThreadId The client's thread id.
94 @param aServerId The system server's SID.
95 @param aServiceId The id of the service.
96 @param aDestination The destination.
97 @param aOpaqueData The opaque data.
98 @param aSecurityResult Whether the client passed the system server's security check
100 : iClientSid(aClientSid), iClientVid(aClientVid), iClientThreadId(aClientThreadId), iClientProcessId(aClientProcessId),
101 iServerSid(aServerSid), iServiceId(aServiceId),
102 iSecurityResult(aSecurityResult)
104 iDestination.Close();
105 iDestination.Swap(aDestination);
107 iOpaqueData.Swap(aOpaqueData);
110 EXPORT_C const TSecureId& CPromptRequest::ClientSid() const
112 Gets the SID of the client process requesting the service.
113 @return The client's SID.
119 EXPORT_C TBool CPromptRequest::IsClientSidProtected() const
121 Determines whether the SID of the client process is in the protected range.
122 If the SID is not protected then it is likely that identify of the client process
123 cannot reliable verified because it may an unsigned application. If so, a warning
124 should be displayed in the prompt dialog.
126 @return ETrue if the SID is in the protected range; otherwise EFalse is returned.
129 return ! (iClientSid.iId & 0x80000000);
132 EXPORT_C const TVendorId& CPromptRequest::ClientVid() const
134 Gets the VID of the client process requesting the service.
135 @return The client's VID.
141 EXPORT_C const TThreadId& CPromptRequest::ClientThreadId() const
143 Gets the TThreadId of the client which issued the request to the system server.
144 This thread ID may be invalid if the thread has exited (we do NOT hold an open RThread to keep around).
145 @return The client's thread id.
148 return iClientThreadId;
151 EXPORT_C const TProcessId& CPromptRequest::ClientProcessId() const
153 Gets the TProcessId of the client which issued the request to the system server.
154 This process ID may be invalid if the process has exited (we do NOT hold an open RProcess to keep around).
155 @return The client's process id.
158 return iClientProcessId;
161 EXPORT_C const TSecureId& CPromptRequest::ServerSid() const
163 Gets the SID of the system server that provides the service.
164 @return The system server's SID.
170 EXPORT_C const TServiceId& CPromptRequest::ServiceId() const
172 Gets the UID of the requested service.
173 @return The service UID.
179 EXPORT_C const TDesC& CPromptRequest::Destination() const
181 Gets the data that the service acts on e.g. the phone number to dial.
182 @return A reference to a descriptor containing the destination string.
188 EXPORT_C const TDesC8& CPromptRequest::OpaqueData() const
190 Gets the opaque data structure provided by the system server.
191 @return A reference to a descriptor containing the opaque data.
197 EXPORT_C TBool CPromptRequest::SecurityResult() const
199 Whether the client processed the system server's security check.
200 @return ETrue, if the client process passed the system server's
201 security check; otherwise, EFalse is returned.
204 return iSecurityResult;
207 CPromptRequest::~CPromptRequest()
212 iDestination.Close();