1 // Copyright (c) 2003-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #ifndef __OBEXCONSTANTS_H
23 #define __OBEXCONSTANTS_H
29 #include <obexpanics.h>
30 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
31 #include <obexconstantsinternal.h>
36 const TInt KChallResponseSize = 58;
38 const TInt KObexRespSize = 16;
40 const TInt KUsbIntStringDescLength = 30;
42 const TUint8 KObexObjectDescriptionSize = 255;
44 // Extended errors for IrObex
46 /** Must not use as not in the allocated range */
47 const TInt KErrIrObexRespBase = - 5500;
49 /** Extended error for IrObex - No other infrared device found */
50 const TInt KErrIrObexClientNoDevicesFound = -5501;
52 /** Extended error for IrObex - Other IR device cannot handle IrObex */
53 const TInt KErrIrObexClientPeerDoesNotHaveObex = -5502;
55 /** Extended error for IrObex - Other IR device aborted the transfer */
56 const TInt KErrIrObexClientPutPeerAborted = -5503;
58 /** Extended error for IrObex - Peer device aborted data transmission/obex sending */
59 const TInt KErrIrObexServerPutPeerAborted = -5507;
61 /** Extended error for IrObex - Cannot authorise the challenge so link dropped */
62 const TInt KErrIrObexConnectChallRejected = -5512;
64 // Other Obex errors defined in the system but no longer used
65 // Do not reuse the number!
66 // KErrIrObexClientPutPeerCannotHandleObject -5504
67 // KErrIrObexServerPutFileWriteError -5509
68 // KErrIrObexClientFirstPutFailed -5510
69 // KErrIrObexClientSubsequentPutFailed -5511
71 /** Unexpected event for the given state */
72 const TInt KErrIrObexBadEvent = -5513;
74 /** Event occurred while Server is stopped */
75 const TInt KErrIrObexServerStopped = -5514;
77 /** Packet received while state machine is in a wait state */
78 const TInt KErrIrObexPacketDuringWait = -5515;
80 // There are other error codes defined at the end of this file,
81 // which are a direct mapping of specific Obex error codes and
82 // are returned by the client.
85 // Flags used by Connect
86 // ...None in OBEX 1.0
90 Version number for TObexTransportInfo and derived classes.
91 When iVersion is set to this value the following fields of TObexTransportInfo
96 The iVersion member variable must be set to this value. If in future any of the
97 iFuture variables are used a new version constant will be created.
99 @see TObexTransportInfo
103 const TInt KObexTransportInfoVersion0 = 0;
106 Default for the receive and transmit MTU sizes
107 Use this default value for setting the iReceiveMtu or iTransmitMtu in TObexTransportInfo
108 objects or derived classes.
110 @see TObexTransportInfo
114 const TInt KObexDefaultMtuSize = 4000;
117 Default value for the number of discovery slots to use. Use this value as a default
118 for iDiscoverySlots in TObexIrdaV2TransportInfo.
120 @see TObexIrdaV2TransportInfo
124 const TUint KObexIrdaDefaultDiscoverySlotsToUse = 1;
127 Default value for the number of discovery attempts made. Use this value as a default for iDiscoveryAttempts
128 in TObexIrdaV2TransportInfo.
129 @see TObexIrdaV2TransportInfo
133 const TUint KObexIrdaDefaultDiscoveryAttempts = 4;
135 // Constants used to define which transport Obex will run over.
136 // Used in TObexTransportInfo and TObexProtocolInfo's iTransport member.
139 Protocol string when running over IrDA
140 @see TObexIrProtocolInfo
141 @see TObexTransportInfo
145 _LIT(KObexIrTTPProtocol, "IrTinyTP");
148 Protocol string when running over IrDA
149 Using this version indicates that the configuration object contains discovery parameters.
150 @see TObexIrProtocolInfo
154 _LIT(KObexIrTTPProtocolV2, "IrTinyTP-V2");
157 Protocol string when running over IrDA
158 Using this version indicates that the configuration object contains the device nickname.
159 @see TObexIrProtocolInfo
162 @capability WriteDeviceData If the TObexIrV3TransportInfo is passed as the argument
163 to CObexServer::NewL or CObexClient::NewL and the associated
167 _LIT(KObexIrTTPProtocolV3, "IrTinyTP-V3");
170 Protocol string when running over Bluetooth
171 @see TObexBluetoothProtocolInfo
172 @see TObexTransportInfo
176 _LIT(KObexRfcommProtocol, "RFCOMM");
179 Protocol string when running over USB
180 @see TObexUsbProtocolInfo
181 @see TObexTransportInfo
185 _LIT(KObexUsbProtocol, "USB");
189 protocol string that should be used
190 if a Win32 emulator USB transport were
191 to be created for testing.
192 @see TObexUsbProtocolInfo
193 @see TObexTransportInfo
197 _LIT(KObexWin32UsbProtocol, "Win32Usb");
200 Protocol string when running over USB using client driver extensions
201 @see TObexUsbProtocolInfoV2
202 @see TObexTransportInfo
206 _LIT(KObexUsbProtocolV2, "USB-V2");
209 This class is derived for each underlying transport protocol OBEX
212 The iTransport member holds the unique name for the transport. For example for
213 infra-red (TinyTP) this is "IrTinyTP" or KObexIrTTPProtocol.
215 @see TObexIrProtocolInfo for running over TinyTP
216 @see TObexBluetoothProtocolInfo for running over Rfcomm
217 @see TObexUsbProtocolInfo for running over USB
218 @see TObexUsbProtocolInfoV2 for running over USB using client driver extensions
220 @see KObexIrTTPProtocol
221 @see KObexIrTTPProtocolV2
222 @see KObexRfcommProtocol
223 @see KObexUsbProtocol
224 @see KObexUsbProtocolV2
229 NONSHARABLE_CLASS(TObexProtocolInfo)
232 /** Holds the unique name for the transport. */
235 // This data padding has been added to help prevent future binary compatibility breaks
236 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
242 Used to describe IrDA specific protocol information
244 To access the default OBEX server, the IAS class value should be "OBEX"
245 and the IAS attribute name "IrDA:TinyTP:LsapSel".
250 NONSHARABLE_CLASS(TObexIrProtocolInfo) : public TObexProtocolInfo
253 /** IrDA address information for this connection, as used in the IrDA sockets interface.
254 Refer to the SDK for more information about this.
255 Its main use is for setting the port that the local machine will listen on. */
257 /** The IAS class value that the OBEX session will register its listener port,
258 or request remote port with. */
259 TBuf8<KIASClassNameMax> iClassName;
260 /** The IAS attribute value that the OBEX session will register its listener port,
261 or request remote port with. */
262 TBuf8<KIASAttributeNameMax> iAttributeName;
263 /** The number of discovery slots to use. */
264 TUint8 iDiscoverySlots;
265 /** The number of discovery attempts to make. */
266 TUint8 iDiscoveryAttempts;
269 // This data padding has been added to help prevent future binary compatibility breaks
270 // None of these padding variables have been zero'd because they are currently not used
278 Used to describe Bluetooth specific protocol information
283 NONSHARABLE_CLASS(TObexBluetoothProtocolInfo) : public TObexProtocolInfo
288 This defines the server channel on which the OBEX server listens
289 for connections. The server channel is set using SetPort on the
292 1) Unless the channel is defined as KRfcommPassiveAutoBind
293 it may be in use when the obex server attempts to 'bind' to it
294 2) If the channel is defined as KRfcommPassiveAutoBind
295 then when the server is FIRST started it will attempt
296 to find a free RFComm channel. If this is successful
297 that free channel will be used as the server channel
298 for the life time of the obex server including
299 when it is 'stopped' and re-'started'.
300 3) When the obex server is stopped, and very
301 briefly when a bluetooth connection comes down, the
302 obex server releases its server channel. It is possible
303 therefore that during this time another application might bind
304 to it. This will cause an error when the obex server tries
307 Also note that a Bluetooth OBEX server will itself set the Object Transfer
308 bit in the Service Class as required by the Generic Object Exchange
309 Profile so the user need not do this.
313 This defines the server channel and the
314 device address to connect to. The server channel
315 and device address are set respectively using SetPort
316 and SetBTAddr on the TRfcommSockAddr.
318 TRfcommSockAddr iAddr;
321 // This data padding has been added to help prevent future binary compatibility breaks
322 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
328 Used to describe USB specific protocol information
333 NONSHARABLE_CLASS(TObexUsbProtocolInfo) : public TObexProtocolInfo
336 /** Provides a string to be attached to the Obex function's Communication Class interface,
337 which may be used to identify the Obex service. */
338 TBuf16<KUsbIntStringDescLength> iInterfaceStringDescriptor;
342 Used to set options used by the extended USB client driver for improved performance
344 @see TObexUsbProtocolInfo
349 NONSHARABLE_CLASS(TObexUsbProtocolInfoV2) : public TObexUsbProtocolInfo
352 /** Bitmap containing the bandwidth priorities to use on IN and OUT endpoints
353 @see TUsbcBandwidthPriority
355 TInt iBandwidthPriority;
356 /** Specifies whether to use DMA on the bulk OUT endpoint */
357 TBool iDmaOnOutEndpoint;
358 /** Specifies whether to use DMA on the bulk IN endpoint */
359 TBool iDmaOnInEndpoint;
362 // This data padding has been added to help prevent future binary compatibility breaks
363 // None of these padding variables have been zero'd because they are currently not used
371 Contains information about OBEX packet sizing policy, defining the
372 maximum buffer size for receive and transmit packets
374 NONSHARABLE_CLASS(TObexProtocolPolicy)
377 IMPORT_C TObexProtocolPolicy (); // Sets version and default values
379 IMPORT_C TInt SetReceiveMtu ( TUint16 aReceiveMtu );
380 IMPORT_C TInt SetTransmitMtu ( TUint16 aTransmitMtu );
381 IMPORT_C TUint16 Version () const;
382 IMPORT_C TUint16 ReceiveMtu () const;
383 IMPORT_C TUint16 TransmitMtu () const;
388 TUint16 iTransmitMtu;
390 // This data padding has been added to help prevent future binary compatibility breaks
391 // None of these padding variables have been zero'd because they are currently not used
398 struct TObexConnectionInfo;
402 This structure contains information used during OBEX connection. iVersion
403 holds the encoded OBEX version of the machine, use @c VersionMajor() and
404 @c VersionMinor() to extract the parts of the version number (each having a
405 value from 0 to 15). @c iFlags holds OBEX connection flags. @c iWho holds
406 the Who attribute from the connect packet, if any was specified, or
407 otherwise has a length of 0.
408 It is recommended that this class is only ever allocated on the heap as it is quite big.
410 NONSHARABLE_CLASS(TObexConnectInfo)
413 IMPORT_C TObexConnectInfo();
414 IMPORT_C TUint8 VersionMajor() const;
415 IMPORT_C TUint8 VersionMinor() const;
417 TUint8 iVersion; /** Encoded OBEX version of the machine*/
418 TUint8 iFlags; /** iFlags holds OBEX connection flags*/
419 TBuf8<KObexObjectDescriptionSize> iWho; /** the Who attribute from the connect packet, if any was specified */
420 TBuf8<KObexObjectDescriptionSize> iTargetHeader; /** the Target header from the connect packet, if any was specified */
423 // This data padding has been added to help prevent future binary compatibility breaks
424 // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
431 //if these codes are extended due to a IRObex spec update ensure
432 //that the TInt immediately below are updated
433 //and the default in the method IrOBEXUtil::ObexResponse is also updated
436 /** Response is "Continue" */
437 ERespContinue = 0x10,
439 /** Response is "Success" */
442 /** Response is "Created" */
445 /** Response is "Accepted" */
446 ERespAccepted = 0x22,
448 /** Response is "Non-Authenticated Information" */
449 ERespNonAuthInfo = 0x23,
451 /** Response is "No Content" */
452 ERespNoContent = 0x24,
454 /** Response is "Reset Content" */
455 ERespResetContent = 0x25,
457 /** Response is "Partial Content" */
458 ERespPartialContent = 0x26,
460 /** Response is "Multiple Choices" */
461 ERespMultipleChoices = 0x30,
463 /** Response is "Moved Permanently" */
464 ERespMovedPerm = 0x31,
466 /** Response is "Moved Temporarily" */
467 ERespMovedTemp = 0x32,
469 /** Response is "See Other" */
470 ERespSeeOther = 0x33,
472 /** Response is "Not Modified" */
473 ERespNotModified = 0x34,
475 /** Response is "Use Proxy" */
476 ERespUseProxy = 0x35,
478 /** Response is "Bad Request" */
479 ERespBadRequest = 0x40,
481 /** Response is "Unauthorized" */
482 ERespUnauthorized = 0x41,
484 /** Response is "Payment Required" */
485 ERespPaymentRequired = 0x42,
487 /** Response is "Forbidden" */
488 ERespForbidden = 0x43,
490 /** Response is "Not Found" */
491 ERespNotFound = 0x44,
493 /** Response is "Method Not Allowed" */
494 ERespMethodNotAllowed = 0x45,
496 /** Response is "Not Acceptable" */
497 ERespNotAcceptable = 0x46,
499 /** Response is "Proxy Authentication is Required" */
500 ERespProxyAuthenReqd = 0x47,
502 /** Response is "Timed Out" */
503 ERespTimedOut = 0x48,
505 /** Response is "Conflict" */
506 ERespConflict = 0x49,
508 /** Response is "Gone" */
511 /** Response is "Length Required" */
512 ERespLengthReqd = 0x4B,
514 /** Response is "Precondition Failed" */
515 ERespPreCondFailed = 0x4C,
517 /** Response is "Required Entity is Too Large" */
518 ERespReqEntityTooLarge = 0x4D,
520 /** Response is "Required URL is Too Large" */
521 ERespReqURLTooLarge = 0x4E,
523 /** Response is "Unsupported Media Type" */
524 ERespUnsupMediaType = 0x4F,
526 /** Response is "Internal Error" */
527 ERespInternalError = 0x50,
529 /** Response is "Not Implemented" */
530 ERespNotImplemented = 0x51,
532 /** Response is "Bad Gateway" */
533 ERespBadGateway = 0x52,
535 /** Response is "Service Unavailable" */
536 ERespServiceUnavail = 0x53,
538 /** Response is "Gateway Timeout" */
539 ERespGatewayTimeout = 0x54,
541 /** Response is "HTTP Version is Not Supported" */
542 ERespHTTPVerNotSupp = 0x55,
544 /** Response is "Database is Full" */
545 ERespDatabaseFull = 0x60,
547 /** Response is "Database is Locked" */
548 ERespDatabaseLocked = 0x61,
550 /** Response is "Service is Unavailable" */
551 ERespServiceUnavailable = 0xD3,
555 //some error codes to be used specifically by the client
556 //these shall, be mapped directly to OBEX defined error codes.
557 const TInt KErrIrObexRespSuccess = KErrIrObexRespBase - ERespSuccess; //-5532 returns 0x20 (0xA0)
558 const TInt KErrIrObexRespCreated = KErrIrObexRespBase - ERespCreated; //-5533 returns 0x21 (0xA1)
559 const TInt KErrIrObexRespAccepted = KErrIrObexRespBase - ERespAccepted; //-5534 returns 0x22 (0xA2)
560 const TInt KErrIrObexRespNonAuthInfo = KErrIrObexRespBase - ERespNonAuthInfo; //-5535 returns 0x23 (0xA3)
561 const TInt KErrIrObexRespNoContent = KErrIrObexRespBase - ERespNoContent; //-5536 returns 0x24 (0xA4)
562 const TInt KErrIrObexRespResetContent = KErrIrObexRespBase - ERespResetContent; //-5537 returns 0x25 (0xA5)
563 const TInt KErrIrObexRespPartialContent = KErrIrObexRespBase - ERespPartialContent; //-5538 returns 0x26 (0xA6)
564 const TInt KErrIrObexRespMultipleChoices = KErrIrObexRespBase - ERespMultipleChoices; //-5548 returns 0x30 (0xB0)
565 const TInt KErrIrObexRespMovedPerm = KErrIrObexRespBase - ERespMovedPerm; //-5549 returns 0x31 (0xB1)
566 const TInt KErrIrObexRespMovedTemp = KErrIrObexRespBase - ERespMovedTemp; //-5550 returns 0x32 (0xB2)
567 const TInt KErrIrObexRespSeeOther = KErrIrObexRespBase - ERespSeeOther; //-5551 returns 0x33 (0xB3)
568 const TInt KErrIrObexRespNotModified = KErrIrObexRespBase - ERespNotModified; //-5552 returns 0x34 (0xB4)
569 const TInt KErrIrObexRespUseProxy = KErrIrObexRespBase - ERespUseProxy; //-5553 returns 0x35 (0xB5)
570 const TInt KErrIrObexRespBadRequest = KErrIrObexRespBase - ERespBadRequest; //-5564 returns 0x40 (0xC0)
571 const TInt KErrIrObexRespUnauthorized = KErrIrObexRespBase - ERespUnauthorized; //-5565 returns 0x41 (0xC1)
572 const TInt KErrIrObexRespPaymentRequired = KErrIrObexRespBase - ERespPaymentRequired; //-5566 returns 0x42 (0xC2)
573 const TInt KErrIrObexRespForbidden = KErrIrObexRespBase - ERespForbidden; //-5567 returns 0x43 (0xC3)
574 const TInt KErrIrObexRespNotFound = KErrIrObexRespBase - ERespNotFound; //-5568 returns 0x44 (0xC4)
575 const TInt KErrIrObexRespMethodNotAllowed = KErrIrObexRespBase - ERespMethodNotAllowed; //-5569 returns 0x45 (0xC5)
576 const TInt KErrIrObexRespNotAcceptable = KErrIrObexRespBase - ERespNotAcceptable; //-5570 returns 0x46 (0xC6)
577 const TInt KErrIrObexRespProxyAuthenReqd = KErrIrObexRespBase - ERespProxyAuthenReqd; //-5571 returns 0x47 (0xC7)
578 const TInt KErrIrObexRespTimedOut = KErrIrObexRespBase - ERespTimedOut; //-5572 returns 0x48 (0xC8)
579 const TInt KErrIrObexRespConflict = KErrIrObexRespBase - ERespConflict; //-5573 returns 0x49 (0xC9)
580 const TInt KErrIrObexRespGone = KErrIrObexRespBase - ERespGone; //-5574 returns 0x4A (0xCA)
581 const TInt KErrIrObexRespLengthReqd = KErrIrObexRespBase - ERespLengthReqd; //-5575 returns 0x4B (0xCB)
582 const TInt KErrIrObexRespPreCondFailed = KErrIrObexRespBase - ERespPreCondFailed; //-5576 returns 0x4C (0xCC)
583 const TInt KErrIrObexRespReqEntityTooLarge = KErrIrObexRespBase - ERespReqEntityTooLarge;//-5577 returns 0x4D (0xCD)
584 const TInt KErrIrObexRespReqURLTooLarge = KErrIrObexRespBase - ERespReqURLTooLarge; //-5578 returns 0x4E (0xCE)
585 const TInt KErrIrObexRespUnsupMediaType = KErrIrObexRespBase - ERespUnsupMediaType; //-5579 returns 0x4F (0xCF)
586 const TInt KErrIrObexRespInternalError = KErrIrObexRespBase - ERespInternalError; //-5580 returns 0x50 (0xD0)
587 const TInt KErrIrObexRespNotImplemented = KErrIrObexRespBase - ERespNotImplemented; //-5581 returns 0x51 (0xD1)
588 const TInt KErrIrObexRespBadGateway = KErrIrObexRespBase - ERespBadGateway; //-5582 returns 0x52 (0xD2)
589 const TInt KErrIrObexRespServiceUnavail = KErrIrObexRespBase - ERespServiceUnavail; //-5583 returns 0x53 (0xD3)
590 const TInt KErrIrObexRespGatewayTimeout = KErrIrObexRespBase - ERespGatewayTimeout; //-5584 returns 0x54 (0xD4)
591 const TInt KErrIrObexRespHTTPVerNotSupp = KErrIrObexRespBase - ERespHTTPVerNotSupp; //-5585 returns 0x55 (0xD5)
592 const TInt KErrIrObexRespDatabaseFull = KErrIrObexRespBase - ERespDatabaseFull; //-5596 returns 0x60 (0xE0)
593 const TInt KErrIrObexRespDatabaseLocked = KErrIrObexRespBase - ERespDatabaseLocked; //-5597 returns 0x61 (0xE1)
595 #endif // __OBEXCONSTANTS_H