irda/irdastack/INC/IR_SOCK.H
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedAll
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef __IR_SOCK_H__
       
    23 #define __IR_SOCK_H__
       
    24 
       
    25 #include "es_sock.h"
       
    26 #include <e32property.h>
       
    27 
       
    28 //################## EXPORTED CONSTANTS ########################
       
    29 
       
    30 
       
    31 /** IrDA protocol family. */
       
    32 const TUint KIrdaAddrFamily=0x100;   // Address of Irda prot family
       
    33 
       
    34 /** IrMUX protocol within the IrDA protocol family. */
       
    35 const TUint KIrmux=88;               // Protocol number for Irmux
       
    36 
       
    37 /** IrTinyTP protocol within the IrDA protocol family.. */
       
    38 const TUint KIrTinyTP=89;            // Protocol number for IrTinyTP
       
    39 
       
    40 /** An invalid LSAP number--binding to this will select the first unused LSAP. */
       
    41 const TUint KAutoBindLSAP = 0xffff;
       
    42 
       
    43 
       
    44 /** Category used when publishing IrDA status notifications. */
       
    45 const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue};
       
    46 
       
    47 /** Key used when publishing IrDA status notifications. */
       
    48 const TUint KIrdaStatus = 0x100052d1;
       
    49 
       
    50 
       
    51 /** Names used for IrDA status notifications. */
       
    52 namespace TIrdaStatusCodes
       
    53 	{
       
    54 	enum
       
    55 		{
       
    56 		EIrLoaded,
       
    57 		EIrDiscoveredPeer,
       
    58 		EIrLostPeer,
       
    59 		EIrConnected,
       
    60 		EIrBlocked,
       
    61 		EIrDisconnected,
       
    62 		EIrUnloaded,
       
    63 		};
       
    64 	}
       
    65 
       
    66 /** PnP support - first service hint byte. */
       
    67 const TUint8 KIrPnPMask=0x01;	   // PnP support - FIRST SERVICE HINT BYTE
       
    68 
       
    69 /** PDA/Palmtop - first service hint byte. */
       
    70 const TUint8 KPalmtopMask=0x02;    // PDA/Palmtop - FIRST SERVICE HINT BYTE
       
    71 
       
    72 /** Computer - first service hint byte. */
       
    73 const TUint8 KComputerMask=0x04;   // Computer - FIRST SERVICE HINT BYTE
       
    74 
       
    75 /** Printer - first service hint byte. */
       
    76 const TUint8 KPrinterMask=0x08;	   // Printer - FIRST SERVICE HINT BYTE
       
    77 
       
    78 /** IrModem - first service hint byte. */
       
    79 const TUint8 KModemMask=0x10;      // IrModem - FIRST SERVICE HINT BYTE
       
    80 
       
    81 /** Fax - first service hint byte. */
       
    82 const TUint8 KFaxMask=0x20;        // Fax - FIRST SERVICE HINT BYTE
       
    83 
       
    84 /** LAN Access - first service hint byte. */
       
    85 const TUint8 KLANAccessMask=0x40;  // LAN Access - FIRST SERVICE HINT BYTE
       
    86 
       
    87 /** Extension bit - first service hint byte. */
       
    88 const TUint8 KExtensionMask=0x80;  // Extension bit - FIRST SERVICE HINT BYTE
       
    89 
       
    90 /** Telephony - second service hint byte. */
       
    91 const TUint8 KTelephonyMask=0x01;  // Telephony - SECOND SERVICE HINT BYTE
       
    92 
       
    93 /** File Server - second service hint byte. */
       
    94 const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE
       
    95 
       
    96 /** IrCOMM support - second service hint byte. */
       
    97 const TUint8 KIrCommMask=0x04;     // IrCOMM support - SECOND SERVICE HINT BYTE
       
    98 
       
    99 /** IrOBEX support - second service hint byte. */
       
   100 const TUint8 KIrObexMask=0x20;     // IrObex support - SECOND SERVICE HINT BYTE
       
   101 
       
   102 //
       
   103 // IrDA Ioctls
       
   104 //
       
   105 
       
   106 /** Completes on receipt of a discovery indication. 
       
   107 
       
   108 Returns log entry in a TNameEntry. 
       
   109 
       
   110 Ioctl level : KIrdaAddrFamily */
       
   111 const TUint KDiscoveryIndicationIoctl=0;
       
   112 
       
   113 /** Completes on successfully making RSocket EXCLUSIVE else returns error. 
       
   114 
       
   115 Completes successfully or returns KErrDisconnected if failed.
       
   116 
       
   117 Ioctl level: KIrdaAddrFamily */
       
   118 const TUint KExclusiveModeIoctl=1;
       
   119 
       
   120 /** Completes on successfully making RSocket MULTIPLEXED else returns error.
       
   121 
       
   122 Completes successfully or returns KErrDisconnected if failed.
       
   123 
       
   124 Ioctl level: KIrdaAddrFamily */
       
   125 const TUint KMultiplexModeIoctl=2;
       
   126 
       
   127 /** Completes on doing a status request on IrMUX layer packets to send.
       
   128 
       
   129 Returns TDes8* holding TUint indicating number of outstanding MUX data requests.
       
   130 
       
   131 Ioctl level: KIrdaAddrFamily */
       
   132 const TUint KIrmuxStatusRequestIoctl=3;
       
   133 
       
   134 /** Completes on doing a status request on IrLAP layer packets to send.
       
   135 
       
   136 Returns TDes8* holding TUint indicating the number of outstanding LAP data 
       
   137 requests.
       
   138 
       
   139 Ioctl level: KIrdaAddrFamily */
       
   140 const TUint KIrlapStatusRequestIoctl=4;
       
   141 
       
   142 /** Completes on successfully putting RSocket into IDLE mode.
       
   143 
       
   144 Completes successfully or returns KErrAbort if failed.
       
   145 
       
   146 Ioctl level: KIrdaAddrFamily */
       
   147 const TUint KIdleRequestIoctl=5;
       
   148 
       
   149 /** Completes on successfully taking RSocket out of IDLE mode.
       
   150 
       
   151 Completes successfully or returns KErrAbort if failed.
       
   152 
       
   153 Ioctl level: KIrdaAddrFamily */
       
   154 const TUint KIdleClearRequestIoctl=6;
       
   155 
       
   156 /** Completes on receipt of an IrLAP disconnect indication.
       
   157 
       
   158 Completes successfully on IrLAP or IrMUX disconnect on this connection.
       
   159 
       
   160 Ioctl level: KIrdaAddrFamily */
       
   161 const TUint KDisconnectIndicationIoctl=7;
       
   162 
       
   163 /** Completes on doing a status request on IrLAP layer packets to send.
       
   164 
       
   165 Returns TDes8* holding TUint indicating the number of outstanding LAP data 
       
   166 requests.
       
   167 
       
   168 Ioctl level: KIrdaAddrFamily */
       
   169 const TUint KIrlapStatusIndicationIoctl=8;
       
   170 
       
   171 /** Completes on receiving a status indication from IrLAP.
       
   172 
       
   173 Returns TDes8* holding TUint indicating the number of outstanding MUX data 
       
   174 requests.
       
   175 
       
   176 Ioctl level: KIrdaAddrFamily */
       
   177 const TUint KIrmuxStatusIndicationIoctl=9;
       
   178 
       
   179 /** Completes on doing an IrLAP link reset.
       
   180 
       
   181 Does an SNRMP-UAF link reset which can be initiated from either primary or 
       
   182 secondary.
       
   183 
       
   184 Ioctl level: KIrdaAddrFamily */
       
   185 const TUint KIrlapResetRequestIoctl=10;
       
   186 
       
   187 /** Completes on receipt of an IrLAP link reset indication.
       
   188 
       
   189 Completes with error value KErrNone if link is successfully reset.
       
   190 
       
   191 Ioctl level: KIrdaAddrFamily */
       
   192 const TUint KIrlapResetIndicationIoctl=11;
       
   193 
       
   194 /** Completes on doing an IrLAP link reset.
       
   195 
       
   196 Does a DISCP-UAF link disconnect which can be initiated from either primary 
       
   197 or secondary.
       
   198 
       
   199 Ioctl level: KIrdaAddrFamily */
       
   200 const TUint KIrlapDisconnectRequestIoctl=12;
       
   201 
       
   202 const TUint KExclusiveMode=0;
       
   203 
       
   204 const TUint KMultiplexMode=1;
       
   205 
       
   206 
       
   207 //********************  Irda Set/GetOpts ******************************
       
   208 // These two are done on Socket Write
       
   209 //
       
   210 
       
   211 
       
   212 /** KLevelIrlap.
       
   213 
       
   214 Sets transfer mode to be unexpedited (the default).
       
   215 
       
   216 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
       
   217 
       
   218 Returns KErrNone */
       
   219 const TUint KUnexpeditedDataOpt		= 0;		// Default
       
   220 
       
   221 /** KLevelIrlap
       
   222 
       
   223 Sets transfer mode to be expedited (urgent).
       
   224 
       
   225 Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
       
   226 
       
   227 Returns KErrNone */
       
   228 const TUint KExpeditedDataOpt		= 1;		// Urgent data transfer
       
   229 
       
   230 // On KLevelIrlap
       
   231 
       
   232 /** KLevelIrlap
       
   233 
       
   234 Sets number of discovery slots.
       
   235 
       
   236 Returns KErrNone */
       
   237 const TUint KDiscoverySlotsOpt		= 2;
       
   238 
       
   239 /** KLevelIrlap
       
   240 
       
   241 Sets the requested maximum link baud rate.
       
   242 
       
   243 Returns KErrInUse, if the link is already running.
       
   244 
       
   245 Returns with the currently set maximum link baud supported. */
       
   246 const TUint KUserBaudOpt			= 3;
       
   247 
       
   248 /** KLevelIrlap
       
   249 
       
   250 Sets the requested maximum data packet size that can be received by the host.
       
   251 
       
   252 Returns KErrInUse, if the link is already running.
       
   253 
       
   254 Returns with the currently set value for the maximum receivable data size 
       
   255 of the host IrLAP layer. */
       
   256 const TUint KHostMaxDataSizeOpt		= 4;
       
   257 
       
   258 /** KLevelIrlap
       
   259 
       
   260 Returns KErrNotSupported.
       
   261 
       
   262 Cannot set this value for the remote station.
       
   263 
       
   264 Returns with the currently set value for the maximum transmissible data size 
       
   265 to remote IrLAP layer. */
       
   266 const TUint KRemoteMaxDataSizeOpt	= 6;	// Remote packet size
       
   267 
       
   268 /** KLevelIrlap
       
   269 
       
   270 Set the maximum link turnaround time for the host IrLAP layer.
       
   271 
       
   272 Returns KErrInUse, if the link is already running.
       
   273 
       
   274 Returns with the currently set value for the host link turnaround time */
       
   275 const TUint KHostMaxTATimeOpt		= 5;
       
   276 
       
   277 /** KLevelIrlap
       
   278 
       
   279 Disables IrLAP level reset_check/wait states */
       
   280 const TUint KIrlapDisableResetOpt	= 9;	// This disables Irlap level reset_check/wait states.
       
   281 
       
   282 /** KLevelIrlap
       
   283 
       
   284 Allows the client to set local busy in IrLAP. */
       
   285 const TUint KLocalBusyDetectedOpt	= 10;	// Client can set local busy in Irlap
       
   286 
       
   287 /** KLevelIrlap
       
   288 
       
   289 Allows the client to clear local busy in IrLAP */
       
   290 const TUint KLocalBusyClearedOpt	= 11;	// Client can clear local busy in Irlap
       
   291 
       
   292 /** KLevelIrlap
       
   293 
       
   294 Disables discovery response for a short period (typically 3 seconds). */
       
   295 const TUint KDiscoveryResponseDisableOpt = 12;
       
   296 
       
   297 /** KLevelIrlap
       
   298 
       
   299 Sets the host's first service hint byte used in XID frames.
       
   300 
       
   301 Retrieves the first hint byte. */
       
   302 const TUint KFirstHintByteOpt		= 13;	// Hint Bytes
       
   303 
       
   304 /** KLevelIrlap
       
   305 
       
   306 Sets the host's second service hint byte used in XID frames.
       
   307 
       
   308 Retrieves the second hint byte */
       
   309 const TUint KSecondHintByteOpt		= 14;
       
   310 
       
   311 // On KLevelIrmux
       
   312 
       
   313 /** KLevelIrmux
       
   314 
       
   315 Turns on transport layer segmentation with the segment size specified. This 
       
   316 value is advertised to the remote machine as the maximum amount of data we 
       
   317 can reassemble.
       
   318 
       
   319 Returns KErrNone */
       
   320 const TUint KTinyTPLocalSegSizeOpt=7;	// This value is advertised to the remote machine as the max amount of data we can reassemble
       
   321 
       
   322 /** KLevelIrmux
       
   323 
       
   324 Queries the remote machine's segment size. The remote machine is unable 
       
   325 to assemble more data than this.
       
   326 
       
   327 Returns the remote machine's segment size. */
       
   328 const TUint KTinyTPRemoteSegSizeOpt=8;	// Remote machine is unable to reassemble more data than this
       
   329 
       
   330 /**
       
   331 Disables TinyTP reassembly of segmented packets. */
       
   332 const TUint KTinyTPDisabledSegmentation=15;
       
   333 /**
       
   334 @deprecated
       
   335 Disables TinyTP reassembly of segmented packets. */
       
   336 const TUint KTinyTPDiasbledSegmentation=15;
       
   337 
       
   338 /**
       
   339 @internalComponent
       
   340 */
       
   341 const TUint KIrdaInternalOption=0x4000000;
       
   342 
       
   343 /**
       
   344 @internalTechnology
       
   345 */
       
   346 const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption;
       
   347 
       
   348 
       
   349 
       
   350 /** The option relates to IrLAP. */
       
   351 const TUint KLevelIrlap=4;
       
   352 
       
   353 /** The option relates to IrMUX. */
       
   354 const TUint KLevelIrmux=5;
       
   355 
       
   356 /** The maximum length of a class name in an IAS entry. */
       
   357 const TUint KIASClassNameMax=60;
       
   358 
       
   359 /** The maximum length of an attribute in an IAS entry. */
       
   360 const TUint KIASAttributeNameMax=60;
       
   361 
       
   362 /** The maximum length of a TIASQuery descriptor. */
       
   363 const TUint KMaxQueryStringLength=128;
       
   364 
       
   365 //################# CLASS DEFINITIONS ########################
       
   366 
       
   367 NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr
       
   368 /** An IrDA socket address. 
       
   369 	@publishedAll 
       
   370 	@released */
       
   371 	{
       
   372 struct SIrdaAddr
       
   373 	{	
       
   374 	TUint iHostDevAddr;
       
   375 	TUint iRemoteDevAddr;
       
   376 	TBool iSniff;
       
   377 	TBool iSolicited;
       
   378 	TUint8 iIrlapVersion;
       
   379 	TUint8 iFirstServiceHintByte;
       
   380 	TUint8 iSecondServiceHintByte;
       
   381 	TUint8 iCharacterSet;
       
   382 	TUint8 iServiceHintByteCount;
       
   383 	// Extra stuff for MUX
       
   384 	TUint8 iHomePort;
       
   385 	TUint8 iRemotePort;
       
   386 	TUint8 iSpare;
       
   387     };
       
   388 public:
       
   389 	IMPORT_C TIrdaSockAddr();
       
   390 	IMPORT_C TIrdaSockAddr(const TSockAddr &aAddr);
       
   391 	/** Casts a reference to a general socket address into an IrDA socket address.
       
   392 	
       
   393 	@param aAddr A reference to a general socket address. 
       
   394 	@return The socket address returned as a reference to an IrDA socket address. */
       
   395 	
       
   396 	/** Casts a pointer to a general socket address into an IrDA socket address.
       
   397 	
       
   398 	@param aAddr A pointer to a general socket address. 
       
   399 	@return The socket address returned as a reference to an IrDA socket address. */
       
   400 	IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr &aAddr);
       
   401 
       
   402 	/** Casts a reference to a general socket address into an IrDA socket address.
       
   403 	
       
   404 	@param aAddr A reference to a general socket address. 
       
   405 	@return The socket address returned as a reference to an IrDA socket address. */
       
   406 	
       
   407 	/** Casts a pointer to a general socket address into an IrDA socket address.
       
   408 	
       
   409 	@param aAddr A pointer to a general socket address. 
       
   410 	@return The socket address returned as a reference to an IrDA socket address. */
       
   411 
       
   412 	IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr);
       
   413 	/** Returns the remote device address.
       
   414 	
       
   415 	@return The remote device address as a 32 bit value. */
       
   416 
       
   417 	IMPORT_C TUint GetRemoteDevAddr() const;
       
   418 	/** Sets the remote device address.
       
   419 	
       
   420 	@param aRemote The remote device address as a 32-bit value. */
       
   421 
       
   422 	IMPORT_C void SetRemoteDevAddr(const TUint aRemote);
       
   423 	
       
   424 	/** Returns the host device address.
       
   425 	
       
   426 	@return The host device address as a 32 bit value. */
       
   427 	IMPORT_C TUint GetHostDevAddr() const;
       
   428 	
       
   429 	/** Sets the host device address.
       
   430 	
       
   431 	@param aHost The host device address as a 32-bit value. */
       
   432 	IMPORT_C void SetHostDevAddr(const TUint aHost);
       
   433 	
       
   434 	/** Returns the remote device's sniff status, i.e. whether the device is capable 
       
   435 	of sniffing for IrDA devices.
       
   436 	
       
   437 	@return True, if the device is capable of sniffing for IrDA devices; false, 
       
   438 	otherwise. */
       
   439 	IMPORT_C TBool GetSniffStatus() const;
       
   440 	
       
   441 	/** Sets the sniff status for the remote device, i.e. whether the device is capable 
       
   442 	of sniffing for IrDA devices.
       
   443 	
       
   444 	@param aSniff True, if the device is capable of sniffing for IrDA devices; 
       
   445 	false, otherwise. */
       
   446 	IMPORT_C void SetSniffStatus(const TBool aSniff);
       
   447 	
       
   448 	/** Returns the solicited status.
       
   449 	
       
   450 	The solicited status indicates whether a discovery was initiated by the host 
       
   451 	device or a remote device.
       
   452 	
       
   453 	@return True, if the discovery was initiated by the host device; false if 
       
   454 	the discovery was initiated by the remote device. */
       
   455 	IMPORT_C TBool GetSolicitedStatus() const;
       
   456 	
       
   457 	/** Sets the solicited status. The solicited status indcates whether a discovery 
       
   458 	was initiated by the host device or a remote device.
       
   459 	
       
   460 	@param aSolicited ETrue, if the discovery was initiated by the host device; 
       
   461 	EFalse, if discovery was initiated by the remote device. */
       
   462 	IMPORT_C void SetSolicitedStatus(const TBool aSolicited);
       
   463 	
       
   464 	/** Returns the remote device's IrLAP version number.
       
   465 	
       
   466 	This should be 0x00 indicating that the device conforms to the IrDA IrLAP 
       
   467 	1.00 specification.
       
   468 	
       
   469 	@return The device's IrLAP version number. */
       
   470 	IMPORT_C TUint8 GetIrlapVersion() const;
       
   471 	
       
   472 	/** Sets the IrLAP version number for the remote device.
       
   473 	
       
   474 	This should be 0x00 indicating that the device conforms to the IrDA IrLAP 
       
   475 	1.00 specification.
       
   476 	
       
   477 	@param aIrlapVersion The device's IrLAP version number. */
       
   478 	IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion);
       
   479 	
       
   480 	/** Returns the character set supported by the remote device.
       
   481 	
       
   482 	@return One of the TIASCharSet enumerator values defining the character set 
       
   483 	supported by the device. */
       
   484 	IMPORT_C TUint8 GetCharacterSet() const;
       
   485 	
       
   486 	/** Sets the character set supported by the remote device.
       
   487 	
       
   488 	@param aCharacterSet One of the TIASCharSet enumerator values defining the 
       
   489 	character set supported by the device */
       
   490 	IMPORT_C void SetCharacterSet(const TUint8 aCharacterSet);
       
   491 	
       
   492 	/** Returns the remote device's first service hint byte. Service hint bytes indicate 
       
   493 	the level of IrLMP support provided by the device.
       
   494 	
       
   495 	@return The first service hint byte. The individual bits have the following 
       
   496 	meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop Bit 2 (0x04) 
       
   497 	- Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 (0x20) - Fax 
       
   498 	Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
       
   499 	IMPORT_C TUint8 GetFirstServiceHintByte() const;
       
   500 	
       
   501 	/** Sets the first service hint byte for the remote device. The service hint bytes 
       
   502 	indicate the level of IrLMP support provided by the device.
       
   503 	
       
   504 	@param aFirstServiceHintByte The first service hint byte. The individual bits 
       
   505 	have the following meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop 
       
   506 	Bit 2 (0x04) - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 
       
   507 	(0x20) - Fax Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
       
   508 	IMPORT_C void SetFirstServiceHintByte(const TUint8 aFirstServiceHintByte);
       
   509 	
       
   510 	/** Returns the remote device's first service hint byte. Service hint bytes indicate 
       
   511 	the level of IrLMP support provided by the device.
       
   512 	
       
   513 	@return The second service hint byte. The individual bits have the following 
       
   514 	meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File Server Bit 2 (0x04) 
       
   515 	- IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved Bit 5 (0x20) - IrOBEX 
       
   516 	Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
       
   517 	IMPORT_C TUint8 GetSecondServiceHintByte() const;
       
   518 	
       
   519 	/** Sets the second service hint byte for the remote device. The service hint bytes 
       
   520 	indicate the level of IrLMP support provided by the device.
       
   521 	
       
   522 	@param aSecondServiceHintByte The second service hint byte. The individual 
       
   523 	bits have the following meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File 
       
   524 	Server Bit 2 (0x04) - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved 
       
   525 	Bit 5 (0x20) - IrOBEX Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
       
   526 	IMPORT_C void SetSecondServiceHintByte(const TUint8 aSecondServiceHintByte);
       
   527 	
       
   528 	/** Returns the number of service hint bytes for the remote device.
       
   529 	
       
   530 	@return The number of service hint bytes. */
       
   531 	IMPORT_C TUint8 GetServiceHintByteCount() const;
       
   532 	
       
   533 	/** Sets the number of service hint bytes for the remote device.
       
   534 	
       
   535 	@param aServiceHintByteCount The number of service hint bytes. */
       
   536 	IMPORT_C void SetServiceHintByteCount(const TUint8 aServiceHintByteCount);
       
   537 	IMPORT_C TUint8 GetHomePort() const;
       
   538 	IMPORT_C void SetHomePort(const TUint8 aHomePort);
       
   539 	IMPORT_C TUint8 GetRemotePort() const;
       
   540 	IMPORT_C void SetRemotePort(const TUint8 aRemotePort);
       
   541 private:
       
   542 	SIrdaAddr* addrPtr() const;
       
   543 	};
       
   544 
       
   545 enum TIASDataType
       
   546 /** An enumeration whose enumerators define the type of response received from 
       
   547 an Information Access Service (IAS) query.
       
   548 
       
   549 @see TIASResponse */
       
   550 {
       
   551 	/** No response type defined. */
       
   552 	EIASDataMissing=0,
       
   553 	/** The response type is an integer. */
       
   554 	EIASDataInteger=1,
       
   555 	/** The response type is binary data. */
       
   556 	EIASDataOctetSequence=2,
       
   557 	/** The response type is a string. */
       
   558 	EIASDataUserString=3
       
   559 };
       
   560 
       
   561 enum TIASCharSet
       
   562 /** The character set encoding of the character string response from an IAS query.
       
   563 
       
   564 @see TIASResponse::GetCharString()
       
   565 @see TIrdaSockAddr::GetCharacterSet() */
       
   566 	{ 
       
   567 	/** String is standard ASCII. */
       
   568 	EIASCharSetUserStringASCII =0x00,
       
   569 	/** String is ISO Latin-1. */
       
   570 	EIASCharSetUserStringISO_8859_1=0x01,
       
   571 	/** String is ISO Latin-2. */
       
   572 	EIASCharSetUserStringISO_8859_2=0x02,
       
   573 	/** String is ISO Latin-3. */
       
   574 	EIASCharSetUserStringISO_8859_3=0x03,
       
   575 	/** String is ISO Latin-4. */
       
   576 	EIASCharSetUserStringISO_8859_4=0x04,
       
   577 	/** String is ISO-8859-5 (Cyrillic). */
       
   578 	EIASCharSetUserStringISO_8859_5=0x05,
       
   579 	/** String is ISO-8859-6 (Arabic). */
       
   580 	EIASCharSetUserStringISO_8859_6=0x06,
       
   581 	/** String is ISO-8859-7 (Greek). */
       
   582 	EIASCharSetUserStringISO_8859_7=0x07,
       
   583 	/** String is ISO-8859-8 (Hebrew). */
       
   584 	EIASCharSetUserStringISO_8859_8=0x08,
       
   585 	/** String is ISO Latin-5. */
       
   586 	EIASCharSetUserStringISO_8859_9=0x09,
       
   587 	/** String is UNICODE. */
       
   588 	EIASCharSetUserStringUnicode=0xFF,
       
   589 	};
       
   590 
       
   591 NONSHARABLE_CLASS(TIASQuery) : public TBuf8<KMaxQueryStringLength>
       
   592 /** An Information Access Service (IAS) query to another device's IAS server.
       
   593 @publishedAll
       
   594 @released
       
   595 @see TIASResponse */
       
   596 	{
       
   597 public:
       
   598 	IMPORT_C TIASQuery(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
       
   599 	IMPORT_C TIASQuery();
       
   600 	IMPORT_C void Set(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
       
   601 	IMPORT_C void Get(TDes8& aClass,TDes8& aAttribute,TUint& aRemoteDevAddr);
       
   602 private:
       
   603 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   604 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   605 	TUint32     iPadding1; 
       
   606 	TUint32     iPadding2; 
       
   607 	};
       
   608 
       
   609 NONSHARABLE_CLASS(TIASResponse) : public TBuf8<KMaxQueryStringLength>
       
   610 /** Response from an Information Access Service (IAS) query to another device's 
       
   611 IAS server.
       
   612 @publishedAll
       
   613 @released
       
   614 @see TIASQuery */
       
   615 	{
       
   616 public:		// But not exported :-)
       
   617 	void SetToInteger(TUint anInteger);
       
   618 	void SetToCharString(const TDesC8& aCharString);
       
   619 	void SetToOctetSeq(const TDesC8& aData);
       
   620 #ifdef _UNICODE
       
   621 	void SetToCharString(const TDesC16& aWideString);
       
   622 #endif
       
   623 
       
   624 public:
       
   625 	IMPORT_C TIASResponse();
       
   626 /** Indicates the response contains a list. */
       
   627 	IMPORT_C TBool IsList() const;
       
   628 /** Indicates the number of items in the response. */
       
   629 	IMPORT_C TInt NumItems() const;
       
   630 
       
   631 /** Returns the type of the response.
       
   632 	
       
   633 	@return An enumeration identifying the type of response. */
       
   634 	IMPORT_C TIASDataType Type() const;
       
   635 
       
   636 	IMPORT_C TInt GetInteger(TInt &aResult,TInt anIndex=0) const;
       
   637 	IMPORT_C TInt GetOctetSeq(TDes8 &aResult,TInt anIndex=0) const;
       
   638 	IMPORT_C TInt GetCharString(TDes8 &aResult,TInt anIndex=0) const;
       
   639 	IMPORT_C const TPtrC8 GetCharString8(TInt anIndex=0) const;
       
   640 	
       
   641 	/** Gets the response string.
       
   642 	
       
   643 	This is called if the response type indicates a string.
       
   644 	
       
   645 	@param aResult On return, an 8 bit modifiable descriptor containing the response 
       
   646 	string. The length of the response string can never be greater than the value 
       
   647 	of (KMaxQueryStringLength - 3). 
       
   648 	@param anIndex Reserved for future use. This argument must be allowed to default 
       
   649 	to 0 and must not be overriden. 
       
   650 	@return If successful, one of the TIASCharSet enumerator values defining the 
       
   651 	character set encoding of the response string. KErrNotSupported, if a non-zero 
       
   652 	value has been specified for anIndex. KErrCorrupt, if the response type is 
       
   653 	not a string. 
       
   654 	@see TIASResponse::Type() */
       
   655 	IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const;
       
   656 
       
   657 	IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const;
       
   658 	
       
   659 private:
       
   660 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   661 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   662 	TUint32     iPadding1;
       
   663 	TUint32     iPadding2;	
       
   664 	};
       
   665 
       
   666 NONSHARABLE_CLASS(TIASDatabaseEntryV001)
       
   667 /** The data for an Information Access Service (IAS) record in the network database.
       
   668 
       
   669 An object of this type is contained in a packaged modifiable buffer descriptor.
       
   670 @publishedAll
       
   671 @released
       
   672 @see TIASDatabaseEntry */
       
   673 	{
       
   674 public:
       
   675 	IMPORT_C TIASDatabaseEntryV001();
       
   676 	
       
   677 	/** The class name for the IAS entry
       
   678 	
       
   679 	This is a template specialisation of a TBuf8<TInt> */
       
   680 	TBuf8<KIASClassNameMax> iClassName;
       
   681 	
       
   682 	/** The attribute for the IAS entry.
       
   683 	
       
   684 	This is a template specialisation of a TBuf8<TInt> */
       
   685 	TBuf8<KIASAttributeNameMax> iAttributeName;
       
   686 	
       
   687 	/** The response data. */
       
   688 	TIASResponse iData;
       
   689 	
       
   690 private:
       
   691 	// This data padding has been added to help prevent future binary compatibility breaks	
       
   692 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
       
   693 	TUint32     iPadding1; 
       
   694 	TUint32     iPadding2; 	
       
   695 	};
       
   696 	
       
   697 NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf<TIASDatabaseEntryV001>
       
   698 /** An Information Access Service (IAS) record in the network database.
       
   699 
       
   700 The record data is contained in an object of type TIASDatabaseEntryV001 packaged 
       
   701 in a modifiable buffer descriptor.
       
   702 @publishedAll
       
   703 @released
       
   704 @see RNetDatabase */
       
   705 	{
       
   706 public:
       
   707 	IMPORT_C void SetClassName(const TDesC8& aClassName);
       
   708 	IMPORT_C void SetAttributeName(const TDesC8& anAttributeName);
       
   709 	IMPORT_C void SetToInteger(const TUint anInteger);
       
   710 	IMPORT_C void SetToCharString(const TDesC8& aCharString);
       
   711 	
       
   712 	/** Sets the response type corresponding to the class and attribute defined in 
       
   713 	this record, as binary data.
       
   714 	
       
   715 	@param aData The response binary data. The length of this data can never be 
       
   716 	greater than (KMaxQueryStringLength - 3). */
       
   717 	IMPORT_C void SetToOctetSeq(const TDesC8& aData);
       
   718 
       
   719 #ifdef _UNICODE	//need to be able to enter wide entries in unicode builds
       
   720 	IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export
       
   721 #endif
       
   722 	};
       
   723 
       
   724 #endif // __IR_SOCK_H__