dhcp: move definition of enum DHCPState to dhcp-protocol.[ch]
It will be also used in DHCP server, later.
This commit is contained in:
@@ -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"
|
||||
@@ -11,22 +12,6 @@
|
||||
#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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user