]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/timesync/timesyncd-server.h
timesyncd: enable DynamicUser=
[thirdparty/systemd.git] / src / timesync / timesyncd-server.h
CommitLineData
84e51726
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2014 Kay Sievers, Lennart Poettering
7
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.
12
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.
17
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/>.
20***/
21
874ff7bf 22#include "list.h"
71d35b6b 23#include "socket-util.h"
874ff7bf 24
84e51726
LP
25typedef struct ServerAddress ServerAddress;
26typedef struct ServerName ServerName;
27
874ff7bf
LP
28typedef enum ServerType {
29 SERVER_SYSTEM,
30 SERVER_FALLBACK,
31 SERVER_LINK,
32} ServerType;
33
34#include "timesyncd-manager.h"
84e51726
LP
35
36struct ServerAddress {
874ff7bf
LP
37 ServerName *name;
38
84e51726
LP
39 union sockaddr_union sockaddr;
40 socklen_t socklen;
874ff7bf 41
84e51726
LP
42 LIST_FIELDS(ServerAddress, addresses);
43};
44
45struct ServerName {
874ff7bf
LP
46 Manager *manager;
47
48 ServerType type;
84e51726 49 char *string;
874ff7bf
LP
50
51 bool marked:1;
52
84e51726
LP
53 LIST_HEAD(ServerAddress, addresses);
54 LIST_FIELDS(ServerName, names);
55};
56
874ff7bf
LP
57int server_address_new(ServerName *n, ServerAddress **ret, const union sockaddr_union *sockaddr, socklen_t socklen);
58ServerAddress* server_address_free(ServerAddress *a);
84e51726 59static inline int server_address_pretty(ServerAddress *a, char **pretty) {
3b1c5241 60 return sockaddr_pretty(&a->sockaddr.sa, a->socklen, true, true, pretty);
84e51726 61}
874ff7bf
LP
62
63int server_name_new(Manager *m, ServerName **ret, ServerType type,const char *string);
64ServerName *server_name_free(ServerName *n);
65void server_name_flush_addresses(ServerName *n);