12 #include <netlink/cli/utils.h> 13 #include <linux/pkt_sched.h> 15 static void print_usage(
void)
18 "Usage: nl-classid-lookup [OPTIONS]... NAME\n" 21 " -h, --help Show this help text.\n" 22 " -v, --version Show versioning information.\n" 23 " -r, --reverse Do a reverse lookup, i.e. classid to name.\n" 24 " --raw Print the raw classid, not pretty printed.\n" 27 " $ nl-classid-lookup low_latency\n" 28 " $ nl-classid-lookup -r 1:12\n" 34 int main(
int argc,
char *argv[])
38 int err, reverse = 0, raw = 0;
45 static struct option long_opts[] = {
46 {
"help", 0, 0,
'h' },
47 {
"version", 0, 0,
'v' },
48 {
"reverse", 0, 0,
'r' },
49 {
"raw", 0, 0, ARG_RAW },
53 c = getopt_long(argc, argv,
"hvr", long_opts, &optidx);
58 case 'h': print_usage();
break;
59 case 'v': nl_cli_print_version();
break;
60 case 'r': reverse = 1;
break;
61 case ARG_RAW: raw = 1;
break;
68 name = argv[optind++];
77 name, nl_geterror(err));
83 printf(
"%#x\n", classid);
85 printf(
"%x:%x\n", TC_H_MAJ(classid) >> 16, TC_H_MIN(classid));
int rtnl_tc_str2handle(const char *str, uint32_t *res)
Convert a charactering strint to a traffic control handle.
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.
char * rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len)
Convert a traffic control handle to a character string (Reentrant).