1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
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 "socket-util.h"
24 #include "ratelimit.h"
26 #include "sd-resolve.h"
27 #include "sd-network.h"
29 typedef struct Manager Manager;
30 typedef struct ServerAddress ServerAddress;
31 typedef struct ServerName ServerName;
33 struct ServerAddress {
34 union sockaddr_union sockaddr;
36 LIST_FIELDS(ServerAddress, addresses);
41 LIST_HEAD(ServerAddress, addresses);
42 LIST_FIELDS(ServerName, names);
49 LIST_HEAD(ServerName, servers);
54 sd_event_source *network_event_source;
55 sd_network_monitor *network_monitor;
58 sd_resolve_query *resolve_query;
59 sd_event_source *event_receive;
60 ServerName *current_server_name;
61 ServerAddress *current_server_address;
63 uint64_t packet_count;
64 sd_event_source *event_timeout;
66 /* last sent packet */
67 struct timespec trans_time_mon;
68 struct timespec trans_time;
69 usec_t retry_interval;
73 sd_event_source *event_timer;
74 usec_t poll_interval_usec;
82 unsigned int samples_idx;
83 double samples_jitter;
89 /* watch for time changes */
90 sd_event_source *event_clock_watch;
93 /* Retry connections */
94 sd_event_source *event_retry;
97 const struct ConfigPerfItem* timesyncd_gperf_lookup(const char *key, unsigned length);
99 int config_parse_servers(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);