Lines Matching refs:argv

32 static void syntax(char *argv[])  in syntax()  argument
34 …(stderr, "%s add|ann|rem|csf|dsf|get|set|del|flush|dump|events|listen|accept [<args>]\n", argv[0]); in syntax()
339 int dsf(int fd, int pm_family, int argc, char *argv[]) in dsf() argument
362 syntax(argv); in dsf()
368 if (!strcmp(argv[arg], "lip")) { in dsf()
372 params[0] = argv[arg]; in dsf()
373 } else if (!strcmp(argv[arg], "lport")) { in dsf()
377 params[1] = argv[arg]; in dsf()
378 } else if (!strcmp(argv[arg], "rip")) { in dsf()
382 params[2] = argv[arg]; in dsf()
383 } else if (!strcmp(argv[arg], "rport")) { in dsf()
387 params[3] = argv[arg]; in dsf()
388 } else if (!strcmp(argv[arg], "token")) { in dsf()
392 params[4] = argv[arg]; in dsf()
394 error(1, 0, "unknown keyword %s", argv[arg]); in dsf()
451 int csf(int fd, int pm_family, int argc, char *argv[]) in csf() argument
476 syntax(argv); in csf()
482 if (!strcmp(argv[arg], "lip")) { in csf()
486 params[0] = argv[arg]; in csf()
487 } else if (!strcmp(argv[arg], "lid")) { in csf()
491 params[1] = argv[arg]; in csf()
492 } else if (!strcmp(argv[arg], "rip")) { in csf()
496 params[2] = argv[arg]; in csf()
497 } else if (!strcmp(argv[arg], "rport")) { in csf()
501 params[3] = argv[arg]; in csf()
502 } else if (!strcmp(argv[arg], "token")) { in csf()
506 params[4] = argv[arg]; in csf()
508 error(1, 0, "unknown param %s", argv[arg]); in csf()
577 int remove_addr(int fd, int pm_family, int argc, char *argv[]) in remove_addr() argument
595 syntax(argv); in remove_addr()
598 if (!strcmp(argv[arg], "id")) { in remove_addr()
602 id = atoi(argv[arg]); in remove_addr()
608 } else if (!strcmp(argv[arg], "token")) { in remove_addr()
612 token = strtoul(argv[arg], NULL, 10); in remove_addr()
619 error(1, 0, "unknown keyword %s", argv[arg]); in remove_addr()
626 int announce_addr(int fd, int pm_family, int argc, char *argv[]) in announce_addr() argument
647 syntax(argv); in announce_addr()
659 if (inet_pton(AF_INET, argv[2], RTA_DATA(rta))) { in announce_addr()
663 } else if (inet_pton(AF_INET6, argv[2], RTA_DATA(rta))) { in announce_addr()
668 error(1, errno, "can't parse ip %s", argv[2]); in announce_addr()
679 if (!strcmp(argv[arg], "id")) { in announce_addr()
684 id = atoi(argv[arg]); in announce_addr()
690 } else if (!strcmp(argv[arg], "dev")) { in announce_addr()
697 ifindex = if_nametoindex(argv[arg]); in announce_addr()
699 error(1, errno, "unknown device %s", argv[arg]); in announce_addr()
706 } else if (!strcmp(argv[arg], "port")) { in announce_addr()
713 port = atoi(argv[arg]); in announce_addr()
719 } else if (!strcmp(argv[arg], "token")) { in announce_addr()
724 token = strtoul(argv[arg], NULL, 10); in announce_addr()
726 error(1, 0, "unknown keyword %s", argv[arg]); in announce_addr()
753 int add_addr(int fd, int pm_family, int argc, char *argv[]) in add_addr() argument
773 syntax(argv); in add_addr()
783 if (inet_pton(AF_INET, argv[2], RTA_DATA(rta))) { in add_addr()
787 } else if (inet_pton(AF_INET6, argv[2], RTA_DATA(rta))) { in add_addr()
792 error(1, errno, "can't parse ip %s", argv[2]); in add_addr()
803 if (!strcmp(argv[arg], "flags")) { in add_addr()
811 for (str = argv[arg]; (tok = strtok(str, ",")); in add_addr()
823 "unknown flag %s", argv[arg]); in add_addr()
836 } else if (!strcmp(argv[arg], "id")) { in add_addr()
840 id = atoi(argv[arg]); in add_addr()
846 } else if (!strcmp(argv[arg], "dev")) { in add_addr()
852 ifindex = if_nametoindex(argv[arg]); in add_addr()
854 error(1, errno, "unknown device %s", argv[arg]); in add_addr()
861 } else if (!strcmp(argv[arg], "port")) { in add_addr()
869 port = atoi(argv[arg]); in add_addr()
876 error(1, 0, "unknown keyword %s", argv[arg]); in add_addr()
884 int del_addr(int fd, int pm_family, int argc, char *argv[]) in del_addr() argument
903 syntax(argv); in del_addr()
905 id = atoi(argv[2]); in del_addr()
908 syntax(argv); in del_addr()
926 if (inet_pton(AF_INET, argv[3], RTA_DATA(rta))) { in del_addr()
930 } else if (inet_pton(AF_INET6, argv[3], RTA_DATA(rta))) { in del_addr()
935 error(1, errno, "can't parse ip %s", argv[3]); in del_addr()
1075 int get_addr(int fd, int pm_family, int argc, char *argv[]) in get_addr() argument
1093 syntax(argv); in get_addr()
1095 id = atoi(argv[2]); in get_addr()
1115 int dump_addrs(int fd, int pm_family, int argc, char *argv[]) in dump_addrs() argument
1137 int flush_addrs(int fd, int pm_family, int argc, char *argv[]) in flush_addrs() argument
1189 int get_set_limits(int fd, int pm_family, int argc, char *argv[]) in get_set_limits() argument
1201 rcv_addr = atoi(argv[2]); in get_set_limits()
1202 subflows = atoi(argv[3]); in get_set_limits()
1237 int add_listener(int argc, char *argv[]) in add_listener() argument
1248 syntax(argv); in add_listener()
1254 if (inet_pton(AF_INET, argv[2], &a4->sin_addr)) { in add_listener()
1257 a4->sin_port = htons(atoi(argv[3])); in add_listener()
1258 } else if (inet_pton(AF_INET6, argv[2], &a6->sin6_addr)) { in add_listener()
1261 a6->sin6_port = htons(atoi(argv[3])); in add_listener()
1263 error(1, errno, "can't parse ip %s", argv[2]); in add_listener()
1285 int set_flags(int fd, int pm_family, int argc, char *argv[]) in set_flags() argument
1309 syntax(argv); in set_flags()
1317 if (!strcmp(argv[arg], "id")) { in set_flags()
1322 id = atoi(argv[arg]); in set_flags()
1331 if (inet_pton(AF_INET, argv[arg], RTA_DATA(rta))) { in set_flags()
1335 } else if (inet_pton(AF_INET6, argv[arg], RTA_DATA(rta))) { in set_flags()
1340 error(1, errno, "can't parse ip %s", argv[arg]); in set_flags()
1356 if (!strcmp(argv[arg], "token")) { in set_flags()
1361 token = strtoul(argv[arg], NULL, 10); in set_flags()
1362 } else if (!strcmp(argv[arg], "flags")) { in set_flags()
1369 for (str = argv[arg]; (tok = strtok(str, ",")); in set_flags()
1378 "unknown flag %s", argv[arg]); in set_flags()
1386 } else if (!strcmp(argv[arg], "port")) { in set_flags()
1395 port = atoi(argv[arg]); in set_flags()
1401 } else if (!strcmp(argv[arg], "rport")) { in set_flags()
1405 rport = atoi(argv[arg]); in set_flags()
1406 } else if (!strcmp(argv[arg], "rip")) { in set_flags()
1410 rip = argv[arg]; in set_flags()
1412 error(1, 0, "unknown keyword %s", argv[arg]); in set_flags()
1471 int main(int argc, char *argv[]) in main() argument
1478 syntax(argv); in main()
1486 if (!strcmp(argv[1], "add")) in main()
1487 return add_addr(fd, pm_family, argc, argv); in main()
1488 else if (!strcmp(argv[1], "ann")) in main()
1489 return announce_addr(fd, pm_family, argc, argv); in main()
1490 else if (!strcmp(argv[1], "rem")) in main()
1491 return remove_addr(fd, pm_family, argc, argv); in main()
1492 else if (!strcmp(argv[1], "csf")) in main()
1493 return csf(fd, pm_family, argc, argv); in main()
1494 else if (!strcmp(argv[1], "dsf")) in main()
1495 return dsf(fd, pm_family, argc, argv); in main()
1496 else if (!strcmp(argv[1], "del")) in main()
1497 return del_addr(fd, pm_family, argc, argv); in main()
1498 else if (!strcmp(argv[1], "flush")) in main()
1499 return flush_addrs(fd, pm_family, argc, argv); in main()
1500 else if (!strcmp(argv[1], "get")) in main()
1501 return get_addr(fd, pm_family, argc, argv); in main()
1502 else if (!strcmp(argv[1], "dump")) in main()
1503 return dump_addrs(fd, pm_family, argc, argv); in main()
1504 else if (!strcmp(argv[1], "limits")) in main()
1505 return get_set_limits(fd, pm_family, argc, argv); in main()
1506 else if (!strcmp(argv[1], "set")) in main()
1507 return set_flags(fd, pm_family, argc, argv); in main()
1508 else if (!strcmp(argv[1], "events")) in main()
1510 else if (!strcmp(argv[1], "listen")) in main()
1511 return add_listener(argc, argv); in main()
1513 fprintf(stderr, "unknown sub-command: %s", argv[1]); in main()
1514 syntax(argv); in main()