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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #if !defined(__ES_SOCK_H__)
31 #undef _DEBUG_SOCKET_FUNCTIONS
33 #define _DEBUG_SOCKET_FUNCTIONS
36 #include <comms-infras/metacontainer.h>
38 using Meta::SMetaDataECom;
39 using Meta::RMetaDataEComContainer;
42 // Forward declaration of CCommsDataObjectBase
45 class CCommsDataObjectBase;
49 Name of ESock server in EKA2
52 _LIT(SOCKET_SERVER_NAME, "!SocketServer");
55 Canonical names for the core ESOCKSVR modules
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
64 Id of the network layer.
67 const TUint KCommsNetworkLayerId = 1;
70 Default number of message slots.
74 const TUint KESockDefaultMessageSlots=8;
77 Major Version Number of Connection
81 const TUint KConnectionMajorVersionNumber=1;
84 Minor Version Number of Connection
88 const TUint KConnectionMinorVersionNumber=0;
91 Build Version Number of Connection
92 this must not be changed - expected by TCPIP to be >=68
96 const TUint KConnectionBuildVersionNumber=68;
99 Size of Maximum SubConnection event
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
105 const TUint KMaxSubConnectionEventSize = 512;
108 SubConnection Unique Id
112 typedef TUint TSubConnectionUniqueId;
115 Buffer for notification of any change in the state of SubConnection.
119 typedef TBuf8<KMaxSubConnectionEventSize> TSubConnectionNotificationBuf;
121 const TUint KUseEmbeddedUniqueId = 0; ///< Used by RConnection to identify cases where the subconnection id is embedded in the data structure
123 const TUint KConnProgressDefault = 0; ///< Default Connection Progress
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.
135 IMPORT_C TSessionPref();
137 /** The protocol's address family. For example, for TCP/IP protocols, KAfInet. */
139 /** The protocol type. */
155 Contains progress information on a dial-up connection
162 inline TNifProgress();
169 Contains information describing an agent
176 /** This class Contains version information */
179 /** This class Defines a modifiable buffer descriptor that can contain the name of a reference counting object */
184 Buffer for Network Interface Progress
189 typedef TPckgBuf<TNifProgress> TNifProgressBuf;
192 Socket address offsets.
198 /** Socket address offsets.
200 This class defines the internal offsets of data members for the TSockAddr
203 /** Address family of socket address */
205 /** Port (or equivilent) number */
210 Maximum sockets address size.
214 const TUint KMaxSockAddrSize=0x20;
216 class TSockAddr : public TBuf8<KMaxSockAddrSize>
217 /** Represents an end point address.
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.
226 Writing derived classes:
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.
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();
246 IMPORT_C void SetUserLen(TInt aLen);
247 inline TUint8* UserPtr() const;
249 inline SSockAddr* BasePtr() const;
252 // Address families (based upon protocol IDs used by ARP/REVARP)
253 /** Default (unspecified) protocol module.
256 const TUint KAFUnspec=0;
262 const TUint KSockStream=1;
263 /** Datagram socket. */
264 const TUint KSockDatagram=2;
265 /** Datagrams with sequence numbers. */
266 const TUint KSockSeqPacket=3;
268 const TUint KSockRaw=4;
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.
276 const TInt KSOLSocket=1;
277 /** Unspecified level. */
278 const TInt KLevelUnspecified=0;
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.
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:
302 const TUint KSODebug=1;
303 /** Socket receive buffer size. Values are:
305 KSocketBufSizeUndefined
307 1 to KMaxTUint: explicit buffer size, supplied as a TPckgBuf<TUint> */
308 const TUint KSORecvBuf=2;
309 /** Socket send buffer size. Values are:
311 KSocketBufSizeUndefined
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,
321 const TUint KSONonBlockingIO=4;
322 /** Socket blocking mode. To set, no values are required. For getting, values are:
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
331 const TUint KSOSelectPoll=6;
332 /** Getting only: retrieve the number of bytes currently available for reading.
334 const TUint KSOReadBytesPending=7;
335 /** Getting only: retrieve the urgent data offset (only for stream protocols that
336 support urgent data).
338 const TUint KSOUrgentDataOffset=8;
339 /** Getting only: retrieves the last error. Value is a TInt. */
340 const TUint KSOSelectLastError=9;
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.
349 const TUint KSOEnableTransfer = 10;
351 /** Setting only. Disables a socket's possibility to be transferred. No option required.
355 const TUint KSODisableTransfer = 11;
357 // The following constants relating to buffer sizes are defined
359 /** Use default buffer size. */
360 const TInt KSocketBufSizeUndefined=0;
361 /** Default buffer size. */
362 const TInt KSocketDefaultBufferSize=4096;
365 const TUint KSocketInternalOptionBit=0x80000000; ///< Must not be set for client requests
370 Must not be set for client requests
375 const TUint KInternalIoctlBit=0x80000000;
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.
381 Used through RSocket::Ioctl(), with aLevel set to KSOLSocket.
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;
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.
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;
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.
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;
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.
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;
427 /** Used in structure TProtocolDesc to describes the endianness of a protocol.
436 /** Other byte order */
441 // Protocol Service information bitmasks.
442 // The following constants are defined for
443 // TServerProtocolDesc and TProtocolDesc
445 /** The protocol is connectionless.
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
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
490 // Naming service constants
491 // The following constants are defined for
492 // TServerProtocolDesc and TProtocolDesc
494 /** Protocol supports resolving human readable entity names into network addresses
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
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;
523 // The following constants are defined for
524 // TServerProtocolDesc and TProtocolDesc
528 const TUint KSocketNoSecurity=0x00000000;
529 /** Secure Sockets Layer.
531 @see CSecureSocket */
532 const TUint KSecureSockets=0x00000001;
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.
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
546 const TInt KSocketMessageSizeNoLimit=-1;
549 /** Undefined socket type.
552 const TUint KUndefinedSockType=0xFFFFFFFF;
555 /** Undefined socket type.
558 const TUint KUndefinedProtocol=0xFFFFFFFE;
560 /** Contains the name of a protocol in structure TProtocolDesc.
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;
570 Socket protocol information for use by clients
576 /** Socket protocol information for use by clients. */
579 /** The name of the protocol
581 @see TProtocolName */
583 /** An integer identifying the protocol's address family. For example, for TCP/IP
584 protocols, KAfInet. */
586 /** An integer specifying the socket type. For example, for TCP, KSockStream. */
588 /** An integer specifying the specific protocol. For example, for TCP, KProtocolInetTcp. */
590 /** The version of the protocol
594 /** The byte order that the protocol uses
597 TByteOrder iByteOrder;
598 /** A bit mask of service information flags.
600 @see KSockStream etc. */
602 /** A bit mask indicating if the protocol supports name resolution, service resolution,
603 or database access services.
605 @see KNSNameResolution etc. */
606 TUint iNamingServices;
607 /** A bitmask of security flags.
609 @see KSocketNoSecurity etc. */
611 /** The message size of datagram protocols.
613 @see KSocketMessageSizeIsStream etc. */
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.
623 const TInt KErrWouldBlock=-1000;
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.
634 const TInt KErrConnectionTerminated=-17210;
636 const TInt KErrCannotFindProtocol = -17211;
638 /** Used in RSocket read and write calls to pass the length of data read and written.
641 typedef TPckgBuf<TInt> TSockXfrLength;
651 const TSockXfrLength* iLength; ///< length of data read and written
652 TUint iFlags; ///< Flag
653 TSockAddr* iAddr; ///< Socket Address
656 class TSockIOBufC : public TPckgC<TSockIO>
657 /** @internalComponent */
660 inline TSockIOBufC();
665 /** @internalComponent */
675 class TSockOpenBufC : public TPckgC<TSockOpen>
676 /** @internalComponent */
679 inline TSockOpenBufC();
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()
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.
696 The following operations are also provided:
698 NumProtocols() - enumerates the number of protocols of which the socket server
701 GetProtocolInfo()/FindProtocol() - return information about a specific protocol.
703 StartProtocol() - loads a protocol asynchronously.
705 @note This class is not intended for user derivation.
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();
734 NONSHARABLE_CLASS(RCommsSubSession) : public RSubSessionBase
736 friend class RCommsApiExtensionBase;
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:
746 reading from and writing to protocol
752 passive connection through the listen/accept model
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.
758 @released Since v5.0*/
760 friend class RSocketServ;
762 /** Used in structure TProtocolDesc to describes the endianness of a protocol. */
765 /** Complete when socket output/input stopped. */
767 /** Stop socket input and complete when output is stopped. */
769 /** Stop socket output and complete when input is stopped. */
771 /** Stop socket input/output and complete (abortive close). */
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);
784 IMPORT_C void Send(const TDesC8& aDesc,TUint someFlags,TRequestStatus& aStatus,TSockXfrLength& aLen);
785 IMPORT_C void CancelSend();
787 IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus);
789 IMPORT_C void Recv(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
791 IMPORT_C void RecvOneOrMore(TDes8& aDesc,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
792 IMPORT_C void CancelRecv();
794 IMPORT_C void Read(TDes8& aDesc,TRequestStatus& aStatus);
795 IMPORT_C void CancelRead();
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);
801 IMPORT_C void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen);
803 IMPORT_C void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus);
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);
836 /** Contains the results of name queries.
841 inline TNameRecord();
845 enum {EAlias=0x00000001,};
854 /** Flags indicating some attribute about the name, i.e. EAlias */
858 /** Packages the TNameRecord class so that it can be passed between a client and
862 typedef TPckgBuf<TNameRecord> TNameEntry;
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.
868 The interface provides functions to access the following facilities:
870 Obtaining names from addresses.
872 Obtaining addresses from names.
874 Getting and setting local host name.
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.
882 Before using any service, a connection to a socket server session must be
885 Each function is available in both synchronous and asynchronous versions.
887 A single RHostResolver can only perform one request of any type at once. A
888 client is panicked if it makes two requests.
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();
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);
916 Port number on service
921 typedef TPckgBuf<TInt> TPortNum;
923 class RServiceResolver : public RSubSessionBase
924 /** Provides an interface to resolver service names and ports.
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();
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.
947 Before making any queries, a connection to a socket server session must be
950 Each function is available in both synchronous and asynchronous versions.
952 A single RNetDatabase can only perform one request of any type at once. A
953 client is panicked if it makes two requests.
955 Particular database access services will specify the format of queries and
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();
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;
985 Level for RConnection::Control()
989 @capability NetworkControl Restrict access to connection clients
990 @ref RConnection::Control()
992 const TUint KCoEnumerateConnectionClients = 1 | (KConnWriteUserDataBit | KConnReadUserDataBit);
995 Level for RConnection::Control()
996 Information about client
1000 @capability NetworkControl Restrict access to connection client info
1001 @ref RConnection::Control()
1003 const TUint KCoGetConnectionClientInfo = 2 | (KConnWriteUserDataBit | KConnReadUserDataBit);
1005 /** @internalTechnology */
1006 const TUint KCoEnumerateConnectionSockets = 3 | (KConnWriteUserDataBit | KConnReadUserDataBit);
1009 Level for RConnection::Control()
1010 Information about connected socket
1014 @capability NetworkControl Restrict access to socket info on a connection
1015 @ref RConnection::Control()
1017 const TUint KCoGetConnectionSocketInfo = 4 | (KConnWriteUserDataBit | KConnReadUserDataBit);
1020 Default connection type
1024 const TUint KConnectionTypeDefault = 0x0800; // KAfInet is the default connection type
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).
1032 const TUint KCoEnableCloneOpen = 5 | (KConnReadUserDataBit);
1035 Setting only: disable "clone" open of this RConnection instance, which was enabled via
1036 a previous KCoEnableCloneOpen option.
1039 const TUint KCoDisableCloneOpen = 6 | (KConnReadUserDataBit);
1042 class TSubConnectionInfo;
1043 class TSubConnectionEvent;
1045 class RConnection : public RCommsSubSession
1048 The management interface for a network connection or subconnection.
1050 Provides clients with the following functionality:
1052 Opening and closing the connection
1054 Starting a connection, which means associating it with a new underlying interface
1056 Attaching the RConnection instance to an existing interface
1058 Stopping the connection, which means disassociating it from the underlying
1061 Obtaining progress information and notification during connection start-up
1063 Notifying when subconnections come up and go down
1065 Notifying when there is a service change for the connection
1067 Notifying when a given amount of data has been sent or received on a connection
1070 Reading CommDB fields specific to an active connection
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:
1077 All available internet access point names and internet access point 'friendly'
1078 names as appropriate for each network (GPRS/UMTS) connection
1080 Enumerating the currently active connections and subconnections
1082 The current status of all network connections e.g. active/suspended
1084 The amount of data (in bytes) transferred uplink and downlink by the network
1085 connection and subconnections
1087 The amount of time each network connection has been active (in seconds)
1089 The current status of the connection and subconnections with respect to data
1090 transfer, i.e. active/inactive
1092 The Quality of Service profile associated with each Packet Data Protocol (GPRS/UMTS)
1093 context, e.g. low/medium/high
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.
1099 @released since v7.0s */
1102 /** Identifies the intended use of the connection. */
1103 enum TConnAttachType
1105 /** The application wishes to use the connection for normal data transfer, and
1106 the idle timers will take that into account. */
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
1113 /** Identifies the type of requirement for stopping the connection. */
1116 /** Any sockets or host/service resolvers associated with this interface will be
1117 errored with KErrCancel. */
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. */
1129 Connection Management Interface
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();
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);
1146 IMPORT_C void WaitForIncoming(RSubConnection& aIncomingSubConnection, TRequestStatus& aStatus);
1147 IMPORT_C TInt WaitForIncoming(RSubConnection& aIncomingSubConnection);
1148 IMPORT_C void CancelWaitForIncoming();
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();
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);
1168 @prototype SymbianOS v9.4
1170 IMPORT_C TInt GetParameters(ESock::CCommsDataObjectBase& aDataObject);
1172 IMPORT_C TInt Name(TName& aName);
1174 IMPORT_C TInt EnumerateConnections(TUint& aCount);
1175 IMPORT_C TInt GetConnectionInfo(TUint aIndex, TDes8& aConnectionInfo);
1177 IMPORT_C void AllInterfaceNotification(TDes8& aNotification, TRequestStatus& aStatus);
1178 IMPORT_C void CancelAllInterfaceNotification();
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);
1187 IMPORT_C TInt Attach(const TDesC8& aConnectionInfo, TConnAttachType aAttachType);
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();
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);
1212 TBool SameSession(TInt aSessionHandle);
1214 TPckg<TUint32> iNewISPId;
1215 TUint32 iReserved[4];
1218 class CSubConParameterSet : public SMetaDataECom
1219 /** Base class for all RSubConnection parameter sets.
1222 @released since v9.0 */
1225 IMPORT_C static CSubConParameterSet* NewL(const STypeId& aTypeId);
1226 virtual ~CSubConParameterSet();
1229 CSubConParameterSet();
1233 class CSubConGenericParameterSet : public CSubConParameterSet
1234 /** Base class for generic RSubConnection parameter sets.
1237 @released since v9.0 */
1240 IMPORT_C ~CSubConGenericParameterSet();
1243 IMPORT_C CSubConGenericParameterSet();
1246 class CSubConExtensionParameterSet : public CSubConParameterSet
1247 /** Base class for extended RSubConnection parameter sets.
1250 @released since v9.0 */
1253 IMPORT_C ~CSubConExtensionParameterSet();
1256 IMPORT_C CSubConExtensionParameterSet();
1259 class RSubConParameterBundle;
1260 class CSubConParameterBundle;
1262 const TInt32 KSubConnParamsInterfaceUid = 0x10204303;
1263 const TInt32 KSubConnEventInterfaceUid = 0x10204305;
1265 const TInt32 KSubConnGenericParamsImplUid = 0x10204304;
1266 const TInt32 KSubConnGenericEventsImplUid = 0x10204306;
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
1276 class CSubConParameterFamily : public CBase
1277 /** Container of RSubConnection parameter sets.
1279 For each Parameter Type (Requested, Acceptable and Granted) it
1280 contains one generic and 0..N extended parameter sets.
1283 @released since v9.0 */
1287 enum TParameterSetType
1292 ENumValues = 3 // The number of values in this enum
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);
1302 IMPORT_C virtual ~CSubConParameterFamily();
1303 IMPORT_C void SetGenericSetL(CSubConGenericParameterSet& aGenericSet, TParameterSetType aType);
1304 IMPORT_C void AddExtensionSetL(CSubConExtensionParameterSet& aExtensionSet, TParameterSetType aType);
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);
1310 inline TUint32 Id();
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);
1318 explicit CSubConParameterFamily(TUint32 aFamilyId);
1319 void ConstructL(RSubConParameterBundle& aBundle);
1320 void ConstructL(CSubConParameterBundle& aBundle);
1322 static TInt32 ExtractFamilyAndCreateBufferL(TPtrC8& aBuffer, TPtrC8& aContainerBuffer);
1325 const TUint32 iFamilyId;
1326 RMetaDataEComContainer iGenericSets;
1327 RMetaDataEComContainer iExtensionSets[ENumValues];
1330 class CSubConParameterBundle : public CObject
1331 /** Container for (bundle of) SubConnection parameter families.
1333 May contain and 0..N parameter families.
1336 @released since v9.0 */
1339 IMPORT_C static CSubConParameterBundle* NewL();
1340 IMPORT_C static CSubConParameterBundle* LoadL(TDesC8& aDes);
1342 IMPORT_C ~CSubConParameterBundle();
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);
1352 CSubConParameterBundle();
1355 CSubConParameterBundle(const CSubConParameterBundle& aBundle);
1356 CSubConParameterBundle& operator=(const CSubConParameterBundle& aBundle);
1359 RPointerArray<CSubConParameterFamily> iFamilies;
1362 class RSubConParameterBundle
1363 /** Container for (bundle of) SubConnection parameter families.
1365 May contain and 0..N SubConnection parameter families.
1369 @released since v9.0 */
1372 IMPORT_C RSubConParameterBundle();
1373 IMPORT_C void Close();
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);
1383 TInt CheckBundle() const;
1385 RSubConParameterBundle(const RSubConParameterBundle& aBundle);
1386 RSubConParameterBundle& operator=(const RSubConParameterBundle& aBundle);
1389 mutable CSubConParameterBundle* iBundle;
1392 const TInt KNotificationEventMaxSize = 2048;
1393 class TNotificationEventBuf : public TBuf8<KNotificationEventMaxSize>
1395 Buffer for Sub-connection event notiifcation
1402 IMPORT_C TNotificationEventBuf();
1403 IMPORT_C ~TNotificationEventBuf();
1405 IMPORT_C TBool IsGeneric() const;
1406 IMPORT_C TInt32 GroupId() const;
1407 IMPORT_C TUint32 Id() const;
1410 class CSubConNotificationEvent : public SMetaDataECom
1413 IMPORT_C static CSubConNotificationEvent* NewL(const STypeId& aTypeId);
1414 IMPORT_C static CSubConNotificationEvent* NewL(const TNotificationEventBuf& aEventBuffer);
1416 IMPORT_C TBool IsGeneric() const;
1417 IMPORT_C TInt32 GroupId() const;
1418 IMPORT_C TUint32 Id() const;
1424 /** @internalComponent */
1427 /** Defines the type of a subconnection */
1430 EAttachToDefault, // will attach to the default sub connection
1431 ECreateNew, // will create a new sub connection
1433 //private extension to subconnection openning modes below:
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.
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.
1451 @released Since v9.0*/
1454 friend class RConnection;
1464 inline TEventFilter(TInt32 aEventGroupId = KSubConnGenericEventsImplUid, TUint32 aEventMask = 0xffffffff);
1465 TInt32 iEventGroupUid;
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();
1478 // Socket Management
1479 IMPORT_C void Add(RSocket& aSocket, TRequestStatus& aStatus);
1480 IMPORT_C void Remove(RSocket& aSocket, TRequestStatus& aStatus);
1483 IMPORT_C TInt SetParameters(const RSubConParameterBundle& aParametersSet);
1484 IMPORT_C TInt GetParameters(RSubConParameterBundle& aParametersSet);
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();
1492 IMPORT_C TInt Control(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
1494 TBool SameSession(TInt aSessionHandle);
1497 IMPORT_C TInt Open(RSocketServ& aServer, TSubConnOpen::TSubConnType aSubConnType, RConnection& aConnection);
1499 //Note : Not used anywhere else in the code, kept in order to avoid the BC Break
1505 /** Reverses the byte order in 16 and 32-bit values.
1510 IMPORT_C static TUint32 Swap32(TUint32 aVal);
1511 IMPORT_C static TUint16 Swap16(TUint16 aVal);
1512 inline static TUint16 Swap16(TUint aVal);
1516 /** Inserts and extracts integers in big-endian format.
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);
1528 /** Inserts and extracts integers in little-endian format.
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);
1539 class TAccessPointInfo
1540 /** Stores Access Point information.
1544 TAccessPointInfo(TUint aApId = 0);
1546 TUint AccessPoint() const;
1547 void SetAccessPoint(TUint aAccessPoint);
1549 TBool operator== (const TAccessPointInfo& aRhs) const;
1551 TUint iAccessPointId;
1554 #include <es_sock.inl>
1556 #endif //__ES_SOCK_H__