1 /* 2 * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. 3 * Copyright (c) 2015 Artem Y. Polyakov <artpol84@gmail.com>. 4 * All rights reserved. 5 * Copyright (c) 2015-2019 Research Organization for Information Science 6 * and Technology (RIST). All rights reserved. 7 * $COPYRIGHT$ 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are 11 * met: 12 * 13 * - Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * - Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer listed 18 * in this license in the documentation and/or other materials 19 * provided with the distribution. 20 * 21 * - Neither the name of the copyright holders nor the names of its 22 * contributors may be used to endorse or promote products derived from 23 * this software without specific prior written permission. 24 * 25 * The copyright holders provide no reassurances that the source code 26 * provided does not infringe any patent, copyright, or any other 27 * intellectual property rights of third parties. The copyright holders 28 * disclaim any liability to any recipient for claims brought against 29 * recipient by any third party for infringement of that parties 30 * intellectual property rights. 31 * 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 42 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 * 44 * $HEADER$ 45 * 46 * PMIx provides a "function-shipping" approach to support for 47 * implementing the server-side of the protocol. This method allows 48 * resource managers to implement the server without being burdened 49 * with PMIx internal details. Accordingly, each PMIx API is mirrored 50 * here in a function call to be provided by the server. When a 51 * request is received from the client, the corresponding server function 52 * will be called with the information. 53 * 54 * Any functions not supported by the RM can be indicated by a NULL for 55 * the function pointer. Client calls to such functions will have a 56 * "not supported" error returned. 57 */ 58 59 #ifndef PMIx_EXTEND_H 60 #define PMIx_EXTEND_H 61 62 #if defined(c_plusplus) || defined(__cplusplus) 63 extern "C" { 64 #endif 65 66 /* declare a convenience macro for checking keys */ 67 #define PMIX_CHECK_KEY(a, b) \ 68 (0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN)) 69 70 /* define a convenience macro for checking nspaces */ 71 #define PMIX_CHECK_NSPACE(a, b) \ 72 (0 == strncmp((a), (b), PMIX_MAX_NSLEN)) 73 74 /* define a convenience macro for checking names */ 75 #define PMIX_CHECK_PROCID(a, b) \ 76 (PMIX_CHECK_NSPACE((a)->nspace, (b)->nspace) && ((a)->rank == (b)->rank || (PMIX_RANK_WILDCARD == (a)->rank || PMIX_RANK_WILDCARD == (b)->rank))) 77 78 /* expose some functions that are resolved in the 79 * PMIx library, but part of a header that 80 * includes internal functions - we don't 81 * want to expose the entire header here. For 82 * consistency, we provide macro versions as well 83 */ 84 void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type); 85 86 pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data, size_t *sz); 87 88 pmix_status_t pmix_value_xfer(pmix_value_t *kv, const pmix_value_t *src); 89 90 pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg); 91 92 pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg); 93 94 pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg); 95 96 void pmix_argv_free(char **argv); 97 98 char **pmix_argv_split(const char *src_string, int delimiter); 99 100 int pmix_argv_count(char **argv); 101 102 char *pmix_argv_join(char **argv, int delimiter); 103 104 char **pmix_argv_copy(char **argv); 105 106 pmix_status_t pmix_setenv(const char *name, const char *value, 107 bool overwrite, char ***env); 108 109 110 #if defined(c_plusplus) || defined(__cplusplus) 111 } 112 #endif 113 114 #endif