1 /* 2 * Copyright (c) 2022 Meta 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include "_common.h" 8 9 #ifdef CONFIG_POSIX_API 10 #include <net/if.h> 11 #else 12 #include <zephyr/posix/net/if.h> 13 #endif 14 15 /** 16 * @brief existence test for `<net/if.h>` 17 * 18 * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html">net/if.h</a> 19 */ ZTEST(posix_headers,test_net_if_h)20ZTEST(posix_headers, test_net_if_h) 21 { 22 zassert_not_equal(-1, offsetof(struct if_nameindex, if_index)); 23 zassert_not_equal(-1, offsetof(struct if_nameindex, if_name)); 24 25 zassert_not_equal(-1, IF_NAMESIZE); 26 27 if (IS_ENABLED(CONFIG_POSIX_NETWORKING)) { 28 zassert_not_null(if_freenameindex); 29 zassert_not_null(if_indextoname); 30 zassert_not_null(if_nameindex); 31 zassert_not_null(if_nametoindex); 32 } 33 } 34