globus_extension.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef GLOBUS_EXTENSION_H
00023 #define GLOBUS_EXTENSION_H
00024 
00025 #include "globus_common_include.h"
00026 #include "globus_module.h"
00027 #include "globus_hashtable.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 extern globus_module_descriptor_t       globus_i_extension_module;
00034 #define GLOBUS_EXTENSION_MODULE (&globus_i_extension_module)
00035 
00036 enum
00037 {
00038     GLOBUS_EXTENSION_ERROR_OPEN_FAILED,
00039     GLOBUS_EXTENSION_ERROR_LOOKUP_FAILED
00040 };
00041 
00056 #define GlobusExtensionDefineModule(name)                                   \
00057     globus_module_descriptor_t name##_module
00058 #define GlobusExtensionDeclareModule(name)                                  \
00059     extern globus_module_descriptor_t name##_module
00060 #define GlobusExtensionMyModule(name) &name##_module
00061 
00094 int
00095 globus_extension_activate(
00096     const char *                        extension_name);
00097 
00098 int
00099 globus_extension_deactivate(
00100     const char *                        extension_name);
00101 
00102 typedef struct globus_l_extension_handle_s * globus_extension_handle_t;
00103 
00104 typedef struct
00105 {
00106     globus_hashtable_t                  table;
00107     globus_bool_t                       initialized;
00108     globus_bool_t                       user_hashing;
00109 } globus_extension_registry_t;
00110 
00111 /* these two calls are only to be called from within an extensions activate
00112  * and deactivate functions
00113  * 
00114  * the module in the add can either be GlobusExtensionMyModule(name),
00115  * some other module, or NULL.  It's purpose is to specify the module that
00116  * is associated with the error objects that might come from use of this
00117  * addition to the registry.
00118  * 
00119  * symbol is a char * by default.  the key can be changed by calling
00120  * globus_extension_registry_set_hashing() before it is accessed.
00121  * 
00122  * regardless, the memory pointed to by symbol must exist as long as the entry
00123  * is in the registry
00124  */
00125 int
00126 globus_extension_registry_add(
00127     globus_extension_registry_t *       registry,
00128     void *                              symbol,
00129     globus_module_descriptor_t *        module,
00130     void *                              data);
00131 
00132 void *
00133 globus_extension_registry_remove(
00134     globus_extension_registry_t *       registry,
00135     void *                              symbol);
00136 
00137 int
00138 globus_extension_registry_set_hashing(
00139     globus_extension_registry_t *       registry,
00140     globus_hashtable_hash_func_t        hash_func,
00141     globus_hashtable_keyeq_func_t       keyeq_func);
00142     
00143 
00159 void *
00160 globus_extension_lookup(
00161     globus_extension_handle_t *         handle,
00162     globus_extension_registry_t *       registry,
00163     void *                              symbol);
00164 
00165 void *
00166 globus_extension_reference(
00167     globus_extension_handle_t           handle);
00168 
00169 void
00170 globus_extension_release(
00171     globus_extension_handle_t           handle);
00172 
00173 globus_bool_t
00174 globus_extension_error_match(
00175     globus_extension_handle_t           handle,
00176     globus_object_t *                   error,
00177     int                                 type);
00178 
00179 typedef
00180 globus_bool_t
00181 (*globus_extension_error_match_cb_t)(
00182     globus_object_t *                   error,
00183     globus_module_descriptor_t *        module,
00184     void *                              type);
00185 
00186 globus_bool_t
00187 globus_extension_error_match_with_cb(
00188     globus_extension_handle_t           handle,
00189     globus_object_t *                   error,
00190     globus_extension_error_match_cb_t   callback,
00191     void *                              type);
00192 
00197 int
00198 globus_extension_register_builtin(
00199     const char *                        extension_name,
00200     globus_module_descriptor_t *        module_descriptor);
00201 
00202 void
00203 globus_extension_unregister_builtin(
00204     const char *                        extension_name);
00205 
00206 typedef struct
00207 {
00208     char *                              extension_name;
00209     globus_module_descriptor_t *        module_descriptor;
00210 } globus_extension_builtin_t;
00211 
00212 /* array of builtins, with null entry at end */
00213 int
00214 globus_extension_register_builtins(
00215     globus_extension_builtin_t *        builtins);
00216 
00217 void
00218 globus_extension_unregister_builtins(
00219     globus_extension_builtin_t *        builtins);
00220 
00221 #ifdef __cplusplus
00222 }
00223 #endif
00224 
00225 #endif /* GLOBUS_EXTENSION_H */

Generated on 20 Jun 2015 for globus_common by  doxygen 1.4.7