random: Include header where it is used

Unit tests were failing to build because random header was
included by kernel_includes.h. The problem is that rand32.h
includes a generated file that is either not generated or not
included when building unit tests. Also, it is better to limit
the scope of this file to where it is used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2020-06-17 13:53:56 -07:00 committed by Anas Nashif
parent 4210259e81
commit e5d444a511
53 changed files with 64 additions and 1 deletions

View File

@ -26,6 +26,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <net/net_if.h>
#include <net/ethernet.h>
#include <ethernet/eth_stats.h>
#include <random/rand32.h>
#if defined(CONFIG_PTP_CLOCK_MCUX)
#include <ptp_clock.h>

View File

@ -23,6 +23,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <stdbool.h>
#include <errno.h>
#include <stddef.h>
#include <random/rand32.h>
#include <net/net_pkt.h>
#include <net/net_core.h>

View File

@ -28,6 +28,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <device.h>
#include <misc/__assert.h>
#include <misc/util.h>
#include <random/rand32.h>
#include <errno.h>
#include <stdbool.h>
#include <net/net_pkt.h>

View File

@ -20,6 +20,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <net/ethernet.h>
#include <ethernet/eth_stats.h>
#include <soc.h>
#include <random/rand32.h>
#include <misc/printk.h>
#include <clock_control.h>
#include <clock_control/stm32_clock_control.h>

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <kernel.h>
#include <arch/cpu.h>
#include <random/rand32.h>
#include <device.h>
#include <init.h>
#include <net/net_if.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
#include <gpio.h>
#include <device.h>
#include <init.h>
#include <random/rand32.h>
#include <net/net_context.h>
#include <net/net_if.h>

View File

@ -32,6 +32,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <net/net_core.h>
#include <net/dummy.h>
#include <console/uart_pipe.h>
#include <random/rand32.h>
#define SLIP_END 0300
#define SLIP_ESC 0333

View File

@ -27,7 +27,6 @@
#include <misc/util.h>
#include <misc/mempool_base.h>
#include <kernel_version.h>
#include <random/rand32.h>
#include <kernel_arch_thread.h>
#include <syscall.h>
#include <misc/printk.h>

View File

@ -30,6 +30,7 @@
#include <init.h>
#include <tracing.h>
#include <stdbool.h>
#include <random/rand32.h>
extern struct _static_thread_data _static_thread_data_list_start[];
extern struct _static_thread_data _static_thread_data_list_end[];

View File

@ -14,6 +14,7 @@
#include <misc/printk.h>
#include <misc/byteorder.h>
#include <zephyr.h>
#include <random/rand32.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>

View File

@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_mqtt_publisher_sample, LOG_LEVEL_DBG);
#include <net/socket.h>
#include <net/mqtt.h>
#include <random/rand32.h>
#include <misc/printk.h>
#include <string.h>
#include <errno.h>

View File

@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
#include <zephyr.h>
#include <errno.h>
#include <stdio.h>
#include <random/rand32.h>
#include <net/socket.h>
#include <net/tls_credentials.h>

View File

@ -13,6 +13,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
#include <zephyr.h>
#include <errno.h>
#include <stdio.h>
#include <random/rand32.h>
#include <net/socket.h>
#include <net/tls_credentials.h>

View File

@ -20,6 +20,7 @@ LOG_MODULE_REGISTER(net_wpan_serial_sample, LOG_LEVEL_DBG);
#include <uart.h>
#include <zephyr.h>
#include <stdio.h>
#include <random/rand32.h>
#include <misc/printk.h>

View File

@ -12,6 +12,8 @@
#include "hal/ecb.h"
#include <random/rand32.h>
int bt_rand(void *buf, size_t len)
{
u8_t *buf8 = buf;

View File

@ -26,6 +26,8 @@ LOG_MODULE_REGISTER(net_dhcpv4, CONFIG_NET_DHCPV4_LOG_LEVEL);
#include <net/dhcpv4.h>
#include <net/dns_resolve.h>
#include <random/rand32.h>
#include "dhcpv4.h"
#include "ipv4.h"

View File

@ -19,6 +19,8 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf, CONFIG_NET_IPV4_AUTO_LOG_LEVEL);
#include <net/net_core.h>
#include <net/net_if.h>
#include <random/rand32.h>
#include "ipv4_autoconf_internal.h"
/* Have only one timer in order to save memory */

View File

@ -12,6 +12,7 @@
LOG_MODULE_DECLARE(net_ipv6, CONFIG_NET_IPV6_LOG_LEVEL);
#include <errno.h>
#include <random/rand32.h>
#include <net/net_core.h>
#include <net/net_pkt.h>
#include <net/net_stats.h>

View File

@ -25,6 +25,8 @@ LOG_MODULE_REGISTER(net_ctx, CONFIG_NET_CONTEXT_LOG_LEVEL);
#include <net/ethernet.h>
#include <net/socket_can.h>
#include <random/rand32.h>
#include "connection.h"
#include "net_private.h"

