[systemd-commits] Makefile.am src/resolve

Lennart Poettering lennart at kemper.freedesktop.org
Fri Aug 1 07:18:21 PDT 2014


 Makefile.am                       |    3 
 src/resolve/resolved-bus.c        |    2 
 src/resolve/resolved-bus.h        |   26 ++++++
 src/resolve/resolved-conf.h       |    2 
 src/resolve/resolved-dns-query.h  |    2 
 src/resolve/resolved-dns-scope.h  |    4 -
 src/resolve/resolved-dns-server.h |    3 
 src/resolve/resolved-dns-stream.h |    2 
 src/resolve/resolved-link.h       |    2 
 src/resolve/resolved-manager.c    |    5 -
 src/resolve/resolved-manager.h    |  146 ++++++++++++++++++++++++++++++++++++++
 src/resolve/resolved.c            |    2 
 src/resolve/resolved.h            |  146 --------------------------------------
 13 files changed, 186 insertions(+), 159 deletions(-)

New commits:
commit 39d8db043b599a7382f94bfc904d5e108af438bd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 1 16:14:59 2014 +0200

    resolved: rename resolved.h to resolved-manager.h
    
    After all it pretty much exlcusively containers definitions about the
    "Manager" object, hence let's call this the most obvious way.

diff --git a/Makefile.am b/Makefile.am
index fb43b41..30b2589 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4732,12 +4732,13 @@ endif
 # ------------------------------------------------------------------------------
 if ENABLE_RESOLVED
 systemd_resolved_SOURCES = \
-	src/resolve/resolved.h \
 	src/resolve/resolved.c \
 	src/resolve/resolved-manager.c \
+	src/resolve/resolved-manager.h \
 	src/resolve/resolved-conf.c \
 	src/resolve/resolved-conf.h \
 	src/resolve/resolved-bus.c \
+	src/resolve/resolved-bus.h \
 	src/resolve/resolved-link.h \
 	src/resolve/resolved-link.c \
 	src/resolve/resolved-dns-domain.h \
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 6bd2b53..fa00b3d 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -22,8 +22,8 @@
 #include "bus-errors.h"
 #include "bus-util.h"
 
-#include "resolved.h"
 #include "resolved-dns-domain.h"
