home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nspr30-v.zip / nspr30-v / include / prerror.h < prev    next >
C/C++ Source or Header  |  1998-11-02  |  12KB  |  206 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef prerror_h___
  20. #define prerror_h___
  21.  
  22. #include "prtypes.h"
  23.  
  24. PR_BEGIN_EXTERN_C
  25.  
  26. typedef PRInt32 PRErrorCode;
  27.  
  28. #define PR_NSPR_ERROR_BASE -6000
  29.  
  30. #define PR_OUT_OF_MEMORY_ERROR              PR_NSPR_ERROR_BASE + 0
  31.                                     /* Insufficient memory to perform request   */
  32. #define PR_BAD_DESCRIPTOR_ERROR             PR_NSPR_ERROR_BASE + 1
  33.                                     /* the file descriptor used as an argument
  34.                                        in the function is invalid; either it has
  35.                                        been deleted or otherwise corrupted.     */
  36. #define PR_WOULD_BLOCK_ERROR                PR_NSPR_ERROR_BASE + 2
  37.                                     /* The operation would have blocked and that
  38.                                        is in conflict with the semantics that
  39.                                        have been established.                   */
  40. #define PR_ACCESS_FAULT_ERROR               PR_NSPR_ERROR_BASE + 3
  41. #define PR_INVALID_METHOD_ERROR             PR_NSPR_ERROR_BASE + 4
  42.                                     /* The method being called is invalid for
  43.                                        the type of file descriptor used.        */
  44. #define PR_ILLEGAL_ACCESS_ERROR             PR_NSPR_ERROR_BASE + 5
  45. #define PR_UNKNOWN_ERROR                    PR_NSPR_ERROR_BASE + 6
  46.                                     /* Some unknown error has occured */
  47. #define PR_PENDING_INTERRUPT_ERROR          PR_NSPR_ERROR_BASE + 7
  48.                                     /* The operation terminated because another
  49.                                        thread has interrupted it (PR_Interrupt) */
  50. #define PR_NOT_IMPLEMENTED_ERROR            PR_NSPR_ERROR_BASE + 8
  51.                                     /* The function called has not been
  52.                                        implemented.                             */
  53. #define PR_IO_ERROR                         PR_NSPR_ERROR_BASE + 9
  54. #define PR_IO_TIMEOUT_ERROR                 PR_NSPR_ERROR_BASE + 10
  55.                                     /* The I/O operation has not completed in
  56.                                        the time specified for the function.     */
  57. #define PR_IO_PENDING_ERROR                 PR_NSPR_ERROR_BASE + 11
  58.                                     /* An I/O operation has been attempted on
  59.                                        a file descriptor that is currently
  60.                                        busy with another operation.             */
  61. #define PR_DIRECTORY_OPEN_ERROR             PR_NSPR_ERROR_BASE + 12
  62.                                     /* The directory could not be opened.       */
  63. #define PR_INVALID_ARGUMENT_ERROR           PR_NSPR_ERROR_BASE + 13
  64.                                     /* One or more of the arguments to the 
  65.                                        function is invalid.                     */
  66. #define PR_ADDRESS_NOT_AVAILABLE_ERROR      PR_NSPR_ERROR_BASE + 14
  67.                                     /* The network address (PRNetAddr) is not
  68.                                        available (probably in use).             */
  69. #define PR_ADDRESS_NOT_SUPPORTED_ERROR      PR_NSPR_ERROR_BASE + 15
  70. #define PR_IS_CONNECTED_ERROR               PR_NSPR_ERROR_BASE + 16
  71.                                     /* An attempt to connect on an already
  72.                                        connected network file descriptor.       */ 
  73. #define PR_BAD_ADDRESS_ERROR                PR_NSPR_ERROR_BASE + 17
  74.                                      /* The network address specified is invalid
  75.                                        (as reported by the network).            */
  76. #define PR_ADDRESS_IN_USE_ERROR             PR_NSPR_ERROR_BASE + 18
  77. #define PR_CONNECT_REFUSED_ERROR            PR_NSPR_ERROR_BASE + 19
  78.                                     /* The peer has refused to allow the connec-
  79.                                        tion to be established.                  */
  80. #define PR_NETWORK_UNREACHABLE_ERROR        PR_NSPR_ERROR_BASE + 20
  81.                                     /* The network address specifies a host
  82.                                        that is unreachable (perhaps temporary). */
  83. #define PR_CONNECT_TIMEOUT_ERROR            PR_NSPR_ERROR_BASE + 21
  84.                                     /* The connection attempt did not complete
  85.                                        in a reasonable period of time.          */
  86. #define PR_NOT_CONNECTED_ERROR              PR_NSPR_ERROR_BASE + 22
  87.                                     /* The call attempted to use connected
  88.                                        sematics on a network file descriptor
  89.                                        that was not connected.                  */
  90. #define PR_LOAD_LIBRARY_ERROR               PR_NSPR_ERROR_BASE + 23
  91.                                     /* Some sort of failure attempting to load
  92.                                        a dynamic library.                       */
  93. #define PR_UNLOAD_LIBRARY_ERROR             PR_NSPR_ERROR_BASE + 24
  94.                                     /* Some sort of failure attempting to unload
  95.                                        a dynamic library.                       */
  96. #define PR_FIND_SYMBOL_ERROR                PR_NSPR_ERROR_BASE + 25
  97.                                     /* Dynamic library symbol could not be found
  98.                                        in any of the available libraries.       */
  99. #define PR_INSUFFICIENT_RESOURCES_ERROR     PR_NSPR_ERROR_BASE + 26
  100.                                     /* There are insufficient system resources
  101.                                        to process the request.                  */
  102. #define PR_DIRECTORY_LOOKUP_ERROR           PR_NSPR_ERROR_BASE + 27
  103. #define PR_TPD_RANGE_ERROR                  PR_NSPR_ERROR_BASE + 28
  104.                                     /* Attempt to access a TPD key that is beyond
  105.                                        any key that has been allocated to the
  106.                                        process.                                 */
  107.  
  108. #define PR_PROC_DESC_TABLE_FULL_ERROR       PR_NSPR_ERROR_BASE + 29
  109. #define PR_SYS_DESC_TABLE_FULL_ERROR        PR_NSPR_ERROR_BASE + 30
  110. #define PR_NOT_SOCKET_ERROR                 PR_NSPR_ERROR_BASE + 31
  111. #define PR_NOT_TCP_SOCKET_ERROR             PR_NSPR_ERROR_BASE + 32
  112. #define PR_SOCKET_ADDRESS_IS_BOUND_ERROR    PR_NSPR_ERROR_BASE + 33
  113. #define PR_NO_ACCESS_RIGHTS_ERROR           PR_NSPR_ERROR_BASE + 34
  114. #define PR_OPERATION_NOT_SUPPORTED_ERROR    PR_NSPR_ERROR_BASE + 35
  115. #define PR_PROTOCOL_NOT_SUPPORTED_ERROR     PR_NSPR_ERROR_BASE + 36
  116. #define PR_REMOTE_FILE_ERROR                PR_NSPR_ERROR_BASE + 37
  117. #define PR_BUFFER_OVERFLOW_ERROR            PR_NSPR_ERROR_BASE + 38
  118. #define PR_CONNECT_RESET_ERROR              PR_NSPR_ERROR_BASE + 39
  119. #define PR_RANGE_ERROR                      PR_NSPR_ERROR_BASE + 40
  120.  
  121. #define PR_DEADLOCK_ERROR                   PR_NSPR_ERROR_BASE + 41
  122. #define PR_FILE_IS_LOCKED_ERROR             PR_NSPR_ERROR_BASE + 42
  123. #define PR_FILE_TOO_BIG_ERROR               PR_NSPR_ERROR_BASE + 43
  124. #define PR_NO_DEVICE_SPACE_ERROR            PR_NSPR_ERROR_BASE + 44
  125. #define PR_PIPE_ERROR                       PR_NSPR_ERROR_BASE + 45
  126. #define PR_NO_SEEK_DEVICE_ERROR             PR_NSPR_ERROR_BASE + 46
  127. #define PR_IS_DIRECTORY_ERROR               PR_NSPR_ERROR_BASE + 47
  128. #define PR_LOOP_ERROR                       PR_NSPR_ERROR_BASE + 48
  129. #define PR_NAME_TOO_LONG_ERROR              PR_NSPR_ERROR_BASE + 49
  130. #define PR_FILE_NOT_FOUND_ERROR             PR_NSPR_ERROR_BASE + 50
  131. #define PR_NOT_DIRECTORY_ERROR              PR_NSPR_ERROR_BASE + 51
  132. #define PR_READ_ONLY_FILESYSTEM_ERROR       PR_NSPR_ERROR_BASE + 52
  133. #define PR_DIRECTORY_NOT_EMPTY_ERROR        PR_NSPR_ERROR_BASE + 53
  134. #define PR_FILESYSTEM_MOUNTED_ERROR         PR_NSPR_ERROR_BASE + 54
  135. #define PR_NOT_SAME_DEVICE_ERROR            PR_NSPR_ERROR_BASE + 55
  136. #define PR_DIRECTORY_CORRUPTED_ERROR        PR_NSPR_ERROR_BASE + 56
  137. #define PR_FILE_EXISTS_ERROR                PR_NSPR_ERROR_BASE + 57
  138. #define PR_MAX_DIRECTORY_ENTRIES_ERROR      PR_NSPR_ERROR_BASE + 58
  139. #define PR_INVALID_DEVICE_STATE_ERROR       PR_NSPR_ERROR_BASE + 59
  140. #define PR_DEVICE_IS_LOCKED_ERROR           PR_NSPR_ERROR_BASE + 60
  141. #define PR_NO_MORE_FILES_ERROR              PR_NSPR_ERROR_BASE + 61
  142. #define PR_END_OF_FILE_ERROR                PR_NSPR_ERROR_BASE + 62
  143. #define PR_FILE_SEEK_ERROR                  PR_NSPR_ERROR_BASE + 63
  144. #define PR_FILE_IS_BUSY_ERROR               PR_NSPR_ERROR_BASE + 64
  145.     
  146. #define PR_IN_PROGRESS_ERROR                PR_NSPR_ERROR_BASE + 66
  147. #define PR_ALREADY_INITIATED_ERROR          PR_NSPR_ERROR_BASE + 67
  148. #define PR_GROUP_EMPTY_ERROR                PR_NSPR_ERROR_BASE + 68
  149. #define PR_INVALID_STATE_ERROR              PR_NSPR_ERROR_BASE + 69
  150. #define PR_NETWORK_DOWN_ERROR               PR_NSPR_ERROR_BASE + 70
  151. #define PR_SOCKET_SHUTDOWN_ERROR            PR_NSPR_ERROR_BASE + 71
  152. #define PR_CONNECT_ABORTED_ERROR            PR_NSPR_ERROR_BASE + 72
  153. #define PR_HOST_UNREACHABLE_ERROR           PR_NSPR_ERROR_BASE + 73
  154. #define PR_MAX_ERROR                        PR_NSPR_ERROR_BASE + 74
  155.                                     /* Place holder for the end of the list     */
  156.  
  157. /*
  158. ** Set error will preserve an error condition within a thread context.
  159. ** The values stored are the NSPR (platform independent) translation of
  160. ** the error. Also, if available, the platform specific oserror is stored.
  161. ** If there is no appropriate OS error number, a zero my be supplied.
  162. */
  163. PR_EXTERN(void) PR_SetError(PRErrorCode errorCode, PRInt32 oserr);
  164.  
  165. /*
  166. ** The text value specified may be NULL. If it is not NULL and the text length
  167. ** is zero, the string is assumed to be a null terminated C string. Otherwise
  168. ** the text is assumed to be the length specified and possibly include NULL
  169. ** characters (e.g., a multi-national string).
  170. **
  171. ** The text will be copied into to thread structure and remain there
  172. ** until the next call to PR_SetError.
  173. */
  174. PR_EXTERN(void) PR_SetErrorText(
  175.     PRIntn textLength, const char *text);
  176.  
  177. /*
  178. ** Return the current threads last set error code.
  179. */
  180. PR_EXTERN(PRErrorCode) PR_GetError(void);
  181.  
  182. /*
  183. ** Return the current threads last set os error code. This is used for
  184. ** machine specific code that desires the underlying os error.
  185. */
  186. PR_EXTERN(PRInt32) PR_GetOSError(void);
  187.  
  188. /*
  189. ** Get the length of the error text. If a zero is returned, then there
  190. ** is no text. Otherwise, the value returned is sufficient to contain
  191. ** the error text currently available.
  192. */
  193. PR_EXTERN(PRInt32) PR_GetErrorTextLength(void);
  194.  
  195. /*
  196. ** Copy the current threads current error text. Then actual number of bytes
  197. ** copied is returned as the result. If the result is zero, the 'text' area
  198. ** is unaffected.
  199. */
  200. PR_EXTERN(PRInt32) PR_GetErrorText(char *text);
  201.  
  202.  
  203. PR_END_EXTERN_C
  204.  
  205. #endif /* prerror_h___ */
  206.