]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp: move definition of enum DHCPState to dhcp-protocol.[ch]
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 10 May 2026 14:13:07 +0000 (23:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 May 2026 23:34:22 +0000 (08:34 +0900)
It will be also used in DHCP server, later.

src/libsystemd-network/dhcp-client-internal.h
src/libsystemd-network/dhcp-protocol.c
src/libsystemd-network/dhcp-protocol.h
src/libsystemd-network/fuzz-dhcp-client.c
src/libsystemd-network/sd-dhcp-client.c

index bd9308e2d1d78f3da03582af143a0cc75e57fbc5..4adaeeec220813c27bbfa40bccf1c5544aa6cec5 100644 (file)
@@ -4,6 +4,7 @@
 #include "sd-dhcp-client.h"
 
 #include "dhcp-client-id-internal.h"
+#include "dhcp-protocol.h"
 #include "ether-addr-util.h"
 #include "iovec-wrapper.h"
 #include "network-common.h"
 #include "socket-util.h"
 #include "tlv-util.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;
-
-DECLARE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_state, DHCPState);
-
 struct sd_dhcp_client {
         unsigned n_ref;
 
index caf92c494ef340dad1c69513332a429fa1de905c..3a42087766b0da7e9bfa0349d694e5f5c00a05bc 100644 (file)
@@ -188,3 +188,17 @@ static const char * const dhcp_option_code_table[] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_option_code, int);
+
+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);
index 2acdb3693cb4963a0363f09f464f511778a5ccef..eb4799ba1c28f30a08d4949e77681fcdd3cb721d 100644 (file)
@@ -138,3 +138,19 @@ enum {
 };
 
 DECLARE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_option_code, int);
+
+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;
+
+DECLARE_STRING_TABLE_LOOKUP_TO_STRING(dhcp_state, DHCPState);
index 0737e0c2cd9b84ca88a820bae297dc4e1946be48..82c92c914b6e754d62746702aa266911211e18df 100644 (file)
@@ -6,7 +6,7 @@
 #include "sd-event.h"
 #include "sd-json.h"
 
-#include "dhcp-client-internal.h"
+#include "dhcp-client-internal.h"  /* IWYU pragma: keep */
 #include "dhcp-lease-internal.h"
 #include "dhcp-message.h"
 #include "fd-util.h"
index d94e6057d5a4382083a16a86a58e3c1c553b57a5..5675c7d78755be91724ad8b2dc71f7840ab14d5e 100644 (file)
@@ -24,7 +24,6 @@
 #include "random-util.h"
 #include "set.h"
 #include "socket-util.h"
-#include "string-table.h"
 #include "string-util.h"
 #include "time-util.h"
 #include "web-util.h"
@@ -1443,17 +1442,3 @@ int sd_dhcp_client_new(sd_dhcp_client **ret) {
 
         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);