diff options
-rw-r--r-- | src/libsystemd-network/dhcp-client-internal.h | 20 | ||||
-rw-r--r-- | src/libsystemd-network/dhcp-protocol.c | 18 | ||||
-rw-r--r-- | src/libsystemd-network/dhcp-protocol.h | 18 | ||||
-rw-r--r-- | src/libsystemd-network/meson.build | 1 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 15 | ||||
-rw-r--r-- | src/network/networkd-dhcp4-bus.c | 1 |
6 files changed, 35 insertions, 38 deletions
diff --git a/src/libsystemd-network/dhcp-client-internal.h b/src/libsystemd-network/dhcp-client-internal.h index 6f43975977..073f605518 100644 --- a/src/libsystemd-network/dhcp-client-internal.h +++ b/src/libsystemd-network/dhcp-client-internal.h @@ -1,8 +1,28 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include <errno.h> + #include "sd-dhcp-client.h" +#include "macro.h" + +typedef enum DHCPState { + DHCP_STATE_STOPPED, + DHCP_STATE_INIT, + DHCP_STATE_SELECTING, + DHCP_STATE_INIT_REBOOT, + DHCP_STATE_REBOOTING, + DHCP_STATE_REQUESTING, + DHCP_STATE_BOUND, + DHCP_STATE_RENEWING, + DHCP_STATE_REBINDING, + _DHCP_STATE_MAX, + _DHCP_STATE_INVALID = -EINVAL, +} DHCPState; + +const char *dhcp_state_to_string(DHCPState s) _const_; + extern const struct hash_ops dhcp_option_hash_ops; int dhcp_client_set_state_callback( diff --git a/src/libsystemd-network/dhcp-protocol.c b/src/libsystemd-network/dhcp-protocol.c deleted file mode 100644 index 955d08720d..0000000000 --- a/src/libsystemd-network/dhcp-protocol.c +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ - -#include "dhcp-protocol.h" -#include "string-table.h" - -static const char* const dhcp_state_table[_DHCP_STATE_MAX] = { - [DHCP_STATE_STOPPED] = "stopped", - [DHCP_STATE_INIT] = "initialization", - [DHCP_STATE_SELECTING] = "selecting", - [DHCP_STATE_INIT_REBOOT] = "init-reboot", - [DHCP_STATE_REBOOTING] = "rebooting", - [DHCP_STATE_REQUESTING] = "requesting", - [DHCP_STATE_BOUND] = "bound", - [DHCP_STATE_RENEWING] = "renewing", - [DHCP_STATE_REBINDING] = "rebinding", -}; - -DEFINE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_state, DHCPState); diff --git a/src/libsystemd-network/dhcp-protocol.h b/src/libsystemd-network/dhcp-protocol.h index 4bf2296ee3..34ab933360 100644 --- a/src/libsystemd-network/dhcp-protocol.h +++ b/src/libsystemd-network/dhcp-protocol.h @@ -59,22 +59,6 @@ enum { DHCP_PORT_CLIENT = 68, }; -enum DHCPState { - DHCP_STATE_STOPPED, - DHCP_STATE_INIT, - DHCP_STATE_SELECTING, - DHCP_STATE_INIT_REBOOT, - DHCP_STATE_REBOOTING, - DHCP_STATE_REQUESTING, - DHCP_STATE_BOUND, - DHCP_STATE_RENEWING, - DHCP_STATE_REBINDING, - _DHCP_STATE_MAX, - _DHCP_STATE_INVALID = -EINVAL, -}; - -typedef enum DHCPState DHCPState; - enum { BOOTREQUEST = 1, BOOTREPLY = 2, @@ -114,5 +98,3 @@ enum { DHCP_FQDN_FLAG_E = (1 << 2), DHCP_FQDN_FLAG_N = (1 << 3), }; - -const char *dhcp_state_to_string(DHCPState s) _const_; diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build index 3eba57f991..93186e23a1 100644 --- a/src/libsystemd-network/meson.build +++ b/src/libsystemd-network/meson.build @@ -6,7 +6,6 @@ sources = files( 'dhcp-network.c', 'dhcp-option.c', 'dhcp-packet.c', - 'dhcp-protocol.c', 'dhcp6-network.c', 'dhcp6-option.c', 'dhcp6-protocol.c', diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index a74a239e12..011b173e88 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -30,6 +30,7 @@ #include "random-util.h" #include "set.h" #include "sort-util.h" +#include "string-table.h" #include "string-util.h" #include "strv.h" #include "time-util.h" @@ -2425,3 +2426,17 @@ int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) { return 0; } + +static const char* const dhcp_state_table[_DHCP_STATE_MAX] = { + [DHCP_STATE_STOPPED] = "stopped", + [DHCP_STATE_INIT] = "initialization", + [DHCP_STATE_SELECTING] = "selecting", + [DHCP_STATE_INIT_REBOOT] = "init-reboot", + [DHCP_STATE_REBOOTING] = "rebooting", + [DHCP_STATE_REQUESTING] = "requesting", + [DHCP_STATE_BOUND] = "bound", + [DHCP_STATE_RENEWING] = "renewing", + [DHCP_STATE_REBINDING] = "rebinding", +}; + +DEFINE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_state, DHCPState); diff --git a/src/network/networkd-dhcp4-bus.c b/src/network/networkd-dhcp4-bus.c index cb88627d20..e00aa0364f 100644 --- a/src/network/networkd-dhcp4-bus.c +++ b/src/network/networkd-dhcp4-bus.c @@ -6,7 +6,6 @@ #include "bus-common-errors.h" #include "bus-util.h" #include "dhcp-client-internal.h" -#include "dhcp-protocol.h" #include "networkd-dhcp4-bus.h" #include "networkd-link-bus.h" #include "networkd-manager.h" |