summaryrefslogtreecommitdiffstats
path: root/utils/mirror_vfd/mirror_remote.h
blob: 7a72372353c6e18a2e9461e04a793c7a52782373 (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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/* Common definitions for "remote" processes for the Mirror VFD.
 *
 * Jacob Smith, 2020-03-06
 */

#include "hdf5.h"
#include "hdf5dev.h"
#include "H5private.h"

#ifdef H5_HAVE_MIRROR_VFD

#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */

#define V_NONE 0
#define V_ERR  1
#define V_WARN 2
#define V_INFO 3
#define V_ALL  4

#define MIRROR_LOG_DEFAULT_STREAM    stdout
#define MIRROR_LOG_DEFAULT_VERBOSITY V_WARN
#define MIRROR_LOG_PREFIX_MAX        79
#define MIRROR_LOG_INFO_MAGIC        0x569D589A

typedef struct mirror_log_info {
    uint32_t     magic;
    FILE *       stream;
    unsigned int verbosity;
    char         prefix[MIRROR_LOG_PREFIX_MAX + 1];
} loginfo_t;

void       mirror_log(loginfo_t *info, unsigned int level, const char *format, ...);
void       mirror_log_bytes(loginfo_t *info, unsigned int level, size_t n_bytes, const unsigned char *buf);
loginfo_t *mirror_log_init(char *path, char *prefix, unsigned int verbosity);
int        mirror_log_term(loginfo_t *loginfo);

herr_t run_writer(int socketfd, H5FD_mirror_xmit_open_t *xmit_open);

#endif /* H5_HAVE_MIRROR_VFD */