chiark / gitweb /
networkd: add dhcp server support
[elogind.git] / src / network / networkd.h
index 3e4e1f2ba6d929c0518ae5b477674a8f288f1fe4..87eadd1c51a6647ec55b3d4574074fbff67d4b8e 100644 (file)
@@ -27,6 +27,7 @@
 #include "sd-rtnl.h"
 #include "sd-bus.h"
 #include "sd-dhcp-client.h"
+#include "sd-dhcp-server.h"
 #include "sd-ipv4ll.h"
 #include "udev.h"
 
@@ -71,6 +72,8 @@ typedef enum NetDevKind {
         NETDEV_KIND_IPIP,
         NETDEV_KIND_GRE,
         NETDEV_KIND_SIT,
+        NETDEV_KIND_VETH,
+        NETDEV_KIND_VTI,
         _NETDEV_KIND_MAX,
         _NETDEV_KIND_INVALID = -1
 } NetDevKind;
@@ -98,6 +101,7 @@ struct NetDev {
 
         char *description;
         char *ifname;
+        char *ifname_peer;
         size_t mtu;
         NetDevKind kind;
 
@@ -107,6 +111,7 @@ struct NetDev {
         int ifindex;
         NetDevState state;
 
+        bool tunnel_pmtudisc;
         unsigned tunnel_ttl;
         unsigned tunnel_tos;
         struct in_addr tunnel_local;
@@ -138,12 +143,15 @@ struct Network {
         Hashmap *macvlans;
         bool dhcp;
         bool dhcp_dns;
+        bool dhcp_ntp;
         bool dhcp_mtu;
         bool dhcp_hostname;
         bool dhcp_domainname;
         bool dhcp_critical;
         bool ipv4ll;
 
+        bool dhcp_server;
+
         LIST_HEAD(Address, static_addresses);
         LIST_HEAD(Route, static_routes);
 
@@ -151,6 +159,7 @@ struct Network {
         Hashmap *routes_by_section;
 
         LIST_HEAD(Address, dns);
+        LIST_HEAD(Address, ntp);
 
         LIST_FIELDS(Network, networks);
 };
@@ -210,6 +219,16 @@ typedef enum LinkState {
         _LINK_STATE_INVALID = -1
 } LinkState;
 
+typedef enum LinkOperationalState {
+        LINK_OPERSTATE_UNKNOWN,
+        LINK_OPERSTATE_DORMANT,
+        LINK_OPERSTATE_CARRIER,
+        LINK_OPERSTATE_DEGRADED,
+        LINK_OPERSTATE_ROUTABLE,
+        _LINK_OPERSTATE_MAX,
+        _LINK_OPERSTATE_INVALID = -1
+} LinkOperationalState;
+
 struct Link {
         Manager *manager;
 
@@ -222,11 +241,12 @@ struct Link {
         struct udev_device *udev_device;
 
         unsigned flags;
-        uint8_t operstate;
+        uint8_t kernel_operstate;
 
         Network *network;
 
         LinkState state;
+        LinkOperationalState operstate;
 
         unsigned addr_messages;
         unsigned route_messages;
@@ -239,6 +259,8 @@ struct Link {
         char *lease_file;
         uint16_t original_mtu;
         sd_ipv4ll *ipv4ll;
+
+        sd_dhcp_server *dhcp_server;
 };
 
 struct Manager {
@@ -258,7 +280,6 @@ struct Manager {
         LIST_HEAD(Network, networks);
 
         usec_t network_dirs_ts_usec;
-        struct kmod_ctx *kmod_ctx;
 };
 
 extern const char* const network_dirs[];
@@ -297,6 +318,7 @@ int netdev_get(Manager *manager, const char *name, NetDev **ret);
 int netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
 int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
 int netdev_create_tunnel(Link *link, sd_rtnl_message_handler_t callback);
+int netdev_create_veth(NetDev *netdev, sd_rtnl_message_handler_t callback);
 
 const char *netdev_kind_to_string(NetDevKind d) _const_;
 NetDevKind netdev_kind_from_string(const char *d) _pure_;
@@ -421,6 +443,9 @@ 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_;
 
+const char* link_operstate_to_string(LinkOperationalState s) _const_;
+LinkOperationalState link_operstate_from_string(const char *s) _pure_;
+
 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
 #define _cleanup_link_unref_ _cleanup_(link_unrefp)