+#include "resolved-bus.h"
 
 static int reply_query_state(DnsQuery *q) {
         _cleanup_free_ char *ip = NULL;
diff --git a/src/resolve/resolved-bus.h b/src/resolve/resolved-bus.h
new file mode 100644
index 0000000..1e72891
--- /dev/null
+++ b/src/resolve/resolved-bus.h
@@ -0,0 +1,26 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2014 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "resolved-manager.h"
+
+int manager_connect_bus(Manager *m);
diff --git a/src/resolve/resolved-conf.h b/src/resolve/resolved-conf.h
index cdd68fe..b3dbea7 100644
--- a/src/resolve/resolved-conf.h
+++ b/src/resolve/resolved-conf.h
@@ -21,7 +21,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "resolved.h"
+#include "resolved-manager.h"
 
 int manager_parse_dns_server(Manager *m, DnsServerType type, const char *string);
 int manager_parse_config_file(Manager *m);
diff --git a/src/resolve/resolved-dns-query.h b/src/resolve/resolved-dns-query.h
index 7fc11df..adaf7b2 100644
--- a/src/resolve/resolved-dns-query.h
+++ b/src/resolve/resolved-dns-query.h
@@ -29,13 +29,13 @@
 
 typedef struct DnsQuery DnsQuery;
 
-#include "resolved.h"
 #include "resolved-dns-scope.h"
 #include "resolved-dns-rr.h"
 #include "resolved-dns-question.h"
 #include "resolved-dns-answer.h"
 #include "resolved-dns-stream.h"
 #include "resolved-dns-transaction.h"
+#include "resolved-manager.h"
 
 struct DnsQuery {
         Manager *manager;
diff --git a/src/resolve/resolved-dns-scope.h b/src/resolve/resolved-dns-scope.h
index 67a6ba2..8f42068 100644
--- a/src/resolve/resolved-dns-scope.h
+++ b/src/resolve/resolved-dns-scope.h
@@ -25,14 +25,14 @@
 
 typedef struct DnsScope DnsScope;
 
-#include "resolved.h"
-#include "resolved-link.h"
 #include "resolved-dns-server.h"
 #include "resolved-dns-packet.h"
 #include "resolved-dns-query.h"
 #include "resolved-dns-cache.h"
 #include "resolved-dns-zone.h"
 #include "resolved-dns-stream.h"
+#include "resolved-manager.h"
+#include "resolved-link.h"
 
 typedef enum DnsScopeMatch {
         DNS_SCOPE_NO,
diff --git a/src/resolve/resolved-dns-server.h b/src/resolve/resolved-dns-server.h
index 358bbd4..8a9f556 100644
--- a/src/resolve/resolved-dns-server.h
+++ b/src/resolve/resolved-dns-server.h
@@ -26,9 +26,8 @@
 typedef struct DnsServer DnsServer;
 typedef enum DnsServerSource DnsServerSource;
 
-#include "resolved.h"
+#include "resolved-manager.h"
 #include "resolved-link.h"
-#include "resolved-dns-server.h"
 
 typedef enum DnsServerType {
         DNS_SERVER_SYSTEM,
diff --git a/src/resolve/resolved-dns-stream.h b/src/resolve/resolved-dns-stream.h
index fc24bb6..46eae31 100644
--- a/src/resolve/resolved-dns-stream.h
+++ b/src/resolve/resolved-dns-stream.h
@@ -25,9 +25,9 @@
 
 typedef struct DnsStream DnsStream;
 
-#include "resolved.h"
 #include "resolved-dns-packet.h"
 #include "resolved-dns-transaction.h"
+#include "resolved-manager.h"
 
 struct DnsStream {
         Manager *manager;
diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h
index 3cafaab..d29311e 100644
--- a/src/resolve/resolved-link.h
+++ b/src/resolve/resolved-link.h
@@ -29,10 +29,10 @@
 typedef struct Link Link;
 typedef struct LinkAddress LinkAddress;
 
-#include "resolved.h"
 #include "resolved-dns-server.h"
 #include "resolved-dns-scope.h"
 #include "resolved-dns-rr.h"
+#include "resolved-manager.h"
 
 struct LinkAddress {
         Link *link;
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index ffb356e..1e86c10 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -35,9 +35,10 @@
 #include "af-list.h"
 #include "utf8.h"
 
-#include "resolved.h"
-#include "resolved-conf.h"
 #include "resolved-dns-domain.h"
+#include "resolved-conf.h"
+#include "resolved-bus.h"
+#include "resolved-manager.h"
 
 #define SEND_TIMEOUT_USEC (200 * USEC_PER_MSEC)
 
diff --git a/src/resolve/resolved-manager.h b/src/resolve/resolved-manager.h
new file mode 100644
index 0000000..03386f0
--- /dev/null
+++ b/src/resolve/resolved-manager.h
@@ -0,0 +1,146 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2014 Tom Gundersen <teg at jklm.no>
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "sd-event.h"
+#include "sd-network.h"
+#include "sd-rtnl.h"
+#include "util.h"
+#include "list.h"
+#include "in-addr-util.h"
+#include "hashmap.h"
+
+typedef struct Manager Manager;
+
+#include "resolved-dns-query.h"
+#include "resolved-dns-server.h"
+#include "resolved-dns-scope.h"
+#include "resolved-dns-stream.h"
+#include "resolved-link.h"
+
+typedef enum Support {
+        SUPPORT_NO,
+        SUPPORT_YES,
+        SUPPORT_RESOLVE,
+        _SUPPORT_MAX,
+        _SUPPORT_INVALID = -1
+} Support;
+
+struct Manager {
+        sd_event *event;
+
+        Support llmnr_support;
+
+        /* Network */
+        Hashmap *links;
+
+        sd_rtnl *rtnl;
+        sd_event_source *rtnl_event_source;
+
+        sd_network_monitor *network_monitor;
+        sd_event_source *network_event_source;
+
+        /* DNS query management */
+        Hashmap *dns_transactions;
+        LIST_HEAD(DnsQuery, dns_queries);
+        unsigned n_dns_queries;
+
+        LIST_HEAD(DnsStream, dns_streams);
+        unsigned n_dns_streams;
+
+        /* Unicast dns */
+        int dns_ipv4_fd;
+        int dns_ipv6_fd;
+
+        sd_event_source *dns_ipv4_event_source;
+        sd_event_source *dns_ipv6_event_source;
+
+        LIST_HEAD(DnsServer, dns_servers);
+        LIST_HEAD(DnsServer, fallback_dns_servers);
+        DnsServer *current_dns_server;
+
+        LIST_HEAD(DnsScope, dns_scopes);
+        DnsScope *unicast_scope;
+
+        /* LLMNR */
+        int llmnr_ipv4_udp_fd;
+        int llmnr_ipv6_udp_fd;
+        int llmnr_ipv4_tcp_fd;
+        int llmnr_ipv6_tcp_fd;
+
+        sd_event_source *llmnr_ipv4_udp_event_source;
+        sd_event_source *llmnr_ipv6_udp_event_source;
+        sd_event_source *llmnr_ipv4_tcp_event_source;
+        sd_event_source *llmnr_ipv6_tcp_event_source;
+
+        /* dbus */
+        sd_bus *bus;
+        sd_event_source *bus_retry_event_source;
+
+        /* The hostname we publish on LLMNR and mDNS */
+        char *hostname;
+        DnsResourceKey *host_ipv4_key;
+        DnsResourceKey *host_ipv6_key;
+
+        /* Watch the system hostname */
+        int hostname_fd;
+        sd_event_source *hostname_event_source;
+};
+
+/* Manager */
+
+int manager_new(Manager **ret);
+Manager* manager_free(Manager *m);
+
+int manager_write_resolv_conf(Manager *m);
+
+bool manager_known_dns_server(Manager *m, int family, const union in_addr_union *in_addr);
+DnsServer *manager_get_dns_server(Manager *m);
+void manager_next_dns_server(Manager *m);
+
+uint32_t manager_find_mtu(Manager *m);
+
+int manager_send(Manager *m, int fd, int ifindex, int family, const union in_addr_union *addr, uint16_t port, DnsPacket *p);
+int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret);
+
+int manager_dns_ipv4_fd(Manager *m);
+int manager_dns_ipv6_fd(Manager *m);
+int manager_llmnr_ipv4_udp_fd(Manager *m);
+int manager_llmnr_ipv6_udp_fd(Manager *m);
+int manager_llmnr_ipv4_tcp_fd(Manager *m);
+int manager_llmnr_ipv6_tcp_fd(Manager *m);
+
+int manager_ifindex_is_loopback(Manager *m, int ifindex);
+int manager_find_ifindex(Manager *m, int family, const union in_addr_union *in_addr);
+LinkAddress* manager_find_link_address(Manager *m, int family, const union in_addr_union *in_addr);
+
+void manager_refresh_rrs(Manager *m);
+int manager_next_hostname(Manager *m);
+
+int manager_our_packet(Manager *m, DnsPacket *p);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
+
+#define EXTRA_CMSG_SPACE 1024
+
+const char* support_to_string(Support p) _const_;
+int support_from_string(const char *s) _pure_;
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
index b4d743f..900a36d 100644
--- a/src/resolve/resolved.c
+++ b/src/resolve/resolved.c
@@ -24,7 +24,7 @@
 #include "mkdir.h"
 #include "capability.h"
 
-#include "resolved.h"
+#include "resolved-manager.h"
 #include "resolved-conf.h"
 
 int main(int argc, char *argv[]) {
diff --git a/src/resolve/resolved.h b/src/resolve/resolved.h
deleted file mode 100644
index caac61b..0000000
--- a/src/resolve/resolved.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
-  This file is part of systemd.
-
-  Copyright 2014 Tom Gundersen <teg at jklm.no>
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "sd-event.h"
-#include "sd-network.h"
-#include "sd-rtnl.h"
-#include "util.h"
-#include "list.h"
-#include "in-addr-util.h"
-#include "hashmap.h"
-
-typedef struct Manager Manager;
-
-#include "resolved-dns-query.h"
-#include "resolved-dns-server.h"
-#include "resolved-dns-scope.h"
-#include "resolved-dns-stream.h"
-
-typedef enum Support {
-        SUPPORT_NO,
-        SUPPORT_YES,
-        SUPPORT_RESOLVE,
-        _SUPPORT_MAX,
-        _SUPPORT_INVALID = -1
-} Support;
-
-struct Manager {
-        sd_event *event;
-
-        Support llmnr_support;
-
-        /* Network */
-        Hashmap *links;
-
-        sd_rtnl *rtnl;
-        sd_event_source *rtnl_event_source;
-
-        sd_network_monitor *network_monitor;
-        sd_event_source *network_event_source;
-
-        /* DNS query management */
-        Hashmap *dns_transactions;
-        LIST_HEAD(DnsQuery, dns_queries);
-        unsigned n_dns_queries;
-
-        LIST_HEAD(DnsStream, dns_streams);
-        unsigned n_dns_streams;
-
-        /* Unicast dns */
-        int dns_ipv4_fd;
-        int dns_ipv6_fd;
-
-        sd_event_source *dns_ipv4_event_source;
-        sd_event_source *dns_ipv6_event_source;
-
-        LIST_HEAD(DnsServer, dns_servers);
-        LIST_HEAD(DnsServer, fallback_dns_servers);
-        DnsServer *current_dns_server;
-
-        LIST_HEAD(DnsScope, dns_scopes);
-        DnsScope *unicast_scope;
-
-        /* LLMNR */
-        int llmnr_ipv4_udp_fd;
-        int llmnr_ipv6_udp_fd;
-        int llmnr_ipv4_tcp_fd;
-        int llmnr_ipv6_tcp_fd;
-
-        sd_event_source *llmnr_ipv4_udp_event_source;
-        sd_event_source *llmnr_ipv6_udp_event_source;
-        sd_event_source *llmnr_ipv4_tcp_event_source;
-        sd_event_source *llmnr_ipv6_tcp_event_source;
-
-        /* dbus */
-        sd_bus *bus;
-        sd_event_source *bus_retry_event_source;
-
-        /* The hostname we publish on LLMNR and mDNS */
-        char *hostname;
-        DnsResourceKey *host_ipv4_key;
-        DnsResourceKey *host_ipv6_key;
-
-        /* Watch the system hostname */
-        int hostname_fd;
-        sd_event_source *hostname_event_source;
-};
-
-/* Manager */
-
-int manager_new(Manager **ret);
-Manager* manager_free(Manager *m);
-
-int manager_write_resolv_conf(Manager *m);
-
-bool manager_known_dns_server(Manager *m, int family, const union in_addr_union *in_addr);
-DnsServer *manager_get_dns_server(Manager *m);
-void manager_next_dns_server(Manager *m);
-
-uint32_t manager_find_mtu(Manager *m);
-
-int manager_send(Manager *m, int fd, int ifindex, int family, const union in_addr_union *addr, uint16_t port, DnsPacket *p);
-int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret);
-
-int manager_dns_ipv4_fd(Manager *m);
-int manager_dns_ipv6_fd(Manager *m);
-int manager_llmnr_ipv4_udp_fd(Manager *m);
-int manager_llmnr_ipv6_udp_fd(Manager *m);
-int manager_llmnr_ipv4_tcp_fd(Manager *m);
-int manager_llmnr_ipv6_tcp_fd(Manager *m);
-
-int manager_ifindex_is_loopback(Manager *m, int ifindex);
-int manager_find_ifindex(Manager *m, int family, const union in_addr_union *in_addr);
-LinkAddress* manager_find_link_address(Manager *m, int family, const union in_addr_union *in_addr);
-
-void manager_refresh_rrs(Manager *m);
-int manager_next_hostname(Manager *m);
-
-int manager_our_packet(Manager *m, DnsPacket *p);
-int manager_connect_bus(Manager *m);
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
-
-#define EXTRA_CMSG_SPACE 1024
-
-const char* support_to_string(Support p) _const_;
-int support_from_string(const char *s) _pure_;



More information about the systemd-commits mailing list