datacommsserver/esockserver/inc/ss_intsock.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2007-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 #if !defined(__SS_INTSOCK_H__)
       
    17 #define __SS_INTSOCK_H__
       
    18 
       
    19 #define SYMBIAN_NETWORKING_UPS
       
    20 
       
    21 #include <es_enum.h>
       
    22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    23 #include <es_enum_internal.h>
       
    24 #endif
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <comms-infras/ss_flowbinders.h>
       
    28 #include <comms-infras/ss_nodeinterfaces.h>
       
    29 #include <comms-infras/ss_nodemessages_dataclient.h>
       
    30 #include "ss_flowrequest.h"
       
    31 #include <es_mbufif.h>
       
    32 
       
    33 #ifdef SYMBIAN_NETWORKING_UPS
       
    34 #include <comms-infras/ss_platsec_apiext.h>		// ASockSubSessionPlatsecApiExt
       
    35 #endif //SYMBIAN_NETWORKING_UPS
       
    36 
       
    37 class CWaitForMBufs;
       
    38 class CProtocolBase;
       
    39 class ProtocolManager;
       
    40 class CInternalSocketImpl;
       
    41 
       
    42 namespace ESock
       
    43 {
       
    44 
       
    45 class AMessage
       
    46 {
       
    47 public:
       
    48 	virtual void AcquireMessage ( AMessage* aMessage ) =0;
       
    49 
       
    50     virtual TInt ReadDes(TInt aSrcParamIndex,TDes8 &aDes,TInt anOffset=0) = 0;
       
    51 	virtual TInt ReadInt(TInt aSrcParamIndex) = 0;
       
    52 	virtual TInt ReadMBuf(TInt aSrcParamIndex, RMBufChain& aBufChain) =0;
       
    53 	virtual void InitMBuf(TInt aParamIndex) =0;
       
    54     virtual TInt WriteDes(TInt aDstParamIndex,const TDesC8& aDes,TInt anOffset=0) = 0;
       
    55     virtual TInt WriteMBuf(TInt aDstParamIndex,RMBufChain& aBufChain) = 0;
       
    56 
       
    57 	virtual void CompleteMessage(TInt anError) = 0;
       
    58 	virtual TBool IsNull (TInt aParamIndex) =0;
       
    59 
       
    60 #ifdef SYMBIAN_NETWORKING_UPS
       
    61     virtual TInt GetProcessAndThreadId(TProcessId& /*aProcessId*/, TThreadId& /*aThreadId*/) const;
       
    62 #endif	
       
    63 		
       
    64 	virtual ~AMessage() {}
       
    65 };
       
    66 
       
    67 NONSHARABLE_CLASS(ASocket) : public Messages::ASimpleNodeIdBase,
       
    68                              public MSessionControlNotify, public MSessionDataNotify,
       
    69                              public AIPCFlowRequester
       
    70 #ifdef SYMBIAN_NETWORKING_UPS
       
    71                              , private ASockSubSessionPlatsecApiExt
       
    72 #endif
       
    73 /**
       
    74 Represents binder-facing part of socket.
       
    75 Implements ESOCK client socket binder and flow specific handling.
       
    76 It's meant to be agregated with the apropriet client-facing part to implement
       
    77 full socket functionality
       
    78 @see CSocket
       
    79 @internalTechnology
       
    80 */
       
    81 	{
       
    82 	friend class ::ProtocolManager;
       
    83 
       
    84 protected:
       
    85 	enum TSocketState
       
    86 		{
       
    87 		ESStateNull=-1,
       
    88 		ESStateCreated=0,
       
    89 		ESStateOpeningActive,
       
    90 		ESStateOpeningPassive,
       
    91 		ESStateOpen,
       
    92 		ESStateConnected,
       
    93 		ESStateDisconnected,
       
    94 		ESStateClosing,
       
    95 		ESStateShuttingDown,
       
    96 		ESStateDead,
       
    97 		ESStateError,
       
    98 		ESStateAccepting,
       
    99 		ESStateBinding
       
   100 		};
       
   101 
       
   102 protected:
       
   103     //Messages::ANode
       
   104 	virtual void ReceivedL(
       
   105 		const Messages::TRuntimeCtxId& aSender,
       
   106 		const Messages::TNodeId& aRecipient,
       
   107 		Messages::TSignatureBase& aMessage
       
   108 		);
       
   109 	//messages
       
   110 	void BindToL(const TCFDataClient::TBindTo& aBindTo);
       
   111 
       
   112 public:
       
   113 	virtual ~ASocket();
       
   114 
       
   115 	virtual const Messages::RNodeInterface* ServiceProvider() const;
       
   116 	TBool GetFlowAndSCPR(Messages::TNodeId& aFlow, Messages::TNodeId& aSCPR) const;
       
   117 
       
   118 	TInt GetConnectionSocketInfo(TConnectionSocketInfo& aInfo) const;
       
   119 
       
   120 	// Request service routines.
       
   121 	void ConnectL(TBool aConnectData);
       
   122 	void ShutdownL(RSocket::TShutdown aType, TBool aDisconnectData);
       
   123 	virtual TBool CloseSocket();
       
   124 	void ListenL(TInt aQlen, TBool aConnectionData);
       
   125 	void Accept();
       
   126 
       
   127 	void AutoBind();
       
   128 	void BindL();
       
   129 	void RemoteNameL();
       
   130 	void LocalNameL();
       
   131 	void SetLocalName();
       
   132 
       
   133 	void SetSockOptionL(TInt aOptionName, TInt aOptionLength, TInt aOptionLevel);
       
   134 	void GetSockOptionL(TInt aOptionName, TInt aOptionLength, TInt aOptionLevel, TInt aWriteBack);
       
   135 	void IoctlL(TInt aOptionName, TInt aOptionLength, TInt aOptionLevel, TBool aReadOption);
       
   136 	void GetDisconnectDataL( ) const;
       
   137 //
       
   138 	void SendL(TInt aXferLenArg, TInt aAddrArg, TInt aSendByteCount, TInt aSendFlags, TBool aUseMBufs);
       
   139 	void RecvL(TInt aXferLenArg, TInt aAddrArg, TInt aReadByteCount, TInt aReadFlags, TBool aUseMBufs, TInt aRecvOneOrMore);
       
   140 //
       
   141 	inline void CancelSend();
       
   142 	inline void CancelRecv();
       
   143 	void CancelConnect();
       
   144 	void CancelAccept();
       
   145 	void CancelIoctl();
       
   146 	void CancelAll();
       
   147 
       
   148 	void GetInfoL();
       
   149 
       
   150 	void CommunicateOwner();
       
   151 
       
   152 	TPtr8 IoctlBuffer();
       
   153 
       
   154 	//	SSP Upcalls - from MSessionControlNotify
       
   155 	void NewData(TUint aCount);
       
   156     void CanSend();
       
   157     void ConnectComplete();
       
   158 	void ConnectComplete(const TDesC8& aConnectData);
       
   159     void ConnectComplete(CSubConnectionFlowBase& anSSP);
       
   160 	void ConnectComplete(CSubConnectionFlowBase& anSSP,const TDesC8& aConnectData);
       
   161 	void CanClose(MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
       
   162     void CanClose(const TDesC8& aDisconnectData,MSessionControlNotify::TDelete aDelete=MSessionControlNotify::EDelete);
       
   163 	TInt Error(TInt anError,TUint anOperationMask);
       
   164 	void Disconnect( );
       
   165 	void Disconnect(TDesC8& aDisconnectData);
       
   166 	void IoctlComplete(TDesC8* aBuf);
       
   167     void SetLocalNameComplete();
       
   168 	void DisconnectFromListener(CSubConnectionFlowBase& aSSP);
       
   169 
       
   170 	// Utitlity functions for testing state and capabilities
       
   171 	inline TUint IsConnectionOriented() const;
       
   172 	inline TUint IsConnectionLess()const;
       
   173 	inline TUint IsDataGram() const;
       
   174 	inline TUint IsStream() const;
       
   175 	inline TUint IsPseudoStream() const;
       
   176 	inline TUint IsReliable() const;
       
   177 	inline TUint DeliversInOrder() const;
       
   178 	inline TUint IsMessageBased() const;
       
   179 	inline TUint CanSendUrgentData() const;
       
   180 	inline TUint CanSendConnectData() const;
       
   181 	inline TUint CanSendDisconnectData() const;
       
   182 	inline TUint CanBroadcast() const;
       
   183 	inline TUint SupportsMultiPoint() const;
       
   184 	inline TUint SupportsQOS() const;
       
   185 	inline TUint IsWriteOnly() const;
       
   186 	inline TUint IsReadOnly() const;
       
   187 	inline TUint SupportsGracefulClose() const;
       
   188 	inline TUint CanReconnect() const;
       
   189 	inline TUint SupportsPeek() const;
       
   190 	inline TUint RequiresOwnerInfo() const;
       
   191 	inline TUint StateCanProcessData() const;
       
   192 
       
   193 	virtual void InitiateDestruction();
       
   194 	inline void SetFlowRequestPending(TBool aPending);
       
   195 
       
   196 	enum 
       
   197         { 
       
   198         KNoXferLen = -1, 
       
   199         KNoAddrArg = -1, 
       
   200         KWriteNoAddrArg = -2    // for legacy compatibility reasons we tolerate ESoWrite on a non-connected datagram socket  
       
   201         };
       
   202 
       
   203 protected:
       
   204    	explicit ASocket(TInt aSocketType);
       
   205 	void Create(TServerProtocolDesc* aServiceInfo);
       
   206 
       
   207 	TBool CheckRunningAndSetReturn();
       
   208 	// Utility functions for handling blocked messages.
       
   209 	enum EBlockingFlags
       
   210 	 {EBlockedClose=0x01,
       
   211 	 EBlockedConnect=0x02,
       
   212 	 EBlockedIoctl=0x04,
       
   213 	 EBlockedRead=0x08, 
       
   214 	 EBlockedWrite=0x10,
       
   215 	 EWriteFlowedOff=0x20,
       
   216 	EReadStopped=0x40,
       
   217 	 EWriteStopped=0x80
       
   218 	, EBlockedSetLocalName=0x100
       
   219 						 };
       
   220 
       
   221 	inline void SetBlockedReadFlag();
       
   222 	inline void SetBlockedWriteFlag();
       
   223 	inline void SetBlockedCloseFlag();
       
   224 	inline void SetBlockedIoctlFlag();
       
   225 	inline void SetBlockedConnectFlag();
       
   226 
       
   227 	inline void SetBlockedRead();
       
   228 	inline void SetBlockedWrite();
       
   229 	inline void SetBlockedClose();
       
   230 	inline void SetBlockedIoctl();
       
   231 	inline void SetBlockedConnect();
       
   232 	inline void SetBlockedSetLocalName();
       
   233 	inline TBool IsBlockedSetLocalName() const;
       
   234 	void CompleteSetLocalName(TInt anErr);
       
   235 
       
   236 	virtual void SetClosing() =0;
       
   237 
       
   238 	inline TBool IsBlockedRead() const;
       
   239 	inline TBool IsBlockedWrite() const;
       
   240 	inline TBool IsBlockedConnect() const;
       
   241 	inline TBool IsBlockedClose() const;
       
   242 	inline TBool IsBlockedIoctl() const;
       
   243 	virtual TBool IsClosing() =0;
       
   244 
       
   245 	TBool CompleteRead(TInt anError);
       
   246 	TBool CompleteWrite(TInt anError);
       
   247 	void CompleteConnect(TInt anErr);
       
   248 	TBool CompleteClose(TInt anErr);
       
   249 	void CompleteIoctl(TInt anErr);
       
   250 
       
   251 	virtual void DontCompleteCurrentRequest() = 0;
       
   252 	virtual ASocket* InitiateAcceptingSocket() = 0;
       
   253 	virtual ASocket* GetAcceptingSocket() = 0;
       
   254 	virtual void DoCompleteAccept();
       
   255 	void AcceptSetupL(const ASocket& aParentSocket, CSubConnectionFlowBase& aFlow);
       
   256 
       
   257 	virtual void PanicSocketClient(TESockPanic aPanic) =0;
       
   258 	virtual void SetReturn(TInt aReturnValue) const = 0;
       
   259 
       
   260 	inline TSocketState State() const;
       
   261 	inline void SetState(TSocketState aState);
       
   262 
       
   263 	virtual TDes8* BorrowTemporaryBuffer(TInt aSize) = 0;
       
   264     virtual TDes8* BorrowTemporaryBufferL(TInt aSize) = 0;
       
   265 
       
   266 	TInt DrainStreamProtocol(AMessage* aMsg);
       
   267 	void DoRecv(TBool aInitialRequest);
       
   268 	TInt FillStreamProtocol(AMessage* aMsg);
       
   269 	void DoSend(TBool aInitialRequest);
       
   270 
       
   271     TUint SelectConditionsReady();
       
   272 	TBool CheckReadStopped();
       
   273 	void TryToCompleteSelectIoctl();
       
   274 	void DoError(TInt aError, TUint aOperationMask, TBool aDeleteInterface = ETrue);
       
   275     inline void ClearErrorIfNotFatal();
       
   276 
       
   277 	TInt RequestAsyncMBufAllocation(TInt aSignalType, TUint aSize);
       
   278 
       
   279 
       
   280 	enum TSocketMessage
       
   281 		{
       
   282 		ESocketCurrentMessage,
       
   283 		ESocketReadMessage,
       
   284 		ESocketWriteMessage,
       
   285 		ESocketCloseMessage,
       
   286 		ESocketIoCtlMessage,
       
   287 		ESocketConnectMessage
       
   288 		,ESocketSetLocalNameMessage
       
   289 
       
   290 		};
       
   291 
       
   292     void ReadParamL(TSocketMessage aMessage, TInt aSrcParamIndex,TDes8 &aDes,TInt anOffset=0);
       
   293     void ReadParamL(TSocketMessage aMessage, TInt aSrcParamIndex, RMBufChain& aBufChain);
       
   294 	void WriteParamL(TSocketMessage aMessage, TInt aDstParamIndex,const TDesC8& aDes,TInt anOffset=0);
       
   295 	void WriteParamL(TSocketMessage aMessage, TInt aDstParamIndex, RMBufChain& aBufChain);
       
   296 
       
   297 
       
   298 	AMessage* GetUserMessage( TSocketMessage aMessage ) const;
       
   299 	void SetUserMessage ( TSocketMessage aMessageType, AMessage* aMessage );
       
   300 
       
   301 	virtual void GetOwnerInfo(TProcessId& aProcId, TSoOwnerInfo& aInfo, TThreadId& aThreadId) = 0;
       
   302     virtual TInt SecurityCheck() = 0;
       
   303 
       
   304 	virtual void CompleteFlowRequestMessage(TInt err) =0;
       
   305 	inline TBool FlowRequestPending();
       
   306 
       
   307 #ifdef SYMBIAN_NETWORKING_UPS
       
   308 	TInt GetProcessAndThreadId(TProcessId& aProcessId, TThreadId& aThreadId) const;
       
   309 #endif
       
   310 
       
   311 protected:
       
   312 	MSessionControl* iSSP; // NULL-ness well controlled
       
   313 	AMessage*  iCurrentMsg;
       
   314 	TSockXfrLength iXferLength;		// used to write transfer lengths back to client; kept in scope with socket to avoid repeated construction cost
       
   315 private:
       
   316 	MSessionData* iSSPData;
       
   317 	MFlowBinderControl* iFlowBinder;
       
   318 	Messages::RNodeInterface iServiceProvider;
       
   319 
       
   320 	TProtocolDesc* iProtocolInfo;
       
   321     TInt        iSocketType;
       
   322 
       
   323 
       
   324 	TSocketState iState;
       
   325 	TInt iDataAvailable;
       
   326 	TInt iSendOffset;
       
   327 	TInt iRecOffset;
       
   328 	TInt iSendByteCount;
       
   329 	TInt iRecByteCount;
       
   330 	TInt iSendFlags;
       
   331 	TInt iRecvFlags;
       
   332 
       
   333 	TSockAddr iRecvFromAddr;
       
   334 //
       
   335 	TUint iBlockedOperations;
       
   336 
       
   337 	TInt iError;
       
   338     TUint iErrorOperationMask;     // stored aOperationMask from last MSessionControlNotify::Error() call
       
   339 
       
   340 
       
   341 	TUint iOptions;
       
   342 
       
   343 	enum { KMaxStreamChunk = 32 * 1024 };
       
   344 //
       
   345 	TInt iRecBufSize;
       
   346 	TInt iSendBufSize;
       
   347 	RMBufChain iSendData;
       
   348 	HBufC8* iDisconnectData;
       
   349 	TInt iDisconnectDataError;
       
   350 	RMBufChain iDatagramTail;
       
   351 //
       
   352 	CWaitForMBufs* iAllocAsync;
       
   353 //
       
   354 	CCirBuf<TAcceptQEntry>* iAcceptQ;	//lint -esym(613, ASocket::iAcceptQ)	// NULL-ness well controlled
       
   355 	CCirBuf<TAcceptQEntry>* iNextAcceptQ;	//lint -esym(613, CSocket::iAcceptQ)	// NULL-ness well controlled
       
   356 	TInt        iSelectFlags;
       
   357 
       
   358 	TSecurityPolicy iTransferSecPolicy;     // used for security check during ProtocolManager::TransferSocketL()
       
   359 
       
   360 	TBool iIsBound:1;
       
   361 	TBool iRecvOneOrMore:1;
       
   362     TBool iSecTransferEnabled:1;  // flag, indicating that iTransferSecPolicy is initialized and socket transfer is enabled
       
   363 	TBool iIsFlowRequestPending:1;
       
   364 	TBool iSendUseMBufs:1;
       
   365 	TBool iRecvUseMBufs:1;
       
   366 	TInt8 iSendXferLenIdx;
       
   367 	TInt8 iRecvXferLenIdx;
       
   368 	TInt8 iSendToAddrIdx;
       
   369 	TInt8 iRecvFromAddrIdx;
       
   370     TInt8 iBlockOnPeekReadCnt; // recursion level counter for NewData().
       
   371 
       
   372 	AMessage* iReadMsg;
       
   373 	AMessage* iWriteMsg;
       
   374 	AMessage* iBlockedCloseMsg;
       
   375 	AMessage* iBlockedConnectMsg;
       
   376 	AMessage* iBlockedIoctlMsg;
       
   377 	AMessage* iBlockedSetLocalNameMsg;
       
   378 	
       
   379 	TSocketState iNextState; // Next state to enter after binding state exits.
       
   380 	TBool        iConnectData; // Used to indicate if connect data is present.
       
   381 
       
   382 	
       
   383 	RMBufAllocator iAllocator; // To speed up the RMBufChain allocation
       
   384 	};
       
   385 
       
   386 inline TUint ASocket::IsConnectionOriented()  const
       
   387 	{
       
   388 	return !(iProtocolInfo->iServiceInfo & KSIConnectionLess);
       
   389 	}
       
   390 
       
   391 inline TUint ASocket::IsConnectionLess() const
       
   392 	{
       
   393 	return (iProtocolInfo->iServiceInfo & KSIConnectionLess);
       
   394 	}
       
   395 
       
   396 inline TUint ASocket::IsDataGram() const
       
   397 	{
       
   398 	return (iProtocolInfo->iServiceInfo & KSIDatagram);
       
   399 	}
       
   400 
       
   401 inline TUint ASocket::IsStream() const
       
   402 	{
       
   403 	return (iProtocolInfo->iServiceInfo & KSIStreamBased);
       
   404 	}
       
   405 
       
   406 inline TUint ASocket::IsPseudoStream() const
       
   407 	{
       
   408 	return (iProtocolInfo->iServiceInfo & KSIPseudoStream);
       
   409 	}
       
   410 
       
   411 inline TUint ASocket::IsReliable() const
       
   412 	{
       
   413 	return (iProtocolInfo->iServiceInfo & KSIReliable);
       
   414 	}
       
   415 
       
   416 inline TUint ASocket::CanReconnect() const
       
   417 	{
       
   418 	return (iProtocolInfo->iServiceInfo & KSICanReconnect);
       
   419 	}
       
   420 
       
   421 inline TUint ASocket::SupportsPeek() const
       
   422 	{
       
   423 	return (iProtocolInfo->iServiceInfo & KSIPeekData);
       
   424 	}
       
   425 
       
   426 inline TUint ASocket::DeliversInOrder() const
       
   427 	{
       
   428 	return (iProtocolInfo->iServiceInfo & KSIInOrder);
       
   429 	}
       
   430 
       
   431 inline TUint ASocket::IsMessageBased() const
       
   432 	{
       
   433 	return (iProtocolInfo->iServiceInfo & KSIMessageBased);
       
   434 	}
       
   435 
       
   436 inline TUint ASocket::CanSendUrgentData() const
       
   437 	{
       
   438 	return (iProtocolInfo->iServiceInfo & KSIUrgentData);
       
   439 	}
       
   440 
       
   441 inline TUint ASocket::CanSendConnectData() const
       
   442 	{
       
   443 	return (iProtocolInfo->iServiceInfo & KSIConnectData);
       
   444 	}
       
   445 
       
   446 inline TUint ASocket::CanSendDisconnectData() const
       
   447 	{
       
   448 	return (iProtocolInfo->iServiceInfo & KSIDisconnectData);
       
   449 	}
       
   450 
       
   451 inline TUint ASocket::CanBroadcast() const
       
   452 	{
       
   453 	return (iProtocolInfo->iServiceInfo & KSIBroadcast);
       
   454 	}
       
   455 
       
   456 inline TUint ASocket::SupportsMultiPoint() const
       
   457 	{
       
   458 	return (iProtocolInfo->iServiceInfo & KSIMultiPoint);
       
   459 	}
       
   460 
       
   461 inline TUint ASocket::SupportsQOS() const
       
   462 	{
       
   463 	return (iProtocolInfo->iServiceInfo & KSIQOS);
       
   464 	}
       
   465 
       
   466 inline TUint ASocket::IsWriteOnly() const
       
   467 	{
       
   468 	return (iProtocolInfo->iServiceInfo & KSIWriteOnly);
       
   469 	}
       
   470 
       
   471 inline TUint ASocket::IsReadOnly() const
       
   472 	{
       
   473 	return (iProtocolInfo->iServiceInfo & KSIReadOnly);
       
   474 	}
       
   475 
       
   476 inline TUint ASocket::SupportsGracefulClose() const
       
   477 	{
       
   478 	return (iProtocolInfo->iServiceInfo & KSIGracefulClose);
       
   479 	}
       
   480 
       
   481 inline TUint ASocket::RequiresOwnerInfo() const
       
   482 	{
       
   483 	return (iProtocolInfo->iServiceInfo & KSIRequiresOwnerInfo);
       
   484 	}
       
   485 
       
   486 inline void ASocket::SetBlockedReadFlag()
       
   487 	{
       
   488 	__ASSERT_DEBUG(!IsBlockedRead(),Fault(ETwoReads));
       
   489 	iBlockedOperations|=EBlockedRead;
       
   490 	}
       
   491 
       
   492 inline void ASocket::SetBlockedWriteFlag()
       
   493 	{
       
   494 	__ASSERT_DEBUG(!IsBlockedWrite(),Fault(ETwoWrites));
       
   495 	iBlockedOperations|=EBlockedWrite;
       
   496 	}
       
   497 
       
   498 inline void ASocket::SetBlockedConnectFlag()
       
   499 	{
       
   500 	__ASSERT_DEBUG(!IsBlockedConnect(),Fault(ETwoConnects));
       
   501 	iBlockedOperations|=EBlockedConnect;
       
   502 	}
       
   503 
       
   504 inline void ASocket::SetBlockedCloseFlag()
       
   505 	{
       
   506 	__ASSERT_DEBUG(!IsBlockedClose(),Fault(ETwoClose));
       
   507 	iBlockedOperations|=EBlockedClose;
       
   508 	}
       
   509 
       
   510 inline void ASocket::SetBlockedIoctlFlag()
       
   511 	{
       
   512 	__ASSERT_DEBUG(!IsBlockedIoctl(),Fault(ETwoIoctl));
       
   513 	iBlockedOperations|=EBlockedIoctl;
       
   514 	}
       
   515 	
       
   516 inline void ASocket::SetBlockedSetLocalName()
       
   517     {
       
   518     iBlockedOperations |= EBlockedSetLocalName;
       
   519     iBlockedSetLocalNameMsg->AcquireMessage( iCurrentMsg );
       
   520     }
       
   521     
       
   522  inline TBool ASocket::IsBlockedSetLocalName() const
       
   523 	{
       
   524 	return iBlockedOperations & EBlockedSetLocalName;
       
   525 	}
       
   526 
       
   527 
       
   528 inline void ASocket::SetBlockedRead()
       
   529 	{
       
   530 	SetBlockedReadFlag ();
       
   531 	}
       
   532 
       
   533 inline void ASocket::SetBlockedWrite()
       
   534 	{
       
   535 	SetBlockedWriteFlag ();
       
   536 	}
       
   537 
       
   538 inline void ASocket::SetBlockedClose()
       
   539 	{
       
   540 	SetBlockedCloseFlag ();
       
   541 	iBlockedCloseMsg->AcquireMessage(iCurrentMsg);
       
   542 	}
       
   543 
       
   544 inline void ASocket::SetBlockedIoctl()
       
   545 	{
       
   546 	SetBlockedIoctlFlag ();
       
   547 	iBlockedIoctlMsg->AcquireMessage(iCurrentMsg);
       
   548 	}
       
   549 
       
   550 inline void ASocket::SetBlockedConnect()
       
   551 	{
       
   552 	SetBlockedConnectFlag ();
       
   553 	iBlockedConnectMsg->AcquireMessage(iCurrentMsg);
       
   554 	}
       
   555 
       
   556 
       
   557 inline TBool ASocket::IsBlockedClose() const
       
   558 	{return iBlockedOperations&EBlockedClose;}
       
   559 
       
   560 inline TBool ASocket::IsBlockedConnect() const
       
   561 	{return iBlockedOperations&EBlockedConnect;}
       
   562 
       
   563 inline TBool ASocket::IsBlockedIoctl() const
       
   564 	{return iBlockedOperations&EBlockedIoctl;}
       
   565 
       
   566 inline TBool ASocket::IsBlockedRead() const
       
   567 	{return iBlockedOperations&EBlockedRead;}
       
   568 
       
   569 inline TBool ASocket::IsBlockedWrite() const
       
   570 	{return iBlockedOperations&EBlockedWrite;}
       
   571 
       
   572 void ASocket::CancelSend()
       
   573 	{ CompleteWrite(KErrCancel); }
       
   574 
       
   575 void ASocket::CancelRecv()
       
   576 	{ CompleteRead(KErrCancel); }
       
   577 
       
   578 inline void ASocket::ClearErrorIfNotFatal()
       
   579 	{
       
   580 	if (State() != ESStateError)
       
   581 		{
       
   582 		iError = KErrNone;
       
   583 		}
       
   584 	};
       
   585 
       
   586 
       
   587 inline ASocket::TSocketState ASocket::State() const
       
   588 	{
       
   589 	return iState;
       
   590 	}
       
   591 
       
   592 inline void ASocket::SetState(TSocketState aState)
       
   593 	{
       
   594 	iState = aState;
       
   595 	// If we've requested notification of available MBufs for a Recv or Send
       
   596 	// operation and now are entering some inappropriate state then we cancel this
       
   597 	if(iAllocAsync && iState != ESStateConnected && iState != ESStateOpen)
       
   598 		{
       
   599 		delete iAllocAsync;
       
   600 		iAllocAsync = NULL;
       
   601 		}
       
   602 	}
       
   603 
       
   604 inline void ASocket::SetFlowRequestPending(TBool aPending)
       
   605 	{
       
   606 	iIsFlowRequestPending = aPending;
       
   607 	}
       
   608 
       
   609 inline TBool ASocket::FlowRequestPending()
       
   610 	{
       
   611 	return iIsFlowRequestPending;
       
   612 	}
       
   613 
       
   614 }  //namespace ESock
       
   615 
       
   616 #endif
       
   617 // __SS_INTSOCK_H__
       
   618