globus_net_manager.h
Go to the documentation of this file.
/*
* Copyright 1999-2014 University of Chicago
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GLOBUS_NET_MANAGER_H
#define GLOBUS_NET_MANAGER_H 1
#include "globus_common.h"
#include "globus_net_manager_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef GLOBUS_GLOBAL_DOCUMENT_SET
#endif
struct globus_net_manager_s;
typedef globus_result_t (*globus_net_manager_pre_listen)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const globus_net_manager_attr_t *attr_array,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_post_listen)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const globus_net_manager_attr_t *attr_array,
char **local_contact_out,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_end_listen)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const globus_net_manager_attr_t *attr_array);
typedef globus_result_t (*globus_net_manager_pre_accept)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const globus_net_manager_attr_t *attr_array,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_post_accept)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const char *remote_contact,
const globus_net_manager_attr_t *attr_array,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_pre_connect)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *remote_contact,
const globus_net_manager_attr_t *attr_array,
char **remote_contact_out,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_post_connect)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const char *remote_contact,
const globus_net_manager_attr_t *attr_array,
globus_net_manager_attr_t **attr_array_out);
typedef globus_result_t (*globus_net_manager_pre_close)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const char *remote_contact,
const globus_net_manager_attr_t *attr_array);
typedef globus_result_t (*globus_net_manager_post_close)(
struct globus_net_manager_s *manager,
const globus_net_manager_attr_t *manager_attr_array,
const char *task_id,
const char *transport,
const char *local_contact,
const char *remote_contact,
const globus_net_manager_attr_t *attr_array);
typedef
struct globus_net_manager_s
{
const char *name;
globus_net_manager_pre_listen pre_listen;
globus_net_manager_post_listen post_listen;
globus_net_manager_end_listen end_listen;
globus_net_manager_pre_accept pre_accept;
globus_net_manager_post_accept post_accept;
globus_net_manager_pre_connect pre_connect;
globus_net_manager_post_connect post_connect;
globus_net_manager_pre_close pre_close;
globus_net_manager_post_close post_close;
}
globus_net_manager_t;
extern globus_extension_registry_t globus_i_net_manager_registry;
#define GLOBUS_NET_MANAGER_REGISTRY &globus_i_net_manager_registry
globus_result_t
globus_net_manager_register(
globus_net_manager_t *manager,
globus_module_descriptor_t *module);
globus_result_t
globus_net_manager_unregister(
globus_net_manager_t *manager);
extern globus_module_descriptor_t globus_i_net_manager_module;
#define GLOBUS_NET_MANAGER_MODULE (&globus_i_net_manager_module)
typedef enum
{
GLOBUS_NET_MANAGER_ERROR_PARAMETER,
GLOBUS_NET_MANAGER_ERROR_MEMORY,
GLOBUS_NET_MANAGER_ERROR_INIT,
GLOBUS_NET_MANAGER_ERROR_MANAGER,
GLOBUS_NET_MANAGER_ERROR_WRAPPED
} globus_net_manager_error_type_t;
/* all macros in this file require each function to 'declare' their name with
* this
*/
#define GlobusNetManagerName(func)
/*
#ifdef __GNUC__
#define GlobusNetManagerName(func) static const char * _netmgr_name __attribute__((__unused__)) = #func
#else
#define GlobusNetManagerName(func) static const char * _netmgr_name = #func
#endif
*/
#define GlobusNetManagerErrorParameter(param_name) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
GLOBUS_NULL, \
GLOBUS_NET_MANAGER_ERROR_PARAMETER, \
__FILE__, \
__func__, \
__LINE__, \
"Bad parameter, %s", \
(param_name)))
#define GlobusNetManagerErrorMemory(mem_name) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
GLOBUS_NULL, \
GLOBUS_NET_MANAGER_ERROR_MEMORY, \
__FILE__, \
__func__, \
__LINE__, \
"Memory allocation failed on %s", \
(mem_name)))
#define GlobusNetManagerErrorInit(manager, explain) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
NULL, \
GLOBUS_NET_MANAGER_ERROR_INIT, \
__FILE__, \
__func__, \
__LINE__, \
"An error occurred accessing a module. %s: %s", manager, explain))
#define GlobusNetManagerErrorManager(result, manager, explain) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
globus_error_get((result)), \
GLOBUS_NET_MANAGER_ERROR_MANAGER, \
__FILE__, \
__func__, \
__LINE__, \
"A network manager (%s) errored in %s.", manager, explain))
#define GlobusNetManagerErrorWrapFailed(failed_func, result) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
globus_error_get((result)), \
GLOBUS_NET_MANAGER_ERROR_WRAPPED, \
__FILE__, \
__func__, \
__LINE__, \
"%s failed.", \
(failed_func)))
#define GlobusNetManagerErrorWrapFailedWithMessage(result, format, arg) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
globus_error_get((result)), \
GLOBUS_NET_MANAGER_ERROR_WRAPPED, \
__FILE__, \
__func__, \
__LINE__, \
(format), \
(arg)))
#define GlobusNetManagerErrorWrapFailedWithMessage2(result, format, arg1, arg2) \
globus_error_put( \
globus_error_construct_error( \
GLOBUS_NET_MANAGER_MODULE, \
globus_error_get((result)), \
GLOBUS_NET_MANAGER_ERROR_WRAPPED, \
__FILE__, \
__func__, \
__LINE__, \
(format), \
(arg1), (arg2)))
#ifdef __cplusplus
}
#endif
#endif /* GLOBUS_NET_MANAGER_H */
globus_net_manager_register
globus_result_t globus_net_manager_register(globus_net_manager_t *manager, globus_module_descriptor_t *module)
Register a network manager.
Definition: register.c:34
globus_net_manager_s::pre_close
globus_net_manager_pre_close pre_close
Definition: globus_net_manager.h:603
globus_net_manager_s::post_close
globus_net_manager_post_close post_close
Definition: globus_net_manager.h:605
globus_net_manager_s::post_accept
globus_net_manager_post_accept post_accept
Definition: globus_net_manager.h:597
globus_net_manager_end_listen
globus_result_t(* globus_net_manager_end_listen)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const globus_net_manager_attr_t *attr_array)
Net Manager End-Listen Function Signature.
Definition: globus_net_manager.h:259
globus_net_manager_pre_connect
globus_result_t(* globus_net_manager_pre_connect)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *remote_contact, const globus_net_manager_attr_t *attr_array, char **remote_contact_out, globus_net_manager_attr_t **attr_array_out)
Net Manager Pre-Connect Function Signature.
Definition: globus_net_manager.h:424
globus_net_manager_s
Net Manager Definition.
Definition: globus_net_manager.h:583
globus_net_manager_s::post_connect
globus_net_manager_post_connect post_connect
Definition: globus_net_manager.h:601
globus_net_manager_unregister
globus_result_t globus_net_manager_unregister(globus_net_manager_t *manager)
Unregister a network manager.
Definition: unregister.c:32
globus_net_manager_post_listen
globus_result_t(* globus_net_manager_post_listen)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const globus_net_manager_attr_t *attr_array, char **local_contact_out, globus_net_manager_attr_t **attr_array_out)
Net Manager Post-Listen Function Signature.
Definition: globus_net_manager.h:216
globus_net_manager_s::post_listen
globus_net_manager_post_listen post_listen
Definition: globus_net_manager.h:591
globus_net_manager_s::end_listen
globus_net_manager_end_listen end_listen
Definition: globus_net_manager.h:593
globus_net_manager_t
struct globus_net_manager_s globus_net_manager_t
Net Manager Definition.
globus_net_manager_post_connect
globus_result_t(* globus_net_manager_post_connect)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const char *remote_contact, const globus_net_manager_attr_t *attr_array, globus_net_manager_attr_t **attr_array_out)
Net Manager Post-Connect Function Signature.
Definition: globus_net_manager.h:478
globus_net_manager_s::pre_connect
globus_net_manager_pre_connect pre_connect
Definition: globus_net_manager.h:599
globus_net_manager_pre_accept
globus_result_t(* globus_net_manager_pre_accept)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const globus_net_manager_attr_t *attr_array, globus_net_manager_attr_t **attr_array_out)
Net Manager Pre-Accept Function Signature.
Definition: globus_net_manager.h:309
globus_net_manager_pre_close
globus_result_t(* globus_net_manager_pre_close)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const char *remote_contact, const globus_net_manager_attr_t *attr_array)
Net Manager Pre-Close Function Signature.
Definition: globus_net_manager.h:524
globus_net_manager_attr_s
Net Manager Attributes.
Definition: globus_net_manager_attr.h:45
globus_net_manager_post_close
globus_result_t(* globus_net_manager_post_close)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const char *remote_contact, const globus_net_manager_attr_t *attr_array)
Net Manager Post-Close Function Signature.
Definition: globus_net_manager.h:569
globus_net_manager_pre_listen
globus_result_t(* globus_net_manager_pre_listen)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const globus_net_manager_attr_t *attr_array, globus_net_manager_attr_t **attr_array_out)
Net Manager Pre-Listen Function Signature.
Definition: globus_net_manager.h:159
globus_net_manager_s::name
const char * name
Definition: globus_net_manager.h:587
globus_net_manager_s::pre_accept
globus_net_manager_pre_accept pre_accept
Definition: globus_net_manager.h:595
globus_net_manager_s::pre_listen
globus_net_manager_pre_listen pre_listen
Definition: globus_net_manager.h:589
globus_net_manager_attr.h
Globus Network Manager Attributes.
globus_net_manager_post_accept
globus_result_t(* globus_net_manager_post_accept)(struct globus_net_manager_s *manager, const globus_net_manager_attr_t *manager_attr_array, const char *task_id, const char *transport, const char *local_contact, const char *remote_contact, const globus_net_manager_attr_t *attr_array, globus_net_manager_attr_t **attr_array_out)
Net Manager Post-Accept Function Signature.
Definition: globus_net_manager.h:365