dhcp: introduce dhcp-forward.h

Then, rework header inclusions for DHCP related files.
This commit is contained in:
Yu Watanabe
2026-05-22 23:06:54 +09:00
parent db8f504afb
commit 76ae87e222
32 changed files with 65 additions and 55 deletions
@@ -1,13 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <linux/if_ether.h>
#include "sd-dhcp-client-id.h"
#include "dhcp-duid-internal.h"
#include "sd-forward.h"
#include "sparse-endian.h"
#include "dhcp-forward.h"
#include "ether-addr-util.h"
/* RFC 2132 section 9.14: its minimum length is 2.
* Note, its maximum is not mentioend in the RFC. Hence, 255. */
@@ -4,13 +4,11 @@
#include "sd-dhcp-client.h"
#include "dhcp-client-id-internal.h"
#include "dhcp-forward.h"
#include "dhcp-protocol.h"
#include "ether-addr-util.h"
#include "iovec-wrapper.h"
#include "network-common.h"
#include "sd-forward.h"
#include "socket-util.h"
#include "tlv-util.h"
struct sd_dhcp_client {
unsigned n_ref;
+1 -1
View File
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-forward.h"
#include "dhcp-forward.h"
int dhcp_client_send_message(sd_dhcp_client *client, uint8_t type);
+1 -2
View File
@@ -4,9 +4,8 @@
#include "sd-dhcp-duid.h"
#include "sd-id128.h"
#include "dhcp-forward.h"
#include "ether-addr-util.h"
#include "sd-forward.h"
#include "sparse-endian.h"
#define SYSTEMD_PEN 43793
+26
View File
@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-forward.h"
#include "sparse-endian.h"
struct in_pktinfo;
struct iphdr;
struct udphdr;
typedef struct sd_dhcp_client sd_dhcp_client;
typedef struct sd_dhcp_client_id sd_dhcp_client_id;
typedef struct sd_dhcp_duid sd_dhcp_duid;
typedef struct sd_dhcp_lease sd_dhcp_lease;
typedef struct sd_dhcp_message sd_dhcp_message;
typedef struct sd_dhcp_relay sd_dhcp_relay;
typedef struct sd_dhcp_relay_interface sd_dhcp_relay_interface;
typedef struct sd_dhcp_route sd_dhcp_route;
typedef struct sd_dhcp_server sd_dhcp_server;
typedef struct sd_dhcp_server_lease sd_dhcp_server_lease;
typedef struct DHCPMessageHeader DHCPMessageHeader;
typedef struct DHCPRequest DHCPRequest;
typedef struct DHCPServerData DHCPServerData;
typedef struct TLV TLV;
+5 -3
View File
@@ -5,11 +5,13 @@
Copyright © 2013 Intel Corporation. All rights reserved.
***/
#include "sd-dhcp-lease.h"
#include "sd-forward.h"
#include <netinet/in.h>
#include "dhcp-client-id-internal.h"
#include "sd-dhcp-lease.h"
#include "dhcp-forward.h"
#include "dhcp-message.h"
#include "time-util.h"
struct sd_dhcp_lease {
unsigned n_ref;
+1 -1
View File
@@ -3,8 +3,8 @@
#include "alloc-util.h"
#include "ansi-color.h"
#include "arphrd-util.h"
#include "dhcp-message.h"
#include "dhcp-message-dump.h"
#include "dhcp-protocol.h"
#include "dhcp-route.h"
#include "dns-resolver-internal.h"
#include "escape.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "dhcp-message.h"
#include "dhcp-forward.h"
typedef enum {
DUMP_DHCP_MESSAGE_LEGEND = 1 << 0,
-1
View File
@@ -5,7 +5,6 @@
#include "alloc-util.h"
#include "dhcp-client-id-internal.h"
#include "dhcp-message.h"
#include "dhcp-protocol.h"
#include "dhcp-route.h"
#include "dns-def.h"
#include "dns-domain.h"
+1 -3
View File
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-dhcp-client-id.h"
#include "sd-forward.h"
#include "dhcp-forward.h"
#include "dhcp-protocol.h"
#include "tlv-util.h"
+1 -2
View File
@@ -7,8 +7,7 @@
#include "sd-dhcp-protocol.h" /* IWYU pragma: export */
#include "sd-forward.h"
#include "sparse-endian.h"
#include "dhcp-forward.h"
#include "time-util.h"
/* RFC 8925 - IPv6-Only Preferred Option for DHCPv4 3.4.
@@ -5,7 +5,6 @@
#include "sd-event.h"
#include "dhcp-message.h"
#include "dhcp-protocol.h"
#include "dhcp-relay-internal.h"
#include "errno-util.h"
#include "ether-addr-util.h"
+4 -4
View File
@@ -1,13 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <netinet/in.h>
#include <sys/uio.h>
#include "sd-dhcp-relay.h"
#include "dhcp-message.h"
#include "ether-addr-util.h"
#include "dhcp-forward.h"
#include "network-common.h"
#include "sd-forward.h"
#include "tlv-util.h"
#define DHCP_RELAY_IFINDEX_UNBOUND (-100)
@@ -5,7 +5,6 @@
#include "sd-event.h"
#include "dhcp-message.h"
#include "dhcp-protocol.h"
#include "dhcp-relay-internal.h"
#include "hashmap.h"
#include "in-addr-util.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "sd-dhcp-lease.h"
#include "dhcp-route.h" /* IWYU pragma: keep */
#include "dhcp-route.h"
int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *ret) {
assert_return(route, -EINVAL);
+2 -2
View File
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-forward.h"
#include <netinet/in.h>
#include "in-addr-util.h" /* IWYU pragma: keep */
#include "dhcp-forward.h" /* IWYU pragma: export */
struct sd_dhcp_route {
struct in_addr dst_addr;
@@ -5,13 +5,13 @@
Copyright © 2013 Intel Corporation. All rights reserved.
***/
#include <netinet/in.h>
#include "sd-dhcp-server.h"
#include "dhcp-forward.h"
#include "dhcp-message.h"
#include "network-common.h"
#include "sd-forward.h"
#include "sparse-endian.h"
#include "tlv-util.h"
typedef struct sd_dhcp_server {
unsigned n_ref;
@@ -4,10 +4,8 @@
#include "sd-dhcp-server-lease.h"
#include "dhcp-client-id-internal.h"
#include "dhcp-server-internal.h"
#include "dhcp-server-request.h"
#include "dhcp-forward.h"
#include "ether-addr-util.h"
#include "sd-forward.h"
typedef struct sd_dhcp_server_lease {
unsigned n_ref;
+1 -5
View File
@@ -1,13 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-dhcp-server-lease.h"
#include "dhcp-client-id-internal.h"
#include "dhcp-message.h"
#include "dhcp-forward.h"
#include "ether-addr-util.h"
#include "sd-forward.h"
#include "sparse-endian.h"
#include "time-util.h"
typedef struct DHCPRequest {
@@ -4,6 +4,7 @@
#include "dhcp-server-internal.h"
#include "dhcp-server-lease-internal.h"
#include "dhcp-server-request.h"
#include "dhcp-server-send.h"
#include "errno-util.h"
#include "fd-util.h"
+1 -3
View File
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-forward.h"
#include "dhcp-server-request.h"
#include "dhcp-forward.h"
int dhcp_server_send_reply(
sd_dhcp_server *server,
+1
View File
@@ -26,6 +26,7 @@
#include "socket-util.h"
#include "string-util.h"
#include "time-util.h"
#include "tlv-util.h"
#include "web-util.h"
#define MAX_MAC_ADDR_LEN CONST_MAX(INFINIBAND_ALEN, ETH_ALEN)
+1 -1
View File
@@ -10,7 +10,7 @@
#include "alloc-util.h"
#include "dhcp-client-internal.h"
#include "dhcp-lease-internal.h"
#include "dhcp-route.h" /* IWYU pragma: keep */
#include "dhcp-route.h"
#include "dns-resolver-internal.h"
#include "in-addr-util.h"
#include "ip-util.h"
+1
View File
@@ -9,6 +9,7 @@
#include "in-addr-util.h"
#include "iovec-util.h"
#include "prioq.h"
#include "tlv-util.h"
static sd_dhcp_relay* dhcp_relay_free(sd_dhcp_relay *relay) {
if (!relay)
@@ -6,7 +6,9 @@
#include "sd-event.h"
#include "alloc-util.h"
#include "dhcp-server-internal.h"
#include "dhcp-server-lease-internal.h"
#include "dhcp-server-request.h"
#include "dns-domain.h"
#include "errno-util.h"
#include "fd-util.h"
+1 -1
View File
@@ -14,7 +14,6 @@
#include "dhcp-client-internal.h"
#include "dhcp-message.h"
#include "dhcp-protocol.h"
#include "ether-addr-util.h"
#include "fd-util.h"
#include "hashmap.h"
@@ -24,6 +23,7 @@
#include "ip-util.h"
#include "log.h"
#include "set.h"
#include "socket-util.h"
#include "strv.h"
#include "tests.h"
@@ -8,7 +8,6 @@
#include "dhcp-client-id-internal.h"
#include "dhcp-message.h"
#include "dhcp-message-dump.h"
#include "dhcp-protocol.h"
#include "dhcp-route.h"
#include "dns-packet.h"
#include "dns-resolver-internal.h"
+2 -2
View File
@@ -5,8 +5,8 @@
#include "sd-event.h"
#include "dhcp-protocol.h"
#include "dhcp-relay-internal.h" /* IWYU pragma: keep */
#include "dhcp-message.h"
#include "dhcp-relay-internal.h"
#include "ether-addr-util.h"
#include "fd-util.h"
#include "hashmap.h"
-6
View File
@@ -76,12 +76,6 @@ typedef enum sd_lldp_multicast_mode_t sd_lldp_multicast_mode_t;
typedef enum sd_ndisc_event_t sd_ndisc_event_t;
typedef struct sd_ipv4ll sd_ipv4ll;
typedef struct sd_dhcp_client sd_dhcp_client;
typedef struct sd_dhcp_lease sd_dhcp_lease;
typedef struct sd_dhcp_route sd_dhcp_route;
typedef struct sd_dhcp_relay sd_dhcp_relay;
typedef struct sd_dhcp_relay_interface sd_dhcp_relay_interface;
typedef struct sd_dhcp_server sd_dhcp_server;
typedef struct sd_dns_resolver sd_dns_resolver;
typedef struct sd_ndisc sd_ndisc;
typedef struct sd_radv sd_radv;
+1
View File
@@ -4,6 +4,7 @@
#include "alloc-util.h"
#include "bus-object.h"
#include "dhcp-server-internal.h"
#include "dhcp-server-lease-internal.h"
#include "hashmap.h"
#include "networkd-dhcp-server-bus.h"
+1
View File
@@ -4,6 +4,7 @@
/* IWYU pragma: always_keep */
#include "conf-parser-forward.h" /* IWYU pragma: export */
#include "dhcp-forward.h" /* IWYU pragma: export */
#include "shared-forward.h" /* IWYU pragma: export */
typedef enum NetDevLocalAddressType NetDevLocalAddressType;
+1
View File
@@ -7,6 +7,7 @@
#include "sd-dhcp6-client.h"
#include "dhcp-lease-internal.h" /* IWYU pragma: keep */
#include "dhcp-server-internal.h"
#include "dhcp-server-lease-internal.h"
#include "dhcp6-lease-internal.h"
#include "extract-word.h"