]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/hostname-util.h
e92222a7b95a72dbf867f4d64df2b70e1bff9415
[thirdparty/systemd.git] / src / basic / hostname-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright 2010-2015 Lennart Poettering
6 ***/
7
8 #include <stdbool.h>
9 #include <stdio.h>
10
11 #include "macro.h"
12
13 bool hostname_is_set(void);
14
15 char* gethostname_malloc(void);
16 int gethostname_strict(char **ret);
17
18 bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
19 char* hostname_cleanup(char *s);
20
21 #define machine_name_is_valid(s) hostname_is_valid(s, false)
22
23 bool is_localhost(const char *hostname);
24 bool is_gateway_hostname(const char *hostname);
25
26 int sethostname_idempotent(const char *s);
27
28 int shorten_overlong(const char *s, char **ret);
29
30 int read_etc_hostname_stream(FILE *f, char **ret);
31 int read_etc_hostname(const char *path, char **ret);