Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:47:26

0001 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
0002 /*
0003  * Copyright (c) 2019      IBM Corporation.  All rights reserved.
0004  * Copyright (c) 2019      Mellanox Technologies, Inc.
0005  *                         All rights reserved.
0006  * Copyright (c) 2020      Intel, Inc.  All rights reserved.
0007  * Copyright (c) 2021-2022 Nanook Consulting.  All rights reserved.
0008  * $COPYRIGHT$
0009  *
0010  * Additional copyrights may follow
0011  *
0012  * $HEADER$
0013  */
0014 
0015 /**
0016  * @file
0017  *
0018  * This interface is for the encoding/decoding of basic types and the
0019  * compression/decompression of larger blobs of data (i.e., modex).
0020  *
0021  * Available plugins may be defined at runtime via the typical MCA parameter
0022  * syntax.
0023  */
0024 
0025 #ifndef PMIX_PSQUASH_H
0026 #define PMIX_PSQUASH_H
0027 
0028 #include "src/include/pmix_config.h"
0029 
0030 #include "src/mca/base/pmix_mca_base_framework.h"
0031 #include "src/mca/base/pmix_mca_base_var.h"
0032 #include "src/mca/mca.h"
0033 
0034 BEGIN_C_DECLS
0035 
0036 /******    MODULE DEFINITION    ******/
0037 
0038 /**
0039  * Initialize the module
0040  */
0041 typedef pmix_status_t (*pmix_psquash_base_module_init_fn_t)(void);
0042 
0043 /**
0044  * Finalize the module
0045  */
0046 typedef void (*pmix_psquash_base_module_finalize_fn_t)(void);
0047 
0048 /**
0049  *  Maximum size of the type.
0050  *
0051  * type - Type (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
0052  * size - size of the type
0053  */
0054 typedef pmix_status_t (*pmix_psquash_get_max_size_fn_t)(pmix_data_type_t type, size_t *size);
0055 
0056 /**
0057  * Encode a basic integer type into a contiguous destination buffer.
0058  *
0059  * type     - Type of the 'src' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
0060  * src      - pointer to a single basic integer type
0061  * dest     - pointer to buffer to store data
0062  * dst_len  - pointer to the packed size of dest, in bytes
0063  */
0064 
0065 typedef pmix_status_t (*pmix_psquash_encode_int_fn_t)(pmix_data_type_t type, void *src, void *dest,
0066                                                       size_t *dst_len);
0067 
0068 /**
0069  * Decode a basic a contiguous destination buffer into a basic integer type.
0070  *
0071  * type     - Type of the 'dest' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64)
0072  * src      - pointer to buffer where data was stored
0073  * src_len  - length, in bytes, of the src buffer
0074  * dest     - pointer to a single basic integer type
0075  * dst_len  - pointer to the unpacked size of dest, in bytes
0076  */
0077 typedef pmix_status_t (*pmix_psquash_decode_int_fn_t)(pmix_data_type_t type, void *src,
0078                                                       size_t src_len, void *dest, size_t *dst_len);
0079 
0080 /**
0081  * Base structure for a PSQUASH module
0082  */
0083 typedef struct {
0084     const char *name;
0085     /* flag indicating if the type is encoded within the value, otherwise, it is necessary to
0086      * further pack the type with the value. */
0087     bool int_type_is_encoded;
0088 
0089     /** init/finalize */
0090     pmix_psquash_base_module_init_fn_t init;
0091     pmix_psquash_base_module_finalize_fn_t finalize;
0092 
0093     pmix_psquash_get_max_size_fn_t get_max_size;
0094 
0095     /** Integer compression */
0096     pmix_psquash_encode_int_fn_t encode_int;
0097     pmix_psquash_decode_int_fn_t decode_int;
0098 } pmix_psquash_base_module_t;
0099 
0100 /**
0101  * Base structure for a PSQUASH component
0102  */
0103 struct pmix_psquash_base_component_t {
0104     pmix_mca_base_component_t base;
0105     int priority;
0106 };
0107 typedef struct pmix_psquash_base_component_t pmix_psquash_base_component_t;
0108 
0109 PMIX_EXPORT extern pmix_psquash_base_module_t pmix_psquash;
0110 
0111 /*
0112  * Macro for use in components that are of type psquash
0113  */
0114 #define PMIX_PSQUASH_BASE_VERSION_1_0_0 PMIX_MCA_BASE_VERSION_1_0_0("psquash", 1, 0, 0)
0115 
0116 END_C_DECLS
0117 
0118 #endif