chiark / gitweb /
networkd: refactor socket activation a bit
[elogind.git] / src / network / networkd.h
index 39b2d2bec9c6b50485068d2816e18b6c52617480..075aefec7172693eb670f6621b8f9e8ddfd1cffe 100644 (file)
@@ -54,14 +54,15 @@ typedef struct Manager Manager;
 typedef struct AddressPool AddressPool;
 typedef struct FdbEntry FdbEntry;
 
-typedef enum DHCPSupport {
-        DHCP_SUPPORT_NONE,
-        DHCP_SUPPORT_BOTH,
-        DHCP_SUPPORT_V4,
-        DHCP_SUPPORT_V6,
-        _DHCP_SUPPORT_MAX,
-        _DHCP_SUPPORT_INVALID = -1,
-} DHCPSupport;
+typedef enum AddressFamilyBoolean {
+        /* This is a bitmask, though it usually doesn't feel that way! */
+        ADDRESS_FAMILY_NO = 0,
+        ADDRESS_FAMILY_IPV4 = 1,
+        ADDRESS_FAMILY_IPV6 = 2,
+        ADDRESS_FAMILY_YES = 3,
+        _ADDRESS_FAMILY_BOOLEAN_MAX,
+        _ADDRESS_FAMILY_BOOLEAN_INVALID = -1,
+} AddressFamilyBoolean;
 
 typedef enum LLMNRSupport {
         LLMNR_SUPPORT_NO,
@@ -102,7 +103,7 @@ struct Network {
         NetDev *bridge;
         NetDev *bond;
         Hashmap *stacked_netdevs;
-        DHCPSupport dhcp;
+        AddressFamilyBoolean dhcp;
         bool dhcp_dns;
         bool dhcp_ntp;
         bool dhcp_mtu;
@@ -120,8 +121,8 @@ struct Network {
 
         unsigned cost;
 
+        AddressFamilyBoolean ip_forward;
         bool ip_masquerade;
-        bool ip_forward;
 
         struct ether_addr *mac;
         unsigned mtu;
@@ -160,7 +161,7 @@ struct Address {
         union in_addr_union in_addr;
         union in_addr_union in_addr_peer;
 
-        bool ip_forward_done;
+        bool ip_masquerade_done;
 
         LIST_FIELDS(Address, addresses);
 };
@@ -198,7 +199,9 @@ struct AddressPool {
 struct Manager {
         sd_rtnl *rtnl;
         sd_event *event;
+        sd_event_source *bus_retry_event_source;
         sd_bus *bus;
+        sd_bus_slot *prepare_for_sleep_slot;
         struct udev *udev;
         struct udev_monitor *udev_monitor;
         sd_event_source *udev_event_source;
@@ -226,10 +229,6 @@ bool manager_should_reload(Manager *m);
 int manager_rtnl_enumerate_links(Manager *m);
 int manager_rtnl_enumerate_addresses(Manager *m);
 
-int manager_rtnl_listen(Manager *m);
-int manager_udev_listen(Manager *m);
-int manager_bus_listen(Manager *m);
-
 int manager_save(Manager *m);
 
 int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found);
@@ -368,9 +367,6 @@ int config_parse_fdb_vlan_id(const char *unit, const char *filename, unsigned li
 
 /* DHCP support */
 
-const char* dhcp_support_to_string(DHCPSupport i) _const_;
-DHCPSupport dhcp_support_from_string(const char *s) _pure_;
-
 int config_parse_dhcp(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);
@@ -391,3 +387,8 @@ int address_pool_new_from_string(Manager *m, AddressPool **ret, int family, cons
 void address_pool_free(AddressPool *p);
 
 int address_pool_acquire(AddressPool *p, unsigned prefixlen, union in_addr_union *found);
+
+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);