globus_module.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 #if !defined(GLOBUS_MODULE_H)
00023 #define GLOBUS_MODULE_H 1
00024 
00033 struct globus_module_descriptor_s;
00034 typedef struct globus_module_descriptor_s globus_module_descriptor_t;
00037 #include "globus_error_generic.h"
00038 
00039 #include <stdio.h>
00040   
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 /******************************************************************************
00046                                Type definitions
00047 ******************************************************************************/
00048 typedef int (*globus_module_activation_func_t)(void);
00049 typedef int (*globus_module_deactivation_func_t)(void);
00050 typedef void (*globus_module_atexit_func_t)(void);
00051 typedef void * (*globus_module_get_pointer_func_t)(void);
00052 
00053 typedef struct
00054 {
00055     int                                 major;
00056     int                                 minor;
00057     /* these two members are reserved for internal Globus components */    
00058     unsigned long                       timestamp;
00059     int                                 branch_id;
00060 } globus_version_t;
00061 
00069 struct globus_module_descriptor_s
00070 {
00072     char *                              module_name;
00074     globus_module_activation_func_t     activation_func;
00076     globus_module_deactivation_func_t   deactivation_func;
00078     globus_module_atexit_func_t         atexit_func;
00080     globus_module_get_pointer_func_t    get_pointer_func;
00082     globus_version_t *                  version;
00084     globus_error_print_friendly_t       friendly_error_func;
00085 };
00086 
00087 /******************************************************************************
00088                               Function prototypes
00089 ******************************************************************************/
00090 
00091 /*
00092  * NOTE: all functions return either GLOBUS_SUCCESS or an error code
00093  */
00094 
00095 int
00096 globus_module_activate(
00097     globus_module_descriptor_t *        module_descriptor);
00098 
00099 int
00100 globus_module_activate_array(
00101     globus_module_descriptor_t *        modules[],
00102     globus_module_descriptor_t **       failed_module);
00103 
00104 int
00105 globus_module_deactivate(
00106     globus_module_descriptor_t *        module_descriptor);
00107 
00108 int
00109 globus_module_deactivate_all(void);
00110 
00116 typedef
00117 int
00118 (*globus_module_deactivate_proxy_cb_t)(
00119     globus_module_descriptor_t *        module_descriptor,
00120     void *                              user_arg);
00121 
00131 int
00132 globus_module_activate_proxy(
00133     globus_module_descriptor_t *        module_descriptor,
00134     globus_module_deactivate_proxy_cb_t deactivate_cb,
00135     void *                              user_arg);
00136 
00140 void
00141 globus_module_setenv(
00142     const char *                        name,
00143     const char *                        value);
00144 
00148 char *
00149 globus_module_getenv(
00150     const char *                        name);
00151 
00155 void *
00156 globus_module_get_module_pointer(
00157     globus_module_descriptor_t *);
00158 
00159 int
00160 globus_module_get_version(
00161     globus_module_descriptor_t *        module_descriptor,
00162     globus_version_t *                  version);
00163     
00164 void
00165 globus_module_print_version(
00166     globus_module_descriptor_t *        module_descriptor,
00167     FILE *                              stream,
00168     globus_bool_t                       verbose);
00169     
00170 void
00171 globus_module_print_activated_versions(
00172     FILE *                              stream,
00173     globus_bool_t                       verbose);
00174 
00175 void
00176 globus_version_print(
00177     const char *                        name,
00178     const globus_version_t *            version,
00179     FILE *                              stream,
00180     globus_bool_t                       verbose);
00181 
00182 
00183 void
00184 globus_module_set_args(
00185     int *                               argc,
00186     char ***                            argv);
00187 
00188 void
00189 globus_module_get_args(
00190     int **                              argc,
00191     char ****                           argv);
00192 
00193 
00194 #ifdef __cplusplus
00195 }
00196 #endif
00197 
00198 #endif /* GLOBUS_MODULE_H */

Generated on 20 Jun 2015 for globus_common by  doxygen 1.4.7