timesyncd-manager.h revision 481b3f9e998d1981e01915bed34f55ea99af1542
1N/A/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1N/A
1N/A#pragma once
1N/A
1N/A/***
1N/A This file is part of systemd.
1N/A
1N/A Copyright 2014 Kay Sievers, Lennart Poettering
1N/A
1N/A systemd is free software; you can redistribute it and/or modify it
1N/A under the terms of the GNU Lesser General Public License as published by
1N/A the Free Software Foundation; either version 2.1 of the License, or
1N/A (at your option) any later version.
1N/A
1N/A systemd is distributed in the hope that it will be useful, but
1N/A WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1N/A Lesser General Public License for more details.
1N/A
1N/A You should have received a copy of the GNU Lesser General Public License
1N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
1N/A***/
1N/A
1N/A#include "sd-event.h"
1N/A#include "sd-resolve.h"
1N/A#include "sd-network.h"
1N/A#include "list.h"
1N/A#include "ratelimit.h"
1N/A
1N/Atypedef struct Manager Manager;
1N/A
1N/A#include "timesyncd-server.h"
1N/A
1N/Astruct Manager {
1N/A sd_event *event;
1N/A sd_resolve *resolve;
1N/A
1N/A LIST_HEAD(ServerName, system_servers);
1N/A LIST_HEAD(ServerName, link_servers);
1N/A LIST_HEAD(ServerName, fallback_servers);
1N/A
1N/A RateLimit ratelimit;
1N/A bool exhausted_servers;
1N/A
1N/A /* network */
1N/A sd_event_source *network_event_source;
1N/A sd_network_monitor *network_monitor;
1N/A
1N/A /* peer */
1N/A sd_resolve_query *resolve_query;
1N/A sd_event_source *event_receive;
1N/A ServerName *current_server_name;
1N/A ServerAddress *current_server_address;
1N/A int server_socket;
1N/A int missed_replies;
1N/A uint64_t packet_count;
1N/A sd_event_source *event_timeout;
1N/A bool good;
1N/A
1N/A /* last sent packet */
1N/A struct timespec trans_time_mon;
1N/A struct timespec trans_time;
1N/A usec_t retry_interval;
1N/A bool pending;
1N/A
1N/A /* poll timer */
1N/A sd_event_source *event_timer;
1N/A usec_t poll_interval_usec;
1N/A bool poll_resync;
1N/A
1N/A /* history data */
1N/A struct {
1N/A double offset;
1N/A double delay;
1N/A } samples[8];
1N/A unsigned int samples_idx;
1N/A double samples_jitter;
1N/A
1N/A /* last change */
1N/A bool jumped;
1N/A bool sync;
1N/A int drift_ppm;
1N/A
1N/A /* watch for time changes */
1N/A sd_event_source *event_clock_watch;
1N/A int clock_watch_fd;
1N/A
1N/A /* Retry connections */
1N/A sd_event_source *event_retry;
1N/A
1N/A /* RTC runs in local time, leave it alone */
1N/A bool rtc_local_time;
1N/A};
1N/A
1N/Aint manager_new(Manager **ret);
1N/Avoid manager_free(Manager *m);
1N/A
1N/ADEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
1N/A
1N/Avoid manager_set_server_name(Manager *m, ServerName *n);
1N/Avoid manager_set_server_address(Manager *m, ServerAddress *a);
1N/Avoid manager_flush_server_names(Manager *m, ServerType t);
1N/A
1N/Aint manager_connect(Manager *m);
1N/Avoid manager_disconnect(Manager *m);
1N/A