summaryrefslogtreecommitdiffstats
path: root/src/H5FDmirror.h
blob: 95ce936594d02b56cc9bb19fec74dc7cb617497f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://www.hdfgroup.org/licenses.               *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 * Purpose:	The public header file for the mirror virtual file driver (VFD)
 */

#ifndef H5FDmirror_H
#define H5FDmirror_H

#ifdef H5_HAVE_MIRROR_VFD

/** Initializer for the mirror VFD */
#define H5FD_MIRROR (H5FDperform_init(H5FD_mirror_init))

/** Identifier for the mirror VFD */
#define H5FD_MIRROR_VALUE H5_VFD_MIRROR

/** Magic number to identify the H5FD_mirror_fapl_t struct */
#define H5FD_MIRROR_FAPL_MAGIC 0xF8DD514C

/**
 * The version number of the H5FD_mirror_fapl_t configuration
 * structure for the #H5FD_MIRROR driver
 */
#define H5FD_MIRROR_CURR_FAPL_T_VERSION 1

/** Max size of the remote_ip array in H5FD_mirror_fapl_t */
#define H5FD_MIRROR_MAX_IP_LEN 45 /* Max size of an IPv4-mapped IPv6 address */

/**
 *\struct H5FD_mirror_fapl_t
 * \brief Configuration structure for H5Pset_fapl_mirror() / H5Pget_fapl_mirror()
 *
 * \details H5FD_mirror_fapl_t is a public structure that is used to pass
 *          configuration data to the #H5FD_MIRROR driver via a File Access
 *          Property List. A pointer to an instance of this structure is
 *          a parameter to H5Pset_fapl_mirror() and H5Pget_fapl_mirror().
 *
 * \var uint32_t H5FD_mirror_fapl_t::magic
 *      Semi-unique number to sanity-check pointers to this structure type.
 *      Must equal H5FD_MIRROR_FAPL_MAGIC to be considered valid.
 *
 * \var uint32_t H5FD_mirror_fapl_t::version
 *      Version number of the H5FD_mirror_fapl_t structure. Any instance passed
 *      to H5Pset_fapl_mirror() / H5Pget_fapl_mirror() must have a recognized version
 *      number or an error will be raised. Currently, this field should be set
 *      to #H5FD_MIRROR_CURR_FAPL_T_VERSION.
 *
 * \var int H5FD_mirror_fapl_t::handshake_port
 *      Port number on the remote host.
 *
 * \var char H5FD_mirror_fapl_t::remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1]
 *      IP address string of the remote host.
 */
typedef struct H5FD_mirror_fapl_t {
    uint32_t magic;
    uint32_t version;
    int      handshake_port;
    char     remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1];
} H5FD_mirror_fapl_t;

#ifdef __cplusplus
extern "C" {
#endif

/** @private
 *
 * \brief Private initializer for the mirror VFD
 */
H5_DLL hid_t H5FD_mirror_init(void);

/**
 * \ingroup FAPL
 *
 * \brief Queries a File Access Property List for #H5FD_MIRROR file driver properties
 *
 * \fapl_id
 * \param[out] fa_out Pointer to #H5FD_MIRROR driver configuration structure
 * \returns \herr_t
 *
 * \details H5Pget_fapl_mirror() queries the #H5FD_MIRROR driver properties as set
 *          by H5Pset_fapl_mirror().
 *
 * \since 1.10.7
 */
H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out);

/**
 * \ingroup FAPL
 *
 * \brief Modifies the file access property list to use the #H5FD_MIRROR driver
 *
 * \fapl_id
 * \param[in] fa Pointer to #H5FD_MIRROR driver configuration structure
 *
 * \returns \herr_t
 *
 * \details H5Pset_fapl_mirror() modifies the file access property list to use the
 *          #H5FD_MIRROR driver.
 *
 * \since 1.10.7
 */
H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa);

#ifdef __cplusplus
}
#endif

#else /* H5_HAVE_MIRROR_VFD */

#define H5FD_MIRROR (H5I_INAVLID_HID)

#endif /* H5_HAVE_MIRROR_VFD */

#endif /* H5FDmirror_H */