Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_error.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #ifndef GLOBUS_ERROR_H
23 #define GLOBUS_ERROR_H
24 
25 #include "globus_common_include.h"
26 #include "globus_object.h"
27 #include "globus_module.h"
28 
29 #include <inttypes.h>
30 
31 typedef uint_least32_t globus_uint_t;
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /**********************************************************************
38  * Error API Types
39  * globus_result_t -- used as error object handle
40  **********************************************************************/
41 
42 /**********************************************************************
43  * Error Creation API
44  **********************************************************************/
45 
46 extern globus_object_t *
47 globus_error_initialize_base (
48  globus_object_t * error,
49  globus_module_descriptor_t * source_module,
50  globus_object_t * causal_error);
51 
52 extern globus_object_t *
53 globus_error_construct_base (
54  globus_module_descriptor_t * source_module,
55  globus_object_t * causal_error);
56 
57 #define globus_error_type_static_initializer(parent_type, \
58  copy_func, \
59  destructor, \
60  string_func) \
61  globus_object_type_static_initializer ((parent_type), \
62  (copy_func), \
63  (destructor), \
64  ((void *) string_func))
65 
66 
67 /**********************************************************************
68  * Standard Error Type
69  * ERROR_TYPE_BASE
70  **********************************************************************/
71 
72 extern const globus_object_type_t GLOBUS_ERROR_TYPE_BASE_DEFINITION;
73 #define GLOBUS_ERROR_TYPE_BASE (&GLOBUS_ERROR_TYPE_BASE_DEFINITION)
74 
75 /**********************************************************************
76  * Standard Error Prototype
77  * ERROR_NO_INFO (type GLOBUS_ERROR_TYPE_BASE)
78  **********************************************************************/
79 
80 extern globus_object_t GLOBUS_ERROR_BASE_STATIC_PROTOTYPE;
81 #define GLOBUS_ERROR_BASE_PROTOTYPE (&GLOBUS_ERROR_BASE_STATIC_PROTOTYPE)
82 
83 #define GLOBUS_ERROR_NO_INFO GLOBUS_ERROR_BASE_PROTOTYPE
84 
85 /**********************************************************************
86  * Error Management API
87  **********************************************************************/
88 
89 extern globus_object_t *
90 globus_error_get(
91  globus_result_t result);
92 /* returns corresponding object for result,
93  * may return GLOBUS_ERROR_NO_INFO */
94 
95 extern globus_object_t *
96 globus_error_peek(
97  globus_result_t result);
98 /* returns pointer to object for result DOES NOT REMOVE object.
99  * This pointer is only valid for the current thread and until another call to
100  * globus_error_peek is made
101  * may return GLOBUS_ERROR_NO_INFO
102  */
103 
104 extern globus_result_t
105 globus_error_put(
106  globus_object_t * error);
107 /* does nothing if error is NULL */
108 
109 /**********************************************************************
110  * Error Manipulation API
111  **********************************************************************/
112 
114 globus_error_base_get_source (
115  globus_object_t * error);
116 
117 extern void
118 globus_error_base_set_source (
119  globus_object_t * error,
120  globus_module_descriptor_t * source_module);
121 
122 extern globus_object_t *
123 globus_error_base_get_cause (
124  globus_object_t * error);
125 
126 extern void
127 globus_error_base_set_cause (
128  globus_object_t * error,
129  globus_object_t * causal_error);
130 
131 
132 #include "globus_thread.h"
133 
134 extern globus_bool_t globus_i_error_verbose;
135 extern globus_thread_key_t globus_i_error_verbose_key;
136 
137 /**********************************************************************
138  * Module definition
139  **********************************************************************/
140 
141 extern globus_module_descriptor_t globus_i_error_module;
142 
143 #define GLOBUS_ERROR_MODULE (&globus_i_error_module)
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* GLOBUS_ERROR_H */
Globus Threading Abstraction.
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Reference Counting Module Activation and Deactivation.
Thread-specific data key.
Definition: globus_thread.h:201
uint32_t globus_result_t
Definition: globus_types.h:99
Include System Headers.
Module Descriptor.
Definition: globus_module.h:71