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-11 21:28:55 -07:00 committed by Anas Nashif
parent 6216c6cf5b
commit c4f7faea10
60 changed files with 62 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#define ZEPHYR_DRIVERS_ETHERNET_ETH_H_
#include <zephyr/types.h>
#include <random/rand32.h>
/* helper macro to return mac address octet from local_mac_address prop */
#define NODE_MAC_ADDR_OCTET(node, n) DT_PROP_BY_IDX(node, local_mac_address, n)

View File

@ -19,6 +19,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <init.h>
#include <net/net_if.h>
#include <net/net_pkt.h>
#include <random/rand32.h>
#include <drivers/console/uart_pipe.h>
#include <net/ieee802154_radio.h>

View File

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

View File

@ -31,6 +31,7 @@ LOG_MODULE_REGISTER(net_ppp, LOG_LEVEL);
#include <sys/crc.h>
#include <drivers/uart.h>
#include <drivers/console/uart_mux.h>
#include <random/rand32.h>
#include "../../subsys/net/ip/net_stats.h"
#include "../../subsys/net/ip/net_private.h"

View File

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

View File

@ -33,7 +33,6 @@
#include <mempool_sys.h>
#endif
#include <kernel_version.h>
#include <random/rand32.h>
#include <syscall.h>
#include <sys/printk.h>
#include <arch/cpu.h>

View File

