CmnErrors.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00043 #ifndef _CMNERRORS_H_
00044 #define _CMNERRORS_H_
00045 
00046 #include <sys/types.h>
00047 #include <errno.h>
00048 
00052 
00053 // Define some error constants not already defined for WIN32
00054 #if (TARGET_HOST == TARGET_HOST_WIN32)
00055 #ifndef EWOULDBLOCK
00056 #define EWOULDBLOCK EAGAIN
00057 #endif
00058 
00059 #ifndef ENOTSUP
00060 #define ENOTSUP 524
00061 #endif
00062 #endif // TARGET_HOST_WIN32
00063 
00064 
00065 // Error reporting options
00066 #define errReportStripContext   0x00000001  // Originating file and line not available
00067 
00068 // Possible responses
00069 #define errResponseTryHighLevel 0x00000001  // Low level code recommends trying high level UI first
00070 #define errResponseBreakNative  0x00000002  // Break in the native code debugger
00071 #define errResponseBreak68K     0x00000004  // Break in the 68000 code debugger
00072 #define errResponseBreakBoth    (errResponseBreakNative + errResponseBreak68K)
00073 #define errResponseIgnore       0x00000008  // Resume offending code
00074 #define errResponseKillProcess  0x00000010  // Kill the process hosting the offending code
00075 #define errResponseSoftReset    0x00000020  // Soft reset the Palm OS
00076 #define errResponseShutdown     0x00000040  // Shutdown whole system (for the simulation this means: exit it)
00077 
00078 #if BUILD_TYPE == BUILD_TYPE_DEBUG
00079 #   define errResponseDefaultSet    (errResponseBreakNative | errResponseKillProcess |\
00080                                         errResponseSoftReset | errResponseShutdown | errResponseIgnore)
00081 #else
00082 #   define errResponseDefaultSet    (errResponseBreakNative | errResponseKillProcess |\
00083                                         errResponseSoftReset | errResponseShutdown )
00084 #endif
00085 
00087 
00088 /************************************************************
00089  * Error Classes for each manager
00090  *************************************************************/
00091 
00095 
00096 #define errorClassMask          0xFFFFFF00  // Mask for extracting class code
00097 
00098 #define memErrorClass           0x80000100  // Memory Manager
00099 #define dmErrorClass            0x80000200  // Data Manager
00100 #define serErrorClass           0x80000300  // Serial Manager
00101 #define slkErrorClass           0x80000400  // Serial Link Manager
00102 #define sysErrorClass           0x80000500  // System Manager
00103 #define fplErrorClass           0x80000600  // Floating Point Library
00104 #define flpErrorClass           0x80000680  // New Floating Point Library
00105 #define evtErrorClass           0x80000700  // System Event Manager
00106 #define sndErrorClass           0x80000800  // Sound Manager
00107 #define almErrorClass           0x80000900  // Alarm Manager
00108 #define timErrorClass           0x80000A00  // Time Manager
00109 #define penErrorClass           0x80000B00  // Pen Manager
00110 #define ftrErrorClass           0x80000C00  // Feature Manager
00111 #define cmpErrorClass           0x80000D00  // Connection Manager (HotSync)
00112 #define dlkErrorClass           0x80000E00  // Desktop Link Manager
00113 #define padErrorClass           0x80000F00  // PAD Manager
00114 #define grfErrorClass           0x80001000  // Graffiti Manager
00115 #define mdmErrorClass           0x80001100  // Modem Manager
00116 #define netErrorClass           0x80001200  // Net Library
00117 #define htalErrorClass          0x80001300  // HTAL Library
00118 #define inetErrorClass          0x80001400  // INet Library
00119 #define exgErrorClass           0x80001500  // Exg Manager
00120 #define fileErrorClass          0x80001600  // File Stream Manager
00121 #define rfutErrorClass          0x80001700  // RFUT Library
00122 #define txtErrorClass           0x80001800  // Text Manager
00123 #define tsmErrorClass           0x80001900  // Text Services Library
00124 #define webErrorClass           0x80001A00  // Web Library
00125 #define secErrorClass           0x80001B00  // Security Library
00126 #define emuErrorClass           0x80001C00  // Emulator Control Manager
00127 #define flshErrorClass          0x80001D00  // Flash Manager
00128 #define pwrErrorClass           0x80001E00  // Power Manager
00129 #define cncErrorClass           0x80001F00  // Connection Manager (Serial Communication)
00130 #define actvErrorClass          0x80002000  // Activation application
00131 #define radioErrorClass         0x80002100  // Radio Manager (Library)
00132 #define dispErrorClass          0x80002200  // Display Driver Errors.
00133 #define bltErrorClass           0x80002300  // Blitter Driver Errors.
00134 #define winErrorClass           0x80002400  // Window manager.
00135 #define omErrorClass            0x80002500  // Overlay Manager
00136 #define menuErrorClass          0x80002600  // Menu Manager
00137 #define lz77ErrorClass          0x80002700  // Lz77 Library
00138 #define smsErrorClass           0x80002800  // Sms Library
00139 #define expErrorClass           0x80002900  // Expansion Manager and Slot Driver Library
00140 #define vfsErrorClass           0x80002A00  // Virtual Filesystem Manager and Filesystem library
00141 #define lmErrorClass            0x80002B00  // Locale Manager
00142 #define intlErrorClass          0x80002C00  // International Manager
00143 #define pdiErrorClass           0x80002D00  // PDI Library
00144 #define attnErrorClass          0x80002E00  // Attention Manager
00145 #define telErrorClass           0x80002F00  // Telephony Manager
00146 #define hwrErrorClass           0x80003000  // Hardware Manager (HAL)
00147 #define blthErrorClass          0x80003100  // Bluetooth Library Error Class
00148 #define udaErrorClass           0x80003200  // UDA Manager Error Class
00149 #define tlsErrorClass           0x80003300  // Thread Local Storage
00150 #define em68kErrorClass         0x80003400  // 68K appl emulator
00151 #define grmlErrorClass          0x80003500  // Gremlins
00152 #define IrErrorClass            0x80003600  // IR Library
00153 #define IrCommErrorClass        0x80003700  // IRComm Serial Mgr Plugin
00154 #define cpmErrorClass           0x80003800  // Crypto Manager
00155 #define sslErrorClass           0x80003900  // SSL (from RSA)
00156 #define kalErrorClass           0x80003A00  // KAL errors
00157 #define halErrorClass           0x80003B00  // HAL errors
00158 #define azmErrorClass           0x80003C00  // Authorization Manager (AZM)
00159 #define amErrorClass            0x80003D00  // Authentication Manager (AM)
00160 #define dirErrorClass           0x80003E00  // Directory
00161 #define svcErrorClass           0x80003F00  // Service Manager
00162 #define appMgrErrorClass        0x80004000  // Application Manager
00163 #define ralErrorClass           0x80004100  // RAL errors
00164 #define iosErrorClass           0x80004200  // IOS errors
00165 #define signErrorClass          0x80004300  // Digital Signature Verification shared library
00166 #define perfErrorClass          0x80004400  // Performance Manager
00167 #define drvrErrorClass          0x80004500  // Hardware Driver errors
00168 #define mediaErrorClass         0x80004600  // Multimedia Error Class
00169 #define catmErrorClass          0x80004700  // Category Mgr Errors
00170 #define certErrorClass          0x80004800  // Certificate Manager Error Class
00171 #define secSvcsErrorClass       0x80004900  // Security Services Errors
00172 #define bndErrorClass           0x80004A00  // Binder Error Class
00173 #define syncMgrErrorClass       0x80004B00  // Sync Manager Errors
00174 #define HttpErrorClass          0x80004C00  // Http Lib errors
00175 //#define xSyncErrorClass       0x80004D00  // Exchange Sync Library Errors
00176 #define hsExgErrorClass         0x80004E00  // HotSync Exchange library errors
00177 #define pppErrorClass           0x80004F00  // PPP lib errors
00178 #define pinsErrorClass          0x80005000  // Pen Input Services errors
00179 #define statErrorClass          0x80005100  // Status Bar Service errors
00180 #define regexpErrorClass        0x80005200  // Regular Expression errors
00181 //#define posixErrorClass           0x80005300  // All those nice POSIX errors  XXX now -ERR
00182 #define uilibErrorClass         0x80005400  // UI Library (Forms, Controls, etc)
00183 #define rimErrorClass           0x80005500  // RIM Manager (BlackBerry Communication)
00184 #define dtErrorClass            0x80005600  // DataTransform Library errors
00185 #define mimeErrorClass          0x80005700  // MIME Library errors
00186 #define dtIntProtClass          0x80005800  // Internet protocole error class in DataTransform Library
00187 #define xmlErrorClass           0x80005900  // XML parser errors
00188 #define postalErrorClass        0x80006000  // Postal Kit errors
00189 #define mobileErrorClass        0x80006100  // Mobile Kit errors
00190 #define vaultErrorClass         0x80006200  // Vault Manager errors
00191 
00192 #define oemErrorClass           0x80007000  // OEM/Licensee errors (0x80007000-0x80007EFF shared among ALL partners)
00193 #define errInfoClass            0x80007F00  // special class shows information w/o error code
00194 #define appErrorClass           0x80008000  // Application-defined errors
00195 
00196 #define dalErrorClass           0x8000FF00  // DAL error class
00197 
00199 
00200 /*******************************************************************
00201  *  Error Codes
00202  *******************************************************************/
00203 
00204 #define kDALError               ((status_t)(dalErrorClass | 0x00FF))
00205 #define kDALTimeout             ((status_t)(sysErrorClass | 1)) // compatible with sysErrTimeout
00206 
00207 /************************************************************
00208  * System Errors
00209  *************************************************************/
00210 
00214 
00216 
00219 #define errNone                         0x00000000
00220 
00222 #define sysErrTimeout                   ((status_t)(sysErrorClass | 1))
00223 
00224 
00228 #define sysErrParamErr                  ((status_t)(sysErrorClass | 2))
00229 
00230 
00231 #define sysErrNoFreeResource            ((status_t)(sysErrorClass | 3))
00232 
00233 #define sysErrNoFreeRAM                 ((status_t)(sysErrorClass | 4))
00234 
00235 
00237 #define sysErrNotAllowed                ((status_t)(sysErrorClass | 5))
00238 #define sysErrOutOfOwnerIDs             ((status_t)(sysErrorClass | 8))
00239 #define sysErrNoFreeLibSlots            ((status_t)(sysErrorClass | 9))
00240 #define sysErrLibNotFound               ((status_t)(sysErrorClass | 10))
00241 #define sysErrModuleNotFound            sysErrLibNotFound
00242 #define sysErrRomIncompatible           ((status_t)(sysErrorClass | 12))
00243 #define sysErrBufTooSmall               ((status_t)(sysErrorClass | 13))
00244 #define sysErrPrefNotFound              ((status_t)(sysErrorClass | 14))
00245 
00247 #define sysNotifyErrEntryNotFound       ((status_t)(sysErrorClass | 16))
00248 
00249 #define sysNotifyErrDuplicateEntry      ((status_t)(sysErrorClass | 17))
00250 
00251 #define sysNotifyErrBroadcastBusy       ((status_t)(sysErrorClass | 19))
00252 
00253 #define sysNotifyErrBroadcastCancelled  ((status_t)(sysErrorClass | 20))
00254 
00255 #define sysNotifyErrNoServer            ((status_t)(sysErrorClass | 21))
00256 
00258 #define sysNotifyErrQueueFull           ((status_t)(sysErrorClass | 27))
00259 
00260 #define sysNotifyErrQueueEmpty          ((status_t)(sysErrorClass | 28))
00261 
00262 #define sysNotifyErrNoStackSpace        ((status_t)(sysErrorClass | 29))
00263 
00264 #define sysErrNotInitialized            ((status_t)(sysErrorClass | 30))
00265 
00266 // Loader error codes:
00267 #define sysErrModuleInvalid             ((status_t)(sysErrorClass | 31))  // following sysErrNotInitialized
00268 #define sysErrModuleIncompatible        ((status_t)(sysErrorClass | 32))
00269 
00270 #define sysErrModuleFound68KCode        ((status_t)(sysErrorClass | 33))
00271 
00272 #define sysErrModuleRelocationError     ((status_t)(sysErrorClass | 34))
00273 
00274 #define sysErrNoGlobalStructure         ((status_t)(sysErrorClass | 35))
00275 
00276 #define sysErrInvalidSignature          ((status_t)(sysErrorClass | 36))
00277 
00278 #define sysErrInternalError             ((status_t)(sysErrorClass | 37))
00279 
00280 #define sysErrDynamicLinkerError        ((status_t)(sysErrorClass | 38))
00281 
00282 #define sysErrRAMModuleNotAllowed       ((status_t)(sysErrorClass | 39))
00283 
00284 #define sysErrCPUArchitecture           ((status_t)(sysErrorClass | 40))
00285 
00287 #define sysErrBadIndex                  ((status_t)(sysErrorClass | 41))
00288 
00289 #define sysErrBadType                   ((status_t)(sysErrorClass | 42))
00290 
00291 #define sysErrMismatchedValues          ((status_t)(sysErrorClass | 43))
00292 
00293 
00296 #define sysErrNameNotFound              ((status_t)(sysErrorClass | 44))
00297 
00298 
00301 #define sysErrNameInUse                 ((status_t)(sysErrorClass | 45))
00302 
00303 
00308 #define sysErrNoInit                    ((status_t)(sysErrorClass | 46))
00309 
00310 
00314 #define sysErrBadData                   ((status_t)(sysErrorClass | 47))
00315 
00316 
00318 #define sysErrDataTruncated             ((status_t)(sysErrorClass | 48))
00319 
00320 
00324 #define sysErrIO                        ((status_t)(sysErrorClass | 49))
00325 
00326 #define sysErrBadDesignEncountered      ((status_t)(sysErrorClass | 50))
00327 
00329 #define sysErrProcessFaulted            ((status_t)(sysErrorClass | 51))
00330 
00332 #define sysErrWeakRefGone               ((status_t)(sysErrorClass | 52))
00333 
00335 #define sysErrOSVersion                 ((status_t)(sysErrorClass | 53))
00336 
00338 
00341 #define sysErrEndOfData                 ((status_t)(sysErrorClass | 54))
00342 
00343 //We may be building the support kit for windows so make sure some of these are defined
00344 #ifndef ECANCEL
00345 #define ECANCEL     5
00346 #endif
00347 
00348 #ifndef ENOTSUP
00349 #define ENOTSUP     45
00350 #endif
00351 
00352 #ifndef EWOULDBLOCK
00353 #define EWOULDBLOCK EAGAIN
00354 #endif
00355 
00356 // Nice names for some POSIX error codes:
00357 
00359 #define sysErrCanceled                  ((status_t)(-ECANCEL))
00360 
00361 
00365 #define sysErrPermissionDenied          ((status_t)(-EPERM))
00366 
00367 
00369 #define sysErrUnsupported               ((status_t)(-ENOTSUP))
00370 
00371 #define sysErrBrokenPipe                ((status_t)(-EPIPE))
00372 
00373 
00375 #define sysErrEntryNotFound             ((status_t)(-ENOENT))
00376 
00377 
00379 #define sysErrEntryExists               ((status_t)(-EEXIST))
00380 
00381 #define sysErrNameTooLong               ((status_t)(-E2BIG))
00382 
00383 #define sysErrWouldBlock                ((status_t)(-EWOULDBLOCK))
00384 
00385 #define sysErrBusy                      ((status_t)(-EBUSY))
00386 
00387 #define sysErrOutOfRange                ((status_t)(-ERANGE))
00388 
00389 #define sysErrDontDoThat                ((status_t)(-EACCES))
00390 
00391 #define sysErrBadAddress                ((status_t)(-EBADADDR))
00392 
00393 #define sysErrInterrupted               ((status_t)(-EINTR))
00394 
00396 
00397 /************************************************************
00398  * Binder Errors
00399  *************************************************************/
00400 
00404 
00405 #define bndErrMissingArg                ((status_t)(bndErrorClass | 1))  
00406 #define bndErrBadType                   ((status_t)(bndErrorClass | 2))  
00407 #define bndErrDead                      ((status_t)(bndErrorClass | 3))  
00408 #define bndErrUnknownTransact           ((status_t)(bndErrorClass | 4))  
00409 #define bndErrBadTransact               ((status_t)(bndErrorClass | 5))  
00410 #define bndErrTooManyLoopers            ((status_t)(bndErrorClass | 6))  
00411 #define bndErrBadInterface              ((status_t)(bndErrorClass | 7))  
00412 #define bndErrUnknownMethod             ((status_t)(bndErrorClass | 8))  
00413 #define bndErrUnknownProperty           ((status_t)(bndErrorClass | 9))  
00414 #define bndErrOutOfStack                ((status_t)(bndErrorClass | 10)) 
00415 #define bndErrIncStrongFailed           ((status_t)(bndErrorClass | 11)) 
00416 #define bndErrReadNullValue             ((status_t)(bndErrorClass | 11)) 
00417 
00418 
00419 
00420 /************************************************************
00421  * RegExp Errors
00422  *************************************************************/
00423 
00427 
00428 #define regexpErrUnmatchedParenthesis           ((status_t)(regexpErrorClass | 1))  
00429 #define regexpErrTooBig                         ((status_t)(regexpErrorClass | 2))  
00430 #define regexpErrTooManyParenthesis             ((status_t)(regexpErrorClass | 3))  
00431 #define regexpErrJunkOnEnd                      ((status_t)(regexpErrorClass | 4))  
00432 #define regexpErrStarPlusOneOperandEmpty        ((status_t)(regexpErrorClass | 5))  
00433 #define regexpErrNestedStarQuestionPlus         ((status_t)(regexpErrorClass | 6))  
00434 #define regexpErrInvalidBracketRange            ((status_t)(regexpErrorClass | 8))  
00435 #define regexpErrUnmatchedBracket               ((status_t)(regexpErrorClass | 9))  
00436 #define regexpErrInternalError                  ((status_t)(regexpErrorClass | 10))  
00437 #define regexpErrQuestionPlusStarFollowsNothing ((status_t)(regexpErrorClass | 11))  
00438 #define regexpErrTrailingBackslash              ((status_t)(regexpErrorClass | 12))  
00439 #define regexpErrCorruptedProgram               ((status_t)(regexpErrorClass | 13))  
00440 #define regexpErrMemoryCorruption               ((status_t)(regexpErrorClass | 14))  
00441 #define regexpErrCorruptedPointers              ((status_t)(regexpErrorClass | 15))  
00442 #define regexpErrCorruptedOpcode                ((status_t)(regexpErrorClass | 16))  
00443 
00444 
00445 
00446 /************************************************************
00447  * Media Errors
00448  *************************************************************/
00449 
00453 
00454 #define mediaErrFormatMismatch          ((status_t)(mediaErrorClass | 1))
00455 #define mediaErrAlreadyVisited          ((status_t)(mediaErrorClass | 2))
00456 #define mediaErrStreamExhausted         ((status_t)(mediaErrorClass | 3))
00457 #define mediaErrAlreadyConnected        ((status_t)(mediaErrorClass | 4))
00458 #define mediaErrNotConnected            ((status_t)(mediaErrorClass | 5))
00459 #define mediaErrNoBufferSource          ((status_t)(mediaErrorClass | 6))
00460 #define mediaErrBufferFlowMismatch      ((status_t)(mediaErrorClass | 7))
00461 
00463 
00464 /************************************************************
00465  * Exchange / Web Errors
00466  *************************************************************/
00467 
00468 #define exgMemError             (exgErrorClass | 1)
00469 #define exgErrStackInit         (exgErrorClass | 2)  // stack could not initialize
00470 #define exgErrUserCancel        (exgErrorClass | 3)
00471 #define exgErrNoReceiver        (exgErrorClass | 4) // receiver device not found
00472 #define exgErrNoKnownTarget     (exgErrorClass | 5) // can't find a target app
00473 #define exgErrTargetMissing     (exgErrorClass | 6)  // target app is known but missing
00474 #define exgErrNotAllowed        (exgErrorClass | 7)  // operation not allowed
00475 #define exgErrBadData           (exgErrorClass | 8)  // internal data was not valid
00476 #define exgErrAppError          (exgErrorClass | 9)  // generic application error
00477 #define exgErrUnknown           (exgErrorClass | 10) // unknown general error
00478 #define exgErrDeviceFull        (exgErrorClass | 11) // device is full
00479 #define exgErrDisconnected      (exgErrorClass | 12) // link disconnected
00480 #define exgErrNotFound          (exgErrorClass | 13) // requested object not found
00481 #define exgErrBadParam          (exgErrorClass | 14) // bad parameter to call
00482 #define exgErrNotSupported      (exgErrorClass | 15) // operation not supported by this library
00483 #define exgErrDeviceBusy        (exgErrorClass | 16) // device is busy
00484 #define exgErrBadLibrary        (exgErrorClass | 17) // bad or missing ExgLibrary
00485 #define exgErrNotEnoughPower    (exgErrorClass | 18) // Device has not enough power to perform the requested operation
00486 #define exgErrNoHardware        (exgErrorClass | 19) // Device does has not have corresponding hardware
00487 #define exgErrAuthRequired      (exgErrorClass | 20) // Need authentication - username/passwd
00488 #define exgErrRedirect          (exgErrorClass | 21) // Redirected url
00489 #define exgErrLibError          (exgErrorClass | 22) // Library specific error - usually the library can provide more details
00490 #define exgErrConnection        (exgErrorClass | 23) // There was an error in making the connection
00491 #define exgErrInvalidURL        (exgErrorClass | 24) // Bad URL
00492 #define exgErrInvalidScheme     (exgErrorClass | 25) // Bad scheme in URL
00493 
00494 #endif  // _CMNERRORS_H_
00495