chiark / gitweb /
Fix a few return codes in error paths
[elogind.git] / src / network / networkd.h
index 85c300982fa541f5b319f1edcfda08cbd8459b00..36902e3c51f810eef252be844b2014eb80e2f703 100644 (file)
 #include "sd-rtnl.h"
 #include "sd-bus.h"
 #include "sd-dhcp-client.h"
+#include "sd-ipv4ll.h"
 #include "udev.h"
 
 #include "rtnl-util.h"
 #include "hashmap.h"
 #include "list.h"
+#include "set.h"
 #include "condition-util.h"
 
+#define CACHE_INFO_INFINITY_LIFE_TIME 0xFFFFFFFFU
+
 typedef struct NetDev NetDev;
 typedef struct Network Network;
 typedef struct Link Link;
@@ -125,14 +129,16 @@ struct Network {
         bool dhcp_hostname;
         bool dhcp_domainname;
         bool dhcp_critical;
+        bool ipv4ll;
 
         LIST_HEAD(Address, static_addresses);
         LIST_HEAD(Route, static_routes);
-        Address *dns;
 
         Hashmap *addresses_by_section;
         Hashmap *routes_by_section;
 
+        Set *dns;
+
         LIST_FIELDS(Network, networks);
 };
 
@@ -142,9 +148,11 @@ struct Address {
 
         unsigned char family;
         unsigned char prefixlen;
+        unsigned char scope;
         char *label;
 
         struct in_addr broadcast;
+        struct ifa_cacheinfo cinfo;
 
         union {
                 struct in_addr in;
@@ -160,6 +168,8 @@ struct Route {
 
         unsigned char family;
         unsigned char dst_prefixlen;
+        unsigned char scope;
+        uint32_t metrics;
 
         union {
                 struct in_addr in;
@@ -189,7 +199,9 @@ struct Link {
 
         uint64_t ifindex;
         char *ifname;
+        char *state_file;
         struct ether_addr mac;
+        struct udev_device *udev_device;
 
         unsigned flags;
 
@@ -204,6 +216,7 @@ struct Link {
         sd_dhcp_client *dhcp_client;
         sd_dhcp_lease *dhcp_lease;
         uint16_t original_mtu;
+        sd_ipv4ll *ipv4ll;
 };
 
 struct Manager {
@@ -254,7 +267,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_free);
 #define _cleanup_netdev_free_ _cleanup_(netdev_freep)
 
 int netdev_get(Manager *manager, const char *name, NetDev **ret);
-int netdev_set_ifindex(NetDev *netdev, int ifindex);
+int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
 int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
 
 const char *netdev_kind_to_string(NetDevKind d) _const_;
@@ -306,6 +319,8 @@ int route_new_static(Network *network, unsigned section, Route **ret);
 int route_new_dynamic(Route **ret);
 void route_free(Route *route);
 int route_configure(Route *route, Link *link, sd_rtnl_message_handler_t callback);
+int route_drop(Route *route, Link *link, sd_rtnl_message_handler_t callback);
+
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
 #define _cleanup_route_free_ _cleanup_(route_freep)
@@ -323,6 +338,7 @@ int address_new_static(Network *network, unsigned section, Address **ret);
 int address_new_dynamic(Address **ret);
 void address_free(Address *address);
 int address_configure(Address *address, Link *link, sd_rtnl_message_handler_t callback);
+int address_update(Address *address, Link *link, sd_rtnl_message_handler_t callback);
 int address_drop(Address *address, Link *link, sd_rtnl_message_handler_t callback);
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
@@ -350,10 +366,14 @@ int link_new(Manager *manager, struct udev_device *device, Link **ret);
 void link_free(Link *link);
 int link_get(Manager *m, int ifindex, Link **ret);
 int link_add(Manager *manager, struct udev_device *device, Link **ret);
-int link_configure(Link *link);
 
 int link_update(Link *link, sd_rtnl_message *message);
 
+int link_save(Link *link);
+
+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)