commsfwsupport/commselements/serverden/inc/sd_minterceptmsgs.h
changeset 0 dfb7c4ff071f
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 SYMBIAN_ELEMENTS_MSGINTERCEPTMSGS_H
       
    22 #define SYMBIAN_ELEMENTS_MSGINTERCEPTMSGS_H
       
    23 
       
    24 #include <elements/sd_mintercept_macro.h>
       
    25 #include <elements/sd_apiextensionclient.h>
       
    26 #include <elements/nm_signatures.h>
       
    27 
       
    28 //[MZ]: Please consider connecting MI at the transport level.
       
    29 //      The macro solution does not scale too well.
       
    30 
       
    31 /* ELEMENTS_DEBUG_MESSAGES_THUNK_POINT
       
    32 // to be reviewed since Message interceptor is decoupled from esock
       
    33 Elements debug messages currently fit the MIR well as it's a disconnect global blob (mostly disconnected;
       
    34 worker thread knows about it for init & cleanup & everybody else has macro hiding it). But for some
       
    35 debugging features closer coupling is required & many of the key classes aren't exported, ie the
       
    36 obvious home for the debugging code is inside ESOCK. Making them the debug dispatches friends isn't
       
    37 very good either as it risks hard-to-debug problems where ESOCKSVR is compiled without the support but
       
    38 the helper DLL is & so dereferences non-existant debug members, etc (and this is particularly likely
       
    39 on hardware where people always juggle weird mixes of UDEB & UREL to get a small enough ROM & this will
       
    40 be very hard to debug)
       
    41 
       
    42 Hence the addition of code ptrs to this MIR structure - poor man's vtbl. Really this shouldn't be in the MIR
       
    43 but a general debug DLL but (a) it's very slim functionality and (b) the MIR is already a bit ambiguous whether
       
    44 it's "a" debug DLL or "the".
       
    45 */
       
    46 
       
    47 namespace Den
       
    48 	{
       
    49 	const TUint KMaxNodeTagLength = 32;
       
    50 	typedef TBuf8<KMaxNodeTagLength> TNodeTag;
       
    51 
       
    52 	class TNodeSpecifier;
       
    53 	class CPattern;
       
    54 	class TEventSummaryTriple;
       
    55 
       
    56 	// Basic types
       
    57 	//------------
       
    58 
       
    59 	//TODO: TNodeExpression needs to be based on a more dynamic mechanism
       
    60 	//to allow for tech specific node descriptions
       
    61 	class TNodeExpression
       
    62 		{
       
    63 		public:
       
    64 			TNodeExpression() {}
       
    65 
       
    66 			TNodeExpression(TUid aUid, const TDesC8& aTagToApply = KNullDesC8) :
       
    67 				iMatchType(EMatchByUid), iUid(aUid), iTagToApplyOnMatch(aTagToApply) {}
       
    68 
       
    69 			TNodeExpression(const TDesC8& aNodeTag) :
       
    70 				iMatchType(EMatchByInstance), iMatchTag(aNodeTag), iTagToApplyOnMatch(KNullDesC8) {}
       
    71 
       
    72 			TBool Compare(const TNodeSpecifier& aNode) const;
       
    73 			TBool SetTagOnMatch() const {return (iTagToApplyOnMatch.Length() > 0);}
       
    74 			const TNodeTag& TagToSet() const {return iTagToApplyOnMatch;}
       
    75 
       
    76 		private:
       
    77 			// Matching by node info
       
    78 			TUid iUid;
       
    79 
       
    80 			// Todo: Include when APId and TierId are implemented for Multimedia
       
    81 			//TUint iAPId;
       
    82 			//TUid iTierId;
       
    83 			TNodeTag iTagToApplyOnMatch;
       
    84 
       
    85 			// Matching by node name
       
    86 			TNodeTag iMatchTag;
       
    87 
       
    88 			enum TMatchType {EMatchByUid, EMatchByInstance} iMatchType;
       
    89 		};
       
    90 
       
    91 	class TMsgExpression
       
    92 		{
       
    93 		public:
       
    94 			TMsgExpression() : iMessageId(0), iRealm(0) {};
       
    95 			TMsgExpression(TUint aMessageId, TUint aRealm) : iMessageId(aMessageId), iRealm(aRealm) {}
       
    96 			TBool Compare(const Messages::TNodeSignal& aMessage) const;
       
    97 
       
    98 		private:
       
    99 			TUint iMessageId;
       
   100 			TUint iRealm;
       
   101 		};
       
   102 
       
   103 	class TEventExpression
       
   104 		{
       
   105 		public:
       
   106 			TEventExpression() : iSenderExpression(), iMsgExpression(), iReceiverExpression() {}
       
   107 			TEventExpression(
       
   108 				const TNodeExpression& aSender,
       
   109 				const TMsgExpression& aMsg,
       
   110 				const TNodeExpression& aReceiver) :
       
   111 					iSenderExpression(aSender), iMsgExpression(aMsg), iReceiverExpression(aReceiver)
       
   112 					{}
       
   113 
       
   114 			const TMsgExpression& MessageExpression() const {return iMsgExpression;}
       
   115 			const TNodeExpression& SenderExpression() const {return iSenderExpression;}
       
   116 			const TNodeExpression& ReceiverExpression() const {return iReceiverExpression;}
       
   117 
       
   118 		private:
       
   119 			TNodeExpression iSenderExpression;
       
   120 			TMsgExpression iMsgExpression;
       
   121 			TNodeExpression iReceiverExpression;
       
   122 		};
       
   123 
       
   124 	class TAction
       
   125 		{
       
   126 		public:
       
   127 			typedef enum {ENoAction, ELeaveAction, EPanicAction} TActionType;
       
   128 
       
   129 			TAction(TActionType aAction, TInt aError) :
       
   130 				iAction(aAction), iError(aError) {}
       
   131 			TAction() : iAction(ENoAction), iError(KErrNone) {}
       
   132 
       
   133 			TActionType Action() const	{return iAction;}
       
   134 			TInt Error() const {return iError;}
       
   135 
       
   136 			TInt ExecuteActionL();
       
   137 
       
   138 		private:
       
   139 			TActionType iAction;
       
   140 			TInt iError;
       
   141 		};
       
   142 
       
   143 	// MI messages
       
   144 	//------------
       
   145 	class TMIMessages
       
   146 		{
       
   147 		public:
       
   148 			static const TInt KMaxExternalisedReqAndRespMsgSize = 240; //size of the biggest message any direction..
       
   149 
       
   150 		public:
       
   151 			static TUid ImplementationUid();
       
   152 			static TInt ImplementationProxyTableSize();
       
   153 			static const TImplementationProxy* ImplementationProxyTable();
       
   154 		};
       
   155 
       
   156 	// Reset
       
   157 	class TSoftResetMsg : public Den::TApiExtSessionReqMsg
       
   158 		{
       
   159 		public:
       
   160 			IMPORT_C TSoftResetMsg();
       
   161 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   162 			                                TSessionUniqueId aClientUniqueId,
       
   163 			                                Elements::RResponseMsg& aResponseMsg);
       
   164 			DECLARE_MVIP_CTR(TSoftResetMsg)
       
   165 			EXPORT_DATA_VTABLE_AND_FN
       
   166 		};
       
   167 
       
   168 	// Enable
       
   169 	class TEnableMsg : public Den::TApiExtSessionReqMsg
       
   170 		{
       
   171 		public:
       
   172 			IMPORT_C TEnableMsg();
       
   173 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   174 			                                TSessionUniqueId aClientUniqueId,
       
   175 	                                        Elements::RResponseMsg& aResponseMsg);
       
   176 			DECLARE_MVIP_CTR(TEnableMsg)
       
   177 			EXPORT_DATA_VTABLE_AND_FN
       
   178 		};
       
   179 
       
   180 	// EnableFallibleMsgMode
       
   181 	class TEnableFallibleMsgModeMsg : public Den::TApiExtSessionReqMsg
       
   182 		{
       
   183 		public:
       
   184 			IMPORT_C TEnableFallibleMsgModeMsg();
       
   185 			IMPORT_C TEnableFallibleMsgModeMsg(TInt aCount);
       
   186 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   187 			                                TSessionUniqueId aClientUniqueId,
       
   188 	                                        Elements::RResponseMsg& aResponseMsg);
       
   189 			DECLARE_MVIP_CTR(TEnableFallibleMsgModeMsg)
       
   190 			EXPORT_DATA_VTABLE_AND_FN
       
   191 		protected:
       
   192 			TInt iCount;
       
   193 		};
       
   194 
       
   195 	// InitFallibleMsgMode
       
   196 	class TInitFallibleMsgModeMsg : public Den::TApiExtSessionReqMsg
       
   197 		{
       
   198 		public:
       
   199 			//TInitFallibleMsgModeMsg(RArray<Messages::TNodeSignal::TMessageId>& aArray);
       
   200 			IMPORT_C TInitFallibleMsgModeMsg();
       
   201 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   202 			                                TSessionUniqueId aClientUniqueId,
       
   203 	                                        Elements::RResponseMsg& aResponseMsg);
       
   204 			IMPORT_C void InitL(RArray<Messages::TNodeSignal::TMessageId>& aArray);
       
   205 			DECLARE_MVIP_CTR(TInitFallibleMsgModeMsg)
       
   206 			EXPORT_DATA_VTABLE_AND_FN
       
   207 
       
   208 		private:
       
   209 			TBuf8<TMIMessages::KMaxExternalisedReqAndRespMsgSize> iArray; //TODO: consider alternatives
       
   210 		};
       
   211 
       
   212 	// CheckFallibleMsgMode
       
   213 	class TCheckFallibleMsgModeMsg : public Den::TApiExtSessionReqMsg
       
   214 		{
       
   215 		public:
       
   216 			IMPORT_C TCheckFallibleMsgModeMsg();
       
   217 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   218 			                                TSessionUniqueId aClientUniqueId,
       
   219 	                                        Elements::RResponseMsg& aResponseMsg);
       
   220 			DECLARE_MVIP_CTR(TCheckFallibleMsgModeMsg)
       
   221 			EXPORT_DATA_VTABLE_AND_FN
       
   222 		};
       
   223 
       
   224 	// Disable
       
   225 	class TDisableMsg : public Den::TApiExtSessionReqMsg
       
   226 		{
       
   227 		public:
       
   228 			IMPORT_C TDisableMsg();
       
   229 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   230 			                                TSessionUniqueId aClientUniqueId,
       
   231 	                                        Elements::RResponseMsg& aResponseMsg);
       
   232 			DECLARE_MVIP_CTR(TDisableMsg)
       
   233 			EXPORT_DATA_VTABLE_AND_FN
       
   234 		};
       
   235 
       
   236 	// Append expression
       
   237 	class TAppendExpressionMsg : public Den::TApiExtSessionReqMsg
       
   238 		{
       
   239 		public:
       
   240 			IMPORT_C TAppendExpressionMsg();
       
   241 			IMPORT_C TAppendExpressionMsg(const TEventExpression& aExpression);
       
   242 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   243 			                                TSessionUniqueId aClientUniqueId,
       
   244 	                                        Elements::RResponseMsg& aResponseMsg);
       
   245 			DECLARE_MVIP_CTR(TAppendExpressionMsg)
       
   246 			EXPORT_DATA_VTABLE_AND_FN
       
   247 
       
   248 		protected:
       
   249 			TEventExpression iExpression;
       
   250 		};
       
   251 
       
   252 	// Append action
       
   253 	class TAppendActionMsg : public Den::TApiExtSessionReqMsg
       
   254 		{
       
   255 		public:
       
   256 			IMPORT_C TAppendActionMsg();
       
   257 			IMPORT_C TAppendActionMsg(const TAction& aAction);
       
   258 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   259 			                                TSessionUniqueId aClientUniqueId,
       
   260 	                                        Elements::RResponseMsg& aResponseMsg);
       
   261 			DECLARE_MVIP_CTR(TAppendActionMsg)
       
   262 			EXPORT_DATA_VTABLE_AND_FN
       
   263 
       
   264 		protected:
       
   265 			TAction iAction;
       
   266 		};
       
   267 
       
   268 	// Query complete
       
   269 	class TQueryCompleteMsg : public Den::TApiExtSessionReqMsg
       
   270 		{
       
   271 		public:
       
   272 			IMPORT_C TQueryCompleteMsg();
       
   273 			IMPORT_C virtual void DispatchL(NetInterfaces::TInterfaceControl& aIntfCtl,
       
   274 			                                TSessionUniqueId aClientUniqueId,
       
   275 	                                        Elements::RResponseMsg& aResponseMsg);
       
   276 			DECLARE_MVIP_CTR(TQueryCompleteMsg)
       
   277 			EXPORT_DATA_VTABLE_AND_FN
       
   278 		};
       
   279 
       
   280 
       
   281 	//*************************************************************************
       
   282 	//
       
   283 	//Response messages
       
   284 	//
       
   285 	//*************************************************************************
       
   286 	const TInt KMessageInterceptResponseMsgImplementationUid = 0x10285C8D;
       
   287 
       
   288 	/**
       
   289 	*/
       
   290 	enum TMIResponseMsgImplementations
       
   291 		{
       
   292 		ECheckFallibleMsgModeResponseMsg = 1
       
   293 		};
       
   294 
       
   295 	/**
       
   296 	Ecom response message from server to client on call to RMessageInterceptorFM::Check()
       
   297 	*/
       
   298 	class TCheckFallibleMsgModeResponseMsg : public Den::TApiExtRespMsg
       
   299 		{
       
   300 	public:
       
   301 		EXPORT_DATA_VTABLE_AND_FN
       
   302 
       
   303 	public:
       
   304 		IMPORT_C static TCheckFallibleMsgModeResponseMsg* NewL(); //For the ecom factory
       
   305 		IMPORT_C TCheckFallibleMsgModeResponseMsg();
       
   306 
       
   307 	public:
       
   308 		TBool iCheckResult;
       
   309 		};
       
   310 
       
   311 	} // Den
       
   312 
       
   313 
       
   314 #endif
       
   315 //SYMBIAN_ELEMENTS_MSGINTERCEPTMSGS_H
       
   316 
       
   317