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
);
42 bool exhausted_servers
;
45 sd_event_source
*network_event_source
;
46 sd_network_monitor
*network_monitor
;
49 sd_resolve_query
*resolve_query
;
50 sd_event_source
*event_receive
;
51 ServerName
*current_server_name
;
52 ServerAddress
*current_server_address
;
55 uint64_t packet_count
;
56 sd_event_source
*event_timeout
;
59 /* last sent packet */
60 struct timespec trans_time_mon
;
61 struct timespec trans_time
;
62 usec_t retry_interval
;
66 sd_event_source
*event_timer
;
67 usec_t poll_interval_usec
;
75 unsigned int samples_idx
;
76 double samples_jitter
;
83 /* watch for time changes */
84 sd_event_source
*event_clock_watch
;
87 /* Retry connections */
88 sd_event_source
*event_retry
;
90 /* RTC runs in local time, leave it alone */
94 int manager_new(Manager
**ret
);
95 void manager_free(Manager
*m
);
97 DEFINE_TRIVIAL_CLEANUP_FUNC(Manager
*, manager_free
);
99 void manager_set_server_name(Manager
*m
, ServerName
*n
);
100 void manager_set_server_address(Manager
*m
, ServerAddress
*a
);
101 void manager_flush_server_names(Manager
*m
, ServerType t
);
103 int manager_connect(Manager
*m
);
104 void manager_disconnect(Manager
*m
);