File indexing completed on 2025-02-22 10:47:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef PMIX_PSEC_H
0031 #define PMIX_PSEC_H
0032
0033 #include "src/include/pmix_config.h"
0034
0035 #include "src/mca/base/pmix_mca_base_framework.h"
0036 #include "src/mca/base/pmix_mca_base_var.h"
0037 #include "src/mca/mca.h"
0038 #include "src/mca/ptl/ptl_types.h"
0039
0040 BEGIN_C_DECLS
0041
0042
0043 struct pmix_peer_t;
0044
0045
0046
0047
0048
0049
0050
0051 typedef pmix_status_t (*pmix_psec_base_module_init_fn_t)(void);
0052
0053
0054
0055
0056
0057 typedef void (*pmix_psec_base_module_fini_fn_t)(void);
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 typedef pmix_status_t (*pmix_psec_base_module_create_cred_fn_t)(struct pmix_peer_t *peer,
0070 const pmix_info_t directives[],
0071 size_t ndirs, pmix_info_t **info,
0072 size_t *ninfo,
0073 pmix_byte_object_t *cred);
0074
0075
0076
0077
0078
0079
0080 typedef pmix_status_t (*pmix_psec_base_module_client_hndshk_fn_t)(int sd);
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 typedef pmix_status_t (*pmix_psec_base_module_validate_cred_fn_t)(struct pmix_peer_t *peer,
0094 const pmix_info_t directives[],
0095 size_t ndirs, pmix_info_t **info,
0096 size_t *ninfo,
0097 const pmix_byte_object_t *cred);
0098
0099
0100
0101
0102
0103
0104 typedef pmix_status_t (*pmix_psec_base_module_server_hndshk_fn_t)(int sd);
0105
0106
0107
0108
0109 typedef struct {
0110 char *name;
0111
0112 pmix_psec_base_module_init_fn_t init;
0113 pmix_psec_base_module_fini_fn_t finalize;
0114
0115 pmix_psec_base_module_create_cred_fn_t create_cred;
0116 pmix_psec_base_module_client_hndshk_fn_t client_handshake;
0117
0118 pmix_psec_base_module_validate_cred_fn_t validate_cred;
0119 pmix_psec_base_module_server_hndshk_fn_t server_handshake;
0120 } pmix_psec_module_t;
0121
0122
0123
0124
0125
0126 PMIX_EXPORT char *pmix_psec_base_get_available_modules(void);
0127
0128
0129 PMIX_EXPORT pmix_psec_module_t *pmix_psec_base_assign_module(const char *options);
0130
0131
0132
0133 #define PMIX_PSEC_CREATE_CRED(r, p, d, nd, in, nin, c) \
0134 (r) = (p)->nptr->compat.psec->create_cred((struct pmix_peer_t *) (p), (d), (nd), (in), (nin), c)
0135
0136 #define PMIX_PSEC_CLIENT_HANDSHAKE(r, p, sd) (r) = (p)->nptr->compat.psec->client_handshake(sd)
0137
0138 #define PMIX_PSEC_VALIDATE_CRED(r, p, d, nd, in, nin, c) \
0139 (r) = (p)->nptr->compat.psec->validate_cred((struct pmix_peer_t *) (p), (d), (nd), (in), \
0140 (nin), c)
0141
0142 #define PMIX_PSEC_VALIDATE_CONNECTION(r, p, d, nd, in, nin, c) \
0143 do { \
0144 int _r; \
0145 \
0146 if (NULL != (p)->nptr->compat.psec->validate_cred) { \
0147 _r = (p)->nptr->compat.psec->validate_cred((struct pmix_peer_t *) (p), (d), (nd), \
0148 (in), (nin), c); \
0149 if (PMIX_SUCCESS != _r) { \
0150 pmix_output_verbose(2, pmix_globals.debug_output, \
0151 "validation of credential failed: %s", PMIx_Error_string(_r)); \
0152 } else { \
0153 pmix_output_verbose(2, pmix_globals.debug_output, "credential validated"); \
0154 } \
0155 (r) = _r; \
0156 } else if (NULL != (p)->nptr->compat.psec->server_handshake) { \
0157 \
0158 pmix_output_verbose(2, pmix_globals.debug_output, "requesting handshake"); \
0159 _r = PMIX_ERR_READY_FOR_HANDSHAKE; \
0160 (r) = _r; \
0161 } else { \
0162 \
0163 (r) = PMIX_ERR_NOT_SUPPORTED; \
0164 } \
0165 } while (0)
0166
0167 #define PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(r, p, d, nd, in, nin, c) \
0168 if (PMIX_ERR_READY_FOR_HANDSHAKE == r) { \
0169 int _r; \
0170 \
0171 pmix_output_verbose(2, pmix_globals.debug_output, "executing handshake"); \
0172 if (PMIX_SUCCESS != (_r = p->nptr->compat.psec->server_handshake((p)->sd))) { \
0173 PMIX_ERROR_LOG(_r); \
0174 } \
0175 \
0176 (r) = _r; \
0177 }
0178
0179
0180
0181
0182 typedef pmix_status_t (*pmix_psec_base_component_init_fn_t)(void);
0183
0184
0185 typedef void (*pmix_psec_base_component_finalize_fn_t)(void);
0186
0187
0188 typedef pmix_psec_module_t *(*pmix_psec_base_component_assign_module_fn_t)(void);
0189
0190
0191
0192
0193 struct pmix_psec_base_component_t {
0194 pmix_mca_base_component_t base;
0195 int priority;
0196 pmix_psec_base_component_init_fn_t init;
0197 pmix_psec_base_component_finalize_fn_t finalize;
0198 pmix_psec_base_component_assign_module_fn_t assign_module;
0199 };
0200 typedef struct pmix_psec_base_component_t pmix_psec_base_component_t;
0201
0202
0203
0204
0205 #define PMIX_PSEC_BASE_VERSION_1_0_0 PMIX_MCA_BASE_VERSION_1_0_0("psec", 1, 0, 0)
0206
0207 END_C_DECLS
0208
0209 #endif