blob: cde5ff3ea2850194baa23209cb24cb2a620951a9 [file] [log] [blame]
/*
* Copyright (c) 2023 David Corbeil
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_LOG_BACKEND_NET_H_
#define ZEPHYR_LOG_BACKEND_NET_H_
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Allows user to set a server IP address at runtime
*
* @details This function allows the user to set an IPv4 or IPv6 address at runtime. It can be
* called either before or after the backend has been initialized. If it gets called when
* the net logger backend context is running, it'll release it and create another one with
* the new address next time process() gets called.
*
* @param addr String that contains the IP address.
*
* @return True if parsing could be done, false otherwise.
*/
bool log_backend_net_set_addr(const char *addr);
/**
* @brief update the hostname
*
* @details This function allows to update the hostname displayed by the logging backend. It will be
* called by the network stack if the hostname is set with net_hostname_set().
*
* @param hostname new hostname as char array.
* @param len Length of the hostname array.
*/
#if defined(CONFIG_NET_HOSTNAME_ENABLE)
void log_backend_net_hostname_set(char *hostname, size_t len);
#else
static inline void log_backend_net_hostname_set(const char *hostname, size_t len)
{
ARG_UNUSED(hostname);
ARG_UNUSED(len);
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_LOG_BACKEND_NET_H_ */