4 This file is part of systemd.
6 Copyright 2014 Kay Sievers, Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 #include "sd-network.h"
24 #include "sd-resolve.h"
27 #include "ratelimit.h"
29 typedef struct Manager Manager
;
31 #include "timesyncd-server.h"
37 LIST_HEAD(ServerName
, system_servers
);
38 LIST_HEAD(ServerName
, link_servers
);
39 LIST_HEAD(ServerName
, fallback_servers
);
41 bool have_fallbacks
:1;
44 bool exhausted_servers
;
47 sd_event_source
*network_event_source
;
48 sd_network_monitor
*network_monitor
;
51 sd_resolve_query
*resolve_query
;
52 sd_event_source
*event_receive
;
53 ServerName
*current_server_name
;
54 ServerAddress
*current_server_address
;
57 uint64_t packet_count
;
58 sd_event_source
*event_timeout
;
61 /* last sent packet */
62 struct timespec trans_time_mon
;
63 struct timespec trans_time
;
64 usec_t retry_interval
;
68 sd_event_source
*event_timer
;
69 usec_t poll_interval_usec
;
77 unsigned int samples_idx
;
78 double samples_jitter
;
79 usec_t max_root_distance_usec
;
86 /* watch for time changes */
87 sd_event_source
*event_clock_watch
;
90 /* Retry connections */
91 sd_event_source
*event_retry
;
93 /* RTC runs in local time, leave it alone */
97 int manager_new(Manager
**ret
);
98 void manager_free(Manager
*m
);
100 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager
*, manager_free
);
102 void manager_set_server_name(Manager
*m
, ServerName
*n
);
103 void manager_set_server_address(Manager
*m
, ServerAddress
*a
);
104 void manager_flush_server_names(Manager
*m
, ServerType t
);
106 int manager_connect(Manager
*m
);
107 void manager_disconnect(Manager
*m
);