networkcontrol/qosfwconfig/qos/inc/flowhook.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 // Copyright (c) 2006-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 
       
    18 /**
       
    19  @internalComponent
       
    20 */
       
    21 #ifndef __FLOWHOOK_H__
       
    22 #define __FLOWHOOK_H__
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <flow.h>		// ..at least for MFlowHook
       
    27 
       
    28 // Forward declarations
       
    29 class CPolicySelector;
       
    30 class CInterface;
       
    31 class RModule;
       
    32 class CQoSConn;
       
    33 
       
    34 class TQoSPolicy
       
    35 	{
       
    36 public:
       
    37 	TQoSPolicy() : iPolicy(NULL), iDefault(NULL), iOverride(NULL), iModules(NULL) {}
       
    38 
       
    39 public:
       
    40 	const CPolicySelector* iPolicy;
       
    41 	const CPolicySelector* iDefault;
       
    42 	const CPolicySelector* iOverride;
       
    43 	// Should also be const, but some other declarations prevent this for the time being...
       
    44 	CModuleSelector* iModules;
       
    45 	};
       
    46 
       
    47 class CQoSSessionBase;
       
    48 class CProtocolQoS;
       
    49 class CInternalQoSChannel;
       
    50 
       
    51 
       
    52 class CFlowHook : public CBase, public MFlowHook
       
    53 	{
       
    54 public:
       
    55 	CFlowHook(CProtocolQoS &aProtocol, CFlowContext &aContext);
       
    56 	void Open();
       
    57 	TInt ReadyL(TPacketHead &);
       
    58 	TInt ApplyL(RMBufSendPacket &, RMBufSendInfo &);
       
    59 	void Close();
       
    60 	void ReleasePolicy(const CPolicySelector* aSel);
       
    61 	void UpdateQoS();
       
    62 	void SetQoS(const TQoSParameters& aSpec);
       
    63 
       
    64 	void ClearPendingRequest(TInt aError);
       
    65 	TInt StartPendingRequest(CQoSSessionBase* iSession);
       
    66 
       
    67 	void CloseQoS();
       
    68 	void RestartQoS();	// CloseQoS + trigger immeadiate ReadyL
       
    69 
       
    70 	inline void SetUid(const TUidType& aUid);
       
    71 	inline const TCheckedUid& Uid() const;
       
    72 	inline TQoSPolicy& Policies();
       
    73 	inline CInterface* Interface();
       
    74 	inline CFlowContext& Context();
       
    75 	inline CProtocolQoS& Protocol();
       
    76 	inline const TQoSParameters& QoSParameters() const;
       
    77 
       
    78 	inline RPointerArray<RModule>& ModuleList() { return iModuleList;}
       
    79 	void Block();
       
    80 	void UnBlock();
       
    81 	inline void SetQoSChannel(CQoSConn* aChannel);
       
    82 	inline CQoSConn* Channel();
       
    83 	inline TBool ChannelJoined();
       
    84 	inline void SetChannelJoined(TBool aJoined);
       
    85 
       
    86 	void FillFlowInfo(TPfqosMessage& aMsg, pfqos_address& aSrc, pfqos_address& aDst, pfqos_selector& aSel, TInetAddr &aMask);
       
    87 private:
       
    88 	virtual ~CFlowHook();	// reference counted object, only Close() can issue the delete.
       
    89 
       
    90 	void LoadModulesL();
       
    91 	void OpenModulesL();
       
    92 	TInt Negotiate();
       
    93 	void AdjustForHeaderMode(TQoSParameters& aQoS);
       
    94 
       
    95 	CProtocolQoS&			iProtocol;	// immutable after construction
       
    96 	CFlowContext&			iContext;	// immutable after construction
       
    97 
       
    98 	TCheckedUid				iUid;	//?? Why TCheckedUid instead of plain TUidType?
       
    99 	TQoSParameters			iQoS;
       
   100 	CInterface*				iInterface;
       
   101 	TQoSPolicy				iQoSPolicies;
       
   102 	TInt					iRefCount;
       
   103 	TInt					iFlowStatus;
       
   104 	CQoSSessionBase*		iSession;
       
   105 	TUint					iChannelJoined:1;		// = 1, when flow has joined the channel (only if iChannel)
       
   106 	TUint					iHasControlModule:1;	// = 1, if flow has control module at iModuleList[0]
       
   107 	TUint					iQoSChanged:1;			// = 1, if flow specific QoS needs negotiation
       
   108 	CQoSConn*				iChannel;
       
   109 	RPointerArray<RModule>	iModuleList;
       
   110 public:	// Only for CProtocolQoS really...
       
   111 	TDblQueLink				iHookLink;
       
   112 	};
       
   113 
       
   114 #include "flowhook.inl"
       
   115 
       
   116 #endif