/***
This file is part of systemd.
Copyright 2014 Kay Sievers, Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "alloc-util.h"
#include "timesyncd-server.h"
int server_address_new(
ServerName *n,
ServerAddress **ret,
const union sockaddr_union *sockaddr,
assert(n);
if (!a)
return -ENOMEM;
a->name = n;
if (ret)
*ret = a;
return 0;
}
if (!a)
return NULL;
if (a->name) {
}
free(a);
return NULL;
}
int server_name_new(
Manager *m,
ServerName **ret,
const char *string) {
assert(m);
if (!n)
return -ENOMEM;
if (!n->string) {
free(n);
return -ENOMEM;
}
if (type == SERVER_SYSTEM) {
} else if (type == SERVER_LINK) {
} else if (type == SERVER_FALLBACK) {
} else
assert_not_reached("Unknown server type");
n->manager = m;
if (type != SERVER_FALLBACK &&
m->current_server_name &&
if (ret)
*ret = n;
return 0;
}
if (!n)
return NULL;
if (n->manager) {
if (n->type == SERVER_SYSTEM)
else if (n->type == SERVER_LINK)
else if (n->type == SERVER_FALLBACK)
else
assert_not_reached("Unknown server type");
if (n->manager->current_server_name == n)
}
free(n);
return NULL;
}
assert(n);
while (n->addresses)
}