globus_xio_load.h

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 
00017 #ifndef GLOBUS_XIO_LOAD_INCLUDE
00018 #define GLOBUS_XIO_LOAD_INCLUDE
00019 
00020 #include "globus_xio_types.h"
00021 #include "globus_common.h"
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 extern globus_extension_registry_t      globus_i_xio_driver_registry;
00028 #define GLOBUS_XIO_DRIVER_REGISTRY &globus_i_xio_driver_registry
00029 
00030 typedef
00031 globus_result_t
00032 (*globus_xio_driver_init_t)(
00033     globus_xio_driver_t *               out_driver);
00034 
00035 typedef
00036 void
00037 (*globus_xio_driver_destroy_t)(
00038     globus_xio_driver_t                 driver);
00039 
00040 typedef struct
00041 {
00042     const char *                        name;
00043     globus_xio_driver_init_t            init;
00044     globus_xio_driver_destroy_t         destroy;
00045 } globus_xio_driver_hook_t;
00046 
00047 globus_result_t
00048 globus_xio_driver_load(
00049     const char *                        driver_name,
00050     globus_xio_driver_t *               out_driver);
00051 
00052 globus_result_t
00053 globus_xio_driver_unload(
00054     globus_xio_driver_t                 driver);
00055 
00065 #define GlobusXIODefineDriver(driver_name, init_func, destroy_func)         \
00066 globus_xio_driver_hook_t globus_i_xio_##driver_name##_hook =                \
00067 {                                                                           \
00068     #driver_name,                                                           \
00069     init_func,                                                              \
00070     destroy_func,                                                           \
00071 }
00072 #define GlobusXIODeclareDriver(driver_name)                                 \
00073     extern globus_xio_driver_hook_t globus_i_xio_##driver_name##_hook
00074 #define GlobusXIOMyDriver(driver_name)                                      \
00075     &globus_i_xio_##driver_name##_hook
00076 
00083 #define GlobusXIORegisterDriver(driver_name)                                \
00084     globus_extension_registry_add(                                          \
00085         GLOBUS_XIO_DRIVER_REGISTRY,                                         \
00086         (void *)#driver_name,                                               \
00087         GlobusXIOMyModule(driver_name),                                     \
00088         GlobusXIOMyDriver(driver_name))
00089 #define GlobusXIOUnRegisterDriver(driver_name)                              \
00090     globus_extension_registry_remove(                                       \
00091         GLOBUS_XIO_DRIVER_REGISTRY,                                         \
00092         (void*)#driver_name)
00093 
00094 #define GlobusXIODefineModule(driver_name)                                  \
00095     GlobusExtensionDefineModule(globus_xio_##driver_name##_driver)
00096 #define GlobusXIODeclareModule(driver_name)                                 \
00097     GlobusExtensionDeclareModule(globus_xio_##driver_name##_driver)
00098 #define GlobusXIOMyModule(driver_name)                                      \
00099     GlobusExtensionMyModule(globus_xio_##driver_name##_driver)
00100 #define GlobusXIOExtensionName(driver_name)                                 \
00101     "globus_xio_" #driver_name "_driver"
00102 
00103 #define GLOBUS_XIO_EXTENSION_FORMAT "globus_xio_%s_driver"
00104 
00105 /* internal activate funcs */
00106 int
00107 globus_i_xio_load_init(void);
00108 
00109 int
00110 globus_i_xio_load_destroy(void);
00111     
00112 #ifdef __cplusplus
00113 }
00114 #endif
00115 
00116 #endif

Generated on 5 Nov 2016 for globus_xio by  doxygen 1.4.7