epoc32/include/es_sock.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1997-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 /**
    19  @file
    20  @publishedAll
    21  @released
    22 */
    23 
    24 #if !defined(__ES_SOCK_H__)
    25 #define __ES_SOCK_H__
    26 
    27 
    28 #include <e32base.h>
    29 #include <nifvar.h>
    30 
    31 #undef	_DEBUG_SOCKET_FUNCTIONS
    32 #if defined(_DEBUG)
    33 #define	_DEBUG_SOCKET_FUNCTIONS
    34 #endif
    35 
    36 #include <comms-infras/metacontainer.h>
    37 using Meta::STypeId;
    38 using Meta::SMetaDataECom;
    39 using Meta::RMetaDataEComContainer;
    40 
    41 
    42 // Forward declaration of CCommsDataObjectBase
    43 namespace ESock
    44 {
    45 	class CCommsDataObjectBase;
    46 }
    47 
    48 /**
    49 Name of ESock server in EKA2
    50 @internalComponent
    51 */
    52 _LIT(SOCKET_SERVER_NAME, "!SocketServer");
    53 
    54 /**
    55 Canonical names for the core ESOCKSVR modules
    56 */
    57 _LIT8(SOCKET_SERVER_MAIN_MODULE_NAME, "ESock_Main");		// Worker 0
    58 _LIT8(SOCKET_SERVER_IP_MODULE_NAME, "ESock_IP");			// Worker 1
    59 _LIT8(SOCKET_SERVER_BT_MODULE_NAME, "ESock_Bt");			// Worker 2
    60 _LIT8(SOCKET_SERVER_IR_MODULE_NAME, "ESock_Ir");			// Worker 3
    61 _LIT8(SOCKET_SERVER_SMSWAP_MODULE_NAME, "ESock_SmsWap");	// Worker 4
    62 
    63 /**
    64 Id of the network layer.
    65 @publishedPartner
    66 */
    67 const TUint KCommsNetworkLayerId = 1;
    68 
    69 /**
    70 Default number of message slots.
    71 @publishedAll
    72 @released
    73 */
    74 const TUint KESockDefaultMessageSlots=8;
    75 
    76 /**
    77 Major Version Number of Connection
    78 
    79 @internalComponent
    80 */
    81 const TUint KConnectionMajorVersionNumber=1;
    82 
    83 /**
    84 Minor Version Number of Connection
    85 
    86 @internalComponent
    87 */
    88 const TUint KConnectionMinorVersionNumber=0;
    89 
    90 /**
    91 Build Version Number of Connection
    92 this must not be changed - expected by TCPIP to be >=68
    93 
    94 @internalComponent
    95 */
    96 const TUint KConnectionBuildVersionNumber=68;
    97 
    98 /**
    99 Size of Maximum SubConnection event
   100 
   101 @internalComponent
   102 @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
   103 if you change this value, you will alter the function signature and break the .def file
   104 */
   105 const TUint KMaxSubConnectionEventSize = 512;
   106 
   107 /**
   108 SubConnection Unique Id
   109 @publishedPartner
   110 @released
   111 */
   112 typedef TUint TSubConnectionUniqueId;
   113 
   114 /**
   115 Buffer for  notification of any change in the state of  SubConnection.
   116 @publishedPartner
   117 @released
   118 */
   119 typedef TBuf8<KMaxSubConnectionEventSize> TSubConnectionNotificationBuf;
   120 //
   121 const TUint KUseEmbeddedUniqueId = 0; ///< Used by RConnection to identify cases where the subconnection id is embedded in the data structure
   122 
   123 const TUint KConnProgressDefault = 0; ///< Default Connection Progress
   124 
   125 class TSessionPref
   126 /**
   127 Hint to the Socket Server on what will be the principal usage of the connection.
   128 It is by no means a restriction but may result in better performance for the session.
   129 
   130 @publishedAll
   131 @released
   132 */
   133 	{
   134 public:
   135     IMPORT_C TSessionPref();
   136 public:
   137 	/** The protocol's address family. For example, for TCP/IP protocols, KAfInet. */
   138 	TUint iAddrFamily;
   139 	/** The protocol type. */
   140 	TUint iProtocol;
   141 	/** Reserved. */
   142 	TUint iReserved;
   143 	/** Reserved. */
   144 	TUint iReserved1;
   145 	/** Reserved. */
   146 	TUint iReserved2;
   147 	/** Reserved. */
   148 	TUint iReserved3;
   149 	/** Reserved. */
   150 	TUint iReserved4;
   151 	};
   152 
   153 class TNifProgress
   154 /**
   155 Contains progress information on a dial-up connection
   156 
   157 @publishedAll
   158 @released
   159 */
   160 	{
   161 public:
   162 	inline TNifProgress();
   163 	TInt iStage;
   164 	TInt iError;
   165 	};
   166 
   167 class TNifAgentInfo
   168 /**
   169 Contains information describing an agent
   170 
   171 @publishedAll
   172 @released
   173 */
   174 	{
   175 public:
   176 	/**	This class Contains version information	*/
   177 	TVersion iVersion;
   178 
   179 	/**	This class Defines a modifiable buffer descriptor that can contain the name of a reference counting object	*/
   180 	TName iName;
   181 	};
   182 
   183 /**
   184 Buffer for Network Interface Progress
   185 
   186 @publishedAll
   187 @released
   188 */
   189 typedef TPckgBuf<TNifProgress> TNifProgressBuf;
   190 
   191 /**
   192 Socket address offsets.
   193 
   194 @publishedAll
   195 @released
   196 */
   197 struct SSockAddr
   198 /** Socket address offsets.
   199 
   200 This class defines the internal offsets of data members for the TSockAddr
   201 class. */
   202 	{
   203 	/** Address family of socket address */
   204 	TUint iFamily;
   205 	/** Port (or equivilent) number */
   206 	TUint iPort;
   207 	};
   208 
   209 /**
   210 Maximum sockets address size.
   211 @publishedAll
   212 @released
   213 */
   214 const TUint KMaxSockAddrSize=0x20;
   215 
   216 class TSockAddr : public TBuf8<KMaxSockAddrSize>
   217 /** Represents an end point address.
   218 
   219 Protocols interpret the class within the socket server to route packets and
   220 form connections. It can be used on its own or as derived by protocols. The
   221 SSockAddr class acts as an offset map for the TSockAddr class which has a
   222 family field and a port field. The family field may be used by protocols to
   223 "up-cast" the base-class to the correct derived class. The port field is provided
   224 because it is a common practice for protocols to use port equivalents in addressing.
   225 
   226 Writing derived classes:
   227 
   228 The two protected member functions allow further data members to be defined
   229 past the area of the base SSockAddr. In any derived constructor the length
   230 of the descriptor should be set to the length of the valid data contained
   231 in the address. Subsequent member function calls should also adjust the length
   232 if it affects valid data.
   233 @publishedAll
   234 @released */
   235 	{
   236 public:
   237 	IMPORT_C TSockAddr();
   238 	IMPORT_C TSockAddr(TUint aFamily);
   239 	IMPORT_C TUint Family() const;
   240 	IMPORT_C void SetFamily(TUint aFamily);
   241 	IMPORT_C TUint Port() const;
   242 	IMPORT_C void SetPort(TUint aPort);
   243 	IMPORT_C TBool CmpPort(const TSockAddr& anAddr) const;
   244 	IMPORT_C TInt GetUserLen();
   245 protected:
   246 	IMPORT_C void SetUserLen(TInt aLen);
   247 	inline TUint8* UserPtr() const;
   248 private:
   249 	inline SSockAddr* BasePtr() const;
   250 	};
   251 
   252 // Address families (based upon protocol IDs used by ARP/REVARP)
   253 /** Default (unspecified) protocol module.
   254 @publishedAll
   255 @released */
   256 const TUint KAFUnspec=0;
   257 
   258 // Socket types
   259 /** Stream socket.
   260 @publishedAll
   261 @released */
   262 const TUint KSockStream=1;
   263 /** Datagram socket. */
   264 const TUint KSockDatagram=2;
   265 /** Datagrams with sequence numbers. */
   266 const TUint KSockSeqPacket=3;
   267 /** Raw socket. */
   268 const TUint KSockRaw=4;
   269 
   270 // constants for various socket calls - can't be enums cos they're largely defined by protocols
   271 // The following constants are used to define level parameters for RSocket::Ioctl(), RSocket::GetOpt()
   272 // and RSocket::SetOpt().
   273 /** Generic socket options/commands.
   274 @publishedAll
   275 @released */
   276 const TInt KSOLSocket=1;
   277 /** Unspecified level. */
   278 const TInt KLevelUnspecified=0;
   279 
   280 // Socket options defined by the server.
   281 // Used through RSocket::SetOpt(), and RSocket::GetOpt() with anOptionLevel set
   282 // to KSOLSocket. Options can be both get and set unless otherwise.
   283 // stated.
   284 // Notes:
   285 // Setting the send and receive buffer sizes explicitly can help to reduce
   286 // the memory requirements if many data sockets are used in an application. If a
   287 // socket is datagram-oriented and its receive/send buffer size is set
   288 // to KSocketBufSizeUndefined, then the initial buffer size will
   289 // be KSocketDefaultBufferSize and buffers will grow to accommodate
   290 // larger sends/receives. If the buffer size is set explicitly for
   291 // datagram-oriented sockets, sends which exceed the set size will fail
   292 // with KErrTooBig and receives will be truncated. For stream based
   293 // sockets there should be no noticeable effect on client reads, unless the buffer
   294 // size is set to a prohibitively low value.
   295 /** Debugging enabled or disabled . Values are:
   296 
   297 (TInt)0. Disabled
   298 
   299 (TInt)1. Enabled
   300 @publishedAll
   301 @released */
   302 const TUint KSODebug=1;
   303 /** Socket receive buffer size. Values are:
   304 
   305 KSocketBufSizeUndefined
   306 
   307 1 to KMaxTUint: explicit buffer size, supplied as a TPckgBuf<TUint> */
   308 const TUint KSORecvBuf=2;
   309 /** Socket send buffer size. Values are:
   310 
   311 KSocketBufSizeUndefined
   312 
   313 1 to KMaxTUint: explicit buffer size, supplied as a TPckgBuf<TUint> */
   314 const TUint KSOSendBuf=3;
   315 /** Socket nonblocking mode. To set, no option values are required. For getting,
   316 values are:
   317 
   318 (TInt)0. Disabled
   319 
   320 (TInt)1. Enabled */
   321 const TUint KSONonBlockingIO=4;
   322 /** Socket blocking mode. To set, no values are required. For getting, values are:
   323 
   324 (TInt)0. Disabled
   325 
   326 (TInt)1. Enabled */
   327 const TUint KSOBlockingIO=5;
   328 /** Getting only: gets a bitmask of flags describing the read/write/exception status
   329 of the socket. Value is a TInt containing a bitmask of socket status (KSockSelectExcept
   330 etc.) constants. */
   331 const TUint KSOSelectPoll=6;
   332 /** Getting only: retrieve the number of bytes currently available for reading.
   333 Value is a TInt. */
   334 const TUint KSOReadBytesPending=7;
   335 /** Getting only: retrieve the urgent data offset (only for stream protocols that
   336 support urgent data).
   337 Value is a TInt. */
   338 const TUint KSOUrgentDataOffset=8;
   339 /** Getting only: retrieves the last error. Value is a TInt. */
   340 const TUint KSOSelectLastError=9;
   341 
   342 
   343 /**
   344 Setting only. Enables socket to be transferred to the process with given capabilities.
   345 The capabilities set should be supplied as TPckgBuf<TSecurityPolicy>.
   346 Each RSocket::Transfer() call must be enabled by setting this option.
   347 @publishedAll
   348 @released */
   349 const TUint KSOEnableTransfer = 10;
   350 
   351 /** Setting only. Disables a socket's possibility to be transferred. No option required.
   352 @publishedAll
   353 @released */
   354 
   355 const TUint KSODisableTransfer = 11;
   356 
   357 // The following constants relating to buffer sizes are defined
   358 
   359 /** Use default buffer size. */
   360 const TInt  KSocketBufSizeUndefined=0;
   361 /** Default buffer size. */
   362 const TInt  KSocketDefaultBufferSize=4096;
   363 
   364 //internal
   365 const TUint KSocketInternalOptionBit=0x80000000;	///< Must not be set for client requests
   366 
   367 /**
   368 Ioctls
   369 
   370 Must not be set for client requests
   371 
   372 @internalComponent
   373 @released
   374 */
   375 const TUint KInternalIoctlBit=0x80000000;
   376 
   377 /** The aDesc parameter of RSocket::Ioctl() specifies a TUint containing a bitmask
   378 of Socket status constants. The completion status will be the subset of those
   379 conditions which is now true for the socket.
   380 
   381 Used through RSocket::Ioctl(), with aLevel set to KSOLSocket.
   382 
   383 @see KSOSelectPoll parameter to RSocket::GetOpt(), which allows the
   384 current select state of the socket to be read synchronously, and KSOSelectLastError,
   385 which returns the error code. */
   386 const TUint KIOctlSelect=1;
   387 
   388 // Select ioctl states
   389 // Socket status. See also KSOSelectLastError and KSOSelectPoll.
   390 /** Data is available to be read; for listening sockets, a connect is pending.
   391 @publishedAll
   392 @released */
   393 const TUint KSockSelectRead   =0x00000001;
   394 /** Writing to the socket is not currently blocked by flow-control. */
   395 const TUint KSockSelectWrite  =0x00000002;
   396 /** An error has occurred. */
   397 const TUint KSockSelectExcept =0x00000004;
   398 /** Include tail of prior read datagram as available data (ie indicates next read will be with read continuation) */
   399 const TUint KSockSelectReadContinuation = 0x01000000;
   400 
   401 // Socket write flags
   402 /** The data to be sent is urgent and is given a higher priority than ordinary data in the send queue.
   403 KSockWriteUrgent may only be provided as a flag to Send() if the protocol's information flag is marked with
   404 KSIUrgentData, otherwise Send() will return with KErrNotSupported. AKA: Out of band or unit data.
   405 @publishedAll
   406 @released */
   407 const TUint KSockWriteUrgent=0x00000001;
   408 /** Must not be set for client requests. */
   409 const TUint KSocketInternalWriteBit=0x80000000;
   410 /** The top 8 bits are reserved for system purposes; protocols must not define these bits. */
   411 const TUint KSockWriteSystemMask=0xFF000000;
   412 
   413 // Socket read flags
   414 /** Read data without consuming it, data remains in the receive queue. KSockReadPeek may only be provided
   415 as a flag to Recv() if the protocol's information flag is marked with KSIPeekData, otherwise Recv() will
   416 return with KErrNotSupported.
   417 @publishedAll
   418 @released
   419 */
   420 const TUint KSockReadPeek=0x00000001;
   421 /** Must not be set for client requests. */
   422 const TUint KSocketInternalReadBit=0x80000000;
   423 /** Read from datagram in a stream-like fashion (not discarding tails). */
   424 const TUint KSockReadContinuation = 0x01000000;
   425 // Types
   426 
   427 /** Used in structure TProtocolDesc to describes the endianness of a protocol.
   428 @publishedAll
   429 @released */
   430 enum TByteOrder
   431 	{
   432 	/** Big endian */
   433 	EBigEndian,
   434 	/** Little endian */
   435 	ELittleEndian,
   436 	/** Other byte order */
   437 	EOtherByteOrder,
   438 	};
   439 
   440 //
   441 // Protocol Service information bitmasks.
   442 // The following constants are defined for
   443 // TServerProtocolDesc and TProtocolDesc
   444 //
   445 /** The protocol is connectionless.
   446 @publishedPartner
   447 @released */
   448 const TUint KSIConnectionLess=0x00000001;
   449 /** The protocol is reliable. */
   450 const TUint KSIReliable=0x00000002;
   451 /** The protocol guarantees in-order delivery. */
   452 const TUint KSIInOrder=0x00000004;
   453 /** The protocol is message based. */
   454 const TUint KSIMessageBased=0x00000008;
   455 /** The same as message based. */
   456 const TUint KSIDatagram=KSIMessageBased;
   457 /** The protocol is stream based. */
   458 const TUint KSIStreamBased=0x00000010;
   459 /** The protocol supports a stream like interface but maintains datagram boundaries. */
   460 const TUint KSIPseudoStream=0x00000020;
   461 /** The protocol offers an expedited data service. */
   462 const TUint KSIUrgentData=0x00000040;
   463 /** The protocol can send user data on a connection request. */
   464 const TUint KSIConnectData=0x00000080;
   465 /** The protocol can send user data on a disconnect request. */
   466 const TUint KSIDisconnectData=0x00000100;
   467 /** The protocol supports broadcast addresses. */
   468 const TUint KSIBroadcast=0x00000200;
   469 /** The protocol supports point to multi-point connections. */
   470 const TUint KSIMultiPoint=0x00000400;
   471 /** The protocol supports a quality of service metric. */
   472 const TUint KSIQOS=0x00000800;
   473 /** The protocol is write only. */
   474 const TUint KSIWriteOnly=0x00001000;
   475 /** The protocol is read only. */
   476 const TUint KSIReadOnly=0x00002000;
   477 /** The protocol supports graceful close. */
   478 const TUint KSIGracefulClose=0x00004000;
   479 /** The same socket can be reconnected if it disconnects (for whatever reason). */
   480 const TUint KSICanReconnect=0x00008000;
   481 /** Protocol supports peeking (looking at the data without removing it from the
   482 protocol). */
   483 const TUint KSIPeekData=0x00010000;
   484 /** Protocol is to be informed of the identity of the client (i.e. process ID,
   485 thread ID and UID) of each SAP (i.e. Socket Service Provider) created.
   486 @see KSoOwnerInfo and TSoOwnerInfo */
   487 const TUint KSIRequiresOwnerInfo=0x00020000;	// SetOption(KSoOwnerInfo) invoked on each SAP
   488 
   489 //
   490 // Naming service constants
   491 // The following constants are defined for
   492 // TServerProtocolDesc and TProtocolDesc
   493 //
   494 /** Protocol supports resolving human readable entity names into network addresses
   495 (like DNS).
   496 @publishedPartner
   497 @released */
   498 const TUint KNSNameResolution=0x00000001;
   499 /** Network naming is hierarchical. */
   500 const TUint KNSHierarchicalNaming=0x00000002;
   501 /** @deprecated Use KNSHierarchicalNaming instead. */
   502 const TUint KNSHeirarchicalNaming=0x00000002;
   503 /** Addressing is dynamic and should be attempted every time before connecting
   504 (like IrDA). */
   505 const TUint KNSRemoteDiscovery=0x00000004;
   506 /** Protocol supports service name to port number resolution. (For example, you
   507 can look up TCP to get port 48.) */
   508 const TUint KNSServiceResolution=0x00000008;
   509 /** Protocol supports additions to the name database. */
   510 const TUint KNSNameRegistration=0x00000010;
   511 /** Protocol supports additions to the service database. */
   512 const TUint KNSServiceRegistration=0x00000020;
   513 /** Addressing is dynamic - i.e. name to address mapping may change (like IrDA
   514 which randomly chooses machine addresses.) */
   515 const TUint KNSDynamicAddressing=0x00000040;
   516 /** Protocol has another database which is defined by the protocol. */
   517 const TUint KNSInfoDatabase=0x00000080;
   518 /** Protocol may request Socket Server to startup a connection on its behalf (via
   519 the KErrCompletion error code)*/
   520 const TUint KNSRequiresConnectionStartup=0x00000100;
   521 
   522 // Security Schemes
   523 // The following constants are defined for
   524 // TServerProtocolDesc and TProtocolDesc
   525 /** No security
   526 @publishedAll
   527 @released */
   528 const TUint KSocketNoSecurity=0x00000000;
   529 /** Secure Sockets Layer.
   530 
   531 @see CSecureSocket */
   532 const TUint KSecureSockets=0x00000001;
   533 
   534 // Special message sizes
   535 // The following constants are defined for
   536 // TServerProtocolDesc and TProtocolDesc
   537 /** Reads and writes can be of any size: the data is treated as a stream.
   538 @publishedAll
   539 @released */
   540 const TInt KSocketMessageSizeIsStream=0;
   541 /** Depends on lower layer or is dynamic. */
   542 const TInt KSocketMessageSizeUndefined=1;
   543 /** Data is packet-oriented but packets can be of any size (i.e. the remote end
   544 must specify a Read of the same size as your Write, but there is no limit
   545 on this size.) */
   546 const TInt KSocketMessageSizeNoLimit=-1;
   547 
   548 
   549 /** Undefined socket type.
   550 @publishedAll
   551 @released */
   552 const TUint KUndefinedSockType=0xFFFFFFFF;
   553 
   554 
   555 /** Undefined socket type.
   556 Undefined Protocol
   557 @released */
   558 const TUint KUndefinedProtocol=0xFFFFFFFE;
   559 
   560 /** Contains the name of a protocol in structure TProtocolDesc.
   561 @publishedAll
   562 @released */
   563 typedef TBuf<0x20> TProtocolName;
   564 /** Defines a descriptor to hold a service name string. */
   565 typedef TBuf<0x20> TServiceName;
   566 /** Defines a descriptor to hold a host name string. */
   567 typedef TBuf<0x100> THostName;
   568 
   569 /**
   570 Socket protocol information for use by clients
   571 
   572 @publishedAll
   573 @released
   574 */
   575 struct TProtocolDesc
   576 /** Socket protocol information for use by clients. */
   577 	{
   578 public:
   579 	/** The name of the protocol
   580 
   581 	@see TProtocolName */
   582 	TProtocolName iName;
   583 	/** An integer identifying the protocol's address family. For example, for TCP/IP
   584 	protocols, KAfInet. */
   585 	TUint iAddrFamily;
   586 	/** An integer specifying the socket type. For example, for TCP, KSockStream. */
   587 	TUint iSockType;
   588 	/** An integer specifying the specific protocol. For example, for TCP, KProtocolInetTcp. */
   589 	TUint iProtocol;
   590 	/** The version of the protocol
   591 
   592 	@see TVersion */
   593 	TVersion iVersion;
   594 	/** The byte order that the protocol uses
   595 
   596 	@see TByteOrder */
   597 	TByteOrder iByteOrder;
   598 	/** A bit mask of service information flags.
   599 
   600 	@see KSockStream etc. */
   601 	TUint iServiceInfo;
   602 	/** A bit mask indicating if the protocol supports name resolution, service resolution,
   603 	or database access services.
   604 
   605 	@see KNSNameResolution etc. */
   606 	TUint iNamingServices;
   607 	/** A bitmask of security flags.
   608 
   609 	@see KSocketNoSecurity etc. */
   610 	TUint iSecurity;
   611 	/** The message size of datagram protocols.
   612 
   613 	@see KSocketMessageSizeIsStream etc. */
   614 	TInt iMessageSize;
   615 	};
   616 
   617 // socket errors
   618 /** This error is returned from operations on non-blocking sockets that cannot
   619 be completed immediately, for example receive when no data is queued for reading.
   620 It is a non-fatal error, and the operation should be retried later.
   621 @publishedAll
   622 @released */
   623 const TInt KErrWouldBlock=-1000;
   624 
   625 /**
   626 socket errors
   627 
   628 The value -17210 is taken from the range allocated for Esock (beginning at -17200)
   629 A gap has been left between the currently existing vals and this one.
   630 
   631 @publishedAll
   632 @released
   633 */
   634 const TInt KErrConnectionTerminated=-17210;
   635 
   636 const TInt KErrCannotFindProtocol = -17211;
   637 
   638 /** Used in RSocket read and write calls to pass the length of data read and written.
   639 @publishedAll
   640 @released */
   641 typedef TPckgBuf<TInt> TSockXfrLength;
   642 
   643 class TSockIO
   644 /**
   645 IPC Data holder
   646 
   647 @internalComponent
   648 */
   649 	{
   650 public:
   651 	const TSockXfrLength* iLength;  ///< length of data read and written
   652 	TUint iFlags;                   ///<  Flag
   653 	TSockAddr* iAddr;               ///< Socket Address
   654 	};
   655 
   656 class TSockIOBufC : public TPckgC<TSockIO>
   657 /** @internalComponent */
   658 	{
   659 public:
   660 	inline TSockIOBufC();
   661 	TSockIO iArgs;
   662 	};
   663 
   664 class TSockOpen
   665 /** @internalComponent */
   666 	{
   667 public:
   668 	TUint iAddrFamily;
   669 	TUint iSockType;
   670 	TUint iProtocol;
   671 	TInt  iHandle;
   672 	TInt  iReserved;
   673 	};
   674 
   675 class TSockOpenBufC : public TPckgC<TSockOpen>
   676 /** @internalComponent */
   677 	{
   678 public:
   679 	inline TSockOpenBufC();
   680 	TSockOpen iArgs;
   681 	};
   682 
   683 class RSocket;
   684 class RConnection;
   685 class RSocketServ : public RSessionBase
   686 /** Provides the Connect() function to create an IPC communication channel to the
   687 socket server. To close the channel RHandleBase provides a RHandleBase::Close()
   688 function.
   689 
   690 The prime use for instances of RSocketServ is to establish subsession communications
   691 for RSocket, RHostResolver, RNetDatabase and RConnection.  Any of the resources
   692 which are open using the session are automatically closed when the session is
   693 terminated, however it is more appropriate to issue a Close() on each subsession object
   694 before closing the session.
   695 
   696 The following operations are also provided:
   697 
   698 NumProtocols() - enumerates the number of protocols of which the socket server
   699 is currently aware.
   700 
   701 GetProtocolInfo()/FindProtocol() - return information about a specific protocol.
   702 
   703 StartProtocol() - loads a protocol asynchronously.
   704 
   705 @note This class is not intended for user derivation.
   706 @publishedAll
   707 @released  */
   708 	{
   709 public:
   710     IMPORT_C RSocketServ();
   711 	IMPORT_C TInt Connect(TUint aMessageSlots=KESockDefaultMessageSlots);
   712 	IMPORT_C TInt Connect(const TSessionPref& aPref, TUint aMessageSlots=KESockDefaultMessageSlots);
   713 	IMPORT_C TVersion Version() const;
   714 	IMPORT_C TInt NumProtocols(TUint& aCount);
   715 	IMPORT_C TInt GetProtocolInfo(TUint anIndex,TProtocolDesc& aProtocol);
   716 	IMPORT_C TInt FindProtocol(const TProtocolName& aName,TProtocolDesc& aProtocol);
   717 	IMPORT_C void StartProtocol(TUint anAddrFamily,TUint aSockType,TUint aProtocol,TRequestStatus& aStatus);
   718 	IMPORT_C void StopProtocol(TUint anAddrFamily,TUint aSockType,TUint aProtocol,TRequestStatus& aStatus);
   719 	IMPORT_C TInt InstallExtension(const TDesC& aDllName, const TDesC& aArgs=TPtrC());
   720 	IMPORT_C void SetExclusiveMode(TRequestStatus& aStatus);
   721 	IMPORT_C void ClearExclusiveMode();
   722 	IMPORT_C TInt __DbgMarkHeap();
   723 	IMPORT_C TInt __DbgCheckHeap(TInt aCount);
   724 	IMPORT_C TInt __DbgMarkEnd(TInt aCount);
   725 	IMPORT_C TInt __DbgFailNext(TInt aCount);
   726 	IMPORT_C TBool __DbgCheckFailNext() const;
   727 	IMPORT_C TInt __DbgFailNextMbuf(TInt aCount);
   728 	IMPORT_C TInt __DbgSetMbufPoolLimit(TInt asize);
   729 	IMPORT_C TInt __DbgCheckMbuf(TInt asize);
   730 	IMPORT_C TInt __DbgMbufFreeSpace();
   731 	IMPORT_C TInt __DbgMbufTotalSpace();
   732 	};
   733 
   734 NONSHARABLE_CLASS(RCommsSubSession) : public RSubSessionBase
   735 	{
   736 	friend class RCommsApiExtensionBase;
   737 	};
   738 
   739 class RSubConnection;
   740 class RSocket : public RCommsSubSession
   741 /** Provides a client endpoint to a protocol. It provides functions for socket
   742 creation, reading, writing, passive connection, active connection, setting
   743 addresses and querying addresses. Use this class as an endpoint for network
   744 type communications. It provides the following services:
   745 
   746 reading from and writing to protocol
   747 
   748 binding to addresses
   749 
   750 active connecting
   751 
   752 passive connection through the listen/accept model
   753 
   754 Before using any of these services, a connection to a socket server session
   755 must have been made and the socket must be open.
   756 
   757 @publishedAll
   758 @released Since v5.0*/
   759 	{
   760 friend class RSocketServ;
   761 public:
   762 	/** Used in structure TProtocolDesc to describes the endianness of a protocol. */
   763 	enum TShutdown
   764 		{
   765 		/** Complete when socket output/input stopped. */
   766 		ENormal,
   767 		/** Stop socket input and complete when output is stopped. */
   768 		EStopInput,
   769 		/** Stop socket output and complete when input is stopped. */
   770 		EStopOutput,
   771 		/** Stop socket input/output and complete (abortive close). */
   772 		EImmediate
   773 		};
   774 public:
   775 	IMPORT_C RSocket();
   776 
   777 	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol);
   778 	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol, RConnection& aConnection);
   779 	IMPORT_C TInt Open(RSocketServ& aServer,TUint addrFamily,TUint sockType,TUint protocol, RSubConnection& aSubConnection);
   780 	IMPORT_C TInt Open(RSocketServ &aServer,const TDesC& aName);
   781 	IMPORT_C TInt Open(RSocketServ& aServer);
   782 	IMPORT_C void Send(const TDesC8& aDesc,TUint someFlags,TRequestStatus& aStatus);
   783 
   784 	IMPORT_C void Send(const TDesC8& aDesc,TUint someFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   785 	IMPORT_C void CancelSend();
   786 
   787 	IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus);
   788 
   789 	IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   790 
   791 	IMPORT_C void RecvOneOrMore(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   792 	IMPORT_C void CancelRecv();
   793 
   794 	IMPORT_C void Read(TDes8& aDesc,TRequestStatus& aStatus);
   795 	IMPORT_C void CancelRead();
   796 
   797 	IMPORT_C void Write(const TDesC8& aDesc,TRequestStatus& aStatus);
   798 	IMPORT_C void CancelWrite();
   799 	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus);
   800 
   801 	IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   802 
   803 	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus);
   804 
   805 	IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
   806 	IMPORT_C void Connect(TSockAddr& anAddr,TRequestStatus& aStatus);
   807 	IMPORT_C void Connect(TSockAddr& anAddr,const TDesC8& aConnectDataOut,TDes8& aConnectDataIn,TRequestStatus& aStatus);
   808 	IMPORT_C void CancelConnect();
   809 	IMPORT_C TInt Bind(TSockAddr& anAddr);
   810 	IMPORT_C TInt SetLocalPort(TInt aPort);
   811 	IMPORT_C void Accept(RSocket& aBlankSocket,TRequestStatus& aStatus);
   812 	IMPORT_C void Accept(RSocket& aBlankSocket,TDes8& aConnectData,TRequestStatus& aStatus);
   813 	IMPORT_C void CancelAccept();
   814 	IMPORT_C TInt Listen(TUint qSize);
   815 	IMPORT_C TInt Listen(TUint qSize,const TDesC8& aConnectData);
   816 	IMPORT_C TInt SetOpt(TUint anOptionName,TUint anOptionLevel,const TDesC8& anOption=TPtrC8(NULL,0));
   817 	IMPORT_C TInt SetOpt(TUint anOptionName,TUint anOptionLevel,TInt anOption);
   818 	IMPORT_C TInt GetOpt(TUint anOptionName,TUint anOptionLevel,TDes8& anOption);
   819 	IMPORT_C TInt GetOpt(TUint anOptionName,TUint anOptionLevel,TInt& anOption);
   820 	IMPORT_C void Ioctl(TUint aCommand,TRequestStatus& aStatus,TDes8* aDesc=NULL,TUint aLevel=KLevelUnspecified);
   821 	IMPORT_C void CancelIoctl();
   822 	IMPORT_C TInt GetDisconnectData(TDes8& aDesc);
   823 	IMPORT_C void LocalName(TSockAddr& anAddr);
   824 	IMPORT_C TUint LocalPort();
   825 	IMPORT_C void RemoteName(TSockAddr& anAddr);
   826 	IMPORT_C void Close();
   827 	IMPORT_C void Shutdown(TShutdown aHow,TRequestStatus& aStatus);
   828 	IMPORT_C void Shutdown(TShutdown aHow,const TDesC8& aDisconnectDataOut,TDes8& aDisconnectDataIn,TRequestStatus& aStatus);
   829 	IMPORT_C void CancelAll();
   830 	IMPORT_C TInt Info(TProtocolDesc& aProtocol);
   831 	IMPORT_C TInt Name(TName& aName);
   832 	IMPORT_C TInt Transfer(RSocketServ& aServer, const TDesC& aName);
   833 	};
   834 
   835 class TNameRecord
   836 /** Contains the results of name queries.
   837 @publishedAll
   838 @released */
   839 	{
   840 public:
   841 	inline TNameRecord();
   842 	/**
   843 	@internalComponent
   844 	*/
   845 	enum {EAlias=0x00000001,};
   846 	/** A host name
   847 
   848 	@see THostName */
   849 	THostName iName;
   850 	/** An address
   851 
   852 	@see TSockAddr */
   853 	TSockAddr iAddr;
   854 	/** Flags indicating some attribute about the name, i.e. EAlias */
   855 	TInt iFlags;
   856 	};
   857 
   858 /** Packages the TNameRecord class so that it can be passed between a client and
   859 the socket server.
   860 @publishedAll
   861 @released  */
   862 typedef TPckgBuf<TNameRecord> TNameEntry;
   863 
   864 class RHostResolver : public RSubSessionBase
   865 /** Provides an interface to host name resolution services, such as DNS, that may
   866 be provided by particular protocol modules.
   867 
   868 The interface provides functions to access the following facilities:
   869 
   870 Obtaining names from addresses.
   871 
   872 Obtaining addresses from names.
   873 
   874 Getting and setting local host name.
   875 
   876 Not all actual services provide all these facilities. You should also consult
   877 the documentation on the protocol you are intending to use. Functions return
   878 KErrNotSupported if the protocol does not support a given operation. Note
   879 that a description of the protocol family name resolution capabilities is
   880 available at run-time from TProtocolDesc::iNamingServices.
   881 
   882 Before using any service, a connection to a socket server session must be
   883 made.
   884 
   885 Each function is available in both synchronous and asynchronous versions.
   886 
   887 A single RHostResolver can only perform one request of any type at once. A
   888 client is panicked if it makes two requests.
   889 @publishedAll
   890 @released */
   891 	{
   892 public:
   893 	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol);
   894 	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol, RConnection& aConnection);
   895 	IMPORT_C void GetByName(const TDesC& aName,TNameEntry& aResult,TRequestStatus& aStatus);
   896 	IMPORT_C TInt GetByName(const TDesC& aName,TNameEntry& aResult);
   897 	IMPORT_C void Next(TNameEntry& aResult,TRequestStatus& aStatus);
   898 	IMPORT_C TInt Next(TNameEntry& aResult);
   899 	IMPORT_C void GetByAddress(const TSockAddr& anAddr,TNameEntry& aResult,TRequestStatus& aStatus);
   900 	IMPORT_C TInt GetByAddress(const TSockAddr& anAddr,TNameEntry& aResult);
   901 	IMPORT_C TInt GetHostName(TDes& aName);
   902 	IMPORT_C void GetHostName(TDes& aName,TRequestStatus& aStatus);
   903 	IMPORT_C TInt SetHostName(const TDesC& aName);
   904 	IMPORT_C void Close();
   905 	IMPORT_C void Cancel();
   906 
   907     IMPORT_C void Query(const TDesC8& aQuery, TDes8& aResult, TRequestStatus& aStatus);
   908     IMPORT_C TInt Query(const TDesC8& aQuery, TDes8& aResult);
   909     IMPORT_C void QueryGetNext(TDes8& aResult, TRequestStatus& aStatus);
   910     IMPORT_C TInt QueryGetNext(TDes8& aResult);
   911 
   912 private:
   913 	};
   914 
   915 /**
   916 Port number on service
   917 
   918 @publishedAll
   919 @released
   920 */
   921 typedef TPckgBuf<TInt> TPortNum;
   922 
   923 class RServiceResolver : public RSubSessionBase
   924 /** Provides an interface to resolver service names and ports.
   925 @publishedAll
   926 @released */
   927 	{
   928 public:
   929 	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint sockType,TUint aProtocol);
   930 	IMPORT_C void GetByName(const TDesC& aName,TPortNum& aPort,TRequestStatus& aStatus);
   931 	IMPORT_C TInt GetByName(const TDesC& aName,TPortNum& aPort);
   932 	IMPORT_C void GetByNumber(const TUint aPort,TDes& aName,TRequestStatus& aStatus);
   933 	IMPORT_C TInt GetByNumber(const TUint aPort,TDes& aName);
   934 	IMPORT_C void RegisterService(const TDesC& aName,const TUint& aPort,TRequestStatus& aStatus);
   935 	IMPORT_C TInt RegisterService(const TDesC& aName,const TUint& aPort);
   936 	IMPORT_C void RemoveService(const TDesC& aName,const TUint& aPort,TRequestStatus& aStatus);
   937 	IMPORT_C TInt RemoveService(const TDesC& aName,const TUint& aPort);
   938 	IMPORT_C void Close();
   939 	IMPORT_C void Cancel();
   940 private:
   941 	};
   942 
   943 class RNetDatabase: public RSubSessionBase
   944 /** Provides an interface to network databases, such as LM-IAS with IrDA, that
   945 may be provided by particular protocol modules.
   946 
   947 Before making any queries, a connection to a socket server session must be
   948 made.
   949 
   950 Each function is available in both synchronous and asynchronous versions.
   951 
   952 A single RNetDatabase can only perform one request of any type at once. A
   953 client is panicked if it makes two requests.
   954 
   955 Particular database access services will specify the format of queries and
   956 of responses.
   957 @publishedAll
   958 @released */
   959 	{
   960 public:
   961 	IMPORT_C TInt Open(RSocketServ& aSocketServer,TUint anAddrFamily,TUint aProtocol);
   962 	IMPORT_C void Query(const TDesC8& aQuery,TDes8& aResult,TRequestStatus& aStat);
   963 	IMPORT_C TInt Query(const TDesC8& aQuery,TDes8& aResult);
   964 	IMPORT_C void Add(const TDesC8& anItem,TRequestStatus& aStat);
   965 	IMPORT_C TInt Add(const TDesC8& anItem);
   966 	IMPORT_C void Remove(const TDesC8& anItem,TRequestStatus& aStat);
   967 	IMPORT_C TInt Remove(const TDesC8& anItem);
   968 	IMPORT_C void Close();
   969 	IMPORT_C void Cancel();
   970 private:
   971 	};
   972 
   973 /**
   974 @publishedPartner
   975 @released
   976 */
   977 
   978 const TUint KCOLConnection = 1;						// level for RConnection::Control()
   979 const TUint KCOLProvider = 2;						// level for RConnection::Control()
   980 const TUint KConnInternalOptionBit = 0x80000000;	// Must not be set for client requests
   981 const TUint KConnWriteUserDataBit = 0x40000000;
   982 const TUint KConnReadUserDataBit = 0x20000000;
   983 
   984 /**
   985 Level for RConnection::Control()
   986 
   987 @publishedPartner
   988 @deprecated in 8.1
   989 @capability NetworkControl Restrict access to connection clients
   990 @ref RConnection::Control()
   991 */
   992 const TUint KCoEnumerateConnectionClients  =  1 | (KConnWriteUserDataBit | KConnReadUserDataBit);
   993 
   994 /**
   995 Level for RConnection::Control()
   996 Information about client
   997 
   998 @publishedPartner
   999 @deprecated in 8.1
  1000 @capability NetworkControl Restrict access to connection client info
  1001 @ref RConnection::Control()
  1002 */
  1003 const TUint KCoGetConnectionClientInfo     =  2 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1004 
  1005 /** @internalTechnology */
  1006 const TUint KCoEnumerateConnectionSockets  =  3 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1007 
  1008 /**
  1009 Level for RConnection::Control()
  1010 Information about connected socket
  1011 
  1012 @publishedPartner
  1013 @deprecated
  1014 @capability NetworkControl Restrict access to socket info on a connection
  1015 @ref RConnection::Control()
  1016 */
  1017 const TUint KCoGetConnectionSocketInfo     =  4 | (KConnWriteUserDataBit | KConnReadUserDataBit);
  1018 
  1019 /**
  1020 Default connection type
  1021 @publishedAll
  1022 @released
  1023 */
  1024 const TUint KConnectionTypeDefault = 0x0800;		// KAfInet is the default connection type
  1025 
  1026 /**
  1027 Setting only: enable processes to "clone" open this RConnection instance via a call to
  1028 RConnection::Open(..., TName&), as long as they conform to the security policy
  1029 passed as argument (specified as a TSecurityPolicyBuf).
  1030 @internalTechnology
  1031 */
  1032 const TUint KCoEnableCloneOpen				= 5 | (KConnReadUserDataBit);
  1033 
  1034 /**
  1035 Setting only: disable "clone" open of this RConnection instance, which was enabled via
  1036 a previous KCoEnableCloneOpen option.
  1037 @internalTechnology
  1038 */
  1039 const TUint KCoDisableCloneOpen				= 6 | (KConnReadUserDataBit);
  1040 
  1041 class TConnPref;
  1042 class TSubConnectionInfo;
  1043 class TSubConnectionEvent;
  1044 
  1045 class RConnection : public RCommsSubSession
  1046 /**
  1047 
  1048 The management interface for a network connection or subconnection.
  1049 
  1050 Provides clients with the following functionality:
  1051 
  1052 Opening and closing the connection
  1053 
  1054 Starting a connection, which means associating it with a new underlying interface
  1055 
  1056 Attaching the RConnection instance to an existing interface
  1057 
  1058 Stopping the connection, which means disassociating it from the underlying
  1059 interface
  1060 
  1061 Obtaining progress information and notification during connection start-up
  1062 
  1063 Notifying when subconnections come up and go down
  1064 
  1065 Notifying when there is a service change for the connection
  1066 
  1067 Notifying when a given amount of data has been sent or received on a connection
  1068 or subconnection
  1069 
  1070 Reading CommDB fields specific to an active connection
  1071 
  1072 Collecting statistical information on the network connection and subconnections.
  1073 A UI component can display the collected statistical information in order
  1074 to allow the user to examine the status of connections. The information that
  1075 can be gathered is the following:
  1076 
  1077 All available internet access point names and internet access point 'friendly'
  1078 names as appropriate for each network (GPRS/UMTS) connection
  1079 
  1080 Enumerating the currently active connections and subconnections
  1081 
  1082 The current status of all network connections e.g. active/suspended
  1083 
  1084 The amount of data (in bytes) transferred uplink and downlink by the network
  1085 connection and subconnections
  1086 
  1087 The amount of time each network connection has been active (in seconds)
  1088 
  1089 The current status of the connection and subconnections with respect to data
  1090 transfer, i.e. active/inactive
  1091 
  1092 The Quality of Service profile associated with each Packet Data Protocol (GPRS/UMTS)
  1093 context, e.g. low/medium/high
  1094 
  1095 Note that several of the new functions are asynchronous. It is essential for
  1096 these calls that the client ensures that the parameters they pass to the RConnection
  1097 API remain in scope for the duration of the asynchronous call.
  1098 @publishedAll
  1099 @released since v7.0s */
  1100 	{
  1101 public:
  1102 	/** Identifies the intended use of the connection. */
  1103 	enum TConnAttachType
  1104 		{
  1105 		/** The application wishes to use the connection for normal data transfer, and
  1106 		the idle timers will take that into account. */
  1107 		EAttachTypeNormal,
  1108 		/** The system control type of application wishes to monitor the state of the connection
  1109 		without otherwise affecting it. In particular, the interface idle timers will
  1110 		not be affected. */
  1111 		EAttachTypeMonitor
  1112 		};
  1113 	/** Identifies the type of requirement for stopping the connection. */
  1114 	enum TConnStopType
  1115 		{
  1116 		/** Any sockets or host/service resolvers associated with this interface will be
  1117 		errored with KErrCancel. */
  1118 
  1119 		EStopNormal,
  1120 
  1121 		/** Any sockets or host/service resolvers associated with this interface will be
  1122 		errored with KErrConnectionTerminated and should clean up quietly without
  1123 		prompting the user. */
  1124 
  1125 		EStopAuthoritative
  1126 		};
  1127 
  1128 	/**
  1129 	Connection Management Interface
  1130 	*/
  1131 	IMPORT_C RConnection();
  1132 	IMPORT_C virtual ~RConnection();
  1133 	IMPORT_C TInt Open(RSocketServ& aSocketServer, TUint aConnectionType = KConnectionTypeDefault);
  1134 	IMPORT_C TInt Open(RSocketServ& aSocketServer, TName& aName);
  1135 	IMPORT_C void Close();
  1136 
  1137 	IMPORT_C void Start(TRequestStatus& aStatus);
  1138 	IMPORT_C void Start(TConnPref& aPref, TRequestStatus& aStatus);
  1139 	IMPORT_C TInt Start();
  1140 	IMPORT_C TInt Start(TConnPref& aPref);
  1141 	IMPORT_C TInt Stop();
  1142 	IMPORT_C TInt Stop(TConnStopType aStopType);
  1143 	IMPORT_C TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId);
  1144 	IMPORT_C TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId, TConnStopType aStopType);
  1145 
  1146 	IMPORT_C void WaitForIncoming(RSubConnection& aIncomingSubConnection, TRequestStatus& aStatus);
  1147 	IMPORT_C TInt WaitForIncoming(RSubConnection& aIncomingSubConnection);
  1148 	IMPORT_C void CancelWaitForIncoming();
  1149 
  1150 	IMPORT_C void ProgressNotification(TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress = KConnProgressDefault);
  1151 	IMPORT_C void ProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgressBuf& aProgress, TRequestStatus& aStatus, TUint aSelectedProgress = KConnProgressDefault);
  1152 	IMPORT_C void CancelProgressNotification();
  1153 	IMPORT_C void CancelProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId);
  1154 	IMPORT_C TInt Progress(TNifProgress& aProgress);
  1155 	IMPORT_C TInt Progress(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgress& aProgress);
  1156 	IMPORT_C TInt LastProgressError(TNifProgress& aProgress);
  1157 	IMPORT_C void ServiceChangeNotification(TUint32& aNewISPId, TDes& aNewServiceType, TRequestStatus& aStatus);
  1158 	IMPORT_C void CancelServiceChangeNotification();
  1159 
  1160 	IMPORT_C TInt GetIntSetting(const TDesC& aSettingName, TUint32& aValue);
  1161 	IMPORT_C TInt GetBoolSetting(const TDesC& aSettingName, TBool& aValue);
  1162 	IMPORT_C TInt GetDesSetting(const TDesC& aSettingName, TDes8& aValue);
  1163 	IMPORT_C TInt GetDesSetting(const TDesC& aSettingName, TDes16& aValue);
  1164 	IMPORT_C TInt GetLongDesSetting(const TDesC& aSettingName, TDes& aValue);
  1165 
  1166 
  1167 	/**
  1168 	@prototype SymbianOS v9.4
  1169 	*/
  1170 	IMPORT_C TInt GetParameters(ESock::CCommsDataObjectBase& aDataObject);
  1171 
  1172 	IMPORT_C TInt Name(TName& aName);
  1173 
  1174 	IMPORT_C TInt EnumerateConnections(TUint& aCount);
  1175 	IMPORT_C TInt GetConnectionInfo(TUint aIndex, TDes8& aConnectionInfo);
  1176 
  1177 	IMPORT_C void AllInterfaceNotification(TDes8& aNotification, TRequestStatus& aStatus);
  1178 	IMPORT_C void CancelAllInterfaceNotification();
  1179 
  1180 	IMPORT_C void Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus, TDes8* aDesc);
  1181 	IMPORT_C void Ioctl(TUint aOptionLevel, TUint aOptionName, TRequestStatus& aStatus);
  1182 	IMPORT_C void CancelIoctl();
  1183 	IMPORT_C TInt Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
  1184 	IMPORT_C TInt GetOpt(TUint aOptionLevel, TUint aOptionName, TInt& aOption);
  1185 	IMPORT_C TInt SetOpt(TUint aOptionLevel, TUint aOptionName, TInt aOption = 0);
  1186 
  1187 	IMPORT_C TInt Attach(const TDesC8& aConnectionInfo, TConnAttachType aAttachType);
  1188 
  1189 	IMPORT_C TInt EnumerateSubConnections(TUint& aCount);
  1190 	IMPORT_C TInt GetSubConnectionInfo(TDes8& aSubConnectionInfo);
  1191 	IMPORT_C TInt GetSubConnectionInfo(TUint aIndex, TDes8& aSubConnectionInfo);
  1192 	IMPORT_C void AllSubConnectionNotification(TSubConnectionNotificationBuf& aSubConnectionEvent, TRequestStatus& aStatus);
  1193 	IMPORT_C void CancelAllSubConnectionNotification();
  1194 
  1195 	IMPORT_C void DataTransferredRequest(TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1196 	IMPORT_C void DataTransferredRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TPckg<TUint>& aUplinkVolume, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1197 	IMPORT_C void DataTransferredCancel();
  1198 	IMPORT_C void DataTransferredCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1199 	IMPORT_C void DataSentNotificationRequest(TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus);
  1200 	IMPORT_C void DataSentNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aUplinkVolume, TRequestStatus& aStatus);
  1201 	IMPORT_C void DataSentNotificationCancel();
  1202 	IMPORT_C void DataSentNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1203 	IMPORT_C void DataReceivedNotificationRequest(TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1204 	IMPORT_C void DataReceivedNotificationRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aThreshold, TPckg<TUint>& aDownlinkVolume, TRequestStatus& aStatus);
  1205 	IMPORT_C void DataReceivedNotificationCancel();
  1206 	IMPORT_C void DataReceivedNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1207 	IMPORT_C void IsConnectionActiveRequest(TUint aSecs, TPckg<TBool>& aState, TRequestStatus& aStatus);
  1208 	IMPORT_C void IsConnectionActiveCancel();
  1209 	IMPORT_C void IsSubConnectionActiveRequest(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aSecs, TPckg<TBool>& aState, TRequestStatus& aStatus);
  1210 	IMPORT_C void IsSubConnectionActiveCancel(TSubConnectionUniqueId aSubConnectionUniqueId);
  1211 
  1212 	TBool SameSession(TInt aSessionHandle);
  1213 private:
  1214 	TPckg<TUint32> iNewISPId;
  1215 	TUint32 iReserved[4];
  1216 	};
  1217 
  1218 class CSubConParameterSet : public SMetaDataECom
  1219 /** Base class for all RSubConnection parameter sets.
  1220 
  1221 @publishedAll
  1222 @released since v9.0 */
  1223 	{
  1224 public:
  1225 	IMPORT_C static CSubConParameterSet* NewL(const STypeId& aTypeId);
  1226 	virtual ~CSubConParameterSet();
  1227 
  1228 protected:
  1229 	CSubConParameterSet();
  1230 	};
  1231 
  1232 
  1233 class CSubConGenericParameterSet : public CSubConParameterSet
  1234 /** Base class for generic RSubConnection parameter sets.
  1235 
  1236 @publishedAll
  1237 @released since v9.0 */
  1238 	{
  1239 public:
  1240 	IMPORT_C ~CSubConGenericParameterSet();
  1241 
  1242 protected:
  1243 	IMPORT_C CSubConGenericParameterSet();
  1244 	};
  1245 
  1246 class CSubConExtensionParameterSet : public CSubConParameterSet
  1247 /** Base class for extended RSubConnection parameter sets.
  1248 
  1249 @publishedAll
  1250 @released since v9.0 */
  1251 	{
  1252 public:
  1253 	IMPORT_C ~CSubConExtensionParameterSet();
  1254 
  1255 protected:
  1256 	IMPORT_C CSubConExtensionParameterSet();
  1257 	};
  1258 
  1259 class RSubConParameterBundle;
  1260 class CSubConParameterBundle;
  1261 
  1262 const TInt32 KSubConnParamsInterfaceUid = 0x10204303;
  1263 const TInt32 KSubConnEventInterfaceUid = 0x10204305;
  1264 
  1265 const TInt32 KSubConnGenericParamsImplUid  = 0x10204304;
  1266 const TInt32 KSubConnGenericEventsImplUid  = 0x10204306;
  1267 
  1268 const TUint32 KSubConGlobalFamily = 0;
  1269 const TUint32 KSubConQoSFamily = 1;
  1270 const TUint32 KSubConAuthorisationFamily = 2;
  1271 const TUint32 KSubConnCallDescrParamsFamily = 3;
  1272 #ifdef SYMBIAN_NETWORKING_UMTSR5
  1273 const TUint32 KSubConnContextDescrParamsFamily = 4;
  1274 #endif //SYMBIAN_NETWORKING_UMTSR5
  1275 
  1276 class CSubConParameterFamily : public CBase
  1277 /** Container of RSubConnection parameter sets.
  1278 
  1279 For each Parameter Type (Requested, Acceptable and Granted) it
  1280 contains one generic and 0..N extended parameter sets.
  1281 
  1282 @publishedAll
  1283 @released since v9.0 */
  1284 	{
  1285 public:
  1286 
  1287 	enum TParameterSetType
  1288          {
  1289          ERequested = 0,
  1290          EAcceptable = 1,
  1291 		 EGranted = 2,
  1292 		 ENumValues = 3 // The number of values in this enum
  1293          };
  1294 
  1295 public:
  1296 	IMPORT_C static CSubConParameterFamily* NewL(RSubConParameterBundle& aBundle, TUint32 aFamilyId);
  1297 	IMPORT_C static CSubConParameterFamily* LoadL(RSubConParameterBundle& aBundle, TPtrC8& aBuffer);
  1298 	IMPORT_C static CSubConParameterFamily* NewL(CSubConParameterBundle& aBundle, TUint32 aFamilyId);
  1299 	IMPORT_C static CSubConParameterFamily* LoadL(CSubConParameterBundle& aBundle, TPtrC8& aBuffer);
  1300 
  1301 public:
  1302 	IMPORT_C virtual ~CSubConParameterFamily();
  1303 	IMPORT_C void SetGenericSetL(CSubConGenericParameterSet& aGenericSet, TParameterSetType aType);
  1304 	IMPORT_C void AddExtensionSetL(CSubConExtensionParameterSet& aExtensionSet, TParameterSetType aType);
  1305 
  1306 	IMPORT_C CSubConExtensionParameterSet* FindExtensionSet(TUid aSetId, TParameterSetType aType);
  1307 	IMPORT_C CSubConExtensionParameterSet* FindExtensionSet(STypeId aSetId, TParameterSetType aType);
  1308 	IMPORT_C CSubConGenericParameterSet* GetGenericSet(TParameterSetType aType);
  1309 
  1310 	inline TUint32 Id();
  1311 
  1312 	IMPORT_C TUint Length() const;
  1313 	IMPORT_C TInt Load(TPtrC8& aDes);
  1314 	IMPORT_C TInt Store(TDes8& aDes) const;
  1315 	IMPORT_C void ClearAllParameters(TParameterSetType aType);
  1316 
  1317 protected:
  1318 	explicit CSubConParameterFamily(TUint32 aFamilyId);
  1319 	void ConstructL(RSubConParameterBundle& aBundle);
  1320 	void ConstructL(CSubConParameterBundle& aBundle);
  1321 
  1322 	static TInt32 ExtractFamilyAndCreateBufferL(TPtrC8& aBuffer, TPtrC8& aContainerBuffer);
  1323 
  1324 private:
  1325 	const TUint32 iFamilyId;
  1326 	RMetaDataEComContainer iGenericSets;
  1327 	RMetaDataEComContainer iExtensionSets[ENumValues];
  1328 	};
  1329 
  1330 class CSubConParameterBundle : public CObject
  1331 /** Container for (bundle of) SubConnection parameter families.
  1332 
  1333 May contain and 0..N parameter families.
  1334 
  1335 @publishedPartner
  1336 @released since v9.0 */
  1337 	{
  1338 public:
  1339 	IMPORT_C static CSubConParameterBundle* NewL();
  1340 	IMPORT_C static CSubConParameterBundle* LoadL(TDesC8& aDes);
  1341 
  1342 	IMPORT_C ~CSubConParameterBundle();
  1343 
  1344 	IMPORT_C TUint Length() const;
  1345 	IMPORT_C TInt Load(const TDesC8& aDes);
  1346 	IMPORT_C TInt Store(TDes8& aDes) const;
  1347 	IMPORT_C void AddFamilyL(CSubConParameterFamily* aFamily);
  1348 	IMPORT_C CSubConParameterFamily* FindFamily(TUint32 aFamilyId);
  1349 	IMPORT_C void ClearAllParameters(CSubConParameterFamily::TParameterSetType aType);
  1350 
  1351 protected:
  1352 	CSubConParameterBundle();
  1353 
  1354 private:
  1355 	CSubConParameterBundle(const CSubConParameterBundle& aBundle);
  1356 	CSubConParameterBundle& operator=(const CSubConParameterBundle& aBundle);
  1357 
  1358 private:
  1359 	RPointerArray<CSubConParameterFamily> iFamilies;
  1360 	};
  1361 
  1362 class RSubConParameterBundle
  1363 /** Container for (bundle of) SubConnection parameter families.
  1364 
  1365 May contain and 0..N SubConnection parameter families.
  1366 
  1367 
  1368 @publishedAll
  1369 @released since v9.0 */
  1370 	{
  1371 public:
  1372 	IMPORT_C RSubConParameterBundle();
  1373 	IMPORT_C void Close();
  1374 
  1375 	IMPORT_C TUint Length() const;
  1376 	IMPORT_C TInt Load(const TDesC8& aDes);
  1377 	IMPORT_C TInt Store(TDes8& aDes) const;
  1378 	IMPORT_C void AddFamilyL(CSubConParameterFamily* aFamily);
  1379 	IMPORT_C CSubConParameterFamily* FindFamily(TUint32 aFamilyId);
  1380 	IMPORT_C void ClearAllParameters(CSubConParameterFamily::TParameterSetType aType);
  1381 
  1382 protected:
  1383 	TInt CheckBundle() const;
  1384 private:
  1385 	RSubConParameterBundle(const RSubConParameterBundle& aBundle);
  1386 	RSubConParameterBundle& operator=(const RSubConParameterBundle& aBundle);
  1387 
  1388 private:
  1389 	mutable CSubConParameterBundle* iBundle;
  1390 	};
  1391 
  1392 const TInt KNotificationEventMaxSize = 2048;
  1393 class TNotificationEventBuf : public TBuf8<KNotificationEventMaxSize>
  1394 /**
  1395 Buffer for Sub-connection event notiifcation
  1396 
  1397 @publishedAll
  1398 @released
  1399 */
  1400 	{
  1401 public:
  1402 	IMPORT_C TNotificationEventBuf();
  1403 	IMPORT_C ~TNotificationEventBuf();
  1404 
  1405 	IMPORT_C TBool IsGeneric() const;
  1406 	IMPORT_C TInt32 GroupId() const;
  1407 	IMPORT_C TUint32 Id() const;
  1408 	};
  1409 
  1410 class CSubConNotificationEvent : public SMetaDataECom
  1411 	{
  1412 public:
  1413 	IMPORT_C static CSubConNotificationEvent* NewL(const STypeId& aTypeId);
  1414 	IMPORT_C static CSubConNotificationEvent* NewL(const TNotificationEventBuf& aEventBuffer);
  1415 
  1416 	IMPORT_C TBool IsGeneric() const;
  1417 	IMPORT_C TInt32 GroupId() const;
  1418 	IMPORT_C TUint32 Id() const;
  1419 
  1420 private:
  1421 	};
  1422 
  1423 class TSubConnOpen
  1424 /** @internalComponent */
  1425 	{
  1426 public:
  1427 	/** Defines the type of a subconnection	*/
  1428 	enum TSubConnType
  1429 		{
  1430 		EAttachToDefault, 	// will attach to the default sub connection
  1431 		ECreateNew, 		// will create a new sub connection
  1432 
  1433 		//private extension to subconnection openning modes below:
  1434 		EWaitForIncoming
  1435 		};
  1436 
  1437 	TSubConnType iType;
  1438 	TInt  iHandle;
  1439 	TInt  iReserved;
  1440 	};
  1441 
  1442 class RSubConnection : public RSubSessionBase
  1443 /** 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.
  1444  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.
  1445  @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.
  1446 
  1447 Before using any of these services, a connection to a socket server session
  1448 must have been made and the connection must be open.
  1449 
  1450 @publishedAll
  1451 @released Since v9.0*/
  1452 	{
  1453 public:
  1454     friend class RConnection;
  1455 
  1456 	enum TSubConnType
  1457 		{
  1458 		EAttachToDefault,
  1459 		ECreateNew
  1460 		};
  1461 
  1462 	struct TEventFilter
  1463 		{
  1464 		inline TEventFilter(TInt32 aEventGroupId = KSubConnGenericEventsImplUid, TUint32 aEventMask = 0xffffffff);
  1465 		TInt32  iEventGroupUid;
  1466 		TUint32 iEventMask;
  1467 		};
  1468 
  1469 public:
  1470 	// Sub Connection Management
  1471 	IMPORT_C RSubConnection();
  1472 	IMPORT_C TInt Open(RSocketServ& aServer, TSubConnType aSubConnType, RConnection& aConnection);
  1473 	IMPORT_C void Close();
  1474 	IMPORT_C void Start(TRequestStatus& aStatus);
  1475 	IMPORT_C TInt Start();
  1476 	IMPORT_C TInt Stop();
  1477 
  1478 	// Socket Management
  1479 	IMPORT_C void Add(RSocket& aSocket, TRequestStatus& aStatus);
  1480 	IMPORT_C void Remove(RSocket& aSocket, TRequestStatus& aStatus);
  1481 
  1482 	// QoS Properties
  1483 	IMPORT_C TInt SetParameters(const RSubConParameterBundle& aParametersSet);
  1484 	IMPORT_C TInt GetParameters(RSubConParameterBundle& aParametersSet);
  1485 
  1486 	// Event Notification
  1487 	IMPORT_C void EventNotification(TNotificationEventBuf& aEventBuffer, TBool aGenericEventsOnly, TRequestStatus& aStatus);
  1488 	IMPORT_C void EventNotification(TNotificationEventBuf& aEventBuffer, TEventFilter aEventFilterList[], TUint aEventListLength, TRequestStatus& aStatus);
  1489 	IMPORT_C void CancelEventNotification();
  1490 
  1491 	// Generic Control
  1492 	IMPORT_C TInt Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
  1493 
  1494 	TBool SameSession(TInt aSessionHandle);
  1495 
  1496 private:
  1497 	IMPORT_C TInt Open(RSocketServ& aServer, TSubConnOpen::TSubConnType aSubConnType, RConnection& aConnection);
  1498 
  1499 	//Note : Not used anywhere else in the code, kept in order to avoid the BC Break
  1500 	TInt iSpare;
  1501 };
  1502 
  1503 
  1504 class ByteOrder
  1505 /** Reverses the byte order in 16 and 32-bit values.
  1506 @publishedAll
  1507 @released */
  1508 	{
  1509 public:
  1510 	IMPORT_C static TUint32 Swap32(TUint32 aVal);
  1511 	IMPORT_C static TUint16 Swap16(TUint16 aVal);
  1512 	inline static TUint16 Swap16(TUint aVal);
  1513 	};
  1514 
  1515 class BigEndian
  1516 /** Inserts and extracts integers in big-endian format.
  1517 @publishedAll
  1518 @released */
  1519 	{
  1520 public:
  1521 	IMPORT_C static TUint32 Get32(const TUint8* aPtr);
  1522 	IMPORT_C static TUint16 Get16(const TUint8* aPtr);
  1523 	IMPORT_C static void Put32(TUint8* aPtr, TUint32 aVal);
  1524 	IMPORT_C static void Put16(TUint8* aPtr, TUint16 aVal);
  1525 	};
  1526 
  1527 class LittleEndian
  1528 /** Inserts and extracts integers in little-endian format.
  1529 @publishedAll
  1530 @released */
  1531 	{
  1532 public:
  1533 	IMPORT_C static TUint32 Get32(const TUint8* aPtr);
  1534 	IMPORT_C static TUint16 Get16(const TUint8* aPtr);
  1535 	IMPORT_C static void Put32(TUint8* aPtr, TUint32 aVal);
  1536 	IMPORT_C static void Put16(TUint8* aPtr, TUint16 aVal);
  1537 	};
  1538 
  1539 class TAccessPointInfo
  1540 /** Stores Access Point information.
  1541 @publishedAll */
  1542 	{
  1543 public:
  1544 	TAccessPointInfo(TUint aApId = 0);
  1545 
  1546 	TUint AccessPoint() const;
  1547 	void SetAccessPoint(TUint aAccessPoint);
  1548 
  1549 	TBool operator== (const TAccessPointInfo& aRhs) const;
  1550 private:
  1551 	TUint iAccessPointId;
  1552 	};
  1553 
  1554 #include <es_sock.inl>
  1555 
  1556 #endif	//__ES_SOCK_H__