@ -26,6 +26,7 @@
#include <stdbool.h>
#include <irq_offload.h>
#include <sys/check.h>
#include <random/rand32.h>
#ifdef CONFIG_THREAD_MONITOR
/* This lock protects the linked list of active threads; i.e. the

View File

@ -11,6 +11,7 @@
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <random/rand32.h>
#include <sys/printk.h>
#include <sys/byteorder.h>
#include <zephyr.h>

View File

@ -12,6 +12,7 @@ LOG_MODULE_REGISTER(mqtt_azure, LOG_LEVEL_DBG);
#include <net/mqtt.h>
#include <sys/printk.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>

View File

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

View File

@ -16,6 +16,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
#include <net/socket.h>
#include <net/tls_credentials.h>
#include <random/rand32.h>
#include "common.h"
#include "ca_certificate.h"

View File

@ -16,6 +16,7 @@ LOG_MODULE_DECLARE(net_echo_client_sample, LOG_LEVEL_DBG);
#include <net/socket.h>
#include <net/tls_credentials.h>
#include <random/rand32.h>
#include "common.h"
#include "ca_certificate.h"

View File

@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_websocket_client_sample, LOG_LEVEL_DBG);
#include <net/socket.h>
#include <net/tls_credentials.h>
#include <net/websocket.h>
#include <random/rand32.h>
#include <shell/shell.h>
#include "ca_certificate.h"

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(wpan_serial, CONFIG_USB_DEVICE_LOG_LEVEL);
#include <drivers/uart.h>
#include <zephyr.h>
#include <usb/usb_device.h>
#include <random/rand32.h>
#include <net/buf.h>
#include <net_private.h>

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_dhcpv4, CONFIG_NET_DHCPV4_LOG_LEVEL);
#include <errno.h>
#include <inttypes.h>
#include <random/rand32.h>
#include <net/net_core.h>
#include <net/net_pkt.h>
#include <net/net_if.h>

View File

@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf, CONFIG_NET_IPV4_AUTO_LOG_LEVEL);
#include <net/net_pkt.h>
#include <net/net_core.h>
#include <net/net_if.h>
#include <random/rand32.h>
#include "ipv4_autoconf_internal.h"

View File

@ -17,6 +17,7 @@ LOG_MODULE_DECLARE(net_ipv6, CONFIG_NET_IPV6_LOG_LEVEL);
#include <net/net_stats.h>
#include <net/net_context.h>
#include <net/net_mgmt.h>
#include <random/rand32.h>
#include "net_private.h"
#include "connection.h"
#include "icmpv6.h"

View File

@ -14,6 +14,7 @@
LOG_MODULE_REGISTER(net_ctx, CONFIG_NET_CONTEXT_LOG_LEVEL);
#include <kernel.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>

View File

@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_if, CONFIG_NET_IF_LOG_LEVEL);
#include <init.h>
#include <kernel.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <syscall_handler.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,6 +15,7 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG);
#include <zephyr.h>
#include <kernel_internal.h>
#include <random/rand32.h>
#include <stdlib.h>
#include <stdio.h>
#include <shell/shell.h>

View File

@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_tcp, CONFIG_NET_TCP_LOG_LEVEL);
#include <stdio.h>
#include <stdlib.h>
#include <zephyr.h>
#include <random/rand32.h>
#include <net/net_pkt.h>
#include <net/net_context.h>
#include <net/udp.h>

View File

@ -14,6 +14,7 @@
#define __TCP_INTERNAL_H
#include <zephyr/types.h>
#include <random/rand32.h>
#include <net/net_core.h>
#include <net/net_ip.h>

View File

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

View File

@ -20,6 +20,7 @@ LOG_MODULE_REGISTER(net_l2_canbus, CONFIG_NET_L2_CANBUS_LOG_LEVEL);
#include <net/ethernet.h>
#include <net/net_ip.h>
#include <string.h>
#include <random/rand32.h>
#define NET_CAN_WFTMAX 2
#define NET_CAN_ALLOC_TIMEOUT K_MSEC(100)

View File

@ -14,6 +14,7 @@ LOG_MODULE_REGISTER(net_ethernet, CONFIG_NET_L2_ETHERNET_LOG_LEVEL);
#include <net/ethernet.h>
#include <net/ethernet_mgmt.h>
#include <net/gptp.h>
#include <random/rand32.h>
#if defined(CONFIG_NET_LLDP)
#include <net/lldp.h>

View File

@ -10,6 +10,7 @@ LOG_MODULE_REGISTER(net_gptp, CONFIG_NET_GPTP_LOG_LEVEL);
#include <net/net_pkt.h>
#include <ptp_clock.h>
#include <net/ethernet_mgmt.h>
#include <random/rand32.h>
#include <net/gptp.h>

View File

@ -11,6 +11,7 @@ LOG_MODULE_REGISTER(net_ieee802154_csma, CONFIG_NET_L2_IEEE802154_LOG_LEVEL);
#include <net/net_if.h>
#include <sys/util.h>
#include <random/rand32.h>
#include <stdlib.h>
#include <errno.h>

View File

@ -11,6 +11,7 @@ LOG_MODULE_DECLARE(net_l2_ppp, CONFIG_NET_L2_PPP_LOG_LEVEL);
#include <net/net_pkt.h>
#include <net/ppp.h>
#include <random/rand32.h>
#include "net_private.h"

View File

@ -14,6 +14,7 @@
LOG_MODULE_REGISTER(net_dns_resolve, CONFIG_DNS_RESOLVER_LOG_LEVEL);
#include <zephyr/types.h>
#include <random/rand32.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

View File

@ -7,6 +7,7 @@
#include <kernel.h>
#include <logging/log.h>
#include <settings/settings.h>
#include <random/rand32.h>
#include <openthread/platform/settings.h>

View File

@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_sock_tls, CONFIG_NET_SOCKETS_LOG_LEVEL);
#include <sys/util.h>
#include <net/net_context.h>
#include <net/socket.h>
#include <random/rand32.h>
#include <syscall_handler.h>
#include <sys/fdtable.h>

View File

@ -26,6 +26,7 @@ LOG_MODULE_REGISTER(net_websocket, CONFIG_NET_WEBSOCKET_LOG_LEVEL);
#include <net/http_client.h>
#include <net/websocket.h>
#include <random/rand32.h>
#include <sys/byteorder.h>
#include <sys/base64.h>
#include <mbedtls/sha1.h>

View File

@ -69,6 +69,7 @@
#include <zephyr/types.h>
#include <sys/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

@ -67,6 +67,7 @@
#include <test_utils.h>
#include "test_ecc_utils.h"
#include <sys/util.h>
#include <random/rand32.h>
#include <stdio.h>
#include <stdlib.h>

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

@ -6,6 +6,7 @@
#include <ztest.h>
#include <zephyr/types.h>
#include <sys/time_units.h>
#include <random/rand32.h>
#define NUM_RANDOM 100

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 <sys/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 <sys/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <tc_util.h>

View File

@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <random/rand32.h>
#include <sys/printk.h>
#include <linker/sections.h>

View File

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

View File

@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_DNS_RESOLVER_LOG_LEVEL);
#include <string.h>
#include <errno.h>
#include <sys/printk.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_DNS_RESOLVER_LOG_LEVEL);
#include <string.h>
#include <errno.h>
#include <sys/printk.h>
#include <random/rand32.h>
#include <ztest.h>

View File

@ -14,6 +14,8 @@ LOG_MODULE_REGISTER(net_test, LOG_LEVEL_WRN);
#include <string.h>
#include <errno.h>
#include <random/rand32.h>
#include "config.h"
/* This is mqtt payload message. */

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

@ -27,6 +27,8 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_IPV6_LOG_LEVEL);
#include <net/net_mgmt.h>
#include <net/net_event.h>
#include <random/rand32.h>
#include "icmpv6.h"
#include "ipv6.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

@ -9,6 +9,7 @@
#include <zephyr.h>
#include <linker/sections.h>
#include <ztest.h>
#include <random/rand32.h>
#include <net/ethernet.h>
#include <net/dummy.h>

View File

@ -29,6 +29,8 @@ LOG_MODULE_REGISTER(net_test, NET_LOG_LEVEL);
#include <net/net_ip.h>
#include <net/net_l2.h>
#include <random/rand32.h>
#define NET_LOG_ENABLED 1
#include "net_private.h"

View File

@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_ROUTE_LOG_LEVEL);
#include <errno.h>
#include <sys/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <tc_util.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 <sys/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 <sys/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 <sys/printk.h>
#include <linker/sections.h>
#include <random/rand32.h>
#include <ztest.h>