1 /* 2 * Copyright (c) 2018 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** @file 8 * @brief Private functions for native posix ethernet driver. 9 */ 10 11 #ifndef ZEPHYR_DRIVERS_ETHERNET_ETH_NATIVE_POSIX_PRIV_H_ 12 #define ZEPHYR_DRIVERS_ETHERNET_ETH_NATIVE_POSIX_PRIV_H_ 13 14 #define ETH_NATIVE_POSIX_DRV_NAME CONFIG_ETH_NATIVE_POSIX_DRV_NAME 15 #define ETH_NATIVE_POSIX_DEV_NAME CONFIG_ETH_NATIVE_POSIX_DEV_NAME 16 17 #if defined(CONFIG_ETH_NATIVE_POSIX_STARTUP_AUTOMATIC) 18 #define ETH_NATIVE_POSIX_SETUP_SCRIPT CONFIG_ETH_NATIVE_POSIX_SETUP_SCRIPT 19 #define ETH_NATIVE_POSIX_STARTUP_SCRIPT CONFIG_ETH_NATIVE_POSIX_STARTUP_SCRIPT 20 #define ETH_NATIVE_POSIX_STARTUP_SCRIPT_USER \ 21 CONFIG_ETH_NATIVE_POSIX_STARTUP_SCRIPT_USER 22 #else 23 #define ETH_NATIVE_POSIX_SETUP_SCRIPT "" 24 #define ETH_NATIVE_POSIX_STARTUP_SCRIPT "" 25 #define ETH_NATIVE_POSIX_STARTUP_SCRIPT_USER "" 26 #endif 27 28 int eth_iface_create(const char *if_name, bool tun_only); 29 int eth_iface_remove(int fd); 30 int eth_setup_host(const char *if_name); 31 int eth_start_script(const char *if_name); 32 int eth_wait_data(int fd); 33 ssize_t eth_read_data(int fd, void *buf, size_t buf_len); 34 ssize_t eth_write_data(int fd, void *buf, size_t buf_len); 35 int eth_if_up(const char *if_name); 36 int eth_if_down(const char *if_name); 37 38 #if defined(CONFIG_NET_GPTP) 39 int eth_clock_gettime(struct net_ptp_time *time); 40 #endif 41 42 #if defined(CONFIG_NET_PROMISCUOUS_MODE) 43 int eth_promisc_mode(const char *if_name, bool enable); 44 #else eth_promisc_mode(const char * if_name,bool enable)45static inline int eth_promisc_mode(const char *if_name, bool enable) 46 { 47 ARG_UNUSED(if_name); 48 ARG_UNUSED(enable); 49 50 return -ENOTSUP; 51 } 52 #endif 53 54 #endif /* ZEPHYR_DRIVERS_ETHERNET_ETH_NATIVE_POSIX_PRIV_H_ */ 55