Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Network Hostname Library

Network hostname configuration library. More...

Macros

#define NET_HOSTNAME_MAX_LEN
 Maximum hostname length.
 

Functions

static const char * net_hostname_get (void)
 Get the device hostname.
 
static int net_hostname_set (char *host, size_t len)
 Set the device hostname.
 
static void net_hostname_init (void)
 Initialize and set the device hostname.
 
static int net_hostname_set_postfix (const uint8_t *hostname_postfix, int postfix_len)
 Set the device hostname postfix.
 

Detailed Description

Network hostname configuration library.

Macro Definition Documentation

◆ NET_HOSTNAME_MAX_LEN

#define NET_HOSTNAME_MAX_LEN

#include <include/zephyr/net/hostname.h>

Value:
(sizeof(CONFIG_NET_HOSTNAME) - 1 + \
(IS_ENABLED(CONFIG_NET_HOSTNAME_UNIQUE) ? sizeof("0011223344556677") - 1 : 0))
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:124

Maximum hostname length.

Function Documentation

◆ net_hostname_get()

static const char * net_hostname_get ( void  )
inlinestatic

#include <include/zephyr/net/hostname.h>

Get the device hostname.

Return pointer to device hostname.

Returns
Pointer to hostname or NULL if not set.

◆ net_hostname_init()

static void net_hostname_init ( void  )
inlinestatic

#include <include/zephyr/net/hostname.h>

Initialize and set the device hostname.

◆ net_hostname_set()

static int net_hostname_set ( char *  host,
size_t  len 
)
inlinestatic

#include <include/zephyr/net/hostname.h>

Set the device hostname.

Parameters
hostnew hostname as char array.
lenLength of the hostname array.
Returns
0 if ok, <0 on error

◆ net_hostname_set_postfix()

static int net_hostname_set_postfix ( const uint8_t hostname_postfix,
int  postfix_len 
)
inlinestatic

#include <include/zephyr/net/hostname.h>

Set the device hostname postfix.

Set the device hostname to some value. This is only used if CONFIG_NET_HOSTNAME_UNIQUE is set.

Parameters
hostname_postfixUsually link address. The function will convert this to a string.
postfix_lenLength of the hostname_postfix array.
Returns
0 if ok, <0 if error