Skip to content

Commit

Permalink
doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Dec 20, 2023
1 parent 460a10e commit f44c423
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
5 changes: 3 additions & 2 deletions applications/gpac/gpac.c
Expand Up @@ -1098,7 +1098,7 @@ static int gpac_run()
}

if (print_filters(argc, argv, argmode)==GF_FALSE)
e = GF_FILTER_NOT_FOUND;
e = GF_NOT_FOUND;
ERR_EXIT
}
if (view_filter_conn) {
Expand Down Expand Up @@ -1425,7 +1425,8 @@ static int gpac_done(GF_Err e, Bool exit_only)

{
if (e) {
fprintf(stderr, "session error: %s\n", gf_error_to_string(e) );
if (e!=GF_NOT_FOUND)
fprintf(stderr, "session error: %s\n", gf_error_to_string(e) );
} else {
e = gf_fs_get_last_connect_error(session);
if (e<0) fprintf(stderr, "session last connect error %s\n", gf_error_to_string(e) );
Expand Down
23 changes: 16 additions & 7 deletions applications/gpac/gpac_help.c
Expand Up @@ -1127,6 +1127,7 @@ void gpac_suggest_arg(char *aname)
Bool gpac_suggest_filter(char *fname, Bool is_help, Bool filter_only)
{
Bool found = GF_FALSE;
Bool exact_match = GF_FALSE;
Bool first = GF_FALSE;
u32 i, count, pass_exact = GF_TRUE;
if (!fname) return GF_FALSE;
Expand Down Expand Up @@ -1213,15 +1214,21 @@ Bool gpac_suggest_filter(char *fname, Bool is_help, Bool filter_only)
i++;

if (gf_sys_word_match(fname, arg->name)) {
if (!first) {
if (!strcmp(fname, arg->name)) {
gf_sys_format_help(helpout, help_flags | GF_PRINTARG_HIGHLIGHT_FIRST, "-%s: %s\n", arg->name, arg->description);
first = GF_TRUE;
if (!found) {
GF_LOG(GF_LOG_ERROR, GF_LOG_APP, ("No such filter %s\n", fname));
found = GF_TRUE;
exact_match = GF_TRUE;
} else {
if (!first) {
first = GF_TRUE;
if (!found) {
GF_LOG(GF_LOG_ERROR, GF_LOG_APP, ("No such filter %s\n", fname));
found = GF_TRUE;
}
GF_LOG(GF_LOG_WARNING, GF_LOG_APP, ("\nClosest core option: \n"));
}
GF_LOG(GF_LOG_WARNING, GF_LOG_APP, ("\nClosest core option: \n"));
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("-%s: %s\n", arg->name, arg->description));
}
GF_LOG(GF_LOG_INFO, GF_LOG_APP, ("-%s: %s\n", arg->name, arg->description));
}
}

Expand All @@ -1238,8 +1245,9 @@ Bool gpac_suggest_filter(char *fname, Bool is_help, Bool filter_only)

if (pass_exact) {
if (!strcmp(fname, arg->arg_name)) {
gf_sys_format_help(helpout, help_flags | GF_PRINTARG_HIGHLIGHT_FIRST, "%s.%s %s\n", reg->name, arg->arg_name, arg->arg_desc);
gf_sys_format_help(helpout, help_flags | GF_PRINTARG_HIGHLIGHT_FIRST, "%s.%s: %s\n", reg->name, arg->arg_name, arg->arg_desc);
found = GF_TRUE;
exact_match = GF_TRUE;
}
continue;
}
Expand Down Expand Up @@ -1285,6 +1293,7 @@ Bool gpac_suggest_filter(char *fname, Bool is_help, Bool filter_only)

}
}
if (exact_match) return GF_TRUE;
if (!found) {
if (pass_exact) {
pass_exact = GF_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/os_config_init.c
Expand Up @@ -1432,7 +1432,7 @@ GF_GPACArg GPAC_Args[] = {
"This will record packets to dump.gpc\n"
"\nEX -netcap=src=dump.gpc,id=NC1 -i session1.sdp:NCID=NC1 -i session2.sdp\n"
"This will read packets from dump.gpc only for session1.sdp and let session2.sdp use regular sockets\n"
"\nEX {p=1234,s=100,n=20}{r=200,s=500,o=10,v=FE}\n"
"\nEX -netcap={p=1234,s=100,n=20}{r=200,s=500,o=10,v=FE}\n"
"This will use regular network interface and drop packets 100 to 119 on port 1234 and patch one random packet every 200 starting from packet 500, setting byte 10 to FE", NULL, NULL, GF_ARG_STRING, GF_ARG_HINT_EXPERT|GF_ARG_SUBSYS_CORE),
#endif

Expand Down
6 changes: 6 additions & 0 deletions src/utils/os_net.c
Expand Up @@ -1181,6 +1181,8 @@ GF_Err gf_netcap_setup(char *rules)
char *dst=NULL;
s32 cap_loop=0;
Bool cap_rt=GF_TRUE;
char *rsep = strchr(rules, '{');
if (rsep) rsep[0] = 0;
//extract src or dst, nrt flag and loop flag
while (rules) {
char *sep = strchr(rules, ',');
Expand All @@ -1206,6 +1208,10 @@ GF_Err gf_netcap_setup(char *rules)
rules = sep+1;
if (rules[0]=='{') break;
}
if (rsep) {
rsep[0] = '{';
rules = rsep;
}
if (!dst && !src && !rules) {
if (id) gf_free(id);
GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[NetCap] Invalid netcap rule, ignoring\n"));
Expand Down

0 comments on commit f44c423

Please sign in to comment.