1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdio.h>
5
6 #include "fdset.h"
7 #include "macro.h"
8 #include "string-util.h"
9 #include "time-util.h"
10
11 int serialize_item(FILE *f, const char *key, const char *value);
12 int serialize_item_escaped(FILE *f, const char *key, const char *value);
13 int serialize_item_format(FILE *f, const char *key, const char *value, ...) _printf_(3,4);
14 int serialize_fd(FILE *f, FDSet *fds, const char *key, int fd);
15 int serialize_usec(FILE *f, const char *key, usec_t usec);
16 int serialize_dual_timestamp(FILE *f, const char *key, const dual_timestamp *t);
17 int serialize_strv(FILE *f, const char *key, char **l);
18
serialize_bool(FILE * f,const char * key,bool b)19 static inline int serialize_bool(FILE *f, const char *key, bool b) {
20 return serialize_item(f, key, yes_no(b));
21 }
22
23 int deserialize_usec(const char *value, usec_t *timestamp);
24 int deserialize_dual_timestamp(const char *value, dual_timestamp *t);
25 int deserialize_environment(const char *value, char ***environment);
26
27 int open_serialization_fd(const char *ident);
28