#include "src/include/pmix_config.h"
#include "pmix_common.h"
#include "src/include/pmix_globals.h"
#include "src/class/pmix_list.h"
#include "src/mca/ptl/base/base.h"
#include "src/util/pmix_argv.h"
#include "src/util/pmix_error.h"
#include "src/util/pmix_output.h"
#include "src/mca/psec/base/base.h"
char *pmix_psec_base_get_available_modules(void)
{
pmix_psec_base_active_module_t *active;
char **tmp = NULL, *reply = NULL;
if (!pmix_psec_globals.initialized) {
return NULL;
}
PMIX_LIST_FOREACH (active, &pmix_psec_globals.actives, pmix_psec_base_active_module_t) {
PMIx_Argv_append_nosize(&tmp, active->component->base.pmix_mca_component_name);
}
if (NULL != tmp) {
reply = PMIx_Argv_join(tmp, ',');
PMIx_Argv_free(tmp);
}
return reply;
}
pmix_psec_module_t *pmix_psec_base_assign_module(const char *options)
{
pmix_psec_base_active_module_t *active;
pmix_psec_module_t *mod;
char **tmp = NULL;
int i;
if (!pmix_psec_globals.initialized) {
return NULL;
}
if (NULL != options) {
tmp = PMIx_Argv_split(options, ',');
}
PMIX_LIST_FOREACH (active, &pmix_psec_globals.actives, pmix_psec_base_active_module_t) {
if (NULL == tmp) {
if (NULL != (mod = active->component->assign_module())) {
return mod;
}
} else {
for (i = 0; NULL != tmp[i]; i++) {
if (0 == strcmp(tmp[i], active->component->base.pmix_mca_component_name)) {
if (NULL != (mod = active->component->assign_module())) {
PMIx_Argv_free(tmp);
return mod;
}
}
}
}
}
if (NULL != tmp) {
PMIx_Argv_free(tmp);
}
return NULL;
}