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