]>
Commit | Line | Data |
---|---|---|
5eef597e MP |
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 | ||
5eef597e | 22 | #include "list.h" |
4c89c718 | 23 | #include "socket-util.h" |
5eef597e MP |
24 | |
25 | typedef struct ServerAddress ServerAddress; | |
26 | typedef struct ServerName ServerName; | |
27 | ||
28 | typedef enum ServerType { | |
29 | SERVER_SYSTEM, | |
30 | SERVER_FALLBACK, | |
31 | SERVER_LINK, | |
32 | } ServerType; | |
33 | ||
34 | #include "timesyncd-manager.h" | |
35 | ||
36 | struct ServerAddress { | |
37 | ServerName *name; | |
38 | ||
39 | union sockaddr_union sockaddr; | |
40 | socklen_t socklen; | |
41 | ||
42 | LIST_FIELDS(ServerAddress, addresses); | |
43 | }; | |
44 | ||
45 | struct ServerName { | |
46 | Manager *manager; | |
47 | ||
48 | ServerType type; | |
49 | char *string; | |
50 | ||
51 | bool marked:1; | |
52 | ||
53 | LIST_HEAD(ServerAddress, addresses); | |
54 | LIST_FIELDS(ServerName, names); | |
55 | }; | |
56 | ||
57 | int server_address_new(ServerName *n, ServerAddress **ret, const union sockaddr_union *sockaddr, socklen_t socklen); | |
58 | ServerAddress* server_address_free(ServerAddress *a); | |
59 | static inline int server_address_pretty(ServerAddress *a, char **pretty) { | |
e3bff60a | 60 | return sockaddr_pretty(&a->sockaddr.sa, a->socklen, true, true, pretty); |
5eef597e MP |
61 | } |
62 | ||
63 | int server_name_new(Manager *m, ServerName **ret, ServerType type,const char *string); | |
64 | ServerName *server_name_free(ServerName *n); | |
65 | void server_name_flush_addresses(ServerName *n); |