mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
network: move LinkOperationalState and relevant functions to network-util.[ch]
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "network-util.h"
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
|
||||
bool network_is_online(void) {
|
||||
@@ -18,3 +19,15 @@ bool network_is_online(void) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
|
||||
[LINK_OPERSTATE_OFF] = "off",
|
||||
[LINK_OPERSTATE_NO_CARRIER] = "no-carrier",
|
||||
[LINK_OPERSTATE_DORMANT] = "dormant",
|
||||
[LINK_OPERSTATE_CARRIER] = "carrier",
|
||||
[LINK_OPERSTATE_DEGRADED] = "degraded",
|
||||
[LINK_OPERSTATE_ENSLAVED] = "enslaved",
|
||||
[LINK_OPERSTATE_ROUTABLE] = "routable",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(link_operstate, LinkOperationalState);
|
||||
|
||||
@@ -3,4 +3,21 @@
|
||||
|
||||
#include "sd-network.h"
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
bool network_is_online(void);
|
||||
|
||||
typedef enum LinkOperationalState {
|
||||
LINK_OPERSTATE_OFF,
|
||||
LINK_OPERSTATE_NO_CARRIER,
|
||||
LINK_OPERSTATE_DORMANT,
|
||||
LINK_OPERSTATE_CARRIER,
|
||||
LINK_OPERSTATE_DEGRADED,
|
||||
LINK_OPERSTATE_ENSLAVED,
|
||||
LINK_OPERSTATE_ROUTABLE,
|
||||
_LINK_OPERSTATE_MAX,
|
||||
_LINK_OPERSTATE_INVALID = -1
|
||||
} LinkOperationalState;
|
||||
|
||||
const char* link_operstate_to_string(LinkOperationalState s) _const_;
|
||||
LinkOperationalState link_operstate_from_string(const char *s) _pure_;
|
||||
|
||||
@@ -4306,15 +4306,3 @@ static const char* const link_state_table[_LINK_STATE_MAX] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(link_state, LinkState);
|
||||
|
||||
static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
|
||||
[LINK_OPERSTATE_OFF] = "off",
|
||||
[LINK_OPERSTATE_NO_CARRIER] = "no-carrier",
|
||||
[LINK_OPERSTATE_DORMANT] = "dormant",
|
||||
[LINK_OPERSTATE_CARRIER] = "carrier",
|
||||
[LINK_OPERSTATE_DEGRADED] = "degraded",
|
||||
[LINK_OPERSTATE_ENSLAVED] = "enslaved",
|
||||
[LINK_OPERSTATE_ROUTABLE] = "routable",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(link_operstate, LinkOperationalState);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "sd-netlink.h"
|
||||
|
||||
#include "list.h"
|
||||
#include "network-util.h"
|
||||
#include "set.h"
|
||||
|
||||
typedef enum LinkState {
|
||||
@@ -28,18 +29,6 @@ typedef enum LinkState {
|
||||
_LINK_STATE_INVALID = -1
|
||||
} LinkState;
|
||||
|
||||
typedef enum LinkOperationalState {
|
||||
LINK_OPERSTATE_OFF,
|
||||
LINK_OPERSTATE_NO_CARRIER,
|
||||
LINK_OPERSTATE_DORMANT,
|
||||
LINK_OPERSTATE_CARRIER,
|
||||
LINK_OPERSTATE_DEGRADED,
|
||||
LINK_OPERSTATE_ENSLAVED,
|
||||
LINK_OPERSTATE_ROUTABLE,
|
||||
_LINK_OPERSTATE_MAX,
|
||||
_LINK_OPERSTATE_INVALID = -1
|
||||
} LinkOperationalState;
|
||||
|
||||
typedef struct Manager Manager;
|
||||
typedef struct Network Network;
|
||||
typedef struct Address Address;
|
||||
@@ -180,9 +169,6 @@ int dhcp6_lease_pd_prefix_lost(sd_dhcp6_client *client, Link* link);
|
||||
const char* link_state_to_string(LinkState s) _const_;
|
||||
LinkState link_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char* link_operstate_to_string(LinkOperationalState s) _const_;
|
||||
LinkOperationalState link_operstate_from_string(const char *s) _pure_;
|
||||
|
||||
extern const sd_bus_vtable link_vtable[];
|
||||
|
||||
int link_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
|
||||
|
||||
Reference in New Issue
Block a user