Grid Community Toolkit  6.2.1566487665 (tag: v6.2.20190829)
globus_extension.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_EXTENSION_H
23 #define GLOBUS_EXTENSION_H
24 
25 #include "globus_common_include.h"
26 #include "globus_module.h"
27 #include "globus_hashtable.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 extern globus_module_descriptor_t globus_i_extension_module;
34 #define GLOBUS_EXTENSION_MODULE (&globus_i_extension_module)
35 
36 enum
37 {
38  GLOBUS_EXTENSION_ERROR_OPEN_FAILED,
39  GLOBUS_EXTENSION_ERROR_LOOKUP_FAILED
40 };
41 
56 #define GlobusExtensionDefineModule(name) \
57  globus_module_descriptor_t name##_module
58 #define GlobusExtensionDeclareModule(name) \
59  extern globus_module_descriptor_t name##_module
60 #define GlobusExtensionMyModule(name) &name##_module
61 
94 int
96  const char * extension_name);
97 
98 int
99 globus_extension_deactivate(
100  const char * extension_name);
101 
102 typedef struct globus_l_extension_handle_s * globus_extension_handle_t;
103 
104 typedef struct
105 {
106  globus_hashtable_t table;
107  globus_bool_t initialized;
108  globus_bool_t user_hashing;
109 } globus_extension_registry_t;
110 
111 /* these two calls are only to be called from within an extensions activate
112  * and deactivate functions
113  *
114  * the module in the add can either be GlobusExtensionMyModule(name),
115  * some other module, or NULL. It's purpose is to specify the module that
116  * is associated with the error objects that might come from use of this
117  * addition to the registry.
118  *
119  * symbol is a char * by default. the key can be changed by calling
120  * globus_extension_registry_set_hashing() before it is accessed.
121  *
122  * regardless, the memory pointed to by symbol must exist as long as the entry
123  * is in the registry
124  */
125 int
126 globus_extension_registry_add(
127  globus_extension_registry_t * registry,
128  void * symbol,
130  void * data);
131 
132 void *
133 globus_extension_registry_remove(
134  globus_extension_registry_t * registry,
135  void * symbol);
136 
137 int
138 globus_extension_registry_set_hashing(
139  globus_extension_registry_t * registry,
141  globus_hashtable_keyeq_func_t keyeq_func);
142 
143 
159 void *
161  globus_extension_handle_t * handle,
162  globus_extension_registry_t * registry,
163  void * symbol);
164 
165 void *
166 globus_extension_reference(
167  globus_extension_handle_t handle);
168 
169 void
170 globus_extension_release(
171  globus_extension_handle_t handle);
172 
173 /* get the module version of a loaded extension. version is a pointer to
174  an existing globus_version_t */
175 int
176 globus_extension_get_module_version(
177  globus_extension_handle_t handle,
178  globus_version_t * version);
179 
181 globus_extension_error_match(
182  globus_extension_handle_t handle,
183  globus_object_t * error,
184  int type);
185 
186 typedef
188 (*globus_extension_error_match_cb_t)(
189  globus_object_t * error,
191  void * type);
192 
194 globus_extension_error_match_with_cb(
195  globus_extension_handle_t handle,
196  globus_object_t * error,
197  globus_extension_error_match_cb_t callback,
198  void * type);
199 
204 int
206  const char * extension_name,
207  globus_module_descriptor_t * module_descriptor);
208 
209 void
210 globus_extension_unregister_builtin(
211  const char * extension_name);
212 
213 typedef struct
214 {
215  char * extension_name;
216  globus_module_descriptor_t * module_descriptor;
217 } globus_extension_builtin_t;
218 
219 /* array of builtins, with null entry at end */
220 int
221 globus_extension_register_builtins(
222  globus_extension_builtin_t * builtins);
223 
224 void
225 globus_extension_unregister_builtins(
226  globus_extension_builtin_t * builtins);
227 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif /* GLOBUS_EXTENSION_H */
int globus_extension_activate(const char *extension_name)
Definition: globus_extension.c:528
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Reference Counting Module Activation and Deactivation.
int(* globus_hashtable_hash_func_t)(void *key, int limit)
Definition: globus_hashtable.h:58
int(* globus_hashtable_keyeq_func_t)(void *key1, void *key2)
Definition: globus_hashtable.h:70
int globus_extension_register_builtin(const char *extension_name, globus_module_descriptor_t *module_descriptor)
Definition: globus_extension.c:1100
Include System Headers.
void * globus_extension_lookup(globus_extension_handle_t *handle, globus_extension_registry_t *registry, void *symbol)
Definition: globus_extension.c:872
Module Descriptor.
Definition: globus_module.h:71