epoc32/include/es_sock.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/es_sock.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/es_sock.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,1556 @@
     1.4 -es_sock.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedAll
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +#if !defined(__ES_SOCK_H__)
    1.29 +#define __ES_SOCK_H__
    1.30 +
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <nifvar.h>
    1.34 +
    1.35 +#undef	_DEBUG_SOCKET_FUNCTIONS
    1.36 +#if defined(_DEBUG)
    1.37 +#define	_DEBUG_SOCKET_FUNCTIONS
    1.38 +#endif
    1.39 +
    1.40 +#include <comms-infras/metacontainer.h>
    1.41 +using Meta::STypeId;
    1.42 +using Meta::SMetaDataECom;
    1.43 +using Meta::RMetaDataEComContainer;
    1.44 +
    1.45 +
    1.46 +// Forward declaration of CCommsDataObjectBase
    1.47 +namespace ESock
    1.48 +{
    1.49 +	class CCommsDataObjectBase;
    1.50 +}
    1.51 +
    1.52 +/**
    1.53 +Name of ESock server in EKA2
    1.54 +@internalComponent
    1.55 +*/
    1.56 +_LIT(SOCKET_SERVER_NAME, "!SocketServer");
    1.57 +
    1.58 +/**
    1.59 +Canonical names for the core ESOCKSVR modules
    1.60 +*/
    1.61 +_LIT8(SOCKET_SERVER_MAIN_MODULE_NAME, "ESock_Main");		// Worker 0
    1.62 +_LIT8(SOCKET_SERVER_IP_MODULE_NAME, "ESock_IP");			// Worker 1
    1.63 +_LIT8(SOCKET_SERVER_BT_MODULE_NAME, "ESock_Bt");			// Worker 2
    1.64 +_LIT8(SOCKET_SERVER_IR_MODULE_NAME, "ESock_Ir");			// Worker 3
    1.65 +_LIT8(SOCKET_SERVER_SMSWAP_MODULE_NAME, "ESock_SmsWap");	// Worker 4
    1.66 +
    1.67 +/**
    1.68 +Id of the network layer.
    1.69 +@publishedPartner
    1.70 +*/
    1.71 +const TUint KCommsNetworkLayerId = 1;
    1.72 +
    1.73 +/**
    1.74 +Default number of message slots.
    1.75 +@publishedAll
    1.76 +@released
    1.77 +*/
    1.78 +const TUint KESockDefaultMessageSlots=8;
    1.79 +
    1.80 +/**
    1.81 +Major Version Number of Connection
    1.82 +
    1.83 +@internalComponent
    1.84 +*/
    1.85 +const TUint KConnectionMajorVersionNumber=1;
    1.86 +
    1.87 +/**
    1.88 +Minor Version Number of Connection
    1.89 +
    1.90 +@internalComponent
    1.91 +*/
    1.92 +const TUint KConnectionMinorVersionNumber=0;
    1.93 +
    1.94 +/**
    1.95 +Build Version Number of Connection
    1.96 +this must not be changed - expected by TCPIP to be >=68
    1.97 +
    1.98 +@internalComponent
    1.99 +*/
   1.100 +const TUint KConnectionBuildVersionNumber=68;
   1.101 +
   1.102 +/**
   1.103 +Size of Maximum SubConnection event
   1.104 +
   1.105 +@internalComponent
   1.106 +@note If you allocate this on the heap, remember to delete through the pointer to the buffer and not any pointers to the events held inside it
   1.107 +if you change this value, you will alter the function signature and break the .def file
   1.108 +*/
   1.109 +const TUint KMaxSubConnectionEventSize = 512;
   1.110 +
   1.111 +/**
   1.112 +SubConnection Unique Id
   1.113 +@publishedPartner
   1.114 +@released
   1.115 +*/
   1.116 +typedef TUint TSubConnectionUniqueId;
   1.117 +
   1.118 +/**
   1.119 +Buffer for  notification of any change in the state of  SubConnection.
   1.120 +@publishedPartner
   1.121 +@released
   1.122 +*/
   1.123 +typedef TBuf8<KMaxSubConnectionEventSize> TSubConnectionNotificationBuf;
   1.124 +//
   1.125 +const TUint KUseEmbeddedUniqueId = 0; ///< Used by RConnection to identify cases where the subconnection id is embedded in the data structure
   1.126 +
   1.127 +const TUint KConnProgressDefault = 0; ///< Default Connection Progress
   1.128 +
   1.129 +class TSessionPref
   1.130 +/**
   1.131 +Hint to the Socket Server on what will be the principal usage of the connection.
   1.132 +It is by no means a restriction but may result in better performance for the session.
   1.133 +
   1.134 +@publishedAll
   1.135 +@released
   1.136 +*/
   1.137 +	{
   1.138 +public:
   1.139 +    IMPORT_C TSessionPref();
   1.140 +public:
   1.141 +	/** The protocol's address family. For example, for TCP/IP protocols, KAfInet. */
   1.142 +	TUint iAddrFamily;
   1.143 +	/** The protocol type. */
   1.144 +	TUint iProtocol;
   1.145 +	/** Reserved. */
   1.146 +	TUint iReserved;
   1.147 +	/** Reserved. */
   1.148 +	TUint iReserved1;
   1.149 +	/** Reserved. */
   1.150 +	TUint iReserved2;
   1.151 +	/** Reserved. */
   1.152 +	TUint iReserved3;
   1.153 +	/** Reserved. */
   1.154 +	TUint iReserved4;
   1.155 +	};
   1.156 +
   1.157 +class TNifProgress
   1.158 +/**
   1.159 +Contains progress information on a dial-up connection
   1.160 +
   1.161 +@publishedAll
   1.162 +@released
   1.163 +*/
   1.164 +	{
   1.165 +public:
   1.166 +	inline TNifProgress();
   1.167 +	TInt iStage;
   1.168 +	TInt iError;
   1.169 +	};
   1.170 +
   1.171 +class TNifAgentInfo
   1.172 +/**
   1.173 +Contains information describing an agent
   1.174 +
   1.175 +@publishedAll
   1.176 +@released
   1.177 +*/
   1.178 +	{
   1.179 +public:
   1.180 +	/**	This class Contains version information	*/
   1.181 +	TVersion iVersion;
   1.182 +
   1.183 +	/**	This class Defines a modifiable buffer descriptor that can contain the name of a reference counting object	*/
   1.184 +	TName iName;
   1.185 +	};
   1.186 +
   1.187 +/**
   1.188 +Buffer for Network Interface Progress
   1.189 +
   1.190 +@publishedAll
   1.191 +@released
   1.192 +*/
   1.193 +typedef TPckgBuf<TNifProgress> TNifProgressBuf;
   1.194 +
   1.195 +/**
   1.196 +Socket address offsets.
   1.197 +
   1.198 +@publishedAll
   1.199 +@released
   1.200 +*/
   1.201 +struct SSockAddr
   1.202 +/** Socket address offsets.
   1.203 +
   1.204 +This class defines the internal offsets of data members for the TSockAddr
   1.205 +class. */
   1.206 +	{
   1.207 +	/** Address family of socket address */
   1.208 +	TUint iFamily;
   1.209 +	/** Port (or equivilent) number */
   1.210 +	TUint iPort;
   1.211 +	};
   1.212 +
   1.213 +/**
   1.214 +Maximum sockets address size.
   1.215 +@publishedAll
   1.216 +@released
   1.217 +*/
   1.218 +const TUint KMaxSockAddrSize=0x20;
   1.219 +
   1.220 +class TSockAddr : public TBuf8<KMaxSockAddrSize>
   1.221 +/** Represents an end point address.
   1.222 +
   1.223 +Protocols interpret the class within the socket server to route packets and
   1.224 +form connections. It can be used on its own or as derived by protocols. The
   1.225 +SSockAddr class acts as an offset map for the TSockAddr class which has a
   1.226 +family field and a port field. The family field may be used by protocols to
   1.227 +"up-cast" the base-class to the correct derived class. The port field is provided
   1.228 +because it is a common practice for protocols to use port equivalents in addressing.
   1.229 +
   1.230 +Writing derived classes:
   1.231 +
   1.232 +The two protected member functions allow further data members to be defined
   1.233 +past the area of the base SSockAddr. In any derived constructor the length
   1.234 +of the descriptor should be set to the length of the valid data contained
   1.235 +in the address. Subsequent member function calls should also adjust the length
   1.236 +if it affects valid data.
   1.237 +@publishedAll
   1.238 +@released */
   1.239 +	{
   1.240 +public:
   1.241 +	IMPORT_C TSockAddr();
   1.242 +	IMPORT_C TSockAddr(TUint aFamily);
   1.243 +	IMPORT_C TUint Family() const;
   1.244 +	IMPORT_C void SetFamily(TUint aFamily);
   1.245 +	IMPORT_C TUint Port() const;
   1.246 +	IMPORT_C void SetPort(TUint aPort);
   1.247 +	IMPORT_C TBool CmpPort(const TSockAddr& anAddr) const;
   1.248 +	IMPORT_C TInt GetUserLen();
   1.249 +protected:
   1.250 +	IMPORT_C void SetUserLen(TInt aLen);
   1.251 +	inline TUint8* UserPtr() const;
   1.252 +private:
   1.253 +	inline SSockAddr* BasePtr() const;
   1.254 +	};
   1.255 +
   1.256 +// Address families (based upon protocol IDs used by ARP/REVARP)
   1.257 +/** Default (unspecified) protocol module.
   1.258 +@publishedAll
   1.259 +@released */
   1.260 +const TUint KAFUnspec=0;
   1.261 +
   1.262 +// Socket types
   1.263 +/** Stream socket.
   1.264 +@publishedAll
   1.265 +@released */
   1.266 +const TUint KSockStream=1;
   1.267 +/** Datagram socket. */
   1.268 +const TUint KSockDatagram=2;
   1.269 +/** Datagrams with sequence numbers. */
   1.270 +const TUint KSockSeqPacket=3;
   1.271 +/** Raw socket. */
   1.272 +const TUint KSockRaw=4;
   1.273 +
   1.274 +// constants for various socket calls - can't be enums cos they're largely defined by protocols
   1.275 +// The following constants are used to define level parameters for RSocket::Ioctl(), RSocket::GetOpt()
   1.276 +// and RSocket::SetOpt().
   1.277 +/** Generic socket options/commands.
   1.278 +@publishedAll
   1.279 +@released */
   1.280 +const TInt KSOLSocket=1;
   1.281 +/** Unspecified level. */
   1.282 +const TInt KLevelUnspecified=0;
   1.283 +
   1.284 +// Socket options defined by the server.
   1.285 +// Used through RSocket::SetOpt(), and RSocket::GetOpt() with anOptionLevel set
   1.286 +// to KSOLSocket. Options can be both get and set unless otherwise.
   1.287 +// stated.
   1.288 +// Notes:
   1.289 +// Setting the send and receive buffer sizes explicitly can help to reduce
   1.290 +// the memory requirements if many data sockets are used in an application. If a
   1.291 +// socket is datagram-oriented and its receive/send buffer size is set
   1.292 +// to KSocketBufSizeUndefined, then the initial buffer size will
   1.293 +// be KSocketDefaultBufferSize and buffers will grow to accommodate
   1.294 +// larger sends/receives. If the buffer size is set explicitly for
   1.295 +// datagram-oriented sockets, sends which exceed the set size will fail
   1.296 +// with KErrTooBig and receives will be truncated. For stream based
   1.297 +// sockets there should be no noticeable effect on client reads, unless the buffer
   1.298 +// size is set to a prohibitively low value.
   1.299 +/** Debugging enabled or disabled . Values are:
   1.300 +
   1.301 +(TInt)0. Disabled
   1.302 +
   1.303 +(TInt)1. Enabled
   1.304 +@publishedAll
   1.305 +@released */
   1.306 +const TUint KSODebug=1;
   1.307 +/** Socket receive buffer size. Values are:
   1.308 +
   1.309 +KSocketBufSizeUndefined
   1.310 +
   1.311 +1 to KMaxTUint: explicit buffer size, supplied as a TPckgBuf<TUint> */
   1.312 +const TUint KSORecvBuf=2;
   1.313 +/** Socket send buffer size. Values are:
   1.314 +
   1.315 +KSocketBufSizeUndefined
   1.316 +
   1.317 +1 to KMaxTUint: explicit buffer size, supplied as a TPckgBuf<TUint> */
   1.318 +const TUint KSOSendBuf=3;
   1.319 +/** Socket nonblocking mode. To set, no option values are required. For getting,
   1.320 +values are:
   1.321 +
   1.322 +(TInt)0. Disabled
   1.323 +
   1.324 +(TInt)1. Enabled */
   1.325 +const TUint KSONonBlockingIO=4;
   1.326 +/** Socket blocking mode. To set, no values are required. For getting, values are:
   1.327 +
   1.328 +(TInt)0. Disabled
   1.329 +
   1.330 +(TInt)1. Enabled */
   1.331 +const TUint KSOBlockingIO=5;
   1.332 +/** Getting only: gets a bitmask of flags describing the read/write/exception status
   1.333 +of the socket. Value is a TInt containing a bitmask of socket status (KSockSelectExcept
   1.334 +etc.) constants. */
   1.335 +const TUint KSOSelectPoll=6;
   1.336 +/** Getting only: retrieve the number of bytes currently available for reading.
   1.337 +Value is a TInt. */
   1.338 +const TUint KSOReadBytesPending=7;
   1.339 +/** Getting only: retrieve the urgent data offset (only for stream protocols that
   1.340 +support urgent data).
   1.341 +Value is a TInt. */
   1.342 +const TUint KSOUrgentDataOffset=8;
   1.343 +/** Getting only: retrieves the last error. Value is a TInt. */
   1.344 +const TUint KSOSelectLastError=9;
   1.345 +
   1.346 +
   1.347 +/**
   1.348 +Setting only. Enables socket to be transferred to the process with given capabilities.
   1.349 +The capabilities set should be supplied as TPckgBuf<TSecurityPolicy>.
   1.350 +Each RSocket::Transfer() call must be enabled by setting this option.
   1.351 +@publishedAll
   1.352 +@released */
   1.353 +const TUint KSOEnableTransfer = 10;
   1.354 +
   1.355 +/** Setting only. Disables a socket's possibility to be transferred. No option required.
   1.356 +@publishedAll
   1.357 +@released */
   1.358 +
   1.359 +const TUint KSODisableTransfer = 11;
   1.360 +
   1.361 +// The following constants relating to buffer sizes are defined
   1.362 +
   1.363 +/** Use default buffer size. */
   1.364 +const TInt  KSocketBufSizeUndefined=0;
   1.365 +/** Default buffer size. */
   1.366 +const TInt  KSocketDefaultBufferSize=4096;
   1.367 +
   1.368 +//internal
   1.369 +const TUint KSocketInternalOptionBit=0x80000000;	///< Must not be set for client requests
   1.370 +
   1.371 +/**
   1.372 +Ioctls
   1.373 +
   1.374 +Must not be set for client requests
   1.375 +
   1.376 +@internalComponent
   1.377 +@released
   1.378 +*/
   1.379 +const TUint KInternalIoctlBit=0x80000000;
   1.380 +
   1.381 +/** The aDesc parameter of RSocket::Ioctl() specifies a TUint containing a bitmask
   1.382 +of Socket status constants. The completion status will be the subset of those
   1.383 +conditions which is now true for the socket.
   1.384 +
   1.385 +Used through RSocket::Ioctl(), with aLevel set to KSOLSocket.
   1.386 +
   1.387 +@see KSOSelectPoll parameter to RSocket::GetOpt(), which allows the
   1.388 +current select state of the socket to be read synchronously, and KSOSelectLastError,
   1.389 +which returns the error code. */
   1.390 +const TUint KIOctlSelect=1;
   1.391 +
   1.392 +// Select ioctl states
   1.393 +// Socket status. See also KSOSelectLastError and KSOSelectPoll.
   1.394 +/** Data is available to be read; for listening sockets, a connect is pending.
   1.395 +@publishedAll
   1.396 +@released */
   1.397 +const TUint KSockSelectRead   =0x00000001;
   1.398 +/** Writing to the socket is not currently blocked by flow-control. */
   1.399 +const TUint KSockSelectWrite  =0x00000002;
   1.400 +/** An error has occurred. */
   1.401 +const TUint KSockSelectExcept =0x00000004;
   1.402 +/** Include tail of prior read datagram as available data (ie indicates next read will be with read continuation) */
   1.403 +const TUint KSockSelectReadContinuation = 0x01000000;
   1.404 +
   1.405 +// Socket write flags
   1.406 +/** The data to be sent is urgent and is given a higher priority than ordinary data in the send queue.
   1.407 +KSockWriteUrgent may only be provided as a flag to Send() if the protocol's information flag is marked with
   1.408 +KSIUrgentData, otherwise Send() will return with KErrNotSupported. AKA: Out of band or unit data.
   1.409 +@publishedAll
   1.410 +@released */
   1.411 +const TUint KSockWriteUrgent=0x00000001;
   1.412 +/** Must not be set for client requests. */
   1.413 +const TUint KSocketInternalWriteBit=0x80000000;
   1.414 +/** The top 8 bits are reserved for system purposes; protocols must not define these bits. */
   1.415 +const TUint KSockWriteSystemMask=0xFF000000;
   1.416 +
   1.417 +// Socket read flags
   1.418 +/** Read data without consuming it, data remains in the receive queue. KSockReadPeek may only be provided
   1.419 +as a flag to Recv() if the protocol's information flag is marked with KSIPeekData, otherwise Recv() will
   1.420 +return with KErrNotSupported.
   1.421 +@publishedAll
   1.422 +@released
   1.423 +*/
   1.424 +const TUint KSockReadPeek=0x00000001;
   1.425 +/** Must not be set for client requests. */
   1.426 +const TUint KSocketInternalReadBit=0x80000000;
   1.427 +/** Read from datagram in a stream-like fashion (not discarding tails). */
   1.428 +const TUint KSockReadContinuation = 0x01000000;
   1.429 +// Types
   1.430 +
   1.431 +/** Used in structure TProtocolDesc to describes the endianness of a protocol.
   1.432 +@publishedAll
   1.433 +@released */
   1.434 +enum TByteOrder
   1.435 +	{
   1.436 +	/** Big endian */
   1.437 +	EBigEndian,
   1.438 +	/** Little endian */
   1.439 +	ELittleEndian,
   1.440 +	/** Other byte order */
   1.441 +	EOtherByteOrder,
   1.442 +	};
   1.443 +
   1.444 +//
   1.445 +// Protocol Service information bitmasks.
   1.446 +// The following constants are defined for
   1.447 +// TServerProtocolDesc and TProtocolDesc
   1.448 +//
   1.449 +/** The protocol is connectionless.
   1.450 +@publishedPartner
   1.451 +@released */
   1.452 +const TUint KSIConnectionLess=0x00000001;
   1.453 +/** The protocol is reliable. */
   1.454 +const TUint KSIReliable=0x00000002;
   1.455 +/** The protocol guarantees in-order delivery. */
   1.456 +const TUint KSIInOrder=0x00000004;
   1.457 +/** The protocol is message based. */
   1.458 +const TUint KSIMessageBased=0x00000008;
   1.459 +/** The same as message based. */
   1.460 +const TUint KSIDatagram=KSIMessageBased;
   1.461 +/** The protocol is stream based. */
   1.462 +const TUint KSIStreamBased=0x00000010;
   1.463 +/** The protocol supports a stream like interface but maintains datagram boundaries. */
   1.464 +const TUint KSIPseudoStream=0x00000020;
   1.465 +/** The protocol offers an expedited data service. */
   1.466 +const TUint KSIUrgentData=0x00000040;
   1.467 +/** The protocol can send user data on a connection request. */
   1.468 +const TUint KSIConnectData=0x00000080;
   1.469 +/** The protocol can send user data on a disconnect request. */
   1.470 +const TUint KSIDisconnectData=0x00000100;
   1.471 +/** The protocol supports broadcast addresses. */
   1.472 +const TUint KSIBroadcast=0x00000200;
   1.473 +/** The protocol supports point to multi-point connections. */
   1.474 +const TUint KSIMultiPoint=0x00000400;
   1.475 +/** The protocol supports a quality of service metric. */
   1.476 +const TUint KSIQOS=0x00000800;
   1.477 +/** The protocol is write only. */
   1.478 +const TUint KSIWriteOnly=0x00001000;
   1.479 +/** The protocol is read only. */
   1.480 +const TUint KSIReadOnly=0x00002000;
   1.481 +/** The protocol supports graceful close. */
   1.482 +const TUint KSIGracefulClose=0x00004000;
   1.483 +/** The same socket can be reconnected if it disconnects (for whatever reason). */
   1.484 +const TUint KSICanReconnect=0x00008000;
   1.485 +/** Protocol supports peeking (looking at the data without removing it from the
   1.486 +protocol). */
   1.487 +const TUint KSIPeekData=0x00010000;
   1.488 +/** Protocol is to be informed of the identity of the client (i.e. process ID,
   1.489 +thread ID and UID) of each SAP (i.e. Socket Service Provider) created.
   1.490 +@see KSoOwnerInfo and TSoOwnerInfo */
   1.491 +const TUint KSIRequiresOwnerInfo=0x00020000;	// SetOption(KSoOwnerInfo) invoked on each SAP
   1.492 +
   1.493 +//
   1.494 +// Naming service constants
   1.495 +// The following constants are defined for
   1.496 +// TServerProtocolDesc and TProtocolDesc
   1.497 +//
   1.498 +/** Protocol supports resolving human readable entity names into network addresses
   1.499 +(like DNS).
   1.500 +@publishedPartner
   1.501 +@released */
   1.502 +const TUint KNSNameResolution=0x00000001;
   1.503 +/** Network naming is hierarchical. */
   1.504 +const TUint KNSHierarchicalNaming=0x00000002;
   1.505 +/** @deprecated Use KNSHierarchicalNaming instead. */
   1.506 +const TUint KNSHeirarchicalNaming=0x00000002;
   1.507 +/** Addressing is dynamic and should be attempted every time before connecting
   1.508 +(like IrDA). */
   1.509 +const TUint KNSRemoteDiscovery=0x00000004;
   1.510 +/** Protocol supports service name to port number resolution. (For example, you
   1.511 +can look up TCP to get port 48.) */
   1.512 +const TUint KNSServiceResolution=0x00000008;
   1.513 +/** Protocol supports additions to the name database. */
   1.514 +const TUint KNSNameRegistration=0x00000010;
   1.515 +/** Protocol supports additions to the service database. */
   1.516 +const TUint KNSServiceRegistration=0x00000020;
   1.517 +/** Addressing is dynamic - i.e. name to address mapping may change (like IrDA
   1.518 +which randomly chooses machine addresses.) */
   1.519 +const TUint KNSDynamicAddressing=0x00000040;
   1.520 +/** Protocol has another database which is defined by the protocol. */
   1.521 +const TUint KNSInfoDatabase=0x00000080;
   1.522 +/** Protocol may request Socket Server to startup a connection on its behalf (via
   1.523 +the KErrCompletion error code)*/
   1.524 +const TUint KNSRequiresConnectionStartup=0x00000100;
   1.525 +
   1.526 +// Security Schemes
   1.527 +// The following constants are defined for
   1.528 +// TServerProtocolDesc and TProtocolDesc
   1.529 +/** No security
   1.530 +@publishedAll
   1.531 +@released */
   1.532 +const TUint KSocketNoSecurity=0x00000000;
   1.533 +/** Secure Sockets Layer.
   1.534 +
   1.535 +@see CSecureSocket */
   1.536 +const TUint KSecureSockets=0x00000001;
   1.537 +
   1.538 +// Special message sizes
   1.539 +// The following constants are defined for
   1.540 +// TServerProtocolDesc and TProtocolDesc
   1.541 +/** Reads and writes can be of any size: the data is treated as a stream.
   1.542 +@publishedAll
   1.543 +@released */
   1.544 +const TInt KSocketMessageSizeIsStream=0;
   1.545 +/** Depends on lower layer or is dynamic. */
   1.546 +const TInt KSocketMessageSizeUndefined=1;
   1.547 +/** Data is packet-oriented but packets can be of any size (i.e. the remote end
   1.548 +must specify a Read of the same size as your Write, but there is no limit
   1.549 +on this size.) */
   1.550 +const TInt KSocketMessageSizeNoLimit=-1;
   1.551 +
   1.552 +
   1.553 +/** Undefined socket type.
   1.554 +@publishedAll
   1.555 +@released */
   1.556 +const TUint KUndefinedSockType=0xFFFFFFFF;
   1.557 +
   1.558 +
   1.559 +/** Undefined socket type.
   1.560 +Undefined Protocol
   1.561 +@released */
   1.562 +const TUint KUndefinedProtocol=0xFFFFFFFE;
   1.563 +
   1.564 +/** Contains the name of a protocol in structure TProtocolDesc.
   1.565 +@publishedAll
   1.566 +@released */
   1.567 +typedef TBuf<0x20> TProtocolName;
   1.568 +/** Defines a descriptor to hold a service name string. */
   1.569 +typedef TBuf<0x20> TServiceName;
   1.570 +/** Defines a descriptor to hold a host name string. */
   1.571 +typedef TBuf<0x100> THostName;
   1.572 +
   1.573 +/**
   1.574 +Socket protocol information for use by clients
   1.575 +
   1.576 +@publishedAll
   1.577 +@released
   1.578 +*/
   1.579 +struct TProtocolDesc
   1.580 +/** Socket protocol information for use by clients. */
   1.581 +	{
   1.582 +public:
   1.583 +	/** The name of the protocol
   1.584 +
   1.585 +	@see TProtocolName */
   1.586 +	TProtocolName iName;
   1.587 +	/** An integer identifying the protocol's address family. For example, for TCP/IP
   1.588 +	protocols, KAfInet. */
   1.589 +	TUint iAddrFamily;
   1.590 +	/** An integer specifying the socket type. For example, for TCP, KSockStream. */
   1.591 +	TUint iSockType;
   1.592 +	/** An integer specifying the specific protocol. For example, for TCP, KProtocolInetTcp. */
   1.593 +	TUint iProtocol;
   1.594 +	/** The version of the protocol
   1.595 +
   1.596 +	@see TVersion */
   1.597 +	TVersion iVersion;
   1.598 +	/** The byte order that the protocol uses
   1.599 +
   1.600 +	@see TByteOrder */
   1.601 +	TByteOrder iByteOrder;
   1.602 +	/** A bit mask of service information flags.
   1.603 +
   1.604 +	@see KSockStream etc. */
   1.605 +	TUint iServiceInfo;
   1.606 +	/** A bit mask indicating if the protocol supports name resolution, service resolution,
   1.607 +	or database access services.
   1.608 +
   1.609 +	@see KNSNameResolution etc. */
   1.610 +	TUint iNamingServices;
   1.611 +	/** A bitmask of security flags.
   1.612 +
   1.613 +	@see KSocketNoSecurity etc. */
   1.614 +	TUint iSecurity;
   1.615 +	/** The message size of datagram protocols.
   1.616 +
   1.617 +	@see KSocketMessageSizeIsStream etc. */
   1.618 +	TInt iMessageSize;
   1.619 +	};
   1.620 +
   1.621 +// socket errors
   1.622 +/** This error is returned from operations on non-blocking sockets that cannot
   1.623 +be completed immediately, for example receive when no data is queued for reading.
   1.624 +It is a non-fatal error, and the operation should be retried later.
   1.625 +@publishedAll
   1.626 +@released */
   1.627 +const TInt KErrWouldBlock=-1000;
   1.628 +
   1.629 +/**
   1.630 +socket errors
   1.631 +
   1.632 +The value -17210 is taken from the range allocated for Esock (beginning at -17200)
   1.633 +A gap has been left between the currently existing vals and this one.
   1.634 +
   1.635 +@publishedAll
   1.636 +@released
   1.637 +*/
   1.638 +const TInt KErrConnectionTerminated=-17210;
   1.639 +
   1.640 +const TInt KErrCannotFindProtocol = -17211;
   1.641 +
   1.642 +/** Used in RSocket read and write calls to pass the length of data read and written.
   1.643 +@publishedAll
   1.644 +@released */
   1.645 +typedef TPckgBuf<TInt> TSockXfrLength;
   1.646 +
   1.647 +class TSockIO
   1.648 +/**
   1.649 +IPC Data holder
   1.650 +
   1.651 +@internalComponent
   1.652 +*/
   1.653 +	{
   1.654 +public:
   1.655 +	const TSockXfrLength* iLength;  ///< length of data read and written
   1.656 +	TUint iFlags;                   ///<  Flag
   1.657 +	TSockAddr* iAddr;               ///< Socket Address
   1.658 +	};
   1.659 +
   1.660 +class TSockIOBufC : public TPckgC<TSockIO>
   1.661 +/** @internalComponent */
   1.662 +	{
   1.663 +public:
   1.664 +	inline TSockIOBufC();
   1.665 +	TSockIO iArgs;
   1.666 +	};
   1.667 +
   1.668 +class TSockOpen
   1.669 +/** @internalComponent */
   1.670 +	{
   1.671 +public:
   1.672 +	TUint iAddrFamily;
   1.673 +	TUint iSockType;
   1.674 +	TUint iProtocol;
   1.675 +	TInt  iHandle;
   1.676 +	TInt  iReserved;
   1.677 +	};
   1.678 +
   1.679 +class TSockOpenBufC : public TPckgC<TSockOpen>
   1.680 +/** @internalComponent */
   1.681 +	{
   1.682 +public:
   1.683 +	inline TSockOpenBufC();
   1.684 +	TSockOpen iArgs;
   1.685 +	};
   1.686 +
   1.687 +class RSocket;
   1.688 +class RConnection;
   1.689 +class RSocketServ : public RSessionBase
   1.690 +/** Provides the Connect() function to create an IPC communication channel to the
   1.691 +socket server. To close the channel RHandleBase provides a RHandleBase::Close()
   1.692 +function.
   1.693 +
   1.694 +The prime use for instances of RSocketServ is to establish subsession communications
   1.695 +for RSocket, RHostResolver, RNetDatabase and RConnection.  Any of the resources
   1.696 +which are open using the session are automatically closed when the session is
   1.697 +terminated, however it is more appropriate to issue a Close() on each subsession object
   1.698 +before closing the session.
   1.699 +
   1.700 +The following operations are also provided:
   1.701 +
   1.702 +NumProtocols() - enumerates the number of protocols of which the socket server
   1.703 +is currently aware.
   1.704 +
   1.705 +GetProtocolInfo()/FindProtocol() - return information about a specific protocol.
   1.706 +
   1.707 +StartProtocol() - loads a protocol asynchronously.
   1.708 +
   1.709 +@note This class is not intended for user derivation.
   1.710 +@publishedAll
   1.711 +@released  */
   1.712 +	{
   1.713 +public:
   1.714 +    IMPORT_C RSocketServ();
   1.715 +	IMPORT_C TInt Connect(TUint aMessageSlots=KESockDefaultMessageSlots);
   1.716 +	IMPORT_C TInt Connect(const TSessionPref& aPref, TUint aMessageSlots=KESockDefaultMessageSlots);
   1.717 +	IMPORT_C TVersion Version() const;
   1.718 +	IMPORT_C TInt NumProtocols(TUint& aCount);
   1.719 +	IMPORT_C TInt GetProtocolInfo(TUint anIndex,TProtocolDesc& aProtocol);
   1.720 +	IMPORT_C TInt FindProtocol(const TProtocolName& aName,TProtocolDesc& aProtocol);
   1.721 +	IMPORT_C void StartProtocol(TUint anAddrFamily,TUint aSockType,TUint aProtocol,TRequestStatus& aStatus);
   1.722 +	IMPORT_C void StopProtocol(TUint anAddrFamily,TUint aSockType,TUint aProtocol,TRequestStatus& aStatus);
   1.723 +	IMPORT_C TInt InstallExtension(const TDesC& aDllName, const TDesC& aArgs=TPtrC());
   1.724 +	IMPORT_C void SetExclusiveMode(TRequestStatus& aStatus);
   1.725 +	IMPORT_C void ClearExclusiveMode();
   1.726 +	IMPORT_C TInt __DbgMarkHeap();
   1.727 +	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
   1.728 +	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
   1.729 +	IMPORT_C TInt __DbgFailNext(TInt aCount);
   1.730 +	IMPORT_C TBool __DbgCheckFailNext() const;
   1.731 +	IMPORT_C TInt __DbgFailNextMbuf(TInt aCount);
   1.732 +	IMPORT_C TInt __DbgSetMbufPoolLimit(TInt asize);
   1.733 +	IMPORT_C TInt __DbgCheckMbuf(TInt asize);
   1.734 +	IMPORT_C TInt __DbgMbufFreeSpace();
   1.735 +	IMPORT_C TInt __DbgMbufTotalSpace();
   1.736 +	};
   1.737 +
   1.738 +NONSHARABLE_CLASS(RCommsSubSession) : public RSubSessionBase
   1.739 +	{
   1.740 +	friend class RCommsApiExtensionBase;
   1.741 +	};
   1.742 +
   1.743 +class RSubConnection;
   1.744 +class RSocket : public RCommsSubSession
   1.745 +/** Provides a client endpoint to a protocol. It provides functions for socket
   1.746 +creation, reading, writing, passive connection, active connection, setting
   1.747 +addresses and querying addresses. Use this class as an endpoint for network
   1.748 +type communications. It provides the following services:
   1.749 +
   1.750 +reading from and writing to protocol
   1.751 +
   1.752 +binding to addresses
   1.753 +
   1.754 +active connecting
   1.755 +
   1.756 +passive connection through the listen/accept model
   1.757 +
   1.758 +Before using any of these services, a connection to a socket server session
   1.759 +must have been made and the socket must be open.
   1.760 +
   1.761 +@publishedAll
   1.762 +@released Since v5.0*/
   1.763 +	{
   1.764 +friend class RSocketServ;
   1.765 +public:
   1.766 +	/** Used in structure TProtocolDesc to describes the endianness of a protocol. */
   1.767 +	enum TShutdown
   1.768 +		{
   1.769 +		/** Complete when socket output/input stopped. */
   1.770 +		ENormal,
   1.771 +		/** Stop socket input and complete when output is stopped. */
   1.772 +		EStopInput,
   1.773 +		/** Stop socket output and complete when input is stopped. */
   1.774 +		EStopOutput,
   1.775 +		/** Stop socket input/output and complete (abortive close). */
   1.776 +		EImmediate
   1.777 +		};
   1.778 +public:
   1.779 +	IMPORT_C RSocket();
   1.780 +
   1.781 +	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol);
   1.782 +	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol, RConnection& aConnection);
   1.783 +	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol, RSubConnection& aSubConnection);
   1.784 +	IMPORT_C TInt Open(RSocketServ &aServer,const TDesC& aName);
   1.785 +	IMPORT_C TInt Open(RSocketServ& aServer);
   1.786 +	IMPORT_C void Send(const TDesC8& aDesc,TUint someFlags,TRequestStatus& aStatus);
   1.787 +
   1.788 +	IMPORT_C void Send(const TDesC8& aDesc,TUint someFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   1.789 +	IMPORT_C void CancelSend();
   1.790 +
   1.791 +	IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus);
   1.792 +
   1.793 +	IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   1.794 +
   1.795 +	IMPORT_C void RecvOneOrMore(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   1.796 +	IMPORT_C void CancelRecv();
   1.797 +
   1.798 +	IMPORT_C void Read(TDes8& aDesc,TRequestStatus& aStatus);
   1.799 +	IMPORT_C void CancelRead();
   1.800 +
   1.801 +	IMPORT_C void Write(const TDesC8& aDesc,TRequestStatus& aStatus);
   1.802 +	IMPORT_C void CancelWrite();
   1.803 +	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus);
   1.804 +
   1.805 +	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   1.806 +
   1.807 +	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus);
   1.808 +
   1.809 +	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   1.810 +	IMPORT_C void Connect(TSockAddr& anAddr,TRequestStatus& aStatus);
   1.811 +	IMPORT_C void Connect(TSockAddr& anAddr,const TDesC8& aConnectDataOut,TDes8& aConnectDataIn,TRequestStatus& aStatus);
   1.812 +	IMPORT_C void CancelConnect();
   1.813 +	IMPORT_C TInt Bind(TSockAddr& anAddr);
   1.814 +	IMPORT_C TInt SetLocalPort(TInt aPort);
   1.815 +	IMPORT_C void Accept(RSocket& aBlankSocket,TRequestStatus& aStatus);
   1.816 +	IMPORT_C void Accept(RSocket& aBlankSocket,TDes8& aConnectData,TRequestStatus& aStatus);
   1.817 +	IMPORT_C void CancelAccept();
   1.818 +	IMPORT_C TInt Listen(TUint qSize);
   1.819 +	IMPORT_C TInt Listen(TUint qSize,const TDesC8& aConnectData);
   1.820 +	IMPORT_C TInt SetOpt(TUint anOptionName,TUint anOptionLevel,const TDesC8& anOption=TPtrC8(NULL,0));
   1.821 +	IMPORT_C TInt SetOpt(TUint anOptionName,TUint anOptionLevel,TInt anOption);
   1.822 +	IMPORT_C TInt GetOpt(TUint anOptionName,TUint anOptionLevel,TDes8& anOption);
   1.823 +	IMPORT_C TInt GetOpt(TUint anOptionName,TUint anOptionLevel,TInt& anOption);
   1.824 +	IMPORT_C void Ioctl(TUint aCommand,TRequestStatus& aStatus,TDes8* aDesc=NULL,TUint aLevel=KLevelUnspecified);
   1.825 +	IMPORT_C void CancelIoctl();
   1.826 +	IMPORT_C TInt GetDisconnectData(TDes8& aDesc);
   1.827 +	IMPORT_C void LocalName(TSockAddr& anAddr);
   1.828 +	IMPORT_C TUint LocalPort();
   1.829 +	IMPORT_C void RemoteName(TSockAddr& anAddr);
   1.830 +	IMPORT_C void Close();
   1.831 +	IMPORT_C void Shutdown(TShutdown aHow,TRequestStatus& aStatus);
   1.832 +	IMPORT_C void Shutdown(TShutdown aHow,const TDesC8& aDisconnectDataOut,TDes8& aDisconnectDataIn,TRequestStatus& aStatus);
   1.833 +	IMPORT_C void CancelAll();
   1.834 +	IMPORT_C TInt Info(TProtocolDesc& aProtocol);
   1.835 +	IMPORT_C TInt Name(TName& aName);
   1.836 +	IMPORT_C TInt Transfer(RSocketServ& aServer, const TDesC& aName);
   1.837 +	};
   1.838 +
   1.839 +class TNameRecord
   1.840 +/** Contains the results of name queries.
   1.841 +@publishedAll
   1.842 +@released */
   1.843 +	{
   1.844 +public:
   1.845 +	inline TNameRecord();
   1.846 +	/**
   1.847 +	@internalComponent
   1.848 +	*/
   1.849 +	enum {EAlias=0x00000001,};
   1.850 +	/** A host name
   1.851 +
   1.852 +	@see THostName */
   1.853 +	THostName iName;
   1.854 +	/** An address
   1.855 +
   1.856 +	@see TSockAddr */
   1.857 +	TSockAddr iAddr;
   1.858 +	/** Flags indicating some attribute about the name, i.e. EAlias */
   1.859 +	TInt iFlags;
   1.860 +	};
   1.861 +
   1.862 +/** Packages the TNameRecord class so that it can be passed between a client and
   1.863 +the socket server.
   1.864 +@publishedAll
   1.865 +@released  */
   1.866 +typedef TPckgBuf<TNameRecord> TNameEntry;
   1.867 +
   1.868 +class RHostResolver : public RSubSessionBase
   1.869 +/** Provides an interface to host name resolution services, such as DNS, that may
   1.870 +be provided by particular protocol modules.
   1.871 +
   1.872 +The interface provides functions to access the following facilities:
   1.873 +
   1.874 +Obtaining names from addresses.
   1.875 +
   1.876 +Obtaining addresses from names.
   1.877 +
   1.878 +Getting and setting local host name.
   1.879 +
   1.880 +Not all actual services provide all these facilities. You should also consult
   1.881 +the documentation on the protocol you are intending to use. Functions return
   1.882 +KErrNotSupported if the protocol does not support a given operation. Note
   1.883 +that a description of the protocol family name resolution capabilities is
   1.884 +available at run-time from TProtocolDesc::iNamingServices.
   1.885 +
   1.886 +Before using any service, a connection to a socket server session must be
   1.887 +made.
   1.888 +
   1.889 +Each function is available in both synchronous and asynchronous versions.
   1.890 +
   1.891 +A single RHostResolver can only perform one request of any type at once. A
   1.892 +client is panicked if it makes two requests.
   1.893 +@publishedAll
   1.894 +@released */
   1.895 +	{
   1.896 +public:
   1.897 +	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol);
   1.898 +	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol, RConnection& aConnection);
   1.899 +	IMPORT_C void GetByName(const TDesC& aName,TNameEntry& aResult,TRequestStatus& aStatus);
   1.900 +	IMPORT_C TInt GetByName(const TDesC& aName,TNameEntry& aResult);
   1.901 +	IMPORT_C void Next(TNameEntry& aResult,TRequestStatus& aStatus);
   1.902 +	IMPORT_C TInt Next(TNameEntry& aResult);
   1.903 +	IMPORT_C void GetByAddress(const TSockAddr& anAddr,TNameEntry& aResult,TRequestStatus& aStatus);
   1.904 +	IMPORT_C TInt GetByAddress(const TSockAddr& anAddr,TNameEntry& aResult);
   1.905 +	IMPORT_C TInt GetHostName(TDes& aName);
   1.906 +	IMPORT_C void GetHostName(TDes& aName,TRequestStatus& aStatus);
   1.907 +	IMPORT_C TInt SetHostName(const TDesC& aName);
   1.908 +	IMPORT_C void Close();
   1.909 +	IMPORT_C void Cancel();
   1.910 +
   1.911 +    IMPORT_C void Query(const TDesC8& aQuery, TDes8& aResult, TRequestStatus& aStatus);
   1.912 +    IMPORT_C TInt Query(const TDesC8& aQuery, TDes8& aResult);
   1.913 +    IMPORT_C void QueryGetNext(TDes8& aResult, TRequestStatus& aStatus);
   1.914 +    IMPORT_C TInt QueryGetNext(TDes8& aResult);
   1.915 +
   1.916 +private:
   1.917 +	};
   1.918 +
   1.919 +/**
   1.920 +Port number on service
   1.921 +
   1.922 +@publishedAll
   1.923 +@released
   1.924 +*/
   1.925 +typedef TPckgBuf<TInt> TPortNum;
   1.926 +
   1.927 +class RServiceResolver : public RSubSessionBase
   1.928 +/** Provides an interface to resolver service names and ports.
   1.929 +@publishedAll
   1.930 +@released */
   1.931 +	{
   1.932 +public:
   1.933 +	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint sockType,TUint aProtocol);
   1.934 +	IMPORT_C void GetByName(const TDesC& aName,TPortNum& aPort,TRequestStatus& aStatus);
   1.935 +	IMPORT_C TInt GetByName(const TDesC& aName,TPortNum& aPort);
   1.936 +	IMPORT_C void GetByNumber(const TUint aPort,TDes& aName,TRequestStatus& aStatus);
   1.937 +	IMPORT_C TInt GetByNumber(const TUint aPort,TDes& aName);
   1.938 +	IMPORT_C void RegisterService(const TDesC& aName,const TUint& aPort,TRequestStatus& aStatus);
   1.939 +	IMPORT_C TInt RegisterService(const TDesC& aName,const TUint& aPort);
   1.940 +	IMPORT_C void RemoveService(const TDesC& aName,const TUint& aPort,TRequestStatus& aStatus);
   1.941 +	IMPORT_C TInt RemoveService(const TDesC& aName,const TUint& aPort);
   1.942 +	IMPORT_C void Close();
   1.943 +	IMPORT_C void Cancel();
   1.944 +private:
   1.945 +	};
   1.946 +
   1.947 +class RNetDatabase: public RSubSessionBase
   1.948 +/** Provides an interface to network databases, such as LM-IAS with IrDA, that
   1.949 +may be provided by particular protocol modules.
   1.950 +
   1.951 +Before making any queries, a connection to a socket server session must be
   1.952 +made.
   1.953 +
   1.954 +Each function is available in both synchronous and asynchronous versions.
   1.955 +
   1.956 +A single RNetDatabase can only perform one request of any type at once. A
   1.957 +client is panicked if it makes two requests.
   1.958 +
   1.959 +Particular database access services will specify the format of queries and
   1.960 +of responses.
   1.961 +@publishedAll
   1.962 +@released */
   1.963 +	{
   1.964 +public:
   1.965 +	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol);
   1.966 +	IMPORT_C void Query(const TDesC8& aQuery,TDes8& aResult,TRequestStatus& aStat);
   1.967 +	IMPORT_C TInt Query(const TDesC8& aQuery,TDes8& aResult);
   1.968 +	IMPORT_C void Add(const TDesC8& anItem,TRequestStatus& aStat);
   1.969 +	IMPORT_C TInt Add(const TDesC8& anItem);
   1.970 +	IMPORT_C void Remove(const TDesC8& anItem,TRequestStatus& aStat);
   1.971 +	IMPORT_C TInt Remove(const TDesC8& anItem);
   1.972 +	IMPORT_C void Close();
   1.973 +	IMPORT_C void Cancel();
   1.974 +private:
   1.975 +	};
   1.976 +
   1.977 +/**
   1.978 +@publishedPartner
   1.979 +@released
   1.980 +*/
   1.981 +
   1.982 +const TUint KCOLConnection = 1;						// level for RConnection::Control()
   1.983 +const TUint KCOLProvider = 2;						// level for RConnection::Control()
   1.984 +const TUint KConnInternalOptionBit = 0x80000000;	// Must not be set for client requests
   1.985 +const TUint KConnWriteUserDataBit = 0x40000000;
   1.986 +const TUint KConnReadUserDataBit = 0x20000000;
   1.987 +
   1.988 +/**
   1.989 +Level for RConnection::Control()
   1.990 +
   1.991 +@publishedPartner
   1.992 +@deprecated in 8.1
   1.993 +@capability NetworkControl Restrict access to connection clients
   1.994 +@ref RConnection::Control()
   1.995 +*/
   1.996 +const TUint KCoEnumerateConnectionClients  =  1 | (KConnWriteUserDataBit | KConnReadUserDataBit);
   1.997 +
   1.998 +/**
   1.999 +Level for RConnection::Control()
  1.1000 +Information about client
  1.1001 +
  1.1002 +@publishedPartner
  1.1003 +@deprecated in 8.1
  1.1004 +@capability NetworkControl Restrict access to connection client info
  1.1005 +@ref RConnection::Control()
  1.1006 +*/
  1.1007 +const TUint KCoGetConnectionClientInfo     =  2 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1.1008 +
  1.1009 +/** @internalTechnology */
  1.1010 +const TUint KCoEnumerateConnectionSockets  =  3 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1.1011 +
  1.1012 +/**
  1.1013 +Level for RConnection::Control()
  1.1014 +Information about connected socket
  1.1015 +
  1.1016 +@publishedPartner
  1.1017 +@deprecated
  1.1018 +@capability NetworkControl Restrict access to socket info on a connection
  1.1019 +@ref RConnection::Control()
  1.1020 +*/
  1.1021 +const TUint KCoGetConnectionSocketInfo     =  4 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1.1022 +
  1.1023 +/**
  1.1024 +Default connection type
  1.1025 +@publishedAll
  1.1026 +@released
  1.1027 +*/
  1.1028 +const TUint KConnectionTypeDefault = 0x0800;		// KAfInet is the default connection type
  1.1029 +
  1.1030 +/**
  1.1031 +Setting only: enable processes to "clone" open this RConnection instance via a call to
  1.1032 +RConnection::Open(..., TName&), as long as they conform to the security policy
  1.1033 +passed as argument (specified as a TSecurityPolicyBuf).
  1.1034 +@internalTechnology
  1.1035 +*/
  1.1036 +const TUint KCoEnableCloneOpen				= 5 | (KConnReadUserDataBit);
  1.1037 +
  1.1038 +/**
  1.1039 +Setting only: disable "clone" open of this RConnection instance, which was enabled via
  1.1040 +a previous KCoEnableCloneOpen option.
  1.1041 +@internalTechnology
  1.1042 +*/
  1.1043 +const TUint KCoDisableCloneOpen				= 6 | (KConnReadUserDataBit);
  1.1044 +
  1.1045 +class TConnPref;
  1.1046 +class TSubConnectionInfo;
  1.1047 +class TSubConnectionEvent;
  1.1048 +
  1.1049 +class RConnection : public RCommsSubSession
  1.1050 +/**
  1.1051 +
  1.1052 +The management interface for a network connection or subconnection.
  1.1053 +
  1.1054 +Provides clients with the following functionality:
  1.1055 +
  1.1056 +Opening and closing the connection
  1.1057 +
  1.1058 +Starting a connection, which means associating it with a new underlying interface
  1.1059 +
  1.1060 +Attaching the RConnection instance to an existing interface
  1.1061 +
  1.1062 +Stopping the connection, which means disassociating it from the underlying
  1.1063 +interface
  1.1064 +
  1.1065 +Obtaining progress information and notification during connection start-up
  1.1066 +
  1.1067 +Notifying when subconnections come up and go down
  1.1068 +
  1.1069 +Notifying when there is a service change for the connection
  1.1070 +
  1.1071 +Notifying when a given amount of data has been sent or received on a connection
  1.1072 +or subconnection
  1.1073 +
  1.1074 +Reading CommDB fields specific to an active connection
  1.1075 +
  1.1076 +Collecting statistical information on the network connection and subconnections.
  1.1077 +A UI component can display the collected statistical information in order
  1.1078 +to allow the user to examine the status of connections. The information that
  1.1079 +can be gathered is the following:
  1.1080 +
  1.1081 +All available internet access point names and internet access point 'friendly'
  1.1082 +names as appropriate for each network (GPRS/UMTS) connection
  1.1083 +
  1.1084 +Enumerating the currently active connections and subconnections
  1.1085 +
  1.1086 +The current status of all network connections e.g. active/suspended
  1.1087 +
  1.1088 +The amount of data (in bytes) transferred uplink and downlink by the network
  1.1089 +connection and subconnections
  1.1090 +
  1.1091 +The amount of time each network connection has been active (in seconds)
  1.1092 +
  1.1093 +The current status of the connection and subconnections with respect to data
  1.1094 +transfer, i.e. active/inactive
  1.1095 +
  1.1096 +The Quality of Service profile associated with each Packet Data Protocol (GPRS/UMTS)
  1.1097 +context, e.g. low/medium/high
  1.1098 +
  1.1099 +Note that several of the new functions are asynchronous. It is essential for
  1.1100 +these calls that the client ensures that the parameters they pass to the RConnection
  1.1101 +API remain in scope for the duration of the asynchronous call.
  1.1102 +@publishedAll
  1.1103 +@released since v7.0s */
  1.1104 +	{
  1.1105 +public:
  1.1106 +	/** Identifies the intended use of the connection. */
  1.1107 +	enum TConnAttachType
  1.1108 +		{
  1.1109 +		/** The application wishes to use the connection for normal data transfer, and
  1.1110 +		the idle timers will take that into account. */
  1.1111 +		EAttachTypeNormal,
  1.1112 +		/** The system control type of application wishes to monitor the state of the connection
  1.1113 +		without otherwise affecting it. In particular, the interface idle timers will
  1.1114 +		not be affected. */
  1.1115 +		EAttachTypeMonitor
  1.1116 +		};
  1.1117 +	/** Identifies the type of requirement for stopping the connection. */
  1.1118 +	enum TConnStopType
  1.1119 +		{
  1.1120 +		/** Any sockets or host/service resolvers associated with this interface will be
  1.1121 +		errored with KErrCancel. */
  1.1122 +
  1.1123 +		EStopNormal,
  1.1124 +
  1.1125 +		/** Any sockets or host/service resolvers associated with this interface will be
  1.1126 +		errored with KErrConnectionTerminated and should clean up quietly without
  1.1127 +		prompting the user. */
  1.1128 +
  1.1129 +		EStopAuthoritative
  1.1130 +		};
  1.1131 +
  1.1132 +	/**
  1.1133 +	Connection Management Interface
  1.1134 +	*/
  1.1135 +	IMPORT_C RConnection();
  1.1136 +	IMPORT_C virtual ~RConnection();
  1.1137 +	IMPORT_C TInt Open(RSocketServ& aSocketServer, TUint aConnectionType = KConnectionTypeDefault);
  1.1138 +	IMPORT_C TInt Open(RSocketServ& aSocketServer, TName& aName);
  1.1139 +	IMPORT_C void Close();
  1.1140 +
  1.1141 +	IMPORT_C void Start(TRequestStatus& aStatus);
  1.1142 +	IMPORT_C void Start(TConnPref& aPref, TRequestStatus& aStatus);
  1.1143 +	IMPORT_C TInt Start();
  1.1144 +	IMPORT_C TInt Start(TConnPref& aPref);
  1.1145 +	IMPORT_C TInt Stop();
  1.1146 +	IMPORT_C TInt Stop(TConnStopType aStopType);
  1.1147 +	IMPORT_C TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1148 +	IMPORT_C TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId, TConnStopType aStopType);
  1.1149 +
  1.1150 +	IMPORT_C void WaitForIncoming(RSubConnection& aIncomingSubConnection, TRequestStatus& aStatus);
  1.1151 +	IMPORT_C TInt WaitForIncoming(RSubConnection& aIncomingSubConnection);
  1.1152 +	IMPORT_C void CancelWaitForIncoming();
  1.1153 +
  1.1154 +	IMPORT_C void ProgressNotification(TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress = KConnProgressDefault);
  1.1155 +	IMPORT_C void ProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress = KConnProgressDefault);
  1.1156 +	IMPORT_C void CancelProgressNotification();
  1.1157 +	IMPORT_C void CancelProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1158 +	IMPORT_C TInt Progress(TNifProgress& aProgress);
  1.1159 +	IMPORT_C TInt Progress(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgress& aProgress);
  1.1160 +	IMPORT_C TInt LastProgressError(TNifProgress& aProgress);
  1.1161 +	IMPORT_C void ServiceChangeNotification(TUint32& aNewISPId, TDes& aNewServiceType, TRequestStatus& aStatus);
  1.1162 +	IMPORT_C void CancelServiceChangeNotification();
  1.1163 +
  1.1164 +	IMPORT_C TInt GetIntSetting(const TDesC& aSettingName, TUint32& aValue);
  1.1165 +	IMPORT_C TInt GetBoolSetting(const TDesC& aSettingName, TBool& aValue);
  1.1166 +	IMPORT_C TInt GetDesSetting(const TDesC& aSettingName, TDes8& aValue);
  1.1167 +	IMPORT_C TInt GetDesSetting(const TDesC& aSettingName, TDes16& aValue);
  1.1168 +	IMPORT_C TInt GetLongDesSetting(const TDesC& aSettingName, TDes& aValue);
  1.1169 +
  1.1170 +
  1.1171 +	/**
  1.1172 +	@prototype SymbianOS v9.4
  1.1173 +	*/
  1.1174 +	IMPORT_C TInt GetParameters(ESock::CCommsDataObjectBase& aDataObject);
  1.1175 +
  1.1176 +	IMPORT_C TInt Name(TName& aName);
  1.1177 +
  1.1178 +	IMPORT_C TInt EnumerateConnections(TUint& aCount);
  1.1179 +	IMPORT_C TInt GetConnectionInfo(TUint aIndex, TDes8& aConnectionInfo);
  1.1180 +
  1.1181 +	IMPORT_C void AllInterfaceNotification(TDes8& aNotification, TRequestStatus& aStatus);
  1.1182 +	IMPORT_C void CancelAllInterfaceNotification();
  1.1183 +
  1.1184 +	IMPORT_C void Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus, TDes8* aDesc);
  1.1185 +	IMPORT_C void Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus);
  1.1186 +	IMPORT_C void CancelIoctl();
  1.1187 +	IMPORT_C TInt Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
  1.1188 +	IMPORT_C TInt GetOpt(TUint aOptionLevel, TUint aOptionName, TInt& aOption);
  1.1189 +	IMPORT_C TInt SetOpt(TUint aOptionLevel, TUint aOptionName, TInt aOption = 0);
  1.1190 +
  1.1191 +	IMPORT_C TInt Attach(const TDesC8& aConnectionInfo, TConnAttachType aAttachType);
  1.1192 +
  1.1193 +	IMPORT_C TInt EnumerateSubConnections(TUint& aCount);
  1.1194 +	IMPORT_C TInt GetSubConnectionInfo(TDes8& aSubConnectionInfo);
  1.1195 +	IMPORT_C TInt GetSubConnectionInfo(TUint aIndex, TDes8& aSubConnectionInfo);
  1.1196 +	IMPORT_C void AllSubConnectionNotification(TSubConnectionNotificationBuf& aSubConnectionEvent, TRequestStatus& aStatus);
  1.1197 +	IMPORT_C void CancelAllSubConnectionNotification();
  1.1198 +
  1.1199 +	IMPORT_C void DataTransferredRequest(TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1.1200 +	IMPORT_C void DataTransferredRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1.1201 +	IMPORT_C void DataTransferredCancel();
  1.1202 +	IMPORT_C void DataTransferredCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1203 +	IMPORT_C void DataSentNotificationRequest(TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus);
  1.1204 +	IMPORT_C void DataSentNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus);
  1.1205 +	IMPORT_C void DataSentNotificationCancel();
  1.1206 +	IMPORT_C void DataSentNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1207 +	IMPORT_C void DataReceivedNotificationRequest(TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1.1208 +	IMPORT_C void DataReceivedNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1.1209 +	IMPORT_C void DataReceivedNotificationCancel();
  1.1210 +	IMPORT_C void DataReceivedNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1211 +	IMPORT_C void IsConnectionActiveRequest(TUint aSecs, TPckg<TBool>& aState, TRequestStatus& aStatus);
  1.1212 +	IMPORT_C void IsConnectionActiveCancel();
  1.1213 +	IMPORT_C void IsSubConnectionActiveRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aSecs, TPckg<TBool>& aState, TRequestStatus& aStatus);
  1.1214 +	IMPORT_C void IsSubConnectionActiveCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1.1215 +
  1.1216 +	TBool SameSession(TInt aSessionHandle);
  1.1217 +private:
  1.1218 +	TPckg<TUint32> iNewISPId;
  1.1219 +	TUint32 iReserved[4];
  1.1220 +	};
  1.1221 +
  1.1222 +class CSubConParameterSet : public SMetaDataECom
  1.1223 +/** Base class for all RSubConnection parameter sets.
  1.1224 +
  1.1225 +@publishedAll
  1.1226 +@released since v9.0 */
  1.1227 +	{
  1.1228 +public:
  1.1229 +	IMPORT_C static CSubConParameterSet* NewL(const STypeId& aTypeId);
  1.1230 +	virtual ~CSubConParameterSet();
  1.1231 +
  1.1232 +protected:
  1.1233 +	CSubConParameterSet();
  1.1234 +	};
  1.1235 +
  1.1236 +
  1.1237 +class CSubConGenericParameterSet : public CSubConParameterSet
  1.1238 +/** Base class for generic RSubConnection parameter sets.
  1.1239 +
  1.1240 +@publishedAll
  1.1241 +@released since v9.0 */
  1.1242 +	{
  1.1243 +public:
  1.1244 +	IMPORT_C ~CSubConGenericParameterSet();
  1.1245 +
  1.1246 +protected:
  1.1247 +	IMPORT_C CSubConGenericParameterSet();
  1.1248 +	};
  1.1249 +
  1.1250 +class CSubConExtensionParameterSet : public CSubConParameterSet
  1.1251 +/** Base class for extended RSubConnection parameter sets.
  1.1252 +
  1.1253 +@publishedAll
  1.1254 +@released since v9.0 */
  1.1255 +	{
  1.1256 +public:
  1.1257 +	IMPORT_C ~CSubConExtensionParameterSet();
  1.1258 +
  1.1259 +protected:
  1.1260 +	IMPORT_C CSubConExtensionParameterSet();
  1.1261 +	};
  1.1262 +
  1.1263 +class RSubConParameterBundle;
  1.1264 +class CSubConParameterBundle;
  1.1265 +
  1.1266 +const TInt32 KSubConnParamsInterfaceUid = 0x10204303;
  1.1267 +const TInt32 KSubConnEventInterfaceUid = 0x10204305;
  1.1268 +
  1.1269 +const TInt32 KSubConnGenericParamsImplUid  = 0x10204304;
  1.1270 +const TInt32 KSubConnGenericEventsImplUid  = 0x10204306;
  1.1271 +
  1.1272 +const TUint32 KSubConGlobalFamily = 0;
  1.1273 +const TUint32 KSubConQoSFamily = 1;
  1.1274 +const TUint32 KSubConAuthorisationFamily = 2;
  1.1275 +const TUint32 KSubConnCallDescrParamsFamily = 3;
  1.1276 +#ifdef SYMBIAN_NETWORKING_UMTSR5
  1.1277 +const TUint32 KSubConnContextDescrParamsFamily = 4;
  1.1278 +#endif //SYMBIAN_NETWORKING_UMTSR5
  1.1279 +
  1.1280 +class CSubConParameterFamily : public CBase
  1.1281 +/** Container of RSubConnection parameter sets.
  1.1282 +
  1.1283 +For each Parameter Type (Requested, Acceptable and Granted) it
  1.1284 +contains one generic and 0..N extended parameter sets.
  1.1285 +
  1.1286 +@publishedAll
  1.1287 +@released since v9.0 */
  1.1288 +	{
  1.1289 +public:
  1.1290 +
  1.1291 +	enum TParameterSetType
  1.1292 +         {
  1.1293 +         ERequested = 0,
  1.1294 +         EAcceptable = 1,
  1.1295 +		 EGranted = 2,
  1.1296 +		 ENumValues = 3 // The number of values in this enum
  1.1297 +         };
  1.1298 +
  1.1299 +public:
  1.1300 +	IMPORT_C static CSubConParameterFamily* NewL(RSubConParameterBundle& aBundle, TUint32 aFamilyId);
  1.1301 +	IMPORT_C static CSubConParameterFamily* LoadL(RSubConParameterBundle& aBundle, TPtrC8& aBuffer);
  1.1302 +	IMPORT_C static CSubConParameterFamily* NewL(CSubConParameterBundle& aBundle, TUint32 aFamilyId);
  1.1303 +	IMPORT_C static CSubConParameterFamily* LoadL(CSubConParameterBundle& aBundle, TPtrC8& aBuffer);
  1.1304 +
  1.1305 +public:
  1.1306 +	IMPORT_C virtual ~CSubConParameterFamily();
  1.1307 +	IMPORT_C void SetGenericSetL(CSubConGenericParameterSet& aGenericSet, TParameterSetType aType);
  1.1308 +	IMPORT_C void AddExtensionSetL(CSubConExtensionParameterSet& aExtensionSet, TParameterSetType aType);
  1.1309 +
  1.1310 +	IMPORT_C CSubConExtensionParameterSet* FindExtensionSet(TUid aSetId, TParameterSetType aType);
  1.1311 +	IMPORT_C CSubConExtensionParameterSet* FindExtensionSet(STypeId aSetId, TParameterSetType aType);
  1.1312 +	IMPORT_C CSubConGenericParameterSet* GetGenericSet(TParameterSetType aType);
  1.1313 +
  1.1314 +	inline TUint32 Id();
  1.1315 +
  1.1316 +	IMPORT_C TUint Length() const;
  1.1317 +	IMPORT_C TInt Load(TPtrC8& aDes);
  1.1318 +	IMPORT_C TInt Store(TDes8& aDes) const;
  1.1319 +	IMPORT_C void ClearAllParameters(TParameterSetType aType);
  1.1320 +
  1.1321 +protected:
  1.1322 +	explicit CSubConParameterFamily(TUint32 aFamilyId);
  1.1323 +	void ConstructL(RSubConParameterBundle& aBundle);
  1.1324 +	void ConstructL(CSubConParameterBundle& aBundle);
  1.1325 +
  1.1326 +	static TInt32 ExtractFamilyAndCreateBufferL(TPtrC8& aBuffer, TPtrC8& aContainerBuffer);
  1.1327 +
  1.1328 +private:
  1.1329 +	const TUint32 iFamilyId;
  1.1330 +	RMetaDataEComContainer iGenericSets;
  1.1331 +	RMetaDataEComContainer iExtensionSets[ENumValues];
  1.1332 +	};
  1.1333 +
  1.1334 +class CSubConParameterBundle : public CObject
  1.1335 +/** Container for (bundle of) SubConnection parameter families.
  1.1336 +
  1.1337 +May contain and 0..N parameter families.
  1.1338 +
  1.1339 +@publishedPartner
  1.1340 +@released since v9.0 */
  1.1341 +	{
  1.1342 +public:
  1.1343 +	IMPORT_C static CSubConParameterBundle* NewL();
  1.1344 +	IMPORT_C static CSubConParameterBundle* LoadL(TDesC8& aDes);
  1.1345 +
  1.1346 +	IMPORT_C ~CSubConParameterBundle();
  1.1347 +
  1.1348 +	IMPORT_C TUint Length() const;
  1.1349 +	IMPORT_C TInt Load(const TDesC8& aDes);
  1.1350 +	IMPORT_C TInt Store(TDes8& aDes) const;
  1.1351 +	IMPORT_C void AddFamilyL(CSubConParameterFamily* aFamily);
  1.1352 +	IMPORT_C CSubConParameterFamily* FindFamily(TUint32 aFamilyId);
  1.1353 +	IMPORT_C void ClearAllParameters(CSubConParameterFamily::TParameterSetType aType);
  1.1354 +
  1.1355 +protected:
  1.1356 +	CSubConParameterBundle();
  1.1357 +
  1.1358 +private:
  1.1359 +	CSubConParameterBundle(const CSubConParameterBundle& aBundle);
  1.1360 +	CSubConParameterBundle& operator=(const CSubConParameterBundle& aBundle);
  1.1361 +
  1.1362 +private:
  1.1363 +	RPointerArray<CSubConParameterFamily> iFamilies;
  1.1364 +	};
  1.1365 +
  1.1366 +class RSubConParameterBundle
  1.1367 +/** Container for (bundle of) SubConnection parameter families.
  1.1368 +
  1.1369 +May contain and 0..N SubConnection parameter families.
  1.1370 +
  1.1371 +
  1.1372 +@publishedAll
  1.1373 +@released since v9.0 */
  1.1374 +	{
  1.1375 +public:
  1.1376 +	IMPORT_C RSubConParameterBundle();
  1.1377 +	IMPORT_C void Close();
  1.1378 +
  1.1379 +	IMPORT_C TUint Length() const;
  1.1380 +	IMPORT_C TInt Load(const TDesC8& aDes);
  1.1381 +	IMPORT_C TInt Store(TDes8& aDes) const;
  1.1382 +	IMPORT_C void AddFamilyL(CSubConParameterFamily* aFamily);
  1.1383 +	IMPORT_C CSubConParameterFamily* FindFamily(TUint32 aFamilyId);
  1.1384 +	IMPORT_C void ClearAllParameters(CSubConParameterFamily::TParameterSetType aType);
  1.1385 +
  1.1386 +protected:
  1.1387 +	TInt CheckBundle() const;
  1.1388 +private:
  1.1389 +	RSubConParameterBundle(const RSubConParameterBundle& aBundle);
  1.1390 +	RSubConParameterBundle& operator=(const RSubConParameterBundle& aBundle);
  1.1391 +
  1.1392 +private:
  1.1393 +	mutable CSubConParameterBundle* iBundle;
  1.1394 +	};
  1.1395 +
  1.1396 +const TInt KNotificationEventMaxSize = 2048;
  1.1397 +class TNotificationEventBuf : public TBuf8<KNotificationEventMaxSize>
  1.1398 +/**
  1.1399 +Buffer for Sub-connection event notiifcation
  1.1400 +
  1.1401 +@publishedAll
  1.1402 +@released
  1.1403 +*/
  1.1404 +	{
  1.1405 +public:
  1.1406 +	IMPORT_C TNotificationEventBuf();
  1.1407 +	IMPORT_C ~TNotificationEventBuf();
  1.1408 +
  1.1409 +	IMPORT_C TBool IsGeneric() const;
  1.1410 +	IMPORT_C TInt32 GroupId() const;
  1.1411 +	IMPORT_C TUint32 Id() const;
  1.1412 +	};
  1.1413 +
  1.1414 +class CSubConNotificationEvent : public SMetaDataECom
  1.1415 +	{
  1.1416 +public:
  1.1417 +	IMPORT_C static CSubConNotificationEvent* NewL(const STypeId& aTypeId);
  1.1418 +	IMPORT_C static CSubConNotificationEvent* NewL(const TNotificationEventBuf& aEventBuffer);
  1.1419 +
  1.1420 +	IMPORT_C TBool IsGeneric() const;
  1.1421 +	IMPORT_C TInt32 GroupId() const;
  1.1422 +	IMPORT_C TUint32 Id() const;
  1.1423 +
  1.1424 +private:
  1.1425 +	};
  1.1426 +
  1.1427 +class TSubConnOpen
  1.1428 +/** @internalComponent */
  1.1429 +	{
  1.1430 +public:
  1.1431 +	/** Defines the type of a subconnection	*/
  1.1432 +	enum TSubConnType
  1.1433 +		{
  1.1434 +		EAttachToDefault, 	// will attach to the default sub connection
  1.1435 +		ECreateNew, 		// will create a new sub connection
  1.1436 +
  1.1437 +		//private extension to subconnection openning modes below:
  1.1438 +		EWaitForIncoming
  1.1439 +		};
  1.1440 +
  1.1441 +	TSubConnType iType;
  1.1442 +	TInt  iHandle;
  1.1443 +	TInt  iReserved;
  1.1444 +	};
  1.1445 +
  1.1446 +class RSubConnection : public RSubSessionBase
  1.1447 +/** A Sub-Connection, a channel within a Connection. A representation of a channel between this device and remote devices with which we are communicating. This channel will be used by one or more sockets.
  1.1448 + Depending on the state of the channel, it may not be possible to bind arbitary sockets into it.  Attempts to bind sockets from different protocol families to a single channel is an error, as each channel can only be used by one protocol family.
  1.1449 + @note The sub-connection can represent a end-to-end channel and/or a channel from this device to an intermediate device (e.g an access server such as a GGSN which using UMTS and PDP contexts. Properties can be specified simultaneously on protocol and link level.
  1.1450 +
  1.1451 +Before using any of these services, a connection to a socket server session
  1.1452 +must have been made and the connection must be open.
  1.1453 +
  1.1454 +@publishedAll
  1.1455 +@released Since v9.0*/
  1.1456 +	{
  1.1457 +public:
  1.1458 +    friend class RConnection;
  1.1459 +
  1.1460 +	enum TSubConnType
  1.1461 +		{
  1.1462 +		EAttachToDefault,
  1.1463 +		ECreateNew
  1.1464 +		};
  1.1465 +
  1.1466 +	struct TEventFilter
  1.1467 +		{
  1.1468 +		inline TEventFilter(TInt32 aEventGroupId = KSubConnGenericEventsImplUid, TUint32 aEventMask = 0xffffffff);
  1.1469 +		TInt32  iEventGroupUid;
  1.1470 +		TUint32 iEventMask;
  1.1471 +		};
  1.1472 +
  1.1473 +public:
  1.1474 +	// Sub Connection Management
  1.1475 +	IMPORT_C RSubConnection();
  1.1476 +	IMPORT_C TInt Open(RSocketServ& aServer, TSubConnType aSubConnType, RConnection& aConnection);
  1.1477 +	IMPORT_C void Close();
  1.1478 +	IMPORT_C void Start(TRequestStatus& aStatus);
  1.1479 +	IMPORT_C TInt Start();
  1.1480 +	IMPORT_C TInt Stop();
  1.1481 +
  1.1482 +	// Socket Management
  1.1483 +	IMPORT_C void Add(RSocket& aSocket, TRequestStatus& aStatus);
  1.1484 +	IMPORT_C void Remove(RSocket& aSocket, TRequestStatus& aStatus);
  1.1485 +
  1.1486 +	// QoS Properties
  1.1487 +	IMPORT_C TInt SetParameters(const RSubConParameterBundle& aParametersSet);
  1.1488 +	IMPORT_C TInt GetParameters(RSubConParameterBundle& aParametersSet);
  1.1489 +
  1.1490 +	// Event Notification
  1.1491 +	IMPORT_C void EventNotification(TNotificationEventBuf& aEventBuffer, TBool aGenericEventsOnly, TRequestStatus& aStatus);
  1.1492 +	IMPORT_C void EventNotification(TNotificationEventBuf& aEventBuffer, TEventFilter aEventFilterList[], TUint aEventListLength, TRequestStatus& aStatus);
  1.1493 +	IMPORT_C void CancelEventNotification();
  1.1494 +
  1.1495 +	// Generic Control
  1.1496 +	IMPORT_C TInt Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
  1.1497 +
  1.1498 +	TBool SameSession(TInt aSessionHandle);
  1.1499 +
  1.1500 +private:
  1.1501 +	IMPORT_C TInt Open(RSocketServ& aServer, TSubConnOpen::TSubConnType aSubConnType, RConnection& aConnection);
  1.1502 +
  1.1503 +	//Note : Not used anywhere else in the code, kept in order to avoid the BC Break
  1.1504 +	TInt iSpare;
  1.1505 +};
  1.1506 +
  1.1507 +
  1.1508 +class ByteOrder
  1.1509 +/** Reverses the byte order in 16 and 32-bit values.
  1.1510 +@publishedAll
  1.1511 +@released */
  1.1512 +	{
  1.1513 +public:
  1.1514 +	IMPORT_C static TUint32 Swap32(TUint32 aVal);
  1.1515 +	IMPORT_C static TUint16 Swap16(TUint16 aVal);
  1.1516 +	inline static TUint16 Swap16(TUint aVal);
  1.1517 +	};
  1.1518 +
  1.1519 +class BigEndian
  1.1520 +/** Inserts and extracts integers in big-endian format.
  1.1521 +@publishedAll
  1.1522 +@released */
  1.1523 +	{
  1.1524 +public:
  1.1525 +	IMPORT_C static TUint32 Get32(const TUint8* aPtr);
  1.1526 +	IMPORT_C static TUint16 Get16(const TUint8* aPtr);
  1.1527 +	IMPORT_C static void Put32(TUint8* aPtr, TUint32 aVal);
  1.1528 +	IMPORT_C static void Put16(TUint8* aPtr, TUint16 aVal);
  1.1529 +	};
  1.1530 +
  1.1531 +class LittleEndian
  1.1532 +/** Inserts and extracts integers in little-endian format.
  1.1533 +@publishedAll
  1.1534 +@released */
  1.1535 +	{
  1.1536 +public:
  1.1537 +	IMPORT_C static TUint32 Get32(const TUint8* aPtr);
  1.1538 +	IMPORT_C static TUint16 Get16(const TUint8* aPtr);
  1.1539 +	IMPORT_C static void Put32(TUint8* aPtr, TUint32 aVal);
  1.1540 +	IMPORT_C static void Put16(TUint8* aPtr, TUint16 aVal);
  1.1541 +	};
  1.1542 +
  1.1543 +class TAccessPointInfo
  1.1544 +/** Stores Access Point information.
  1.1545 +@publishedAll */
  1.1546 +	{
  1.1547 +public:
  1.1548 +	TAccessPointInfo(TUint aApId = 0);
  1.1549 +
  1.1550 +	TUint AccessPoint() const;
  1.1551 +	void SetAccessPoint(TUint aAccessPoint);
  1.1552 +
  1.1553 +	TBool operator== (const TAccessPointInfo& aRhs) const;
  1.1554 +private:
  1.1555 +	TUint iAccessPointId;
  1.1556 +	};
  1.1557 +
  1.1558 +#include <es_sock.inl>
  1.1559 +
  1.1560 +#endif	//__ES_SOCK_H__