datacommsserver/esockserver/inc/ss_flowrequest.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     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 /**
       
    17  @file
       
    18  @internalTechnology
       
    19  @released
       
    20 */
       
    21 
       
    22 #if !defined(__SS_FLOWREQUEST_H__)
       
    23 #define __SS_FLOWREQUEST_H__
       
    24 
       
    25 #include <comms-infras/ss_nodemessages_internal.h>
       
    26 #include <comms-infras/ss_nodemessages.h>
       
    27 #include <comms-infras/ss_mmnode.h>
       
    28 #include <comms-infras/ss_platsec_apiext.h>
       
    29 #include <comms-infras/ss_common.h>
       
    30 #include <cs_subconparams.h>
       
    31 
       
    32 #include <elements/nm_messages_internal.h>
       
    33 
       
    34 
       
    35 
       
    36 class CSockSession;
       
    37 namespace ESock
       
    38 {
       
    39 
       
    40 //
       
    41 //CFlowRequest
       
    42 NONSHARABLE_CLASS(CFlowRequest) : public CBase,
       
    43 	                              public ACFMMNodeIdBase,
       
    44                                   public ASubSessionPlatsecApiExt,
       
    45 	                              public ITFHIERARCHY_LINK_1(CFlowRequest, MeshMachine::AMMNodeBase, MPlatsecApiExt)
       
    46 
       
    47 	{
       
    48 public:
       
    49 	typedef ITFHIERARCHY_LINK_1(CFlowRequest, MeshMachine::AMMNodeBase, MPlatsecApiExt) TIfStaticFetcherNearestInHierarchy;
       
    50 
       
    51 public:
       
    52 	static CFlowRequest* NewL(TSubSessionUniqueId aSubSessionUniqueId);
       
    53 
       
    54     virtual ~CFlowRequest();
       
    55     void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
       
    56 
       
    57 	void ReturnInterfacePtrL(MPlatsecApiExt*& aInterface);
       
    58 
       
    59 protected:
       
    60 	void Received(MeshMachine::TNodeContextBase& aContext);
       
    61 
       
    62 public:
       
    63 	CFlowRequest(TSubSessionUniqueId aSubSessionUniqueId);
       
    64 	RCFParameterFamilyBundleC iFlowParameters;
       
    65 	};
       
    66 
       
    67 //
       
    68 //CImplicitFlowRequest - specialised for implicit
       
    69 NONSHARABLE_CLASS(CImplicitFlowRequest) : public CFlowRequest
       
    70 	{
       
    71 public:
       
    72 	~CImplicitFlowRequest();
       
    73 
       
    74 	static CImplicitFlowRequest* NewL(TSubSessionUniqueId aSubSessionUniqueId, const Messages::TNodeId& aTierManagerFC, TUid aTierId);
       
    75 
       
    76 public:
       
    77 	Messages::TNodeId iTierManagerFC;
       
    78 	Messages::TNodeId iCSR;
       
    79 	TUid iTierId;
       
    80 	
       
    81 protected:
       
    82 	CImplicitFlowRequest(TSubSessionUniqueId aSubSessionUniqueId, const Messages::TNodeId& aTierManagerFC, TUid aTierId);
       
    83 	};
       
    84 
       
    85 //
       
    86 //TCFFlowRequestBase
       
    87 struct TCFFlowRequestBase : public Messages::TSelfDispatcherAndErrorHandler
       
    88 	{
       
    89 protected:
       
    90 	TCFFlowRequestBase(TSubSessionUniqueId aSubSessionUniqueId);
       
    91 	TCFFlowRequestBase(TSubSessionUniqueId aSubSessionUniqueId, TFlowParams& aFlowParams) :
       
    92 		iSubSessionUniqueId(aSubSessionUniqueId),
       
    93 		iFlowParams(aFlowParams)
       
    94 		{}
       
    95 	TCFFlowRequestBase(TFlowParams& aFlowParams) :
       
    96 		iFlowParams(aFlowParams)
       
    97 		{}
       
    98 	TCFFlowRequestBase()
       
    99 		{
       
   100 		}
       
   101 
       
   102 protected:
       
   103 	DATA_VTABLE
       
   104 
       
   105 protected:
       
   106 	TSubSessionUniqueId iSubSessionUniqueId;
       
   107 	TFlowParams iFlowParams;
       
   108 	};
       
   109 
       
   110 //
       
   111 //TCFImplicitFlowRequest
       
   112 NONSHARABLE_STRUCT(TCFImplicitFlowRequest) : public TCFFlowRequestBase
       
   113 	{
       
   114 public:
       
   115 	explicit TCFImplicitFlowRequest(
       
   116 		TSubSessionUniqueId aSubSessionUniqueId,
       
   117 		TFlowParams& aFlowParams)
       
   118 		:	TCFFlowRequestBase(aSubSessionUniqueId, aFlowParams)
       
   119 		{
       
   120 		}
       
   121 	TCFImplicitFlowRequest(TFlowParams& aFlowParams)
       
   122 		: TCFFlowRequestBase(aFlowParams)
       
   123 		{
       
   124 		}
       
   125 protected:
       
   126 	void StartL(const Messages::TNodeId& aSender, const Messages::ANode& aItf);
       
   127 	void DispatchL(const Messages::TRuntimeCtxId& aSender, const Messages::TRuntimeCtxId& aRecipient);
       
   128 	TCFImplicitFlowRequest()
       
   129 	:	TCFFlowRequestBase()
       
   130 		{
       
   131 		}
       
   132 public:
       
   133 	DATA_VTABLE
       
   134     DECLARE_MVIP_CTR(TCFImplicitFlowRequest)
       
   135 	};
       
   136 
       
   137 //
       
   138 //TCFConnFlowRequest
       
   139 NONSHARABLE_STRUCT(TCFConnFlowRequest) : public TCFFlowRequestBase
       
   140 	{
       
   141 public:
       
   142 	explicit TCFConnFlowRequest(
       
   143 		TSubSessionUniqueId aSubSessionUniqueId,
       
   144 		CSockSession& aSession,
       
   145 		TUint aHandle,
       
   146 		TFlowParams& aFlowParams
       
   147 		)
       
   148 	:	TCFFlowRequestBase(aSubSessionUniqueId, aFlowParams),
       
   149 		iSession(&aSession),
       
   150 		iHandle(aHandle)
       
   151 		{
       
   152 		}
       
   153 
       
   154 	explicit TCFConnFlowRequest(TSubSessionUniqueId aSubSessionUniqueId, CSockSession& aSession, TUint aHandle)
       
   155 	:	TCFFlowRequestBase(aSubSessionUniqueId),
       
   156 		iSession(&aSession),
       
   157 		iHandle(aHandle)
       
   158 		{
       
   159 		}
       
   160 
       
   161 protected:
       
   162 	void StartL(const Messages::TNodeId& aSender);
       
   163 	void DispatchL(const Messages::TRuntimeCtxId& aSender, const Messages::TRuntimeCtxId& aRecipient);
       
   164 	TCFConnFlowRequest()
       
   165 	:	TCFFlowRequestBase()
       
   166 		{
       
   167 		}
       
   168 
       
   169 public:
       
   170     CSockSession* iSession;
       
   171     TUint iHandle;
       
   172 public:
       
   173 	DATA_VTABLE
       
   174     DECLARE_MVIP_CTR(TCFConnFlowRequest)
       
   175 	};
       
   176 
       
   177 //
       
   178 //TCFSubConnFlowRequest
       
   179 NONSHARABLE_STRUCT(TCFSubConnFlowRequest) : public TCFFlowRequestBase
       
   180 	{
       
   181 public:
       
   182 	explicit TCFSubConnFlowRequest(TSubSessionUniqueId aSubSessionUniqueId, CSockSession& aSession, TUint aHandle,
       
   183 		TFlowParams& aFlowParams)
       
   184 	:	TCFFlowRequestBase(aSubSessionUniqueId, aFlowParams),
       
   185 		iSession(&aSession),
       
   186 		iHandle(aHandle)
       
   187 		{
       
   188 		}
       
   189 
       
   190 	explicit TCFSubConnFlowRequest(TSubSessionUniqueId aSubSessionUniqueId, CSockSession& aSession, TUint aHandle)
       
   191 	:	TCFFlowRequestBase(aSubSessionUniqueId),
       
   192 		iSession(&aSession),
       
   193 		iHandle(aHandle)
       
   194 		{
       
   195 		}
       
   196 
       
   197 protected:
       
   198 	void StartL(const Messages::TNodeId& aSender);
       
   199 	void DispatchL(const Messages::TRuntimeCtxId& aSender, const Messages::TRuntimeCtxId& aRecipient);
       
   200 	TCFSubConnFlowRequest()
       
   201 	:	TCFFlowRequestBase()
       
   202 		{
       
   203 		}
       
   204 
       
   205 public:
       
   206     CSockSession* iSession;
       
   207     TUint iHandle;
       
   208 
       
   209 public:
       
   210 	DATA_VTABLE
       
   211     DECLARE_MVIP_CTR(TCFSubConnFlowRequest)
       
   212 	};
       
   213 
       
   214 
       
   215 // aggregate class for ipc subsessions which request flows
       
   216 NONSHARABLE_CLASS(AIPCFlowRequester)
       
   217 	{
       
   218 public:
       
   219 	AIPCFlowRequester() : iIsFlowRequestPending(EFalse) {}
       
   220 
       
   221 	void SetFlowRequestPending(TBool aPending)
       
   222 		{
       
   223 		iIsFlowRequestPending = aPending;
       
   224 		}
       
   225 
       
   226 	TBool FlowRequestPending()
       
   227 		{
       
   228 		return iIsFlowRequestPending;
       
   229 		}
       
   230 
       
   231 	void AdoptFlowRequestMessage(const RMessage2& aFlowRequestMessage)
       
   232 		{
       
   233 		iFlowRequestMessage.Adopt(static_cast<Den::RSafeMessage&>(const_cast<RMessage2&>(aFlowRequestMessage)));
       
   234 		}
       
   235 
       
   236 	void CompleteFlowRequestMessage(TInt err)
       
   237 		{
       
   238 		iFlowRequestMessage.Complete(err);
       
   239 		iFlowRequestMessage.ResetHandle();
       
   240 		}
       
   241 
       
   242 protected:
       
   243 	Den::RSafeMessage iFlowRequestMessage;
       
   244 	TBool iIsFlowRequestPending;
       
   245 	};
       
   246 
       
   247 } // namespace ESock
       
   248 
       
   249 #endif
       
   250 // __SS_FLOWREQUEST_H__
       
   251 
       
   252