diff options
author | Tom Gundersen <teg@jklm.no> | 2015-02-04 11:44:37 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-02-05 11:50:34 +0100 |
commit | e331e24649213f2e093e16e4d3d64ee823dfc375 (patch) | |
tree | d21fa218f79f2621d6d61f071e846cc6465458c1 /src/network/networkd.h | |
parent | 6a24f1484fcc1f59f89617afbe4282667a358eab (diff) |
networkd: add basic dbus API
Only the very basics, more to come.
For now:
$ busctl tree org.freedesktop.network1
└─/org/freedesktop/network1
└─/org/freedesktop/network1/link
├─/org/freedesktop/network1/link/1
├─/org/freedesktop/network1/link/2
├─/org/freedesktop/network1/link/3
├─/org/freedesktop/network1/link/4
├─/org/freedesktop/network1/link/5
├─/org/freedesktop/network1/link/6
├─/org/freedesktop/network1/link/7
├─/org/freedesktop/network1/link/8
└─/org/freedesktop/network1/link/9
$ busctl introspect org.freedesktop.network1 /org/freedesktop/network1
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.network1.Manager interface - - -
.OperationalState property s "carrier" emits-change
$ busctl introspect org.freedesktop.network1 /org/freedesktop/network1/link/1
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.network1.Link interface - - -
.AdministrativeState property s "unmanaged" emits-change
.OperationalState property s "carrier" emits-change
Diffstat (limited to 'src/network/networkd.h')
-rw-r--r-- | src/network/networkd.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/network/networkd.h b/src/network/networkd.h index e053bd624a..9f3a5ea9d5 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -72,6 +72,17 @@ typedef enum LLMNRSupport { _LLMNR_SUPPORT_INVALID = -1, } LLMNRSupport; +typedef enum LinkOperationalState { + LINK_OPERSTATE_OFF, + LINK_OPERSTATE_NO_CARRIER, + LINK_OPERSTATE_DORMANT, + LINK_OPERSTATE_CARRIER, + LINK_OPERSTATE_DEGRADED, + LINK_OPERSTATE_ROUTABLE, + _LINK_OPERSTATE_MAX, + _LINK_OPERSTATE_INVALID = -1 +} LinkOperationalState; + struct FdbEntry { Network *network; unsigned section; @@ -209,6 +220,7 @@ struct Manager { bool enumerating; char *state_file; + LinkOperationalState operational_state; Hashmap *links; Hashmap *netdevs; @@ -222,6 +234,8 @@ extern const char* const network_dirs[]; /* Manager */ +extern const sd_bus_vtable manager_vtable[]; + int manager_new(Manager **ret); void manager_free(Manager *m); @@ -231,6 +245,7 @@ bool manager_should_reload(Manager *m); int manager_rtnl_enumerate_links(Manager *m); int manager_rtnl_enumerate_addresses(Manager *m); +int manager_send_changed(Manager *m, const char *property, ...) _sentinel_; int manager_save(Manager *m); int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found); @@ -394,3 +409,8 @@ const char *address_family_boolean_to_string(AddressFamilyBoolean b) _const_; AddressFamilyBoolean address_family_boolean_from_string(const char *s) _const_; int config_parse_address_family_boolean(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); + +/* Opeartional State */ + +const char* link_operstate_to_string(LinkOperationalState s) _const_; +LinkOperationalState link_operstate_from_string(const char *s) _pure_; |