feat: prepare group argument handling
This commit is contained in:
parent
8487dc951d
commit
850c278317
1 changed files with 9 additions and 3 deletions
|
@ -21,14 +21,13 @@ struct igmp_extra {
|
||||||
{ 2, "query", 0x11, 1, "224.0.0.1", 0 },
|
{ 2, "query", 0x11, 1, "224.0.0.1", 0 },
|
||||||
{ 2, "report", 0x16, 1, "224.0.0.2", 1 },
|
{ 2, "report", 0x16, 1, "224.0.0.2", 1 },
|
||||||
{ 2, "leave", 0x17, 1, "224.0.0.2", 0 },
|
{ 2, "leave", 0x17, 1, "224.0.0.2", 0 },
|
||||||
|
|
||||||
/* Note: end of list (please keep) */
|
/* Note: end of list (please keep) */
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
void usage(char *name)
|
void usage(char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s -i ethdevice -t packet.version\n", name);
|
fprintf(stderr, "usage: %s -i ethdevice -g group -t packet.version\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -52,7 +51,7 @@ int main(int argc, char **argv)
|
||||||
printf("IGMP packet generator\n\n");
|
printf("IGMP packet generator\n\n");
|
||||||
|
|
||||||
printf("Parsing command line...\n");
|
printf("Parsing command line...\n");
|
||||||
while((c = getopt(argc, argv, "i:t:")) != EOF)
|
while((c = getopt(argc, argv, "i:t:g:")) != EOF)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +81,13 @@ int main(int argc, char **argv)
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
// Group argument handling logic
|
||||||
|
printf(" Group = [%s]\n", optarg);
|
||||||
|
igmp_group_str = optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|
Loading…
Reference in a new issue