1.1 --- a/epoc32/include/ir_sock.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/ir_sock.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,726 @@
1.4 -ir_sock.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __IR_SOCK_H__
1.29 +#define __IR_SOCK_H__
1.30 +
1.31 +#include "es_sock.h"
1.32 +#include <e32property.h>
1.33 +
1.34 +//################## EXPORTED CONSTANTS ########################
1.35 +
1.36 +
1.37 +/** IrDA protocol family. */
1.38 +const TUint KIrdaAddrFamily=0x100; // Address of Irda prot family
1.39 +
1.40 +/** IrMUX protocol within the IrDA protocol family. */
1.41 +const TUint KIrmux=88; // Protocol number for Irmux
1.42 +
1.43 +/** IrTinyTP protocol within the IrDA protocol family.. */
1.44 +const TUint KIrTinyTP=89; // Protocol number for IrTinyTP
1.45 +
1.46 +/** An invalid LSAP number--binding to this will select the first unused LSAP. */
1.47 +const TUint KAutoBindLSAP = 0xffff;
1.48 +
1.49 +
1.50 +/** Category used when publishing IrDA status notifications. */
1.51 +const TUid KIrdaPropertyCategory = {KUidSystemCategoryValue};
1.52 +
1.53 +/** Key used when publishing IrDA status notifications. */
1.54 +const TUint KIrdaStatus = 0x100052d1;
1.55 +
1.56 +
1.57 +/** Names used for IrDA status notifications. */
1.58 +namespace TIrdaStatusCodes
1.59 + {
1.60 + enum
1.61 + {
1.62 + EIrLoaded,
1.63 + EIrDiscoveredPeer,
1.64 + EIrLostPeer,
1.65 + EIrConnected,
1.66 + EIrBlocked,
1.67 + EIrDisconnected,
1.68 + EIrUnloaded,
1.69 + };
1.70 + }
1.71 +
1.72 +/** PnP support - first service hint byte. */
1.73 +const TUint8 KIrPnPMask=0x01; // PnP support - FIRST SERVICE HINT BYTE
1.74 +
1.75 +/** PDA/Palmtop - first service hint byte. */
1.76 +const TUint8 KPalmtopMask=0x02; // PDA/Palmtop - FIRST SERVICE HINT BYTE
1.77 +
1.78 +/** Computer - first service hint byte. */
1.79 +const TUint8 KComputerMask=0x04; // Computer - FIRST SERVICE HINT BYTE
1.80 +
1.81 +/** Printer - first service hint byte. */
1.82 +const TUint8 KPrinterMask=0x08; // Printer - FIRST SERVICE HINT BYTE
1.83 +
1.84 +/** IrModem - first service hint byte. */
1.85 +const TUint8 KModemMask=0x10; // IrModem - FIRST SERVICE HINT BYTE
1.86 +
1.87 +/** Fax - first service hint byte. */
1.88 +const TUint8 KFaxMask=0x20; // Fax - FIRST SERVICE HINT BYTE
1.89 +
1.90 +/** LAN Access - first service hint byte. */
1.91 +const TUint8 KLANAccessMask=0x40; // LAN Access - FIRST SERVICE HINT BYTE
1.92 +
1.93 +/** Extension bit - first service hint byte. */
1.94 +const TUint8 KExtensionMask=0x80; // Extension bit - FIRST SERVICE HINT BYTE
1.95 +
1.96 +/** Telephony - second service hint byte. */
1.97 +const TUint8 KTelephonyMask=0x01; // Telephony - SECOND SERVICE HINT BYTE
1.98 +
1.99 +/** File Server - second service hint byte. */
1.100 +const TUint8 KFileServerMask=0x02; // File Server - SECOND SERVICE HINT BYTE
1.101 +
1.102 +/** IrCOMM support - second service hint byte. */
1.103 +const TUint8 KIrCommMask=0x04; // IrCOMM support - SECOND SERVICE HINT BYTE
1.104 +
1.105 +/** IrOBEX support - second service hint byte. */
1.106 +const TUint8 KIrObexMask=0x20; // IrObex support - SECOND SERVICE HINT BYTE
1.107 +
1.108 +//
1.109 +// IrDA Ioctls
1.110 +//
1.111 +
1.112 +/** Completes on receipt of a discovery indication.
1.113 +
1.114 +Returns log entry in a TNameEntry.
1.115 +
1.116 +Ioctl level : KIrdaAddrFamily */
1.117 +const TUint KDiscoveryIndicationIoctl=0;
1.118 +
1.119 +/** Completes on successfully making RSocket EXCLUSIVE else returns error.
1.120 +
1.121 +Completes successfully or returns KErrDisconnected if failed.
1.122 +
1.123 +Ioctl level: KIrdaAddrFamily */
1.124 +const TUint KExclusiveModeIoctl=1;
1.125 +
1.126 +/** Completes on successfully making RSocket MULTIPLEXED else returns error.
1.127 +
1.128 +Completes successfully or returns KErrDisconnected if failed.
1.129 +
1.130 +Ioctl level: KIrdaAddrFamily */
1.131 +const TUint KMultiplexModeIoctl=2;
1.132 +
1.133 +/** Completes on doing a status request on IrMUX layer packets to send.
1.134 +
1.135 +Returns TDes8* holding TUint indicating number of outstanding MUX data requests.
1.136 +
1.137 +Ioctl level: KIrdaAddrFamily */
1.138 +const TUint KIrmuxStatusRequestIoctl=3;
1.139 +
1.140 +/** Completes on doing a status request on IrLAP layer packets to send.
1.141 +
1.142 +Returns TDes8* holding TUint indicating the number of outstanding LAP data
1.143 +requests.
1.144 +
1.145 +Ioctl level: KIrdaAddrFamily */
1.146 +const TUint KIrlapStatusRequestIoctl=4;
1.147 +
1.148 +/** Completes on successfully putting RSocket into IDLE mode.
1.149 +
1.150 +Completes successfully or returns KErrAbort if failed.
1.151 +
1.152 +Ioctl level: KIrdaAddrFamily */
1.153 +const TUint KIdleRequestIoctl=5;
1.154 +
1.155 +/** Completes on successfully taking RSocket out of IDLE mode.
1.156 +
1.157 +Completes successfully or returns KErrAbort if failed.
1.158 +
1.159 +Ioctl level: KIrdaAddrFamily */
1.160 +const TUint KIdleClearRequestIoctl=6;
1.161 +
1.162 +/** Completes on receipt of an IrLAP disconnect indication.
1.163 +
1.164 +Completes successfully on IrLAP or IrMUX disconnect on this connection.
1.165 +
1.166 +Ioctl level: KIrdaAddrFamily */
1.167 +const TUint KDisconnectIndicationIoctl=7;
1.168 +
1.169 +/** Completes on doing a status request on IrLAP layer packets to send.
1.170 +
1.171 +Returns TDes8* holding TUint indicating the number of outstanding LAP data
1.172 +requests.
1.173 +
1.174 +Ioctl level: KIrdaAddrFamily */
1.175 +const TUint KIrlapStatusIndicationIoctl=8;
1.176 +
1.177 +/** Completes on receiving a status indication from IrLAP.
1.178 +
1.179 +Returns TDes8* holding TUint indicating the number of outstanding MUX data
1.180 +requests.
1.181 +
1.182 +Ioctl level: KIrdaAddrFamily */
1.183 +const TUint KIrmuxStatusIndicationIoctl=9;
1.184 +
1.185 +/** Completes on doing an IrLAP link reset.
1.186 +
1.187 +Does an SNRMP-UAF link reset which can be initiated from either primary or
1.188 +secondary.
1.189 +
1.190 +Ioctl level: KIrdaAddrFamily */
1.191 +const TUint KIrlapResetRequestIoctl=10;
1.192 +
1.193 +/** Completes on receipt of an IrLAP link reset indication.
1.194 +
1.195 +Completes with error value KErrNone if link is successfully reset.
1.196 +
1.197 +Ioctl level: KIrdaAddrFamily */
1.198 +const TUint KIrlapResetIndicationIoctl=11;
1.199 +
1.200 +/** Completes on doing an IrLAP link reset.
1.201 +
1.202 +Does a DISCP-UAF link disconnect which can be initiated from either primary
1.203 +or secondary.
1.204 +
1.205 +Ioctl level: KIrdaAddrFamily */
1.206 +const TUint KIrlapDisconnectRequestIoctl=12;
1.207 +
1.208 +const TUint KExclusiveMode=0;
1.209 +
1.210 +const TUint KMultiplexMode=1;
1.211 +
1.212 +
1.213 +//******************** Irda Set/GetOpts ******************************
1.214 +// These two are done on Socket Write
1.215 +//
1.216 +
1.217 +
1.218 +/** KLevelIrlap.
1.219 +
1.220 +Sets transfer mode to be unexpedited (the default).
1.221 +
1.222 +Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
1.223 +
1.224 +Returns KErrNone */
1.225 +const TUint KUnexpeditedDataOpt = 0; // Default
1.226 +
1.227 +/** KLevelIrlap
1.228 +
1.229 +Sets transfer mode to be expedited (urgent).
1.230 +
1.231 +Not recommended for use with SetOpt(). Preferred use is with RSocket::Send()
1.232 +
1.233 +Returns KErrNone */
1.234 +const TUint KExpeditedDataOpt = 1; // Urgent data transfer
1.235 +
1.236 +// On KLevelIrlap
1.237 +
1.238 +/** KLevelIrlap
1.239 +
1.240 +Sets number of discovery slots.
1.241 +
1.242 +Returns KErrNone */
1.243 +const TUint KDiscoverySlotsOpt = 2;
1.244 +
1.245 +/** KLevelIrlap
1.246 +
1.247 +Sets the requested maximum link baud rate.
1.248 +
1.249 +Returns KErrInUse, if the link is already running.
1.250 +
1.251 +Returns with the currently set maximum link baud supported. */
1.252 +const TUint KUserBaudOpt = 3;
1.253 +
1.254 +/** KLevelIrlap
1.255 +
1.256 +Sets the requested maximum data packet size that can be received by the host.
1.257 +
1.258 +Returns KErrInUse, if the link is already running.
1.259 +
1.260 +Returns with the currently set value for the maximum receivable data size
1.261 +of the host IrLAP layer. */
1.262 +const TUint KHostMaxDataSizeOpt = 4;
1.263 +
1.264 +/** KLevelIrlap
1.265 +
1.266 +Returns KErrNotSupported.
1.267 +
1.268 +Cannot set this value for the remote station.
1.269 +
1.270 +Returns with the currently set value for the maximum transmissible data size
1.271 +to remote IrLAP layer. */
1.272 +const TUint KRemoteMaxDataSizeOpt = 6; // Remote packet size
1.273 +
1.274 +/** KLevelIrlap
1.275 +
1.276 +Set the maximum link turnaround time for the host IrLAP layer.
1.277 +
1.278 +Returns KErrInUse, if the link is already running.
1.279 +
1.280 +Returns with the currently set value for the host link turnaround time */
1.281 +const TUint KHostMaxTATimeOpt = 5;
1.282 +
1.283 +/** KLevelIrlap
1.284 +
1.285 +Disables IrLAP level reset_check/wait states */
1.286 +const TUint KIrlapDisableResetOpt = 9; // This disables Irlap level reset_check/wait states.
1.287 +
1.288 +/** KLevelIrlap
1.289 +
1.290 +Allows the client to set local busy in IrLAP. */
1.291 +const TUint KLocalBusyDetectedOpt = 10; // Client can set local busy in Irlap
1.292 +
1.293 +/** KLevelIrlap
1.294 +
1.295 +Allows the client to clear local busy in IrLAP */
1.296 +const TUint KLocalBusyClearedOpt = 11; // Client can clear local busy in Irlap
1.297 +
1.298 +/** KLevelIrlap
1.299 +
1.300 +Disables discovery response for a short period (typically 3 seconds). */
1.301 +const TUint KDiscoveryResponseDisableOpt = 12;
1.302 +
1.303 +/** KLevelIrlap
1.304 +
1.305 +Sets the host's first service hint byte used in XID frames.
1.306 +
1.307 +Retrieves the first hint byte. */
1.308 +const TUint KFirstHintByteOpt = 13; // Hint Bytes
1.309 +
1.310 +/** KLevelIrlap
1.311 +
1.312 +Sets the host's second service hint byte used in XID frames.
1.313 +
1.314 +Retrieves the second hint byte */
1.315 +const TUint KSecondHintByteOpt = 14;
1.316 +
1.317 +// On KLevelIrmux
1.318 +
1.319 +/** KLevelIrmux
1.320 +
1.321 +Turns on transport layer segmentation with the segment size specified. This
1.322 +value is advertised to the remote machine as the maximum amount of data we
1.323 +can reassemble.
1.324 +
1.325 +Returns KErrNone */
1.326 +const TUint KTinyTPLocalSegSizeOpt=7; // This value is advertised to the remote machine as the max amount of data we can reassemble
1.327 +
1.328 +/** KLevelIrmux
1.329 +
1.330 +Queries the remote machine's segment size. The remote machine is unable
1.331 +to assemble more data than this.
1.332 +
1.333 +Returns the remote machine's segment size. */
1.334 +const TUint KTinyTPRemoteSegSizeOpt=8; // Remote machine is unable to reassemble more data than this
1.335 +
1.336 +/**
1.337 +Disables TinyTP reassembly of segmented packets. */
1.338 +const TUint KTinyTPDisabledSegmentation=15;
1.339 +/**
1.340 +@deprecated
1.341 +Disables TinyTP reassembly of segmented packets. */
1.342 +const TUint KTinyTPDiasbledSegmentation=15;
1.343 +
1.344 +/**
1.345 +@internalComponent
1.346 +*/
1.347 +const TUint KIrdaInternalOption=0x4000000;
1.348 +
1.349 +/**
1.350 +@internalTechnology
1.351 +*/
1.352 +const TUint KTinyTPSetMaxBufferSpace=16 | KIrdaInternalOption;
1.353 +
1.354 +
1.355 +
1.356 +/** The option relates to IrLAP. */
1.357 +const TUint KLevelIrlap=4;
1.358 +
1.359 +/** The option relates to IrMUX. */
1.360 +const TUint KLevelIrmux=5;
1.361 +
1.362 +/** The maximum length of a class name in an IAS entry. */
1.363 +const TUint KIASClassNameMax=60;
1.364 +
1.365 +/** The maximum length of an attribute in an IAS entry. */
1.366 +const TUint KIASAttributeNameMax=60;
1.367 +
1.368 +/** The maximum length of a TIASQuery descriptor. */
1.369 +const TUint KMaxQueryStringLength=128;
1.370 +
1.371 +//################# CLASS DEFINITIONS ########################
1.372 +
1.373 +NONSHARABLE_CLASS(TIrdaSockAddr) : public TSockAddr
1.374 +/** An IrDA socket address.
1.375 + @publishedAll
1.376 + @released */
1.377 + {
1.378 +struct SIrdaAddr
1.379 + {
1.380 + TUint iHostDevAddr;
1.381 + TUint iRemoteDevAddr;
1.382 + TBool iSniff;
1.383 + TBool iSolicited;
1.384 + TUint8 iIrlapVersion;
1.385 + TUint8 iFirstServiceHintByte;
1.386 + TUint8 iSecondServiceHintByte;
1.387 + TUint8 iCharacterSet;
1.388 + TUint8 iServiceHintByteCount;
1.389 + // Extra stuff for MUX
1.390 + TUint8 iHomePort;
1.391 + TUint8 iRemotePort;
1.392 + TUint8 iSpare;
1.393 + };
1.394 +public:
1.395 + IMPORT_C TIrdaSockAddr();
1.396 + IMPORT_C TIrdaSockAddr(const TSockAddr &aAddr);
1.397 + /** Casts a reference to a general socket address into an IrDA socket address.
1.398 +
1.399 + @param aAddr A reference to a general socket address.
1.400 + @return The socket address returned as a reference to an IrDA socket address. */
1.401 +
1.402 + /** Casts a pointer to a general socket address into an IrDA socket address.
1.403 +
1.404 + @param aAddr A pointer to a general socket address.
1.405 + @return The socket address returned as a reference to an IrDA socket address. */
1.406 + IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr &aAddr);
1.407 +
1.408 + /** Casts a reference to a general socket address into an IrDA socket address.
1.409 +
1.410 + @param aAddr A reference to a general socket address.
1.411 + @return The socket address returned as a reference to an IrDA socket address. */
1.412 +
1.413 + /** Casts a pointer to a general socket address into an IrDA socket address.
1.414 +
1.415 + @param aAddr A pointer to a general socket address.
1.416 + @return The socket address returned as a reference to an IrDA socket address. */
1.417 +
1.418 + IMPORT_C static TIrdaSockAddr &Cast(const TSockAddr *aAddr);
1.419 + /** Returns the remote device address.
1.420 +
1.421 + @return The remote device address as a 32 bit value. */
1.422 +
1.423 + IMPORT_C TUint GetRemoteDevAddr() const;
1.424 + /** Sets the remote device address.
1.425 +
1.426 + @param aRemote The remote device address as a 32-bit value. */
1.427 +
1.428 + IMPORT_C void SetRemoteDevAddr(const TUint aRemote);
1.429 +
1.430 + /** Returns the host device address.
1.431 +
1.432 + @return The host device address as a 32 bit value. */
1.433 + IMPORT_C TUint GetHostDevAddr() const;
1.434 +
1.435 + /** Sets the host device address.
1.436 +
1.437 + @param aHost The host device address as a 32-bit value. */
1.438 + IMPORT_C void SetHostDevAddr(const TUint aHost);
1.439 +
1.440 + /** Returns the remote device's sniff status, i.e. whether the device is capable
1.441 + of sniffing for IrDA devices.
1.442 +
1.443 + @return True, if the device is capable of sniffing for IrDA devices; false,
1.444 + otherwise. */
1.445 + IMPORT_C TBool GetSniffStatus() const;
1.446 +
1.447 + /** Sets the sniff status for the remote device, i.e. whether the device is capable
1.448 + of sniffing for IrDA devices.
1.449 +
1.450 + @param aSniff True, if the device is capable of sniffing for IrDA devices;
1.451 + false, otherwise. */
1.452 + IMPORT_C void SetSniffStatus(const TBool aSniff);
1.453 +
1.454 + /** Returns the solicited status.
1.455 +
1.456 + The solicited status indicates whether a discovery was initiated by the host
1.457 + device or a remote device.
1.458 +
1.459 + @return True, if the discovery was initiated by the host device; false if
1.460 + the discovery was initiated by the remote device. */
1.461 + IMPORT_C TBool GetSolicitedStatus() const;
1.462 +
1.463 + /** Sets the solicited status. The solicited status indcates whether a discovery
1.464 + was initiated by the host device or a remote device.
1.465 +
1.466 + @param aSolicited ETrue, if the discovery was initiated by the host device;
1.467 + EFalse, if discovery was initiated by the remote device. */
1.468 + IMPORT_C void SetSolicitedStatus(const TBool aSolicited);
1.469 +
1.470 + /** Returns the remote device's IrLAP version number.
1.471 +
1.472 + This should be 0x00 indicating that the device conforms to the IrDA IrLAP
1.473 + 1.00 specification.
1.474 +
1.475 + @return The device's IrLAP version number. */
1.476 + IMPORT_C TUint8 GetIrlapVersion() const;
1.477 +
1.478 + /** Sets the IrLAP version number for the remote device.
1.479 +
1.480 + This should be 0x00 indicating that the device conforms to the IrDA IrLAP
1.481 + 1.00 specification.
1.482 +
1.483 + @param aIrlapVersion The device's IrLAP version number. */
1.484 + IMPORT_C void SetIrlapVersion(const TUint8 aIrlapVersion);
1.485 +
1.486 + /** Returns the character set supported by the remote device.
1.487 +
1.488 + @return One of the TIASCharSet enumerator values defining the character set
1.489 + supported by the device. */
1.490 + IMPORT_C TUint8 GetCharacterSet() const;
1.491 +
1.492 + /** Sets the character set supported by the remote device.
1.493 +
1.494 + @param aCharacterSet One of the TIASCharSet enumerator values defining the
1.495 + character set supported by the device */
1.496 + IMPORT_C void SetCharacterSet(const TUint8 aCharacterSet);
1.497 +
1.498 + /** Returns the remote device's first service hint byte. Service hint bytes indicate
1.499 + the level of IrLMP support provided by the device.
1.500 +
1.501 + @return The first service hint byte. The individual bits have the following
1.502 + meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop Bit 2 (0x04)
1.503 + - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5 (0x20) - Fax
1.504 + Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
1.505 + IMPORT_C TUint8 GetFirstServiceHintByte() const;
1.506 +
1.507 + /** Sets the first service hint byte for the remote device. The service hint bytes
1.508 + indicate the level of IrLMP support provided by the device.
1.509 +
1.510 + @param aFirstServiceHintByte The first service hint byte. The individual bits
1.511 + have the following meaning: Bit 0 (0x01) - PnP Compatible Bit 1 (0x02) - PDA/Palmtop
1.512 + Bit 2 (0x04) - Computer Bit 3 (0x08) - Printer Bit 4 (0x10) - Modem Bit 5
1.513 + (0x20) - Fax Bit 6 (0x40) - LAN Access Bit 7 (0x80) - Extension */
1.514 + IMPORT_C void SetFirstServiceHintByte(const TUint8 aFirstServiceHintByte);
1.515 +
1.516 + /** Returns the remote device's first service hint byte. Service hint bytes indicate
1.517 + the level of IrLMP support provided by the device.
1.518 +
1.519 + @return The second service hint byte. The individual bits have the following
1.520 + meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File Server Bit 2 (0x04)
1.521 + - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved Bit 5 (0x20) - IrOBEX
1.522 + Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
1.523 + IMPORT_C TUint8 GetSecondServiceHintByte() const;
1.524 +
1.525 + /** Sets the second service hint byte for the remote device. The service hint bytes
1.526 + indicate the level of IrLMP support provided by the device.
1.527 +
1.528 + @param aSecondServiceHintByte The second service hint byte. The individual
1.529 + bits have the following meaning: Bit 0 (0x01) - Telephony Bit 1 (0x02) - File
1.530 + Server Bit 2 (0x04) - IrCOMM Bit 3 (0x08) - reserved Bit 4 (0x10) - reserved
1.531 + Bit 5 (0x20) - IrOBEX Bit 6 (0x40) - reserved Bit 7 (0x80) - Extension */
1.532 + IMPORT_C void SetSecondServiceHintByte(const TUint8 aSecondServiceHintByte);
1.533 +
1.534 + /** Returns the number of service hint bytes for the remote device.
1.535 +
1.536 + @return The number of service hint bytes. */
1.537 + IMPORT_C TUint8 GetServiceHintByteCount() const;
1.538 +
1.539 + /** Sets the number of service hint bytes for the remote device.
1.540 +
1.541 + @param aServiceHintByteCount The number of service hint bytes. */
1.542 + IMPORT_C void SetServiceHintByteCount(const TUint8 aServiceHintByteCount);
1.543 + IMPORT_C TUint8 GetHomePort() const;
1.544 + IMPORT_C void SetHomePort(const TUint8 aHomePort);
1.545 + IMPORT_C TUint8 GetRemotePort() const;
1.546 + IMPORT_C void SetRemotePort(const TUint8 aRemotePort);
1.547 +private:
1.548 + SIrdaAddr* addrPtr() const;
1.549 + };
1.550 +
1.551 +enum TIASDataType
1.552 +/** An enumeration whose enumerators define the type of response received from
1.553 +an Information Access Service (IAS) query.
1.554 +
1.555 +@see TIASResponse */
1.556 +{
1.557 + /** No response type defined. */
1.558 + EIASDataMissing=0,
1.559 + /** The response type is an integer. */
1.560 + EIASDataInteger=1,
1.561 + /** The response type is binary data. */
1.562 + EIASDataOctetSequence=2,
1.563 + /** The response type is a string. */
1.564 + EIASDataUserString=3
1.565 +};
1.566 +
1.567 +enum TIASCharSet
1.568 +/** The character set encoding of the character string response from an IAS query.
1.569 +
1.570 +@see TIASResponse::GetCharString()
1.571 +@see TIrdaSockAddr::GetCharacterSet() */
1.572 + {
1.573 + /** String is standard ASCII. */
1.574 + EIASCharSetUserStringASCII =0x00,
1.575 + /** String is ISO Latin-1. */
1.576 + EIASCharSetUserStringISO_8859_1=0x01,
1.577 + /** String is ISO Latin-2. */
1.578 + EIASCharSetUserStringISO_8859_2=0x02,
1.579 + /** String is ISO Latin-3. */
1.580 + EIASCharSetUserStringISO_8859_3=0x03,
1.581 + /** String is ISO Latin-4. */
1.582 + EIASCharSetUserStringISO_8859_4=0x04,
1.583 + /** String is ISO-8859-5 (Cyrillic). */
1.584 + EIASCharSetUserStringISO_8859_5=0x05,
1.585 + /** String is ISO-8859-6 (Arabic). */
1.586 + EIASCharSetUserStringISO_8859_6=0x06,
1.587 + /** String is ISO-8859-7 (Greek). */
1.588 + EIASCharSetUserStringISO_8859_7=0x07,
1.589 + /** String is ISO-8859-8 (Hebrew). */
1.590 + EIASCharSetUserStringISO_8859_8=0x08,
1.591 + /** String is ISO Latin-5. */
1.592 + EIASCharSetUserStringISO_8859_9=0x09,
1.593 + /** String is UNICODE. */
1.594 + EIASCharSetUserStringUnicode=0xFF,
1.595 + };
1.596 +
1.597 +NONSHARABLE_CLASS(TIASQuery) : public TBuf8<KMaxQueryStringLength>
1.598 +/** An Information Access Service (IAS) query to another device's IAS server.
1.599 +@publishedAll
1.600 +@released
1.601 +@see TIASResponse */
1.602 + {
1.603 +public:
1.604 + IMPORT_C TIASQuery(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
1.605 + IMPORT_C TIASQuery();
1.606 + IMPORT_C void Set(const TDesC8& aClass,const TDesC8& aAttribute,TUint aRemoteDevAddr);
1.607 + IMPORT_C void Get(TDes8& aClass,TDes8& aAttribute,TUint& aRemoteDevAddr);
1.608 +private:
1.609 + // This data padding has been added to help prevent future binary compatibility breaks
1.610 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.611 + TUint32 iPadding1;
1.612 + TUint32 iPadding2;
1.613 + };
1.614 +
1.615 +NONSHARABLE_CLASS(TIASResponse) : public TBuf8<KMaxQueryStringLength>
1.616 +/** Response from an Information Access Service (IAS) query to another device's
1.617 +IAS server.
1.618 +@publishedAll
1.619 +@released
1.620 +@see TIASQuery */
1.621 + {
1.622 +public: // But not exported :-)
1.623 + void SetToInteger(TUint anInteger);
1.624 + void SetToCharString(const TDesC8& aCharString);
1.625 + void SetToOctetSeq(const TDesC8& aData);
1.626 +#ifdef _UNICODE
1.627 + void SetToCharString(const TDesC16& aWideString);
1.628 +#endif
1.629 +
1.630 +public:
1.631 + IMPORT_C TIASResponse();
1.632 +/** Indicates the response contains a list. */
1.633 + IMPORT_C TBool IsList() const;
1.634 +/** Indicates the number of items in the response. */
1.635 + IMPORT_C TInt NumItems() const;
1.636 +
1.637 +/** Returns the type of the response.
1.638 +
1.639 + @return An enumeration identifying the type of response. */
1.640 + IMPORT_C TIASDataType Type() const;
1.641 +
1.642 + IMPORT_C TInt GetInteger(TInt &aResult,TInt anIndex=0) const;
1.643 + IMPORT_C TInt GetOctetSeq(TDes8 &aResult,TInt anIndex=0) const;
1.644 + IMPORT_C TInt GetCharString(TDes8 &aResult,TInt anIndex=0) const;
1.645 + IMPORT_C const TPtrC8 GetCharString8(TInt anIndex=0) const;
1.646 +
1.647 + /** Gets the response string.
1.648 +
1.649 + This is called if the response type indicates a string.
1.650 +
1.651 + @param aResult On return, an 8 bit modifiable descriptor containing the response
1.652 + string. The length of the response string can never be greater than the value
1.653 + of (KMaxQueryStringLength - 3).
1.654 + @param anIndex Reserved for future use. This argument must be allowed to default
1.655 + to 0 and must not be overriden.
1.656 + @return If successful, one of the TIASCharSet enumerator values defining the
1.657 + character set encoding of the response string. KErrNotSupported, if a non-zero
1.658 + value has been specified for anIndex. KErrCorrupt, if the response type is
1.659 + not a string.
1.660 + @see TIASResponse::Type() */
1.661 + IMPORT_C TInt GetCharString(TDes16 &aResult,TInt anIndex=0) const;
1.662 +
1.663 + IMPORT_C const TPtrC16 GetCharString16(TInt anIndex=0) const;
1.664 +
1.665 +private:
1.666 + // This data padding has been added to help prevent future binary compatibility breaks
1.667 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.668 + TUint32 iPadding1;
1.669 + TUint32 iPadding2;
1.670 + };
1.671 +
1.672 +NONSHARABLE_CLASS(TIASDatabaseEntryV001)
1.673 +/** The data for an Information Access Service (IAS) record in the network database.
1.674 +
1.675 +An object of this type is contained in a packaged modifiable buffer descriptor.
1.676 +@publishedAll
1.677 +@released
1.678 +@see TIASDatabaseEntry */
1.679 + {
1.680 +public:
1.681 + IMPORT_C TIASDatabaseEntryV001();
1.682 +
1.683 + /** The class name for the IAS entry
1.684 +
1.685 + This is a template specialisation of a TBuf8<TInt> */
1.686 + TBuf8<KIASClassNameMax> iClassName;
1.687 +
1.688 + /** The attribute for the IAS entry.
1.689 +
1.690 + This is a template specialisation of a TBuf8<TInt> */
1.691 + TBuf8<KIASAttributeNameMax> iAttributeName;
1.692 +
1.693 + /** The response data. */
1.694 + TIASResponse iData;
1.695 +
1.696 +private:
1.697 + // This data padding has been added to help prevent future binary compatibility breaks
1.698 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.699 + TUint32 iPadding1;
1.700 + TUint32 iPadding2;
1.701 + };
1.702 +
1.703 +NONSHARABLE_CLASS(TIASDatabaseEntry) : public TPckgBuf<TIASDatabaseEntryV001>
1.704 +/** An Information Access Service (IAS) record in the network database.
1.705 +
1.706 +The record data is contained in an object of type TIASDatabaseEntryV001 packaged
1.707 +in a modifiable buffer descriptor.
1.708 +@publishedAll
1.709 +@released
1.710 +@see RNetDatabase */
1.711 + {
1.712 +public:
1.713 + IMPORT_C void SetClassName(const TDesC8& aClassName);
1.714 + IMPORT_C void SetAttributeName(const TDesC8& anAttributeName);
1.715 + IMPORT_C void SetToInteger(const TUint anInteger);
1.716 + IMPORT_C void SetToCharString(const TDesC8& aCharString);
1.717 +
1.718 + /** Sets the response type corresponding to the class and attribute defined in
1.719 + this record, as binary data.
1.720 +
1.721 + @param aData The response binary data. The length of this data can never be
1.722 + greater than (KMaxQueryStringLength - 3). */
1.723 + IMPORT_C void SetToOctetSeq(const TDesC8& aData);
1.724 +
1.725 +#ifdef _UNICODE //need to be able to enter wide entries in unicode builds
1.726 + IMPORT_C void SetToCharString(const TDesC16& aWideString);//new export
1.727 +#endif
1.728 + };
1.729 +
1.730 +#endif // __IR_SOCK_H__