View File

@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_if, CONFIG_NET_IF_LOG_LEVEL);
#include <net/net_if.h>
#include <net/net_mgmt.h>
#include <net/ethernet.h>
#include <random/rand32.h>
#include "net_private.h"
#include "ipv6.h"

View File

@ -23,6 +23,8 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG);
#include <net/dns_resolve.h>
#include <misc/printk.h>
#include <random/rand32.h>
#include "route.h"
#include "icmpv6.h"
#include "icmpv4.h"

View File

@ -20,6 +20,8 @@
#include <net/net_pkt.h>
#include <net/net_context.h>
#include <random/rand32.h>
#include "connection.h"
#ifdef __cplusplus

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_trickle, CONFIG_NET_TRICKLE_LOG_LEVEL);
#include <errno.h>
#include <misc/util.h>
#include <random/rand32.h>
#include <net/net_core.h>
#include <net/trickle.h>

View File

@ -11,6 +11,8 @@ LOG_MODULE_REGISTER(net_gptp, CONFIG_NET_GPTP_LOG_LEVEL);
#include <ptp_clock.h>
#include <net/ethernet_mgmt.h>
#include <random/rand32.h>
#include <net/gptp.h>
#include "gptp_messages.h"

View File

@ -10,6 +10,8 @@ LOG_MODULE_REGISTER(net_ieee802154_csma, CONFIG_NET_L2_IEEE802154_LOG_LEVEL);
#include <net/net_core.h>
#include <net/net_if.h>
#include <random/rand32.h>
#include <misc/util.h>
#include <stdlib.h>

View File

@ -16,6 +16,8 @@ LOG_MODULE_REGISTER(net_coap, CONFIG_COAP_LOG_LEVEL);
#include <zephyr/types.h>
#include <misc/byteorder.h>
#include <random/rand32.h>
#include <net/net_ip.h>
#include <net/net_core.h>
#include <net/coap.h>

View File

@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL);
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <random/rand32.h>
#include <net/net_ip.h>
#include <net/net_pkt.h>

View File

@ -7,6 +7,8 @@
#include <kernel.h>
#include <string.h>
#include <random/rand32.h>
#include <openthread/platform/random.h>
#include "platform-zephyr.h"

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_sock_tls, CONFIG_NET_SOCKETS_LOG_LEVEL);
#include <net/socket.h>
#include <syscall_handler.h>
#include <misc/fdtable.h>
#include <random/rand32.h>
#if defined(CONFIG_MBEDTLS)
#if !defined(CONFIG_MBEDTLS_CFG_FILE)

View File

@ -69,6 +69,7 @@
#include <zephyr/types.h>
#include <misc/byteorder.h>
#include <random/rand32.h>
#include "kernel.h"

View File

@ -15,6 +15,7 @@
#include <ztest.h>
#include <kernel_internal.h>
#include <random/rand32.h>
#define N_VALUES 10

View File

@ -71,6 +71,7 @@
#include <stdlib.h>
#include <string.h>
#include <ztest.h>
#include <random/rand32.h>
/* Maximum size of message to be signed. */
#define BUF_SIZE 256

View File

@ -14,6 +14,8 @@
#include <inttypes.h>
#include <random/rand32.h>
#include "test_gpio.h"
void test_gpio_pin_read_write(void)

View File

@ -5,6 +5,7 @@
*/
#include <zephyr.h>
#include <ztest.h>
#include <random/rand32.h>
#define NUM_THREADS 8
#define STACK_SIZE (256 + CONFIG_TEST_EXTRA_STACKSIZE)

View File

@ -25,6 +25,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_ARP_LOG_LEVEL);
#include <net/net_ip.h>
#include <net/dummy.h>
#include <ztest.h>
#include <random/rand32.h>
#include "arp.h"

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_CONTEXT_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <tc_util.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
#include <device.h>
#include <init.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
#include <string.h>
#include <errno.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -23,6 +23,8 @@ LOG_MODULE_REGISTER(net_test, CONFIG_DNS_RESOLVER_LOG_LEVEL);
#include <net/net_if.h>
#include <net/dns_resolve.h>
#include <random/rand32.h>
#define NET_LOG_ENABLED 1
#include "net_private.h"

View File

@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
#include <net/mqtt.h>
#include <net/socket.h>
#include <ztest.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>

View File

@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
#include <ztest.h>
#include <net/socket.h>
#include <net/mqtt.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>

View File

@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
#include <ztest.h>
#include <net/socket.h>
#include <net/mqtt.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
#include <string.h>
#include <errno.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -12,6 +12,7 @@
#include <net/net_if.h>
#include <net/net_ip.h>
#include <net/ethernet.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_ROUTE_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <tc_util.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -29,6 +29,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <net/ethernet.h>
#include <net/dummy.h>
#include <net/udp.h>
#include <random/rand32.h>
#include "ipv4.h"
#include "ipv6.h"

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <errno.h>
#include <misc/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>