1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2014 Kay Sievers, Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 #include "sd-resolve.h"
26 #include "sd-network.h"
28 #include "socket-util.h"
29 #include "ratelimit.h"
31 typedef struct Manager Manager;
33 #include "timesyncd-server.h"
39 LIST_HEAD(ServerName, system_servers);
40 LIST_HEAD(ServerName, link_servers);
41 LIST_HEAD(ServerName, fallback_servers);
46 sd_event_source *network_event_source;
47 sd_network_monitor *network_monitor;
50 sd_resolve_query *resolve_query;
51 sd_event_source *event_receive;
52 ServerName *current_server_name;
53 ServerAddress *current_server_address;
55 uint64_t packet_count;
56 sd_event_source *event_timeout;
58 /* last sent packet */
59 struct timespec trans_time_mon;
60 struct timespec trans_time;
61 usec_t retry_interval;
65 sd_event_source *event_timer;
66 usec_t poll_interval_usec;
74 unsigned int samples_idx;
75 double samples_jitter;
82 /* watch for time changes */
83 sd_event_source *event_clock_watch;
86 /* Retry connections */
87 sd_event_source *event_retry;
89 /* RTC runs in local time, leave it alone */
93 int manager_new(Manager **ret);
94 void manager_free(Manager *m);
96 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
98 void manager_set_server_name(Manager *m, ServerName *n);
99 void manager_set_server_address(Manager *m, ServerAddress *a);
100 void manager_flush_server_names(Manager *m, ServerType t);
102 int manager_connect(Manager *m);
103 void manager_disconnect(Manager *m);