]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/hostname-util.h
license: LGPL-2.1+ -> LGPL-2.1-or-later
[thirdparty/systemd.git] / src / basic / hostname-util.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
958b66ea
LP
2#pragma once
3
958b66ea 4#include <stdbool.h>
dccca82b 5#include <stdio.h>
958b66ea
LP
6
7#include "macro.h"
8
9bool hostname_is_set(void);
10
11char* gethostname_malloc(void);
e97708fa 12char* gethostname_short_malloc(void);
8e1ad1ea 13int gethostname_strict(char **ret);
958b66ea 14
d65652f1 15bool valid_ldh_char(char c) _const_;
b59abc4d 16bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
ae691c1d 17char* hostname_cleanup(char *s);
958b66ea 18
25300b5a
LP
19#define machine_name_is_valid(s) hostname_is_valid(s, false)
20
958b66ea 21bool is_localhost(const char *hostname);
46a5e0e7 22bool is_gateway_hostname(const char *hostname);
958b66ea
LP
23
24int sethostname_idempotent(const char *s);
139e5336 25
2de2abad
LB
26int shorten_overlong(const char *s, char **ret);
27
f35cb39e
LP
28int read_etc_hostname_stream(FILE *f, char **ret);
29int read_etc_hostname(const char *path, char **ret);