2004-06-16 09:41:13 +04:00
|
|
|
/* -*- C -*-
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-06-30 01:17:10 +04:00
|
|
|
/** @file
|
|
|
|
* @page gpr_api
|
|
|
|
*/
|
2004-06-16 09:41:13 +04:00
|
|
|
|
|
|
|
/**
|
2004-06-30 01:17:10 +04:00
|
|
|
* \brief General Purpose Registry (GPR) API
|
2004-06-16 09:41:13 +04:00
|
|
|
*
|
|
|
|
* The Open MPI General Purpose Registry (GPR)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_GPR_H_
|
|
|
|
#define MCA_GPR_H_
|
|
|
|
|
2004-06-16 21:01:24 +04:00
|
|
|
/*
|
|
|
|
* includes
|
|
|
|
*/
|
2004-06-16 09:41:13 +04:00
|
|
|
|
2004-06-16 21:01:24 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2004-06-16 09:41:13 +04:00
|
|
|
#include "include/types.h"
|
2004-06-16 21:01:24 +04:00
|
|
|
#include "include/constants.h"
|
|
|
|
#include "class/ompi_list.h"
|
2004-08-15 09:49:55 +04:00
|
|
|
#include "util/pack.h"
|
2004-06-16 21:01:24 +04:00
|
|
|
|
2004-06-16 09:41:13 +04:00
|
|
|
#include "mca/mca.h"
|
2004-08-15 09:49:55 +04:00
|
|
|
#include "mca/oob/base/base.h"
|
2004-06-16 21:01:24 +04:00
|
|
|
#include "mca/ns/base/base.h"
|
2004-06-16 09:41:13 +04:00
|
|
|
|
2004-06-16 21:01:24 +04:00
|
|
|
/** Define the notification actions for the subscription system
|
|
|
|
*/
|
2004-08-19 19:14:29 +04:00
|
|
|
#define OMPI_REGISTRY_NOTIFY_MODIFICATION 0x0001 /**< Notifies subscriber when object modified */
|
|
|
|
#define OMPI_REGISTRY_NOTIFY_ADD_SUBSCRIBER 0x0002 /**< Notifies subscriber when another subscriber added */
|
|
|
|
#define OMPI_REGISTRY_NOTIFY_DELETE 0x0004 /**< Notifies subscriber when object deleted */
|
|
|
|
#define OMPI_REGISTRY_NOTIFY_ALL 0xffff /**< Notifies subscriber upon any action */
|
|
|
|
|
|
|
|
typedef uint16_t ompi_registry_notify_action_t;
|
2004-06-16 21:01:24 +04:00
|
|
|
|
|
|
|
|
|
|
|
/** Define the mode bit-masks for registry operations.
|
|
|
|
*/
|
2004-08-19 19:14:29 +04:00
|
|
|
#define OMPI_REGISTRY_NONE 0x0000 /**< None */
|
|
|
|
#define OMPI_REGISTRY_OVERWRITE 0x0001 /**< Overwrite Permission */
|
|
|
|
#define OMPI_REGISTRY_AND 0x0002 /**< AND tokens together for search results */
|
|
|
|
#define OMPI_REGISTRY_OR 0x0004 /**< OR tokens for search results */
|
|
|
|
#define OMPI_REGISTRY_XAND 0x0008 /**< All tokens required, nothing else allowed */
|
|
|
|
#define OMPI_REGISTRY_XOR 0x0010 /**< Any one of the tokens required, nothing else allowed */
|
|
|
|
|
|
|
|
typedef uint16_t ompi_registry_mode_t;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define flag values for remote commands - only used internally
|
|
|
|
*/
|
2004-08-19 20:51:51 +04:00
|
|
|
#define MCA_GPR_DELETE_SEGMENT_CMD 0x0001
|
|
|
|
#define MCA_GPR_PUT_CMD 0x0002
|
|
|
|
#define MCA_GPR_DELETE_OBJECT_CMD 0x0004
|
|
|
|
#define MCA_GPR_INDEX_CMD 0x0008
|
|
|
|
#define MCA_GPR_SUBSCRIBE_CMD 0x0010
|
|
|
|
#define MCA_GPR_UNSUBSCRIBE_CMD 0x0020
|
|
|
|
#define MCA_GPR_GET_CMD 0x0040
|
|
|
|
#define MCA_GPR_TEST_INTERNALS_CMD 0x0080
|
2004-08-19 19:14:29 +04:00
|
|
|
#define MCA_GPR_ERROR 0xffff
|
|
|
|
|
|
|
|
typedef uint16_t mca_gpr_cmd_flag_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* packing type definitions
|
|
|
|
*/
|
|
|
|
/* CAUTION - any changes here must also change corresponding
|
|
|
|
* typedefs above
|
|
|
|
*/
|
|
|
|
#define MCA_GPR_OOB_PACK_CMD OMPI_INT16
|
|
|
|
#define MCA_GPR_OOB_PACK_ACTION OMPI_INT16
|
|
|
|
#define MCA_GPR_OOB_PACK_MODE OMPI_INT16
|
|
|
|
#define MCA_GPR_OOB_PACK_OBJECT_SIZE OMPI_INT32
|
|
|
|
|
2004-06-16 21:01:24 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* typedefs
|
|
|
|
*/
|
|
|
|
|
2004-08-19 19:14:29 +04:00
|
|
|
typedef void* ompi_registry_object_t;
|
|
|
|
typedef uint32_t ompi_registry_object_size_t;
|
2004-06-16 21:01:24 +04:00
|
|
|
|
|
|
|
|
2004-06-16 09:41:13 +04:00
|
|
|
/*
|
2004-08-15 09:49:55 +04:00
|
|
|
* structures
|
2004-06-16 09:41:13 +04:00
|
|
|
*/
|
|
|
|
|
2004-08-15 09:49:55 +04:00
|
|
|
/** Return value structure for registry requests.
|
|
|
|
* A request for information stored within the registry returns a linked list of values that
|
|
|
|
* correspond to the provided tokens. The linked list is terminated by a "next" value of NULL.
|
|
|
|
* Each link in the list contains a pointer to a copy of the registry object, and the size
|
|
|
|
* of that object in bytes. Note that the pointer is to a \em copy of the object, and not
|
|
|
|
* to the registry object itself. This prevents inadvertent modification of the registry, but
|
|
|
|
* may require the recipient to release the structure's memory when done.
|
2004-06-16 09:41:13 +04:00
|
|
|
*/
|
2004-08-15 09:49:55 +04:00
|
|
|
struct ompi_registry_value_t {
|
|
|
|
ompi_list_item_t item; /**< Allows this item to be placed on a list */
|
2004-08-19 19:14:29 +04:00
|
|
|
ompi_registry_object_t object; /**< Pointer to object being returned */
|
2004-08-15 09:49:55 +04:00
|
|
|
ompi_registry_object_size_t object_size; /**< Size of returned object, in bytes */
|
|
|
|
};
|
|
|
|
typedef struct ompi_registry_value_t ompi_registry_value_t;
|
2004-06-16 09:41:13 +04:00
|
|
|
|
2004-08-15 09:49:55 +04:00
|
|
|
OBJ_CLASS_DECLARATION(ompi_registry_value_t);
|
|
|
|
|
|
|
|
/** Return value structure for index requests.
|
2004-06-16 21:01:24 +04:00
|
|
|
*/
|
2004-08-17 01:36:50 +04:00
|
|
|
struct ompi_registry_index_value_t {
|
2004-08-15 09:49:55 +04:00
|
|
|
ompi_list_item_t item; /**< Allows this item to be placed on a list */
|
2004-08-16 06:08:48 +04:00
|
|
|
char *token; /**< Pointer to the token string */
|
2004-08-15 09:49:55 +04:00
|
|
|
};
|
2004-08-17 01:36:50 +04:00
|
|
|
typedef struct ompi_registry_index_value_t ompi_registry_index_value_t;
|
2004-06-16 21:01:24 +04:00
|
|
|
|
2004-08-17 01:36:50 +04:00
|
|
|
OBJ_CLASS_DECLARATION(ompi_registry_index_value_t);
|
2004-06-16 21:01:24 +04:00
|
|
|
|
2004-08-17 08:23:06 +04:00
|
|
|
/** Return value for test results on internal test
|
|
|
|
*/
|
|
|
|
struct ompi_registry_internal_test_results_t {
|
|
|
|
ompi_list_item_t item; /**< Allows this item to be placed on a list */
|
|
|
|
char *test;
|
|
|
|
char *message;
|
|
|
|
};
|
|
|
|
typedef struct ompi_registry_internal_test_results_t ompi_registry_internal_test_results_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(ompi_registry_internal_test_results_t);
|
|
|
|
|
|
|
|
|
2004-06-16 09:41:13 +04:00
|
|
|
/*
|
2004-08-15 09:49:55 +04:00
|
|
|
* Component functions that MUST be provided
|
2004-06-16 09:41:13 +04:00
|
|
|
*/
|
2004-08-15 07:33:13 +04:00
|
|
|
typedef int (*mca_gpr_base_module_delete_segment_fn_t)(char *segment);
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_gpr_base_module_put_fn_t)(ompi_registry_mode_t mode, char *segment,
|
2004-06-16 09:41:13 +04:00
|
|
|
char **tokens, ompi_registry_object_t *object,
|
2004-08-15 09:49:55 +04:00
|
|
|
ompi_registry_object_size_t size);
|
2004-08-17 01:36:50 +04:00
|
|
|
typedef ompi_list_t* (*mca_gpr_base_module_get_fn_t)(ompi_registry_mode_t mode,
|
|
|
|
char *segment, char **tokens);
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_gpr_base_module_delete_fn_t)(ompi_registry_mode_t mode,
|
2004-06-16 09:41:13 +04:00
|
|
|
char *segment, char **tokens);
|
2004-08-17 01:36:50 +04:00
|
|
|
typedef ompi_list_t* (*mca_gpr_base_module_index_fn_t)(char *segment);
|
2004-08-16 06:08:48 +04:00
|
|
|
typedef int (*mca_gpr_base_module_subscribe_fn_t)(ompi_process_name_t* subscriber,
|
|
|
|
ompi_registry_mode_t mode,
|
|
|
|
ompi_registry_notify_action_t action,
|
|
|
|
char *segment, char **tokens);
|
|
|
|
typedef int (*mca_gpr_base_module_unsubscribe_fn_t)(ompi_process_name_t* subscriber,
|
|
|
|
ompi_registry_mode_t mode,
|
|
|
|
char *segment, char **tokens);
|
2004-06-16 09:41:13 +04:00
|
|
|
|
2004-08-17 08:23:06 +04:00
|
|
|
/*
|
|
|
|
* test interface for internal functions - optional to provide
|
|
|
|
*/
|
|
|
|
typedef ompi_list_t* (*mca_gpr_base_module_test_internals_fn_t)(int level);
|
|
|
|
|
2004-06-16 09:41:13 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ver 1.0.0
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_gpr_base_module_1_0_0_t {
|
|
|
|
mca_gpr_base_module_get_fn_t get;
|
|
|
|
mca_gpr_base_module_put_fn_t put;
|
2004-08-15 07:33:13 +04:00
|
|
|
mca_gpr_base_module_delete_segment_fn_t delete_segment;
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_gpr_base_module_subscribe_fn_t subscribe;
|
|
|
|
mca_gpr_base_module_unsubscribe_fn_t unsubscribe;
|
2004-08-16 20:20:47 +04:00
|
|
|
mca_gpr_base_module_delete_fn_t delete_object;
|
2004-08-17 01:36:50 +04:00
|
|
|
mca_gpr_base_module_index_fn_t index;
|
2004-08-17 08:23:06 +04:00
|
|
|
mca_gpr_base_module_test_internals_fn_t test_internals;
|
2004-06-16 09:41:13 +04:00
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct mca_gpr_base_module_1_0_0_t mca_gpr_base_module_1_0_0_t;
|
2004-06-16 09:41:13 +04:00
|
|
|
typedef mca_gpr_base_module_1_0_0_t mca_gpr_base_module_t;
|
|
|
|
|
2004-08-15 09:49:55 +04:00
|
|
|
/*
|
|
|
|
* GPR Component
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef mca_gpr_base_module_t* (*mca_gpr_base_component_init_fn_t)(
|
|
|
|
bool *allow_multi_user_threads,
|
|
|
|
bool *have_hidden_threads,
|
|
|
|
int *priority);
|
|
|
|
|
|
|
|
typedef int (*mca_gpr_base_component_finalize_fn_t)(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the standard component data structure
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
struct mca_gpr_base_component_1_0_0_t {
|
|
|
|
mca_base_component_t gpr_version;
|
|
|
|
mca_base_component_data_1_0_0_t gpr_data;
|
|
|
|
|
|
|
|
mca_gpr_base_component_init_fn_t gpr_init;
|
|
|
|
mca_gpr_base_component_finalize_fn_t gpr_finalize;
|
|
|
|
};
|
|
|
|
typedef struct mca_gpr_base_component_1_0_0_t mca_gpr_base_component_1_0_0_t;
|
|
|
|
typedef mca_gpr_base_component_1_0_0_t mca_gpr_base_component_t;
|
|
|
|
|
|
|
|
|
2004-06-16 09:41:13 +04:00
|
|
|
/*
|
|
|
|
* Macro for use in modules that are of type coll v1.0.0
|
|
|
|
*/
|
|
|
|
#define MCA_GPR_BASE_VERSION_1_0_0 \
|
|
|
|
/* gpr v1.0 is chained to MCA v1.0 */ \
|
|
|
|
MCA_BASE_VERSION_1_0_0, \
|
|
|
|
/* gpr v1.0 */ \
|
|
|
|
"gpr", 1, 0, 0
|
|
|
|
|
|
|
|
#endif
|