1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <stdbool.h>
5 #include <stdio.h>
6 
7 #include "sd-dhcp-lease.h"
8 
9 size_t serialize_in_addrs(FILE *f,
10                           const struct in_addr *addresses,
11                           size_t size,
12                           bool *with_leading_space,
13                           bool (*predicate)(const struct in_addr *addr));
14 int deserialize_in_addrs(struct in_addr **addresses, const char *string);
15 void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
16                          size_t size,
17                          bool *with_leading_space);
18 int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
19 
20 /* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
21 struct sd_dhcp_route;
22 struct sd_dhcp_lease;
23 
24 void serialize_dhcp_routes(FILE *f, const char *key, struct sd_dhcp_route **routes, size_t size);
25 int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, const char *string);
26 
27 /* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
28 int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
29 
30 int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
31 int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);
32