]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/hostname-util.h
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / src / basic / hostname-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
958b66ea
LP
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2010-2015 Lennart Poettering
958b66ea
LP
8***/
9
10#include <stdbool.h>
dccca82b 11#include <stdio.h>
958b66ea
LP
12
13#include "macro.h"
14
15bool hostname_is_set(void);
16
17char* gethostname_malloc(void);
8e1ad1ea 18int gethostname_strict(char **ret);
958b66ea 19
b59abc4d 20bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
ae691c1d 21char* hostname_cleanup(char *s);
958b66ea 22
25300b5a
LP
23#define machine_name_is_valid(s) hostname_is_valid(s, false)
24
958b66ea 25bool is_localhost(const char *hostname);
46a5e0e7 26bool is_gateway_hostname(const char *hostname);
958b66ea
LP
27
28int sethostname_idempotent(const char *s);
139e5336 29
2de2abad
LB
30int shorten_overlong(const char *s, char **ret);
31
f35cb39e
LP
32int read_etc_hostname_stream(FILE *f, char **ret);
33int read_etc_hostname(const char *path, char **ret);