12 #include <netlink/cli/utils.h>
14 static struct nl_cache *alloc_genl_family_cache(
struct nl_sock *sk)
16 return nl_cli_alloc_cache(sk,
"generic netlink family",
20 static void print_usage(
void)
23 "Usage: genl-ctrl-list [--details]\n"
26 " -d, --details Include detailed information in the list\n"
27 " -h, --help Show this help\n"
28 " -v, --version Show versioning information\n"
33 int main(
int argc,
char *argv[])
36 struct nl_cache *family_cache;
42 sock = nl_cli_alloc_socket();
43 nl_cli_connect(sock, NETLINK_GENERIC);
44 family_cache = alloc_genl_family_cache(sock);
48 static struct option long_opts[] = {
49 {
"details", 0, 0,
'd' },
50 {
"format", 1, 0,
'f' },
51 {
"help", 0, 0,
'h' },
52 {
"version", 0, 0,
'v' },
56 c = getopt_long(argc, argv,
"df:hv", long_opts, &optidx);
61 case 'f': params.
dp_type = nl_cli_parse_dumptype(optarg);
break;
63 case 'h': print_usage();
break;
64 case 'v': nl_cli_print_version();
break;