]> git.proxmox.com Git - systemd.git/blob - src/libsystemd-network/network-internal.h
New upstream version 245.7
[systemd.git] / src / libsystemd-network / network-internal.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <linux/nl80211.h>
5 #include <stdbool.h>
6
7 #include "sd-device.h"
8 #include "sd-dhcp-lease.h"
9
10 #include "conf-parser.h"
11 #include "def.h"
12 #include "set.h"
13 #include "strv.h"
14
15 #define LINK_BRIDGE_PORT_PRIORITY_INVALID 128
16 #define LINK_BRIDGE_PORT_PRIORITY_MAX 63
17
18 char *link_get_type_string(unsigned short iftype, sd_device *device);
19 bool net_match_config(Set *match_mac,
20 Set *match_permanent_mac,
21 char * const *match_paths,
22 char * const *match_drivers,
23 char * const *match_iftypes,
24 char * const *match_names,
25 char * const *match_property,
26 char * const *match_wifi_iftype,
27 char * const *match_ssid,
28 Set *match_bssid,
29 sd_device *device,
30 const struct ether_addr *dev_mac,
31 const struct ether_addr *dev_permanent_mac,
32 const char *dev_driver,
33 unsigned short dev_iftype,
34 const char *dev_name,
35 char * const *alternative_names,
36 enum nl80211_iftype dev_wifi_iftype,
37 const char *dev_ssid,
38 const struct ether_addr *dev_bssid);
39
40 CONFIG_PARSER_PROTOTYPE(config_parse_net_condition);
41 CONFIG_PARSER_PROTOTYPE(config_parse_hwaddr);
42 CONFIG_PARSER_PROTOTYPE(config_parse_hwaddrs);
43 CONFIG_PARSER_PROTOTYPE(config_parse_match_strv);
44 CONFIG_PARSER_PROTOTYPE(config_parse_match_ifnames);
45 CONFIG_PARSER_PROTOTYPE(config_parse_match_property);
46 CONFIG_PARSER_PROTOTYPE(config_parse_ifalias);
47 CONFIG_PARSER_PROTOTYPE(config_parse_bridge_port_priority);
48
49 int net_get_unique_predictable_data(sd_device *device, bool use_sysname, uint64_t *result);
50 const char *net_get_name_persistent(sd_device *device);
51
52 size_t serialize_in_addrs(FILE *f,
53 const struct in_addr *addresses,
54 size_t size,
55 bool with_leading_space,
56 bool (*predicate)(const struct in_addr *addr));
57 int deserialize_in_addrs(struct in_addr **addresses, const char *string);
58 void serialize_in6_addrs(FILE *f, const struct in6_addr *addresses,
59 size_t size);
60 int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
61
62 /* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
63 struct sd_dhcp_route;
64
65 void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, size_t size);
66 int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t *ret_allocated, const char *string);
67
68 /* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
69 int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
70
71 #define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network"))