CNDP  22.08.0
cnet_ifshow.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2016-2022 Intel Corporation
3  */
4 
5 #ifndef __CNET_IFSHOW_H
6 #define __CNET_IFSHOW_H
7 
13 #include <sys/queue.h>
14 #include <stdint.h> // for uint32_t
15 #include <stdio.h> // for printf
16 #include <net/if.h>
17 
18 #include <cne_common.h>
19 #include <cnet_netif.h> // for _IFF_ALLMULTI, _IFF_BROADCAST, _IFF_LINK0
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 static inline void
26 cnet_print_flags(uint32_t flags)
27 {
28  const char *ifflags[] = {"up", "broadcast", "debug", "loopback", "p2p",
29  "notrailers", "running", "noarp", "promisc", "allmulti",
30  "master", "slave", "multicast", "portsel", "automedia",
31  "dynamic", "lowerup"};
32 
33  cne_printf("[magenta]flags[]:< [cyan]");
34  for (int i = 0; i < cne_countof(ifflags); i++)
35  if (flags & (1UL << i))
36  cne_printf("%s ", ifflags[i]);
37  cne_printf("[]>");
38 }
39 
48 CNDP_API int cnet_ifshow(char *ifname);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* __CNET_IFSHOW_H */
CNDP_API int cne_printf(const char *fmt,...)
CNDP_API int cnet_ifshow(char *ifname)
Show the configuration information of a given interface or all if not given.