datacommsserver/esockserver/inc/ss_transporthook.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 /**
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * THIS API IS INTERNAL TO NETWORKING AND IS SUBJECT TO CHANGE AND NOT FOR EXTERNAL USE
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file ss_transporthook.h
       
    24  @internalTechnology
       
    25 */
       
    26 
       
    27 #ifndef SYMBIAN_TRANSPORTHOOK_H
       
    28 #define SYMBIAN_TRANSPORTHOOK_H
       
    29 
       
    30 #include <comms-infras/ss_nodemessages.h>
       
    31 
       
    32 //TODO[PROD] - reimplement hooks?
       
    33 #ifdef HOOKS_IMPLEMENTED
       
    34 #include <cftransporthook.h>
       
    35 #endif
       
    36 
       
    37 namespace ESock
       
    38 {
       
    39 
       
    40 //TODO[PROD] - reimplement hooks?
       
    41 #ifdef HOOKS_IMPLEMENTED
       
    42 class TCFRegisterMessageHook : public CommsFW::TCFRegisterHookSignal
       
    43     {
       
    44 public:
       
    45     IMPORT_C TCFRegisterMessageHook(const Messages::TNodeId& aSenderId, TUint aActivityId, const Messages::TNodeSignal::TMessageId& aMessageId);
       
    46 
       
    47 	EXPORT_DATA_VTABLE_AND_FN
       
    48 	DECLARE_MVIP_CTR(TCFRegisterMessageHook)
       
    49 
       
    50 protected:
       
    51     TCFRegisterMessageHook(){};
       
    52 	IMPORT_C virtual CommsFW::CCFHookEntry* NewHookEntryL() const;
       
    53 	IMPORT_C virtual void Error(TAny* aItf, TInt aError);
       
    54 
       
    55 protected:
       
    56     Messages::TNodeSignal::TMessageId iMessageId; //of the message to listen for
       
    57 	TUint iActivityId; //to address the right activity on error
       
    58     };
       
    59 
       
    60 class TCFDeregisterMessageHook : public CommsFW::TCFDeregisterHookSignal
       
    61     {
       
    62     friend class TTransportHookError;
       
    63 public:
       
    64     IMPORT_C TCFDeregisterMessageHook(const Messages::TNodeId& aSenderId, const Messages::TNodeSignal::TMessageId& aMessageId);
       
    65 
       
    66 	EXPORT_DATA_VTABLE_AND_FN
       
    67 	DECLARE_MVIP_CTR(TCFDeregisterMessageHook)
       
    68 
       
    69 protected:
       
    70     TCFDeregisterMessageHook(){};
       
    71     void DeregisterLocalTag(CommsFW::MTransportReceiver& aTransport){LocalTag(aTransport);}
       
    72 
       
    73 
       
    74 protected:
       
    75     Messages::TNodeSignal::TMessageId iMessageId;
       
    76     };
       
    77 
       
    78 //class MTransportSender;
       
    79 class TTransportHookError : public Messages::TSignatureBase
       
    80     {
       
    81 public:
       
    82 	EXPORT_DATA_VTABLE_AND_FN
       
    83 	DECLARE_MVIP_CTR(TTransportHookError)
       
    84 
       
    85 protected:
       
    86     TTransportHookError(){};
       
    87     explicit TTransportHookError(const Messages::TNodeSignal::TMessageId& aMessageId, const Messages::TNodeId& aSenderId, TUint aActivityId, const Messages::TNodeSignal::TMessageId& aHookedMessageId, TInt aError):
       
    88         Messages::TSignatureBase(aMessageId, aSenderId, aActivityId),
       
    89         iError(aError),
       
    90         iHookedMessageId(aHookedMessageId)
       
    91         {
       
    92         }
       
    93 
       
    94 	virtual TInt VerifyDestination(const CommsFW::TCookie& aDestination, CommsFW::MTransportReceiver& aTransport);
       
    95 
       
    96 protected:
       
    97 	TInt iError;
       
    98 	Messages::TNodeSignal::TMessageId iHookedMessageId;
       
    99     };
       
   100 
       
   101 template<TInt id, TInt32 realm>
       
   102 struct TCFMessageTransportHookError : public TTransportHookError, public Messages::TSignatureBase::TTypeToMessageId<id, realm>
       
   103     {
       
   104     enum { iId = id };
       
   105 	explicit TCFMessageTransportHookError(const Messages::TNodeId& aSenderId, TUint aActivityId, const Messages::TNodeSignal::TMessageId& aMessageId, TInt aError ) :
       
   106 	    TTransportHookError(Messages::TNodeSignal::TMessageId(id, realm), aSenderId, aActivityId, aMessageId, aError){}
       
   107     };
       
   108 
       
   109 //this class shouldn't be here if we export the file
       
   110 class CCFMessageHooks : public CommsFW::CCFTransportHooks
       
   111     {
       
   112 public:
       
   113     CCFMessageHooks() :
       
   114         CCFTransportHooks()
       
   115         {
       
   116         }
       
   117 
       
   118     virtual void WalkHooks( const CommsFW::TCFSignalBase& aMessage, const CommsFW::TCookie& aRecipient );
       
   119     virtual void RegisterL( const CommsFW::TCFRegisterHookSignal& aMessage );
       
   120     virtual void Deregister( const CommsFW::TCFDeregisterHookSignal& aMessage );
       
   121     };
       
   122 
       
   123 class CCFMessageHookEntry : public CommsFW::CCFHookEntry
       
   124     {
       
   125 public:
       
   126     IMPORT_C CCFMessageHookEntry( const Messages::TNodeSignal::TMessageId& aMessageId, TInt aActivityId, const Messages::TNodeId& aNode, const Messages::TNodeId& aListener );
       
   127     IMPORT_C virtual TBool Match( const CommsFW::TCFSignalBase& aMessage, const CommsFW::TCookie& aRecipient );
       
   128     IMPORT_C virtual void Notify( const CommsFW::TCFSignalBase& aMessage ) const;
       
   129 
       
   130 protected:
       
   131     IMPORT_C virtual TBool Match( const CommsFW::TCFDeregisterHookSignal& aReq ) const;
       
   132 
       
   133 protected:
       
   134     Messages::TNodeSignal::TMessageId iMessageId;
       
   135     TInt iActivityId;
       
   136     };
       
   137 
       
   138 #endif
       
   139 
       
   140 } //namespace ESock
       
   141 
       
   142 #endif //SYMBIAN_TRANSPORTHOOK_H
       
   143