chiark / gitweb /
networkd: get preexiting addresses when a link is added
[elogind.git] / src / network / networkd.h
index aebb2859206691f7788a495fcfb51b2fa5309589..ec2e111a7b1b6cdafd9c04cd6a94f7013667b19c 100644 (file)
@@ -76,6 +76,7 @@ typedef enum NetDevState {
         NETDEV_STATE_FAILED,
         NETDEV_STATE_CREATING,
         NETDEV_STATE_READY,
+        NETDEV_STATE_LINGER,
         _NETDEV_STATE_MAX,
         _NETDEV_STATE_INVALID = -1,
 } NetDevState;
@@ -83,6 +84,8 @@ typedef enum NetDevState {
 struct NetDev {
         Manager *manager;
 
+        int n_ref;
+
         char *filename;
 
         Condition *match_host;
@@ -192,6 +195,7 @@ typedef enum LinkState {
         LINK_STATE_CONFIGURED,
         LINK_STATE_UNMANAGED,
         LINK_STATE_FAILED,
+        LINK_STATE_LINGER,
         _LINK_STATE_MAX,
         _LINK_STATE_INVALID = -1
 } LinkState;
@@ -199,6 +203,8 @@ typedef enum LinkState {
 struct Link {
         Manager *manager;
 
+        int n_ref;
+
         uint64_t ifindex;
         char *ifname;
         char *state_file;
@@ -218,6 +224,7 @@ struct Link {
 
         sd_dhcp_client *dhcp_client;
         sd_dhcp_lease *dhcp_lease;
+        char *lease_file;
         uint16_t original_mtu;
         sd_ipv4ll *ipv4ll;
 };
@@ -266,11 +273,13 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
 /* NetDev */
 
 int netdev_load(Manager *manager);
+void netdev_drop(NetDev *netdev);
 
-void netdev_free(NetDev *netdev);
+NetDev *netdev_unref(NetDev *netdev);
+NetDev *netdev_ref(NetDev *netdev);
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_free);
-#define _cleanup_netdev_free_ _cleanup_(netdev_freep)
+DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
+#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
 
 int netdev_get(Manager *manager, const char *name, NetDev **ret);
 int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
@@ -303,22 +312,10 @@ int network_get(Manager *manager, struct udev_device *device,
                 Network **ret);
 int network_apply(Manager *manager, Network *network, Link *link);
 
-int config_parse_bridge(const char *unit, const char *filename, unsigned line,
+int config_parse_netdev(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);
 
-int config_parse_bond(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);
-
-int config_parse_vlan(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);
-
-int config_parse_macvlan(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);
-
 /* gperf */
 const struct ConfigPerfItem* network_network_gperf_lookup(const char *key, unsigned length);
 
@@ -370,11 +367,14 @@ int config_parse_label(const char *unit, const char *filename, unsigned line,
 
 /* Link */
 
-void link_free(Link *link);
+Link *link_unref(Link *link);
+Link *link_ref(Link *link);
 int link_get(Manager *m, int ifindex, Link **ret);
 int link_add(Manager *manager, sd_rtnl_message *message, Link **ret);
+void link_drop(Link *link);
 
 int link_update(Link *link, sd_rtnl_message *message);
+int link_rtnl_process_address(sd_rtnl *rtnl, sd_rtnl_message *message, void *userdata);
 
 int link_initialized(Link *link, struct udev_device *device);
 
@@ -385,8 +385,8 @@ bool link_has_carrier(unsigned flags, uint8_t operstate);
 const char* link_state_to_string(LinkState s) _const_;
 LinkState link_state_from_string(const char *s) _pure_;
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);
-#define _cleanup_link_free_ _cleanup_(link_freep)
+DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
+#define _cleanup_link_unref_ _cleanup_(link_unrefp)
 
 /* Macros which append INTERFACE= to the message */