williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __IR_SOCK_H__ williamr@2: #define __IR_SOCK_H__ williamr@2: williamr@2: #include "es_sock.h" williamr@2: #include williamr@2: williamr@2: //################## EXPORTED CONSTANTS ######################## williamr@2: williamr@2: williamr@2: /** IrDA protocol family. */ williamr@2: const TUint KIrdaAddrFamily=0x100; // Address of Irda prot family williamr@2: williamr@2: /** IrMUX protocol within the IrDA protocol family. */ williamr@2: const TUint KIrmux=88; // Protocol number for Irmux williamr@2: williamr@2: /** IrTinyTP protocol within the IrDA protocol family.. */ williamr@2: const TUint KIrTinyTP=89; // Protocol number for IrTinyTP williamr@2: williamr@2: /** An invalid LSAP number--binding to this will select the first unused LSAP. */ williamr@2: const TUint KAutoBindLSAP = 0xffff; williamr@2: williamr@2: williamr@2: /** Category used when publishing IrDA status notifications. */ williamr@2: const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue}; williamr@2: williamr@2: /** Key used when publishing IrDA status notifications. */ williamr@2: const TUint KIrdaStatus = 0x100052d1; williamr@2: williamr@2: williamr@2: /** Names used for IrDA status notifications. */ williamr@2: namespace TIrdaStatusCodes williamr@2: { williamr@2: enum williamr@2: { williamr@2: EIrLoaded, williamr@2: EIrDiscoveredPeer, williamr@2: EIrLostPeer, williamr@2: EIrConnected, williamr@2: EIrBlocked, williamr@2: EIrDisconnected, williamr@2: EIrUnloaded, williamr@2: }; williamr@2: } williamr@2: williamr@2: /** PnP support - first service hint byte. */ williamr@2: const TUint8 KIrPnPMask=0x01; // PnP support - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** PDA/Palmtop - first service hint byte. */ williamr@2: const TUint8 KPalmtopMask=0x02; // PDA/Palmtop - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** Computer - first service hint byte. */ williamr@2: const TUint8 KComputerMask=0x04; // Computer - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** Printer - first service hint byte. */ williamr@2: const TUint8 KPrinterMask=0x08; // Printer - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** IrModem - first service hint byte. */ williamr@2: const TUint8 KModemMask=0x10; // IrModem - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** Fax - first service hint byte. */ williamr@2: const TUint8 KFaxMask=0x20; // Fax - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** LAN Access - first service hint byte. */ williamr@2: const TUint8 KLANAccessMask=0x40; // LAN Access - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** Extension bit - first service hint byte. */ williamr@2: const TUint8 KExtensionMask=0x80; // Extension bit - FIRST SERVICE HINT BYTE williamr@2: williamr@2: /** Telephony - second service hint byte. */ williamr@2: const TUint8 KTelephonyMask=0x01; // Telephony - SECOND SERVICE HINT BYTE williamr@2: williamr@2: /** File Server - second service hint byte. */ williamr@2: const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE williamr@2: williamr@2: /** IrCOMM support - second service hint byte. */ williamr@2: const TUint8 KIrCommMask=0x04; // IrCOMM support - SECOND SERVICE HINT BYTE williamr@2: williamr@2: /** IrOBEX support - second service hint byte. */ williamr@2: const TUint8 KIrObexMask=0x20; // IrObex support - SECOND SERVICE HINT BYTE williamr@2: williamr@2: // williamr@2: // IrDA Ioctls williamr@2: // williamr@2: williamr@2: /** Completes on receipt of a discovery indication. williamr@2: williamr@2: Returns log entry in a TNameEntry. williamr@2: williamr@2: Ioctl level : KIrdaAddrFamily */ williamr@2: const TUint KDiscoveryIndicationIoctl=0; williamr@2: williamr@2: /** Completes on successfully making RSocket EXCLUSIVE else returns error. williamr@2: williamr@2: Completes successfully or returns KErrDisconnected if failed. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KExclusiveModeIoctl=1; williamr@2: williamr@2: /** Completes on successfully making RSocket MULTIPLEXED else returns error. williamr@2: williamr@2: Completes successfully or returns KErrDisconnected if failed. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KMultiplexModeIoctl=2; williamr@2: williamr@2: /** Completes on doing a status request on IrMUX layer packets to send. williamr@2: williamr@2: Returns TDes8* holding TUint indicating number of outstanding MUX data requests. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrmuxStatusRequestIoctl=3; williamr@2: williamr@2: /** Completes on doing a status request on IrLAP layer packets to send. williamr@2: williamr@2: Returns TDes8* holding TUint indicating the number of outstanding LAP data williamr@2: requests. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrlapStatusRequestIoctl=4; williamr@2: williamr@2: /** Completes on successfully putting RSocket into IDLE mode. williamr@2: williamr@2: Completes successfully or returns KErrAbort if failed. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIdleRequestIoctl=5; williamr@2: williamr@2: /** Completes on successfully taking RSocket out of IDLE mode. williamr@2: williamr@2: Completes successfully or returns KErrAbort if failed. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIdleClearRequestIoctl=6; williamr@2: williamr@2: /** Completes on receipt of an IrLAP disconnect indication. williamr@2: williamr@2: Completes successfully on IrLAP or IrMUX disconnect on this connection. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KDisconnectIndicationIoctl=7; williamr@2: williamr@2: /** Completes on doing a status request on IrLAP layer packets to send. williamr@2: williamr@2: Returns TDes8* holding TUint indicating the number of outstanding LAP data williamr@2: requests. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrlapStatusIndicationIoctl=8; williamr@2: williamr@2: /** Completes on receiving a status indication from IrLAP. williamr@2: williamr@2: Returns TDes8* holding TUint indicating the number of outstanding MUX data williamr@2: requests. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrmuxStatusIndicationIoctl=9; williamr@2: williamr@2: /** Completes on doing an IrLAP link reset. williamr@2: williamr@2: Does an SNRMP-UAF link reset which can be initiated from either primary or williamr@2: secondary. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrlapResetRequestIoctl=10; williamr@2: williamr@2: /** Completes on receipt of an IrLAP link reset indication. williamr@2: williamr@2: Completes with error value KErrNone if link is successfully reset. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrlapResetIndicationIoctl=11; williamr@2: williamr@2: /** Completes on doing an IrLAP link reset. williamr@2: williamr@2: Does a DISCP-UAF link disconnect which can be initiated from either primary williamr@2: or secondary. williamr@2: williamr@2: Ioctl level: KIrdaAddrFamily */ williamr@2: const TUint KIrlapDisconnectRequestIoctl=12; williamr@2: williamr@2: const TUint KExclusiveMode=0; williamr@2: williamr@2: const TUint KMultiplexMode=1; williamr@2: williamr@2: williamr@2: //******************** Irda Set/GetOpts ****************************** williamr@2: // These two are done on Socket Write williamr@2: // williamr@2: williamr@2: williamr@2: /** KLevelIrlap. williamr@2: williamr@2: Sets transfer mode to be unexpedited (the default). williamr@2: williamr@2: Not recommended for use with SetOpt(). Preferred use is with RSocket::Send() williamr@2: williamr@2: Returns KErrNone */ williamr@2: const TUint KUnexpeditedDataOpt = 0; // Default williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets transfer mode to be expedited (urgent). williamr@2: williamr@2: Not recommended for use with SetOpt(). Preferred use is with RSocket::Send() williamr@2: williamr@2: Returns KErrNone */ williamr@2: const TUint KExpeditedDataOpt = 1; // Urgent data transfer williamr@2: williamr@2: // On KLevelIrlap williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets number of discovery slots. williamr@2: williamr@2: Returns KErrNone */ williamr@2: const TUint KDiscoverySlotsOpt = 2; williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets the requested maximum link baud rate. williamr@2: williamr@2: Returns KErrInUse, if the link is already running. williamr@2: williamr@2: Returns with the currently set maximum link baud supported. */ williamr@2: const TUint KUserBaudOpt = 3; williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets the requested maximum data packet size that can be received by the host. williamr@2: williamr@2: Returns KErrInUse, if the link is already running. williamr@2: williamr@2: Returns with the currently set value for the maximum receivable data size williamr@2: of the host IrLAP layer. */ williamr@2: const TUint KHostMaxDataSizeOpt = 4; williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Returns KErrNotSupported. williamr@2: williamr@2: Cannot set this value for the remote station. williamr@2: williamr@2: Returns with the currently set value for the maximum transmissible data size williamr@2: to remote IrLAP layer. */ williamr@2: const TUint KRemoteMaxDataSizeOpt = 6; // Remote packet size williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Set the maximum link turnaround time for the host IrLAP layer. williamr@2: williamr@2: Returns KErrInUse, if the link is already running. williamr@2: williamr@2: Returns with the currently set value for the host link turnaround time */ williamr@2: const TUint KHostMaxTATimeOpt = 5; williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Disables IrLAP level reset_check/wait states */ williamr@2: const TUint KIrlapDisableResetOpt = 9; // This disables Irlap level reset_check/wait states. williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Allows the client to set local busy in IrLAP. */ williamr@2: const TUint KLocalBusyDetectedOpt = 10; // Client can set local busy in Irlap williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Allows the client to clear local busy in IrLAP */ williamr@2: const TUint KLocalBusyClearedOpt = 11; // Client can clear local busy in Irlap williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Disables discovery response for a short period (typically 3 seconds). */ williamr@2: const TUint KDiscoveryResponseDisableOpt = 12; williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets the host's first service hint byte used in XID frames. williamr@2: williamr@2: Retrieves the first hint byte. */ williamr@2: const TUint KFirstHintByteOpt = 13; // Hint Bytes williamr@2: williamr@2: /** KLevelIrlap williamr@2: williamr@2: Sets the host's second service hint byte used in XID frames. williamr@2: williamr@2: Retrieves the second hint byte */ williamr@2: const TUint KSecondHintByteOpt = 14; williamr@2: williamr@2: // On KLevelIrmux williamr@2: williamr@2: /** KLevelIrmux williamr@2: williamr@2: Turns on transport layer segmentation with the segment size specified. This williamr@2: value is advertised to the remote machine as the maximum amount of data we williamr@2: can reassemble. williamr@2: williamr@2: Returns KErrNone */ williamr@2: const TUint KTinyTPLocalSegSizeOpt=7; // This value is advertised to the remote machine as the max amount of data we can reassemble williamr@2: williamr@2: /** KLevelIrmux williamr@2: williamr@2: Queries the remote machine's segment size. The remote machine is unable williamr@2: to assemble more data than this. williamr@2: williamr@2: Returns the remote machine's segment size. */ williamr@2: const TUint KTinyTPRemoteSegSizeOpt=8; // Remote machine is unable to reassemble more data than this williamr@2: williamr@2: /** williamr@2: Disables TinyTP reassembly of segmented packets. */ williamr@2: const TUint KTinyTPDisabledSegmentation=15; williamr@2: /** williamr@2: @deprecated williamr@2: Disables TinyTP reassembly of segmented packets. */ williamr@2: const TUint KTinyTPDiasbledSegmentation=15; williamr@2: williamr@2: /** williamr@2: @internalComponent williamr@2: */ williamr@2: const TUint KIrdaInternalOption=0x4000000; williamr@2: williamr@2: /** williamr@2: @internalTechnology williamr@2: */ williamr@2: const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption; williamr@2: williamr@2: williamr@2: williamr@2: /** The option relates to IrLAP. */ williamr@2: const TUint KLevelIrlap=4; williamr@2: williamr@2: /** The option relates to IrMUX. */ williamr@2: const TUint KLevelIrmux=5; williamr@2: williamr@2: /** The maximum length of a class name in an IAS entry. */ williamr@2: const TUint KIASClassNameMax=60; williamr@2: williamr@2: /** The maximum length of an attribute in an IAS entry. */ williamr@2: const TUint KIASAttributeNameMax=60; williamr@2: williamr@2: /** The maximum length of a TIASQuery descriptor. */ williamr@2: const TUint KMaxQueryStringLength=128; williamr@2: williamr@2: //################# CLASS DEFINITIONS ######################## williamr@2: williamr@2: NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr williamr@2: /** An IrDA socket address. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: struct SIrdaAddr williamr@2: { williamr@2: TUint iHostDevAddr; williamr@2: TUint iRemoteDevAddr; williamr@2: TBool iSniff; williamr@2: TBool iSolicited; williamr@2: TUint8 iIrlapVersion; williamr@2: TUint8 iFirstServiceHintByte; williamr@2: TUint8 iSecondServiceHintByte; williamr@2: TUint8 iCharacterSet; williamr@2: TUint8 iServiceHintByteCount; williamr@2: // Extra stuff for MUX williamr@2: TUint8 iHomePort; williamr@2: TUint8 iRemotePort; williamr@2: TUint8 iSpare; williamr@2: }; williamr@2: public: williamr@2: IMPORT_C TIrdaSockAddr(); williamr@2: IMPORT_C TIrdaSockAddr(const TSockAddr &aAddr); williamr@2: /** Casts a reference to a general socket address into an IrDA socket address. williamr@2: williamr@2: @param aAddr A reference to a general socket address. williamr@2: @return The socket address returned as a reference to an IrDA socket address. */ williamr@2: williamr@2: /** Casts a pointer to a general socket address into an IrDA socket address. williamr@2: williamr@2: @param aAddr A pointer to a general socket address. williamr@2: @return The socket address returned as a reference to an IrDA socket address. */ williamr@2: IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr &aAddr); williamr@2: williamr@2: /** Casts a reference to a general socket address into an IrDA socket address. williamr@2: williamr@2: @param aAddr A reference to a general socket address. williamr@2: @return The socket address returned as a reference to an IrDA socket address. */ williamr@2: williamr@2: /** Casts a pointer to a general socket address into an IrDA socket address. williamr@2: williamr@2: @param aAddr A pointer to a general socket address. williamr@2: @return The socket address returned as a reference to an IrDA socket address. */ williamr@2: williamr@2: IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr); williamr@2: /** Returns the remote device address. williamr@2: williamr@2: @return The remote device address as a 32 bit value. */ williamr@2: williamr@2: IMPORT_C TUint GetRemoteDevAddr() const; williamr@2: /** Sets the remote device address. williamr@2: williamr@2: @param aRemote The remote device address as a 32-bit value. */ williamr@2: williamr@2: IMPORT_C void SetRemoteDevAddr(const TUint aRemote); williamr@2: williamr@2: /** Returns the host device address. williamr@2: williamr@2: @return The host device address as a 32 bit value. */ williamr@2: IMPORT_C TUint GetHostDevAddr() const; williamr@2: williamr@2: /** Sets the host device address. williamr@2: williamr@2: @param aHost The host device address as a 32-bit value. */ williamr@2: IMPORT_C void SetHostDevAddr(const TUint aHost); williamr@2: williamr@2: /** Returns the remote device's sniff status, i.e. whether the device is capable williamr@2: of sniffing for IrDA devices. williamr@2: williamr@2: @return True, if the device is capable of sniffing for IrDA devices; false, williamr@2: otherwise. */ williamr@2: IMPORT_C TBool GetSniffStatus() const; williamr@2: williamr@2: /** Sets the sniff status for the remote device, i.e. whether the device is capable williamr@2: of sniffing for IrDA devices. williamr@2: williamr@2: @param aSniff True, if the device is capable of sniffing for IrDA devices; williamr@2: false, otherwise. */ williamr@2: IMPORT_C void SetSniffStatus(const TBool aSniff); williamr@2: williamr@2: /** Returns the solicited status. williamr@2: williamr@2: The solicited status indicates whether a discovery was initiated by the host williamr@2: device or a remote device. williamr@2: williamr@2: @return True, if the discovery was initiated by the host device; false if williamr@2: the discovery was initiated by the remote device. */ williamr@2: IMPORT_C TBool GetSolicitedStatus() const; williamr@2: williamr@2: /** Sets the solicited status. The solicited status indcates whether a discovery williamr@2: was initiated by the host device or a remote device. williamr@2: williamr@2: @param aSolicited ETrue, if the discovery was initiated by the host device; williamr@2: EFalse, if discovery was initiated by the remote device. */ williamr@2: IMPORT_C void SetSolicitedStatus(const TBool aSolicited); williamr@2: williamr@2: /** Returns the remote device's IrLAP version number. williamr@2: williamr@2: This should be 0x00 indicating that the device conforms to the IrDA IrLAP williamr@2: 1.00 specification. williamr@2: williamr@2: @return The device's IrLAP version number. */ williamr@2: IMPORT_C TUint8 GetIrlapVersion() const; williamr@2: williamr@2: /** Sets the IrLAP version number for the remote device. williamr@2: williamr@2: This should be 0x00 indicating that the device conforms to the IrDA IrLAP williamr@2: 1.00 specification. williamr@2: williamr@2: @param aIrlapVersion The device's IrLAP version number. */ williamr@2: IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion); williamr@2: williamr@2: /** Returns the character set supported by the remote device. williamr@2: williamr@2: @return One of the TIASCharSet enumerator values defining the character set williamr@2: supported by the device. */ williamr@2: IMPORT_C TUint8 GetCharacterSet() const; williamr@2: williamr@2: /** Sets the character set supported by the remote device. williamr@2: williamr@2: @param aCharacterSet One of the TIASCharSet enumerator values defining the williamr@2: character set supported by the device */ williamr@2: IMPORT_C void SetCharacterSet(const TUint8 aCharacterSet); williamr@2: williamr@2: /** Returns the remote device's first service hint byte. Service hint bytes indicate williamr@2: the level of IrLMP support provided by the device. williamr@2: williamr@2: @return The first service hint byte. The individual bits have the following williamr@2: meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop Bit 2 (0x04) williamr@2: - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 (0x20) - Fax williamr@2: Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */ williamr@2: IMPORT_C TUint8 GetFirstServiceHintByte() const; williamr@2: williamr@2: /** Sets the first service hint byte for the remote device. The service hint bytes williamr@2: indicate the level of IrLMP support provided by the device. williamr@2: williamr@2: @param aFirstServiceHintByte The first service hint byte. The individual bits williamr@2: have the following meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop williamr@2: Bit 2 (0x04) - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 williamr@2: (0x20) - Fax Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */ williamr@2: IMPORT_C void SetFirstServiceHintByte(const TUint8 aFirstServiceHintByte); williamr@2: williamr@2: /** Returns the remote device's first service hint byte. Service hint bytes indicate williamr@2: the level of IrLMP support provided by the device. williamr@2: williamr@2: @return The second service hint byte. The individual bits have the following williamr@2: meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File Server Bit 2 (0x04) williamr@2: - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved Bit 5 (0x20) - IrOBEX williamr@2: Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */ williamr@2: IMPORT_C TUint8 GetSecondServiceHintByte() const; williamr@2: williamr@2: /** Sets the second service hint byte for the remote device. The service hint bytes williamr@2: indicate the level of IrLMP support provided by the device. williamr@2: williamr@2: @param aSecondServiceHintByte The second service hint byte. The individual williamr@2: bits have the following meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File williamr@2: Server Bit 2 (0x04) - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved williamr@2: Bit 5 (0x20) - IrOBEX Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */ williamr@2: IMPORT_C void SetSecondServiceHintByte(const TUint8 aSecondServiceHintByte); williamr@2: williamr@2: /** Returns the number of service hint bytes for the remote device. williamr@2: williamr@2: @return The number of service hint bytes. */ williamr@2: IMPORT_C TUint8 GetServiceHintByteCount() const; williamr@2: williamr@2: /** Sets the number of service hint bytes for the remote device. williamr@2: williamr@2: @param aServiceHintByteCount The number of service hint bytes. */ williamr@2: IMPORT_C void SetServiceHintByteCount(const TUint8 aServiceHintByteCount); williamr@2: IMPORT_C TUint8 GetHomePort() const; williamr@2: IMPORT_C void SetHomePort(const TUint8 aHomePort); williamr@2: IMPORT_C TUint8 GetRemotePort() const; williamr@2: IMPORT_C void SetRemotePort(const TUint8 aRemotePort); williamr@2: private: williamr@2: SIrdaAddr* addrPtr() const; williamr@2: }; williamr@2: williamr@2: enum TIASDataType williamr@2: /** An enumeration whose enumerators define the type of response received from williamr@2: an Information Access Service (IAS) query. williamr@2: williamr@2: @see TIASResponse */ williamr@2: { williamr@2: /** No response type defined. */ williamr@2: EIASDataMissing=0, williamr@2: /** The response type is an integer. */ williamr@2: EIASDataInteger=1, williamr@2: /** The response type is binary data. */ williamr@2: EIASDataOctetSequence=2, williamr@2: /** The response type is a string. */ williamr@2: EIASDataUserString=3 williamr@2: }; williamr@2: williamr@2: enum TIASCharSet williamr@2: /** The character set encoding of the character string response from an IAS query. williamr@2: williamr@2: @see TIASResponse::GetCharString() williamr@2: @see TIrdaSockAddr::GetCharacterSet() */ williamr@2: { williamr@2: /** String is standard ASCII. */ williamr@2: EIASCharSetUserStringASCII =0x00, williamr@2: /** String is ISO Latin-1. */ williamr@2: EIASCharSetUserStringISO_8859_1=0x01, williamr@2: /** String is ISO Latin-2. */ williamr@2: EIASCharSetUserStringISO_8859_2=0x02, williamr@2: /** String is ISO Latin-3. */ williamr@2: EIASCharSetUserStringISO_8859_3=0x03, williamr@2: /** String is ISO Latin-4. */ williamr@2: EIASCharSetUserStringISO_8859_4=0x04, williamr@2: /** String is ISO-8859-5 (Cyrillic). */ williamr@2: EIASCharSetUserStringISO_8859_5=0x05, williamr@2: /** String is ISO-8859-6 (Arabic). */ williamr@2: EIASCharSetUserStringISO_8859_6=0x06, williamr@2: /** String is ISO-8859-7 (Greek). */ williamr@2: EIASCharSetUserStringISO_8859_7=0x07, williamr@2: /** String is ISO-8859-8 (Hebrew). */ williamr@2: EIASCharSetUserStringISO_8859_8=0x08, williamr@2: /** String is ISO Latin-5. */ williamr@2: EIASCharSetUserStringISO_8859_9=0x09, williamr@2: /** String is UNICODE. */ williamr@2: EIASCharSetUserStringUnicode=0xFF, williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TIASQuery) : public TBuf8 williamr@2: /** An Information Access Service (IAS) query to another device's IAS server. williamr@2: @publishedAll williamr@2: @released williamr@2: @see TIASResponse */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TIASQuery(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr); williamr@2: IMPORT_C TIASQuery(); williamr@2: IMPORT_C void Set(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr); williamr@2: IMPORT_C void Get(TDes8& aClass,TDes8& aAttribute,TUint& aRemoteDevAddr); williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TIASResponse) : public TBuf8 williamr@2: /** Response from an Information Access Service (IAS) query to another device's williamr@2: IAS server. williamr@2: @publishedAll williamr@2: @released williamr@2: @see TIASQuery */ williamr@2: { williamr@2: public: // But not exported :-) williamr@2: void SetToInteger(TUint anInteger); williamr@2: void SetToCharString(const TDesC8& aCharString); williamr@2: void SetToOctetSeq(const TDesC8& aData); williamr@2: #ifdef _UNICODE williamr@2: void SetToCharString(const TDesC16& aWideString); williamr@2: #endif williamr@2: williamr@2: public: williamr@2: IMPORT_C TIASResponse(); williamr@2: /** Indicates the response contains a list. */ williamr@2: IMPORT_C TBool IsList() const; williamr@2: /** Indicates the number of items in the response. */ williamr@2: IMPORT_C TInt NumItems() const; williamr@2: williamr@2: /** Returns the type of the response. williamr@2: williamr@2: @return An enumeration identifying the type of response. */ williamr@2: IMPORT_C TIASDataType Type() const; williamr@2: williamr@2: IMPORT_C TInt GetInteger(TInt &aResult,TInt anIndex=0) const; williamr@2: IMPORT_C TInt GetOctetSeq(TDes8 &aResult,TInt anIndex=0) const; williamr@2: IMPORT_C TInt GetCharString(TDes8 &aResult,TInt anIndex=0) const; williamr@2: IMPORT_C const TPtrC8 GetCharString8(TInt anIndex=0) const; williamr@2: williamr@2: /** Gets the response string. williamr@2: williamr@2: This is called if the response type indicates a string. williamr@2: williamr@2: @param aResult On return, an 8 bit modifiable descriptor containing the response williamr@2: string. The length of the response string can never be greater than the value williamr@2: of (KMaxQueryStringLength - 3). williamr@2: @param anIndex Reserved for future use. This argument must be allowed to default williamr@2: to 0 and must not be overriden. williamr@2: @return If successful, one of the TIASCharSet enumerator values defining the williamr@2: character set encoding of the response string. KErrNotSupported, if a non-zero williamr@2: value has been specified for anIndex. KErrCorrupt, if the response type is williamr@2: not a string. williamr@2: @see TIASResponse::Type() */ williamr@2: IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const; williamr@2: williamr@2: IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const; williamr@2: williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TIASDatabaseEntryV001) williamr@2: /** The data for an Information Access Service (IAS) record in the network database. williamr@2: williamr@2: An object of this type is contained in a packaged modifiable buffer descriptor. williamr@2: @publishedAll williamr@2: @released williamr@2: @see TIASDatabaseEntry */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TIASDatabaseEntryV001(); williamr@2: williamr@2: /** The class name for the IAS entry williamr@2: williamr@2: This is a template specialisation of a TBuf8 */ williamr@2: TBuf8 iClassName; williamr@2: williamr@2: /** The attribute for the IAS entry. williamr@2: williamr@2: This is a template specialisation of a TBuf8 */ williamr@2: TBuf8 iAttributeName; williamr@2: williamr@2: /** The response data. */ williamr@2: TIASResponse iData; williamr@2: williamr@2: private: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf williamr@2: /** An Information Access Service (IAS) record in the network database. williamr@2: williamr@2: The record data is contained in an object of type TIASDatabaseEntryV001 packaged williamr@2: in a modifiable buffer descriptor. williamr@2: @publishedAll williamr@2: @released williamr@2: @see RNetDatabase */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C void SetClassName(const TDesC8& aClassName); williamr@2: IMPORT_C void SetAttributeName(const TDesC8& anAttributeName); williamr@2: IMPORT_C void SetToInteger(const TUint anInteger); williamr@2: IMPORT_C void SetToCharString(const TDesC8& aCharString); williamr@2: williamr@2: /** Sets the response type corresponding to the class and attribute defined in williamr@2: this record, as binary data. williamr@2: williamr@2: @param aData The response binary data. The length of this data can never be williamr@2: greater than (KMaxQueryStringLength - 3). */ williamr@2: IMPORT_C void SetToOctetSeq(const TDesC8& aData); williamr@2: williamr@2: #ifdef _UNICODE //need to be able to enter wide entries in unicode builds williamr@2: IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export williamr@2: #endif williamr@2: }; williamr@2: williamr@2: #endif // __IR_SOCK_H__