Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
hostname.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2017 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_NET_HOSTNAME_H_
12#define ZEPHYR_INCLUDE_NET_HOSTNAME_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
25#define NET_HOSTNAME_MAX_LEN \
26 (sizeof(CONFIG_NET_HOSTNAME) - 1 + \
27 (IS_ENABLED(CONFIG_NET_HOSTNAME_UNIQUE) ? \
28 sizeof("0011223344556677") - 1 : 0))
29
37#if defined(CONFIG_NET_HOSTNAME_ENABLE)
38const char *net_hostname_get(void);
39#else
40static inline const char *net_hostname_get(void)
41{
42 return "zephyr";
43}
44#endif /* CONFIG_NET_HOSTNAME_ENABLE */
45
50#if defined(CONFIG_NET_HOSTNAME_ENABLE)
51void net_hostname_init(void);
52#else
53static inline void net_hostname_init(void)
54{
55}
56#endif /* CONFIG_NET_HOSTNAME_ENABLE */
57
70#if defined(CONFIG_NET_HOSTNAME_UNIQUE)
71int net_hostname_set_postfix(const uint8_t *hostname_postfix,
72 int postfix_len);
73#else
74static inline int net_hostname_set_postfix(const uint8_t *hostname_postfix,
75 int postfix_len)
76{
77 return -EMSGSIZE;
78}
79#endif /* CONFIG_NET_HOSTNAME_UNIQUE */
80
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* ZEPHYR_INCLUDE_NET_HOSTNAME_H_ */
static int net_hostname_set_postfix(const uint8_t *hostname_postfix, int postfix_len)
Set the device hostname postfix.
Definition: hostname.h:74
static const char * net_hostname_get(void)
Get the device hostname.
Definition: hostname.h:40
static void net_hostname_init(void)
Initialize and set the device hostname.
Definition: hostname.h:53
#define EMSGSIZE
Definition: errno.h:107
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58