/*******************************************************************

Copyright (c) 2004 Open Mobile Alliance, Ltd.  All Rights Reserved.

This software is made available under the usage and distribution terms 
covered by the Common Public License 1.0 and by using this software you
are bound by the terms and conditions of the same.

EXCEPT AS EXPRESSLY SET FORTH IN THE COMMON PUBLIC LICENSE,
THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
   
Each recipient is solely responsible for determining the 
appropriateness of using and distributing this program and assumes 
all risks associated with its exercise of rights under the Common 
Public License, including but not limited to the risks and 
costs of program errors, compliance with applicable laws, 
damage to or loss of data, programs or equipment, and 
unavailability or interruption of operations.

********************************************************************/
/*************************************************************************/
/* module:          SyncML OBEX binding error header file.               */
/* file:            src/xpt/win/obex.obexbindingerror.h                  */
/* target system:   all                                                  */
/* target OS:       all                                                  */
/*************************************************************************/
/*
** Defines error codes used within the obex binding modules.
** Values are only valid WITHIN the obex bindings
*/
#ifndef OBEXBINDINGERROR_H
#define OBEXBINDINGERROR_H

// #define OBX_RC_OK                SML_ERR_OK

#define OBX_RC_OBEX_GENERAL_ERROR   SML_ERR_A_XPT_COMMUNICATION   // General obex error
#define OBX_RC_OBEX_INIT_FAILURE    SML_ERR_A_XPT_COMMUNICATION   // Failure during obex initialization
#define OBX_RC_COMMAND_FAILED       SML_ERR_A_XPT_COMMUNICATION   // Failure flowing an OBEX command
#define OBX_RC_SERVER_REG_FAILED    SML_ERR_A_XPT_COMMUNICATION   // Registration of the server failed

#define OBX_RC_SERVICE_ALREADY_REG  SML_ERR_A_XPT_COMMUNICATION   // Attempt to use a service name that is already registered.
#define OBX_RC_UNKNOWN_COMM_ROLE    SML_ERR_A_XPT_INVALID_STATE   // Unknown communction role.

#define OBX_RC_SOCKET               SML_ERR_A_XPT_COMMUNICATION   // General socket error
#define OBX_RC_SOCKET_BAD_HOST_NAME SML_ERR_A_XPT_COMMUNICATION
#define OBX_RC_SERVER_ACCEPT_FAILED SML_ERR_A_XPT_COMMUNICATION   // Failure when attempting an accept (in server mode)
#define OBX_RC_OBEX_TRANS_FAILURE   SML_ERR_A_XPT_COMMUNICATION   // General failure from transport layer

#define OBX_RC_OBEX_HEADER          SML_ERR_A_XPT_COMMUNICATION   // Error adding header to obex object
#define OBX_RC_OBEX_DATA_LENGTH     SML_ERR_A_XPT_COMMUNICATION   // Provided data != specified data length

#define OBX_RC_MEMORY_ERROR         SML_ERR_A_XPT_MEMORY          // Non specific memory error

#define OBX_RC_MEMORY_ERROR_ALLOC   SML_ERR_A_XPT_MEMORY          // Failure during Alloc
#define OBX_RC_MEMORY_NULL_PNTR     SML_ERR_A_XPT_INVALID_PARM    // Null pointer on function call

#define OBX_RC_GENERAL_ERROR        SML_ERR_A_XPT_COMMUNICATION   // Non specific general error


// ERROR handling

#define OBX_ERRORMSG_NULL_POINTER            0           // Null pointer passed to a function.
#define OBX_ERRORMSG_OBEX_HEADER             1           // Error adding a header to an obex object
#define OBX_ERRORMSG_OBEX_DATA_LENGTH        2           // Error adding a header to an obex object
#define OBX_ERRORMSG_UNKNOWN_TRANSPORT_TYP   3           // Uknown transport type
#define OBX_ERRORMSG_SOCKET_BAD_HOST_NAME    4           // Unable to resolve.
#define OBX_ERRORMSG_MEMORY_ALLOC            5           // Memory alloc error
#define OBX_ERRORMSG_OBEX_TRANSPORT_FAILURE  6           // Failure while attempting to invoke transport.
#define OBX_ERRORMSG_BUFFER_LENGTH           7           // Bad length provided
#define OBX_ERRORMSG_BAD_SERVICE_TYPE        8           // Bad service type

static const char *ERRORS[] = {
   "A null pointer was passed as an argument to function %s.  Variable name %s.",
   "An error occured in %s while adding header %s to an OBEX object.",
   "The length specified in the document information did not match the amount of data provided to send.",
   "The transport type was unknown.  Normally this is either OBEX_TRANS_INET or OBEX_TRANS_IRDA",
   "Unable to resolve host name '%s'.",
   "An error allocating memory in function %s for variable %s has occured.",
   "The OBEX transport layer returned an unexpected return code from function call %s.",
   "The specified buffer or document length of %d in function %s is inappropriate",
   "The service type was found to be bad in function %s.",
};

#endif
