|
1 // Copyright (c) 1997-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 "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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__SS_CONNSELECT_H__) |
|
17 #define __SS_CONNSELECT_H__ |
|
18 |
|
19 #include <ss_select.h> |
|
20 #include <comms-infras/ss_mcprnodemessages.h> |
|
21 #include <comms-infras/ss_platsec_apiext.h> |
|
22 #include <comms-infras/ss_nodemessages_serviceprovider.h> |
|
23 |
|
24 namespace ESock |
|
25 { |
|
26 |
|
27 class CSelectionRequest : public CBase, |
|
28 public Messages::ASimpleNodeIdBase, |
|
29 public MPlatsecApiExt, |
|
30 protected NetInterfaces::TInterfaceControl, |
|
31 public ITFHIERARCHY_1(CSelectionRequest,MPlatsecApiExt) |
|
32 |
|
33 /** |
|
34 Connection selection request. |
|
35 |
|
36 @internalTechnology |
|
37 */ |
|
38 { |
|
39 public: |
|
40 typedef ITFHIERARCHY_1(CSelectionRequest,MPlatsecApiExt) TIfStaticFetcherNearestInHierarchy; |
|
41 |
|
42 public: |
|
43 static CSelectionRequest* NewL(const Messages::TRuntimeCtxId& aRequestingClient, const Messages::TNodeId& aTierManagerId); |
|
44 virtual ~CSelectionRequest(); |
|
45 |
|
46 void Select(const TSelectionPrefs& aSelectionPreferences); |
|
47 void SelectConnPrefList(const RConnPrefList& aConnPrefList); |
|
48 void Provision(const Meta::SMetaData* aProvisionConfig); |
|
49 void Cancel(); //Cancels all active requests |
|
50 |
|
51 void JoinComplete(const Messages::TNodeId& aSender, TCFPeer::TJoinComplete& aCFMessage); |
|
52 void CommsBinderResponse(const TCFServiceProvider::TCommsBinderResponse& aMsg); |
|
53 void SelectComplete(const Messages::TNodeId& aSenderId, const Messages::TNodeId& aMcprId, const TProviderInfo& aMcprInfo); |
|
54 |
|
55 // from MPlatsecApiExt |
|
56 virtual TInt SecureId(TSecureId& aResult) const; |
|
57 virtual TInt VendorId(TVendorId& aResult) const; |
|
58 virtual TBool HasCapability(const TCapability aCapability) const; |
|
59 virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy) const; |
|
60 |
|
61 void ReturnInterfacePtrL(MPlatsecApiExt*& aInterface); |
|
62 virtual NetInterfaces::TInterfaceControl* FetchNodeInterfaceControlL(TInt aInterfaceId); |
|
63 |
|
64 protected: |
|
65 explicit CSelectionRequest(const Messages::TRuntimeCtxId& aRequestingClient, const Messages::TNodeId& aTierManagerId); |
|
66 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
67 |
|
68 private: |
|
69 TInt FindActiveRequest(const Messages::TRuntimeCtxId& aMcprId); |
|
70 void HandleProviderSelection(const Messages::TNodeId& aMcprId); |
|
71 void ProviderSelectionFinished(const Messages::TRuntimeCtxId& aMcprId); //Our selection request (SP or SNL) has been fully served -> SelectComplete(NULL). |
|
72 void SelectionFinished(); //The whole selection has finished. |
|
73 void PostError(const Messages::TNodeSignal::TMessageId& aMessageId, TInt aError); |
|
74 void InitialiseDestroy(); |
|
75 |
|
76 private: |
|
77 void SelectionError(const Messages::TRuntimeCtxId& aSenderId, TInt aError); //Selection error |
|
78 void CommsBinderRequestError(const Messages::TRuntimeCtxId& aSenderId, Messages::TEBase::TError& aCFMessage); //CommsBinderRequest returned error |
|
79 |
|
80 private: |
|
81 enum {EIdle = 0x00, ESelecting = 0x01, ECancelling = 0x02, ERequestingCommsBinder = 0x04}; //Selection Status |
|
82 TInt iOriginalError; |
|
83 TSelectionPrefs iSelectionPreferences; |
|
84 Messages::TNodeId iTierManagerId; |
|
85 Messages::TNodeId iTopMcprId; |
|
86 TProviderInfo iTopMcprInfo; |
|
87 Messages::RNodeInterface iRequestingNode; |
|
88 Messages::RRequestOriginator iRequest; |
|
89 RArray<Messages::RNodeInterface> iActiveRequests; //List of all service providers (mcprs) currently processing our selection requests |
|
90 TUint iSelectionStatus : 4; |
|
91 TUint iDestroying : 1; |
|
92 TUint iJoined : 1; |
|
93 ASubSessionPlatsecApiExt* iPlatsecApiExt; |
|
94 const Meta::SMetaData* iProvision; |
|
95 RConnPrefList iConnPrefList; |
|
96 }; |
|
97 |
|
98 } //namespace ESock |
|
99 |
|
100 |
|
101 #endif //__SS_CONNSELECT_H__ |
|
102 |