Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */ 2 : #pragma once 3 : 4 : #include "list.h" 5 : #include "socket-util.h" 6 : 7 : typedef struct ServerAddress ServerAddress; 8 : typedef struct ServerName ServerName; 9 : 10 : typedef enum ServerType { 11 : SERVER_SYSTEM, 12 : SERVER_FALLBACK, 13 : SERVER_LINK, 14 : } ServerType; 15 : 16 : #include "timesyncd-manager.h" 17 : 18 : struct ServerAddress { 19 : ServerName *name; 20 : 21 : union sockaddr_union sockaddr; 22 : socklen_t socklen; 23 : 24 : LIST_FIELDS(ServerAddress, addresses); 25 : }; 26 : 27 : struct ServerName { 28 : Manager *manager; 29 : 30 : ServerType type; 31 : char *string; 32 : 33 : bool marked:1; 34 : 35 : LIST_HEAD(ServerAddress, addresses); 36 : LIST_FIELDS(ServerName, names); 37 : }; 38 : 39 : int server_address_new(ServerName *n, ServerAddress **ret, const union sockaddr_union *sockaddr, socklen_t socklen); 40 : ServerAddress* server_address_free(ServerAddress *a); 41 0 : static inline int server_address_pretty(ServerAddress *a, char **pretty) { 42 0 : return sockaddr_pretty(&a->sockaddr.sa, a->socklen, true, true, pretty); 43 : } 44 : 45 : int server_name_new(Manager *m, ServerName **ret, ServerType type,const char *string); 46 : ServerName *server_name_free(ServerName *n); 47 : void server_name_flush_addresses(ServerName *n);