datacommsserver/esockserver/eintsock/eintsock.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-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  @internalAll
       
    19 */
       
    20 
       
    21 #ifndef __EINTSOCK_H__
       
    22 #define __EINTSOCK_H__
       
    23 
       
    24 #include <e32std.h>
       
    25 #include <es_sock.h>
       
    26 #include <es_panic.h>
       
    27 
       
    28 
       
    29 GLREF_C void InternalSocketPanic(TESockPanic aPanic);
       
    30 
       
    31 class RInternalHostResolver; 	// no implementation yet - not need for PAN profile
       
    32 class RInternalServiceResolver; // no implementation yet - not need for PAN profile
       
    33 class RInternalConnection;		// no implementation yet - not need for PAN profile
       
    34 class RInternalNetDatabase;		// no implementation yet - not need for PAN profile
       
    35 
       
    36 class RMBufChain;
       
    37 class CInternalSocketImpl;
       
    38 class RInternalSocket
       
    39 /**
       
    40 A socket intended for use by components running inside the ESOCKV3 server, either within one
       
    41 thread or between threads.
       
    42 Currently, rather than interfacing with esock after the client-server interface (esock 
       
    43 wouldn't support this without modification), we just pretend to be esock from the protocol 
       
    44 below's point of view.
       
    45 
       
    46 @note This implementation *does not* support the use of RMBufChains by clients if the 
       
    47 protocol only provides a descriptor interface (and because of the mbuf<->des shim 
       
    48 provided by esock, we can never tell that it won't work, but no data will be returned 
       
    49 to the client)
       
    50 
       
    51 @internalAll
       
    52 @released Complete implementation as like RSocket
       
    53 */
       
    54 	{
       
    55 	friend class CInternalSocketImpl;
       
    56 	
       
    57 public:
       
    58 	//
       
    59 	// RSocket methods
       
    60 	//
       
    61 	// All methods copied from RSocket API, methods commented rather than
       
    62     // removed to allow incremental implementation, and easy reference to the
       
    63     // original API
       
    64 
       
    65     IMPORT_C RInternalSocket();
       
    66     IMPORT_C ~RInternalSocket();
       
    67 
       
    68 	// These methods replace the normal Open() methods, as we just need to create
       
    69     // an object here, rather than the three stage, connect, create & open process
       
    70     // used outside the esock thread.  As such the Socket Server is not required.
       
    71 	// The below 2 Open APIs are deprecated. With the asynchronous nature of COMMS FW and the 
       
    72 	// recent changing the RInternalSocket implementation to use ASocket the synchronous API need 
       
    73 	// special handling to make it work. It is better to use the asynchronous version of Open API and t
       
    74 	// this works inside the COMMS FW. Currently Bluetooth uses these 2 synchronous APIs. Future use of the
       
    75 	// Open API should use the asynchronous versions.
       
    76 	// 	@deprecated
       
    77 	IMPORT_C TInt Open(const TDesC& aName);		
       
    78 	//@deprecated
       
    79 	IMPORT_C TInt Open(TUint aAddrFamily,  TUint aSockType, TUint aProtocol);		
       
    80 	// 	@internalAll
       
    81 	IMPORT_C TInt Open();		
       
    82 	IMPORT_C void Open(const TDesC& aName, TRequestStatus& aStatus);		
       
    83 	IMPORT_C void Open(TUint aAddrFamily,  TUint aSockType, TUint aProtocol, TRequestStatus& aStatus);		
       
    84 	
       
    85 	IMPORT_C void Send(const TDesC8& aDesc,TUint aFlags,TRequestStatus& aStatus);
       
    86 	IMPORT_C void Send(RMBufChain& aData,TUint aFlags,TRequestStatus& aStatus);
       
    87 	IMPORT_C void Send(const TDesC8& aDesc,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
    88 	IMPORT_C void Send(RMBufChain& aData,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
    89 	IMPORT_C void CancelSend();
       
    90 
       
    91 	IMPORT_C void Recv(TDes8& aDesc, TUint aFlags, TRequestStatus& aStatus);
       
    92 	IMPORT_C void Recv(RMBufChain& aData, TUint aFlags, TRequestStatus& aStatus);
       
    93 	IMPORT_C void Recv(TDes8& aDesc, TUint aFlags, TRequestStatus& aStatus, TSockXfrLength& aLen);
       
    94 	IMPORT_C void Recv(RMBufChain& aData, TUint aFlags, TRequestStatus& aStatus, TSockXfrLength& aLen);
       
    95 	IMPORT_C void RecvOneOrMore(TDes8& aDesc, TUint aFlags, TRequestStatus& aStatus, TSockXfrLength& aLen);
       
    96 	IMPORT_C void CancelRecv();
       
    97 	
       
    98 	IMPORT_C void Read(TDes8& aDesc, TRequestStatus& aStatus);
       
    99 	IMPORT_C void Read(RMBufChain& aData, TRequestStatus& aStatus);
       
   100 	IMPORT_C void CancelRead();
       
   101 	
       
   102 	IMPORT_C void Write(const TDesC8& aDesc, TRequestStatus& aStatus);
       
   103 	IMPORT_C void Write(RMBufChain& aData, TRequestStatus& aStatus);
       
   104 	IMPORT_C void CancelWrite();
       
   105 	
       
   106 	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus);
       
   107 	IMPORT_C void SendTo(RMBufChain& aData,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus);
       
   108 	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
   109 	IMPORT_C void SendTo(RMBufChain& aData, TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
   110 
       
   111 	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus);
       
   112 	IMPORT_C void RecvFrom(RMBufChain& aData,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus);
       
   113 	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
   114 	IMPORT_C void RecvFrom(RMBufChain& aData,TSockAddr& aAddr,TUint aFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
       
   115 
       
   116 	IMPORT_C void Connect(TSockAddr& aAddr,TRequestStatus& aStatus);
       
   117 	IMPORT_C void Connect(TSockAddr& aAddr,const TDesC8& aConnectDataOut,TDes8& aConnectDataIn,TRequestStatus& aStatus);
       
   118 	IMPORT_C void CancelConnect();
       
   119 	
       
   120 	IMPORT_C TInt Bind(TSockAddr& aAddr);								
       
   121 	IMPORT_C TInt SetLocalPort(TInt aPort);								
       
   122 	
       
   123 	IMPORT_C void Accept(RInternalSocket& aBlankSocket,TRequestStatus& aStatus);
       
   124 	IMPORT_C void Accept(RInternalSocket& aBlankSocket,TDes8& aConnectData,TRequestStatus& aStatus);
       
   125 	IMPORT_C void CancelAccept();
       
   126 	
       
   127 	IMPORT_C TInt Listen(TUint aQSize);									
       
   128 	IMPORT_C TInt Listen(TUint aQSize,const TDesC8& aConnectData);		
       
   129 	
       
   130 	IMPORT_C TInt SetOpt(TUint aOptionName,TUint aOptionLevel,const TDesC8& aOption=TPtrC8(NULL,0));	
       
   131 	IMPORT_C TInt SetOpt(TUint aOptionName,TUint aOptionLevel,TInt aOption);							
       
   132 	IMPORT_C TInt GetOpt(TUint aOptionName,TUint aOptionLevel,TDes8& aOption);							
       
   133 	IMPORT_C TInt GetOpt(TUint aOptionName,TUint aOptionLevel,TInt& aOption);							
       
   134 
       
   135 	IMPORT_C void Ioctl(TUint aCommand,TRequestStatus& aStatus,TDes8* aDesc=NULL,TUint aLevel=KLevelUnspecified);
       
   136 	IMPORT_C void CancelIoctl();
       
   137 	
       
   138 	IMPORT_C TInt GetDisconnectData(TDes8& aDesc);		
       
   139 	
       
   140 	IMPORT_C void LocalName(TSockAddr& aAddr);			
       
   141 	IMPORT_C TUint LocalPort();							
       
   142 	IMPORT_C void RemoteName(TSockAddr& aAddr);			
       
   143 	
       
   144 	IMPORT_C void Close();
       
   145 	
       
   146 	IMPORT_C void Shutdown(RSocket::TShutdown aHow,TRequestStatus& aStatus);
       
   147 	IMPORT_C void Shutdown(RSocket::TShutdown aHow,const TDesC8& aDisconnectDataOut,TDes8& aDisconnectDataIn,TRequestStatus& aStatus);
       
   148 	IMPORT_C void CancelAll();
       
   149 
       
   150 	IMPORT_C TInt Info(TProtocolDesc& aProtocol);		
       
   151 
       
   152 	// don't support socket ::Name() with internal sockets, it's not needed for xfer here	- IMPORT_C TInt Name(TName& aName);
       
   153 	IMPORT_C TInt Transfer(RInternalSocket& aSource); // special version for internal sockets
       
   154 
       
   155 private:
       
   156 	// for socket xfer and listen/accept
       
   157 	inline CInternalSocketImpl* Implementation()
       
   158 		{
       
   159 		return(iImplementation);
       
   160 		}
       
   161 	inline void SetImplementation(CInternalSocketImpl* aImplementation)
       
   162 		{
       
   163 		iImplementation = aImplementation;
       
   164 		}
       
   165 	TInt AdoptBlankSocketToCurrentThread ( RInternalSocket& aBlankSocket );
       
   166 private:
       
   167 	CInternalSocketImpl* iImplementation; //< ptr to implementation, created on Open()
       
   168 	};
       
   169 	
       
   170 #endif // __EINTSOCK_H__
       
   171