1 /* 2 * Copyright (c) 2021 Nordic Semiconductor 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_NET_SOCKET_TYPES_H_ 8 #define ZEPHYR_INCLUDE_NET_SOCKET_TYPES_H_ 9 10 /** 11 * @brief BSD Sockets compatible API 12 * @defgroup bsd_sockets BSD Sockets compatible API 13 * @ingroup networking 14 * @{ 15 */ 16 17 #include <zephyr/types.h> 18 19 20 #ifdef CONFIG_NEWLIB_LIBC 21 22 #include <newlib.h> 23 24 #ifdef __NEWLIB__ 25 #include <sys/_timeval.h> 26 #else /* __NEWLIB__ */ 27 #include <sys/types.h> 28 /* workaround for older Newlib 2.x, as it lacks sys/_timeval.h */ 29 struct timeval { 30 time_t tv_sec; 31 suseconds_t tv_usec; 32 }; 33 #endif /* __NEWLIB__ */ 34 35 #else /* CONFIG_NEWLIB_LIBC */ 36 37 #if defined(CONFIG_ARCH_POSIX) && defined(CONFIG_EXTERNAL_LIBC) 38 #include <bits/types/struct_timeval.h> 39 #else 40 #include <sys/_timeval.h> 41 #endif 42 43 #endif /* CONFIG_NEWLIB_LIBC */ 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 #define zsock_timeval timeval 50 51 #ifdef __cplusplus 52 } 53 #endif 54 55 /** 56 * @} 57 */ 58 59 #endif /* ZEPHYR_INCLUDE_NET_SOCKET_TYPES_H_ */ 60