networkcontrol/qosipscpr/src/qos_msg.h
changeset 0 af10295192d8
equal deleted inserted replaced
-1:000000000000 0:af10295192d8
       
     1 /**
       
     2 * Copyright (c) 2004-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 * Header file for the QoS Mapping Messages
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file qos_msg.h
       
    24 */
       
    25 
       
    26 #ifndef __QOS_MSG_H__
       
    27 #define __QOS_MSG_H__
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <e32std.h>
       
    31 #include <comms-infras/eintsock.h>
       
    32 #include <networking/qoslib.h>
       
    33 #include <elements/nm_messages_base.h>
       
    34 
       
    35 class CPfqosStream;
       
    36 
       
    37 class TQoSIpSCprMessages
       
    38 /**
       
    39 QoSIpSCpr message realm (messages specific to qosipscpr)
       
    40  
       
    41 
       
    42 @internalComponent
       
    43 */
       
    44 	{
       
    45   public:
       
    46     enum { ERealmId = 0x10204307 };
       
    47 
       
    48   private:
       
    49   	enum
       
    50   	    {
       
    51         EOpenInternalSocket = Messages::KNullMessageId + 1,
       
    52 		EInternalSocketOpened
       
    53 	    };
       
    54 
       
    55   public:
       
    56 
       
    57 	typedef Messages::TMessageSigVoid<EOpenInternalSocket, TQoSIpSCprMessages::ERealmId> TOpenInternalSocket;
       
    58 	typedef Messages::TMessageSigVoid<EInternalSocketOpened, TQoSIpSCprMessages::ERealmId> TInternalSocketOpened;
       
    59 	};
       
    60 
       
    61 
       
    62 NONSHARABLE_CLASS(CQoSMsg) : public CBase
       
    63 /**
       
    64 Encapsulation of a QoS PRT Message that can be stored in a 
       
    65 link list of messages.
       
    66 
       
    67 @internalComponent
       
    68 
       
    69 @released Since v9.0
       
    70 */
       
    71 	{
       
    72 public:
       
    73 	// Construction
       
    74 	static CQoSMsg* NewL( TPfqosMessages aMsgType );
       
    75 	~CQoSMsg();
       
    76 
       
    77 	// Message Content
       
    78 	inline void AddConnInfo(TUint32 aProtocol, const TUidType& aUid, TUint32 aIapId );
       
    79 	void AddSrcAddr(const TInetAddr &aAddr);
       
    80 	void AddDstAddr(const TInetAddr &aAddr);
       
    81 	inline void AddChannel(TInt aChannelId);
       
    82 	inline void AddQoSParameters(const TQoSParameters& aParameters);
       
    83 	void AddExtensionPolicy(TQoSExtensionQueue& aExtensions);
       
    84 
       
    85 	// Send Message to PRT
       
    86 	void Send(RInternalSocket &aSocket, TRequestStatus& aStatus);
       
    87 
       
    88 protected:
       
    89 	// Construction
       
    90 	CQoSMsg();
       
    91 	void ConstructL( TPfqosMessages aMsgType );
       
    92 
       
    93 public:
       
    94 	/** QoS PRT formatted Message */
       
    95 	CPfqosStream* iMsg;
       
    96 
       
    97 	/** Message Type */
       
    98 	TPfqosMessages iType;
       
    99 
       
   100 	/** Link to next item */
       
   101 	TSglQueLink iLink;
       
   102 	};
       
   103 
       
   104 
       
   105 class CIpSubConnectionProvider;
       
   106 
       
   107 NONSHARABLE_CLASS(CQoSSocketOpener) : public CActive
       
   108 /**
       
   109   Active object for asynchronously opening an Internal Socket
       
   110 
       
   111   @internalComponent
       
   112   @prototype
       
   113 */
       
   114 	{
       
   115 public:
       
   116 	static CQoSSocketOpener* NewL(CIpSubConnectionProvider& aIpScpr, Messages::TNodeCtxId& aOriginator);
       
   117 	~CQoSSocketOpener();
       
   118 
       
   119 	void Open();
       
   120 	
       
   121 protected:
       
   122 	CQoSSocketOpener(CIpSubConnectionProvider& aIpScpr, Messages::TNodeCtxId& aOriginator);
       
   123 	
       
   124 	// Active Object Implementation
       
   125 	void RunL();
       
   126 	void DoCancel();
       
   127 	
       
   128 private:
       
   129 	CIpSubConnectionProvider& iIpScpr;
       
   130 	Messages::TNodeCtxId iOriginator;
       
   131 	};
       
   132 
       
   133 NONSHARABLE_CLASS(CQoSMsgWriter) : public CActive
       
   134 /**
       
   135 Active Object that sends messages from IP Connection Provider to the QoS PRT
       
   136 
       
   137 @internalComponent
       
   138 
       
   139 @released Since v9.0
       
   140 */
       
   141 	{
       
   142 public:
       
   143 	// Construction
       
   144 	static CQoSMsgWriter* NewL(CIpSubConnectionProvider* aOwner, RInternalSocket& aSocket);
       
   145 	~CQoSMsgWriter();
       
   146 
       
   147 	// Send Message over Internal Socket
       
   148 	void Send(CQoSMsg* aMsg);
       
   149 
       
   150 protected:
       
   151 	// Construction
       
   152 	CQoSMsgWriter(CIpSubConnectionProvider* aOwner, RInternalSocket& aSocket);
       
   153 
       
   154 	// Active Object Implementation
       
   155 	void RunL();
       
   156 	inline void DoCancel();
       
   157 
       
   158 private:
       
   159 	/** Message Owner */
       
   160 	CIpSubConnectionProvider* iOwner;
       
   161 
       
   162 	/** Reference to an Internal Socket */
       
   163 	RInternalSocket& iSocket;
       
   164 
       
   165 	/** Current Message */
       
   166 	CQoSMsg* iCurrentMsg;
       
   167 
       
   168 	/** List of Pending Messages */
       
   169 	TSglQue<CQoSMsg> iPendingMsg;
       
   170 
       
   171 	/** Flag Set when Active Object is shuttin down */
       
   172 	TBool iClosing;
       
   173 	};
       
   174 
       
   175 
       
   176 NONSHARABLE_CLASS(CQoSMsgReader) : public CActive
       
   177 /**
       
   178 Active Object that receives messages from the QoS PRT and forwards them to the
       
   179 IP Connection Provider
       
   180 
       
   181 @internalComponent
       
   182 
       
   183 @released Since v9.0
       
   184 */
       
   185 	{
       
   186 public:
       
   187 	// Construction
       
   188 	static CQoSMsgReader* NewL(CIpSubConnectionProvider *aOwner, RInternalSocket& aSocket);
       
   189 	~CQoSMsgReader();
       
   190 
       
   191 protected:
       
   192 	// Construction
       
   193 	CQoSMsgReader(CIpSubConnectionProvider* aOwner, RInternalSocket& aSocket);
       
   194 	void ConstructL();
       
   195 
       
   196 	// Active Object Implmentation
       
   197 	void RunL();
       
   198 	inline void DoCancel();
       
   199 
       
   200 private:
       
   201 	/** Message Owner */
       
   202 	CIpSubConnectionProvider* iOwner;
       
   203 
       
   204 	/** Reference of Internal Socket */
       
   205 	RInternalSocket& iSocket;
       
   206 
       
   207 	/** Pointer to Buffer to receive data from QoS PRT */
       
   208 	TPtr8 iRecvPtr;
       
   209 
       
   210 	/** Buffer to receive data from QoS PRT */
       
   211 	HBufC8* iRecvBuf;
       
   212 
       
   213 	/** Flag Set when Active Object is shuttin down */
       
   214 	TBool iClosing;
       
   215 	};
       
   216 
       
   217 #include "qos_msg.inl"
       
   218 
       
   219 #endif // __QOS_MSG_H__