datacommsserver/esockserver/inc/ss_nodemessages_internal.h
changeset 0 dfb7c4ff071f
child 14 8b5d60ce1e94
child 16 d3f948f1301a
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2008-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 */
       
    20 
       
    21 #ifndef __SS_NODEMESSAGES_INTERNAL_H__
       
    22 #define __SS_NODEMESSAGES_INTERNAL_H__
       
    23 
       
    24 #include <comms-infras/ss_nodemessages.h>
       
    25 #include <es_enum.h>
       
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <es_enum_partner.h>
       
    28 #endif
       
    29 
       
    30 #include <elements/nm_address.h>
       
    31 #include <elements/nm_messages_base.h>
       
    32 #include <comms-infras/ss_common.h>
       
    33 #include <comms-infras/ss_logext.h>
       
    34 
       
    35 class CSockManData; //must be seen in global namespace before being a friend in ESock namespace
       
    36 //otherwise silly compiler confused since it interprets friend class as a forward declaration
       
    37 //for no reason
       
    38 
       
    39 class CParameterBundleBase;
       
    40 
       
    41 namespace Messages
       
    42 {
       
    43 	class RNodeInterface;
       
    44 }
       
    45 
       
    46 namespace ESock
       
    47 {
       
    48 class MPlatsecApiExt;
       
    49 class CCommsFactoryBase;
       
    50 
       
    51 class CMetaConnectionProviderFactoryBase;
       
    52 
       
    53 
       
    54 struct TFlowParams
       
    55 /** Conveys attributes of a flow request
       
    56 */
       
    57 	{
       
    58 	enum TFlowRequestType
       
    59 		{
       
    60 		EImplicit, EExplicitSubConnection, EExplicitConnection
       
    61 		};
       
    62 
       
    63 	explicit TFlowParams(
       
    64 		TInt aAddrFamily,
       
    65 		TInt aSocketType,
       
    66 		TInt aProtocol,
       
    67 		TInt aFlowRequestType,
       
    68 		TAny* aSessionProxy,
       
    69 		TBool aFlowLoadsProtocol = ETrue
       
    70 		) :
       
    71 			iAddrFamily(aAddrFamily),
       
    72 			iSocketType(aSocketType),
       
    73 			iProtocol(aProtocol),
       
    74 			iFlowRequestType(aFlowRequestType),
       
    75 			iSessionProxy(aSessionProxy),
       
    76 			iFlowLoadsProtocol(aFlowLoadsProtocol) {}
       
    77 
       
    78 	explicit TFlowParams() :
       
    79 		iAddrFamily(NULL), iSocketType(NULL), iProtocol(NULL),
       
    80 		iFlowRequestType(NULL), iSessionProxy(NULL), iFlowLoadsProtocol(ETrue) {}
       
    81 
       
    82 	TInt iAddrFamily;
       
    83 	TInt iProtocol;
       
    84 	TInt iSocketType;
       
    85 	TInt iFlowRequestType;
       
    86 	TAny* iSessionProxy;
       
    87 	TBool iFlowLoadsProtocol;
       
    88 	};
       
    89 
       
    90 
       
    91 /**
       
    92 @internalTechnology
       
    93 Special Meta Type to increase refcount on RMetaExtensionContainers when they are posted.
       
    94 Relies on fact that one serialisation will occur per post.
       
    95 */
       
    96 NONSHARABLE_CLASS(TMetaExtensionContainerMetaType) : public Meta::MMetaType
       
    97 	{
       
    98 public:
       
    99 	inline static Meta::MMetaType* NewL(const TAny* aMem, const TAny* aData)
       
   100 		{
       
   101 		return ::new ((TUint8*)aMem) TMetaExtensionContainerMetaType(reinterpret_cast<const RMetaExtensionContainerC*>(aData));
       
   102 		}
       
   103 
       
   104 	inline virtual TInt Load(TPtrC8& aBuffer)
       
   105 		{
       
   106 		TInt len = Length();
       
   107 		if (aBuffer.Length() < len)
       
   108 			{
       
   109 			return KErrArgument;
       
   110 			}
       
   111 		Mem::Copy(const_cast<RMetaExtensionContainerC*>(iData), aBuffer.Ptr(), len);
       
   112 		aBuffer.Set(aBuffer.Ptr()+len, aBuffer.Length()-len); //update pointer
       
   113 		return KErrNone;
       
   114 		}
       
   115 
       
   116 	inline virtual TInt Store(TDes8& aBuffer) const
       
   117 		{
       
   118 		const_cast<RMetaExtensionContainerC*>(iData)->Open();
       
   119 		TInt len = Length();
       
   120 		if (aBuffer.MaxLength() - aBuffer.Length() < len)
       
   121 			{
       
   122 			return KErrOverflow;
       
   123 			}
       
   124 		aBuffer.Append((TUint8*)iData, len);
       
   125 		return KErrNone;
       
   126 		}
       
   127 
       
   128 	inline virtual void Copy(const TAny* aData)
       
   129 		{
       
   130 		Mem::Copy((TAny*)iData, aData, Length());
       
   131 		}
       
   132 
       
   133 	inline virtual TInt Length() const
       
   134 		{
       
   135 		return sizeof(RMetaExtensionContainerC);
       
   136 		}
       
   137 
       
   138 private:
       
   139 	inline TMetaExtensionContainerMetaType::TMetaExtensionContainerMetaType(const RMetaExtensionContainerC* aData)
       
   140 		: iData(aData)
       
   141 		{
       
   142 		__ASSERT_DEBUG(iData!=NULL, User::Panic(_L("RMECMeta"),KErrArgument));
       
   143 		}
       
   144 
       
   145 private:
       
   146 	const RMetaExtensionContainerC* iData;
       
   147 	};
       
   148 
       
   149 //
       
   150 // Signature classes
       
   151 //
       
   152 
       
   153 DECLARE_MESSAGE_SIG_1(SigConnectionInfo, TConnectionInfo, ConnectionInfo)
       
   154 DECLARE_MESSAGE_SIG_1(SigSubConNotification, CRefCountOwnedSubConNotification*, RefCountOwnedSubConNotification)
       
   155 DECLARE_MESSAGE_SIG_1(SigPlaneNotification, CRefCountOwnedNotification*, RefCountOwnedNotification)
       
   156 DECLARE_MESSAGE_SIG_1(SigSubConnOpenedEvent, TSubConnectionOpenedEvent, SubConnectionOpenedEvent)
       
   157 DECLARE_MESSAGE_SIG_1(SigSubConnClosedEvent, TSubConnectionClosedEvent, SubConnectionClosedEvent)
       
   158 DECLARE_MESSAGE_SIG_1(SigStateChange, Elements::TStateChange, StateChange)
       
   159 DECLARE_MESSAGE_SIG_1(SigFlowParams, TFlowParams, FlowParams)
       
   160 
       
   161 class CConnectionInfo;
       
   162 DECLARE_MESSAGE_SIG_1(SigConnectionInfoPtr, ESock::CConnectionInfo*, Ptr)
       
   163 
       
   164 #ifdef SYMBIAN_NETWORKING_UPS
       
   165 struct TPolicyCheckRequestParams
       
   166 /**
       
   167 Parameters passed in a TPolicyCheckRequest message
       
   168 */
       
   169 	{
       
   170 	inline TPolicyCheckRequestParams()
       
   171 		{ };
       
   172 
       
   173 	inline TPolicyCheckRequestParams(const TProcessId& aProcessId, const TThreadId& aThreadId, TInt aPlatSecResult,
       
   174 									 const TUpsDestinationAddr& aDestinationAddr, const TUpsDestinationAddrType& aDestinationAddrType)
       
   175 	  : iProcessId(aProcessId), iThreadId(aThreadId), iPlatSecResult(aPlatSecResult),
       
   176 	    iDestinationAddr(aDestinationAddr), iDestinationAddrType(aDestinationAddrType),
       
   177 	    iCommsId(Messages::TNodeId::NullId())
       
   178 	    
       
   179 		{ };
       
   180 
       
   181 	inline TPolicyCheckRequestParams(const TProcessId& aProcessId, const TThreadId& aThreadId, TInt aPlatSecResult,
       
   182 									 const TUpsDestinationAddr& aDestinationAddr, const TUpsDestinationAddrType& aDestinationAddrType, const Messages::TNodeId& aCommsId)
       
   183 		  : iProcessId(aProcessId), iThreadId(aThreadId), iPlatSecResult(aPlatSecResult),
       
   184 		    iDestinationAddr(aDestinationAddr), iDestinationAddrType(aDestinationAddrType), iCommsId(aCommsId)
       
   185 			{ };	    
       
   186 	    
       
   187 	TProcessId				iProcessId;
       
   188 	TThreadId				iThreadId;
       
   189 	TInt					iPlatSecResult;			// result of Platform Security policy check
       
   190 	TUpsDestinationAddr		iDestinationAddr;		// destination (e.g. IP address where available)
       
   191 	TUpsDestinationAddrType	iDestinationAddrType;	// form of iDestinationAddr (e.g. string, IP address etc)
       
   192 	Messages::TNodeId 		iCommsId;
       
   193 	};
       
   194 
       
   195 DECLARE_MESSAGE_SIG_1(SigUpsParameters, TPolicyCheckRequestParams, Params)
       
   196 
       
   197 struct TUPSStatusChangeParams
       
   198 /**
       
   199 Parameters passed in a UPS Status Change message
       
   200 */
       
   201 	{
       
   202 	inline TUPSStatusChangeParams()
       
   203 		{ };
       
   204 	
       
   205 	inline TUPSStatusChangeParams(const TProcessId& aProcessId, const TThreadId& aThreadId, const Messages::TNodeId& aCommsId)
       
   206 		  : iProcessId(aProcessId), iThreadId(aThreadId), iCommsId(aCommsId)
       
   207 			{ };	    
       
   208 	    
       
   209 	TProcessId				iProcessId;
       
   210 	TThreadId				iThreadId;
       
   211 	Messages::TNodeId 		iCommsId;
       
   212 	};
       
   213 
       
   214 DECLARE_MESSAGE_SIG_1(SigUpsStatusChangeParameters, TUPSStatusChangeParams, Params)
       
   215 #endif
       
   216 
       
   217 template<TInt id, TInt32 realm> struct TMessageSigSelectionPrefs;
       
   218 template<TInt id, TInt32 realm> struct TCFMessageSigConnPrefList;
       
   219 template<TInt id, TInt32 realm> struct TMessageSigSelectComplete;
       
   220 template<TInt id, TInt32 realm> struct TCFMessageTransportHookError;
       
   221 
       
   222 
       
   223 //any new enum added here needs to go into one of the utracedecoder definition files
       
   224 //NEVER INSERT ANYTHING IN HERE ONLY ADD THE PENALTY IS SUDDEN DEATH!
       
   225 class TCFMessage
       
   226 	{
       
   227   private:
       
   228   	enum
       
   229  	{
       
   230 	ECFSubConnDataTransferred		= 94, //email details to remek including comparison of conn and subconn
       
   231 	EStateChange                    = 95,
       
   232 	
       
   233 	ECFTransportNotification		= 100,  // For SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   234 	
       
   235     ECFProvisionConnectionInfo      = 101
       
   236 	};
       
   237 protected:
       
   238 	friend class ::CSockManData;
       
   239 
       
   240 /*
       
   241  * Utility functions to register/deregister internal transport messages
       
   242  * @internalComponent
       
   243  * @released 9.3
       
   244  */
       
   245 	static void RegisterL();
       
   246 	static void DeRegister();
       
   247 
       
   248 public:
       
   249     enum { ERealmId = 0x10285A57 }; //UID allocated on 21/11/2007
       
   250     /*==========================================================================
       
   251     <<Keys:>>
       
   252     [Name]:      <messagename>
       
   253     [Semantics]: Message semantics
       
   254 
       
   255     [Type]:      Request for <responsemsg>|Response to <requestmsg>|Notification/[Peerless]
       
   256                  Where:
       
   257                  Request      - request to perform an action. Sender should expect <responsemsg>
       
   258                                 to ackowledge the completion of the action.
       
   259                  Response     - acknowledgement that the previous request is now completed.
       
   260                  Notification - a one-off message flagging an event.
       
   261                  Peerless     - the message is peerless, i.e.: the sender doesn't have to
       
   262                                 be the recipient's client.
       
   263     [Fallible]:  Yes|No
       
   264                  Only applicable to requests and denotes whether the request can fail or not,
       
   265                  or, in other words, whether the request can be completed to with TError.
       
   266 
       
   267     [Structure]:
       
   268     Every message defined in this realm has at least:
       
   269     param        iSender      - the message sender
       
   270     param        iActivityId  - depending on the message type:
       
   271                  Request      - the activity id the response should be addressed to.
       
   272                                 Request senders fill up this param to match the response
       
   273                                 with the local activity. Activity id on the sender side
       
   274                                 should uniquelly identify the activity expecting the response.
       
   275                  Response     - the activity on the recipient side expecting this response.
       
   276                                 the activityid to put here has been previously conveyed
       
   277                                 with the request.
       
   278                  Notification - ignored.
       
   279     ===========================================================================*/
       
   280     //[399TODO] RZ: the list of messages that follow is pretty long. I was then thinking
       
   281     //that perhaps we could chop it (with namespaces) into conceptual interfaces. Even better,
       
   282     //perhaps we could even make some runtime checks on message reception to panic if a message
       
   283     //received doesn't belong to any of the interfaces implemented locally.
       
   284 
       
   285 //--Generic framework--
       
   286     //typedef Messages::TMessageSigVoid<ECFNull, TCFMessage::ERealmId> TNull;
       
   287 
       
   288    /****************************************************************************
       
   289     **
       
   290     ****************************************************************************
       
   291     **
       
   292     **
       
   293     **
       
   294     **
       
   295     **
       
   296     **
       
   297     ** INTERFACE: Unasigned
       
   298     **
       
   299     **
       
   300     **
       
   301     **
       
   302     **
       
   303     **
       
   304     ****************************************************************************
       
   305     **
       
   306     ****************************************************************************/
       
   307 
       
   308     /*==========================================================================
       
   309     [Name]:      TSubConnDataTransferred
       
   310     [Semantics]: [399TODO] RZ: Simon please finish.
       
   311 
       
   312     [Type]:
       
   313     [Fallible]:
       
   314 
       
   315     [Structure]:
       
   316     ===========================================================================*/
       
   317 	typedef Messages::TMessageSigNumberNumberNumber<ECFSubConnDataTransferred, TCFMessage::ERealmId> TSubConnDataTransferred;
       
   318 
       
   319 	/*==========================================================================
       
   320 	[Name]:      TStateChange
       
   321 	[Semantics]: Sender flags its state change. The state represents the legacy concept of a progress
       
   322 			and is only sent during connection start or stop.
       
   323 
       
   324 	[Type]:      Notification
       
   325 	===========================================================================*/
       
   326 	typedef TMessageSigStateChange<EStateChange, TCFMessage::ERealmId> TStateChange;
       
   327 
       
   328 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   329 	/*==========================================================================
       
   330 	[Name]:      TTransportNotification
       
   331 	[Semantics]: Sender sends this message to Data clients which will have a notification.
       
   332 			Presently used to notify the data clients for the change in underlying bearer
       
   333 			which will enable the SAP to used set the TCP receive window size and Maximum
       
   334 			window size (which will be used for scaling negotiation). The window sizes will
       
   335 			be retrieved using the pointer to the Lookup Table.
       
   336 
       
   337 	[Type]:      Notification
       
   338 	
       
   339 	===========================================================================*/
       
   340 	typedef Messages::TMessageSigVoid <ECFTransportNotification, TCFMessage::ERealmId> TTransportNotification;
       
   341 
       
   342 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   343 
       
   344 	   /**
       
   345 	    The message provisions connection information during the selection request
       
   346 
       
   347 	    @li Type:  Notification
       
   348 
       
   349 	    IMPORTANT: There is no response to TProvisionConnectionInfo. If the recipient finds out
       
   350 	    that the configuration received is in any way inadequate, it cannot flag this
       
   351 	    fact until it is requested to do something (e.g.: TCFDataClient::Start)
       
   352 	    */
       
   353 	    typedef TMessageSigConnectionInfoPtr<ECFProvisionConnectionInfo, TCFMessage::ERealmId> TProvisionConnectionInfo;
       
   354 	};
       
   355 } //namespace ESock
       
   356 
       
   357 #endif
       
   358 // __SS_NODEMESSAGES_INTERNAL_H__
       
   359