config: add option to indicate dns service presence
[project/odhcpd.git] / src / odhcpd.h
index ae4826e3c2c72ee95a1acf00157fab44411c69cd..0108af1d93c01c63ecd8e66f1ce854a3a6922a92 100644 (file)
@@ -44,6 +44,7 @@
 struct interface;
 struct nl_sock;
 extern struct vlist_tree leases;
+extern struct config config;
 
 struct odhcpd_event {
        struct uloop_fd uloop;
@@ -53,6 +54,10 @@ struct odhcpd_event {
        void (*recv_msgs)(struct odhcpd_event *e);
 };
 
+typedef        int (*send_reply_cb_t)(const void *buf, size_t len,
+                              const struct sockaddr *dest, socklen_t dest_len,
+                              void *opaque);
+
 typedef void (*dhcpv6_binding_cb_handler_t)(struct in6_addr *addr, int prefix,
                                            uint32_t pref, uint32_t valid,
                                            void *arg);
@@ -139,7 +144,7 @@ struct config {
        char *dhcp_cb;
        char *dhcp_statefile;
        int log_level;
-} config;
+};
 
 
 struct lease {
@@ -248,6 +253,7 @@ struct interface {
        bool master;
        bool ignore;
        bool always_rewrite_dns;
+       bool dns_service;
 
        // NDP
        int learn_routes;
@@ -272,6 +278,9 @@ struct interface {
        uint32_t ra_hoplimit;
        int ra_mtu;
 
+       // DHCP
+       uint32_t dhcp_leasetime;
+
        // DHCPv4
        struct in_addr dhcpv4_start;
        struct in_addr dhcpv4_end;
@@ -284,7 +293,6 @@ struct interface {
        size_t dhcpv4_router_cnt;
        struct in_addr *dhcpv4_dns;
        size_t dhcpv4_dns_cnt;
-       uint32_t dhcpv4_leasetime;
        bool dhcpv4_forcereconf;
 
        // DNS
@@ -408,6 +416,9 @@ int ndp_init(void);
 int dhcpv4_init(void);
 
 int dhcpv4_setup_interface(struct interface *iface, bool enable);
+void dhcpv4_handle_msg(void *addr, void *data, size_t len,
+                      struct interface *iface, _unused void *dest_addr,
+                      send_reply_cb_t send_reply, void *opaque);
 #endif
 int router_setup_interface(struct interface *iface, bool enable);
 int dhcpv6_setup_interface(struct interface *iface, bool enable);