Ejemplo n.º 1
0
/*
 *  appUsageLong();
 *
 *    Print complete usage information to USAGE_FH.  Pass this
 *    function to skOptionsSetUsageCallback(); skOptionsParse() will
 *    call this funciton and then exit the program when the --help
 *    option is given.
 */
static void
appUsageLong(
    void)
{
    FILE *fh = USAGE_FH;
    unsigned int i;

#define USAGE_MSG                                                             \
    ("--keys=KEYS --counters=COUNTERS [SWITCHES] [FILES]\n"                   \
     "\tRead SiLK Flow records, bin the records by the fields in KEYS,\n"     \
     "\tcompute the COUNTERS field(s) for each KEYS, and write the binary\n"  \
     "\tAggregate Bag output to the standard output or the --output-path.\n"  \
     "\tRead SiLK Flows from the named files or from the standard input.\n")

    /* Create the string maps for --keys and --counters */
    createStringmaps();

    fprintf(fh, "%s %s", skAppName(), USAGE_MSG);

    fprintf(fh, "\nSWITCHES:\n");
    skOptionsDefaultUsage(fh);
    for (i = 0; appOptions[i].name; ++i) {
        fprintf(fh, "--%s %s. ", appOptions[i].name,
                SK_OPTION_HAS_ARG(appOptions[i]));
        switch ((appOptionsEnum)appOptions[i].val) {
          case OPT_KEYS:
            /* Dynamically build the help */
            fprintf(fh, "%s\n", appHelp[i]);
            skStringMapPrintUsage(key_name_map, fh, 4);
            break;
          case OPT_COUNTERS:
            fprintf(fh, "%s\n", appHelp[i]);
            skStringMapPrintUsage(counter_name_map, fh, 4);
            break;
          case OPT_OUTPUT_PATH:
            /* include the help for --notes and --invocation-strip
             * after --output-path */
            fprintf(fh, "%s\n", appHelp[i]);
            skAggBagOptionsUsage(fh);
            break;
          default:
            /* Simple help text from the appHelp array */
            fprintf(fh, "%s\n", appHelp[i]);
            break;
        }
    }

    skOptionsCtxOptionsUsage(optctx, fh);
    skIPv6PolicyUsage(fh);
    sksiteOptionsUsage(fh);
    /* skPluginOptionsUsage(fh); */
}
Ejemplo n.º 2
0
/*
 *  appUsageLong();
 *
 *    Print complete usage information to USAGE_FH.  Pass this
 *    function to skOptionsSetUsageCallback(); skOptionsParse() will
 *    call this funciton and then exit the program when the --help
 *    option is given.
 */
static void
appUsageLong(
    void)
{
#define USAGE_MSG                                                          \
    ("<PREFIX_SWITCH> [<PREFIX_SWITCH>...] [SWITCHES] [FILES]\n"           \
     "\tRead SiLK Flow records from FILES named on the command line or\n"  \
     "\tfrom the standard input, keep the specified number of most\n"      \
     "\tsignificant bits for each IP address, and write the modified\n"    \
     "\trecords to the specified output file or to the standard output.\n")

    FILE *fh = USAGE_FH;
    int i, j;

    fprintf(fh, "%s %s", skAppName(), USAGE_MSG);

    fprintf(fh, "\nPREFIX SWITCHES:\n");
    /* print everything before --output-path */
    for (i=0; appOptions[i].name && appOptions[i].val < OPT_OUTPUT_PATH; ++i) {
        fprintf(fh, "--%s %s. %s\n", appOptions[i].name,
                SK_OPTION_HAS_ARG(appOptions[i]), appHelp[i]);
    }

    /* print the first three switches again as aliases---use a
     * different variable!! */
    for (j = 0;
         appOptions[j].name && appOptions[j].val <= OPT_4NHIP_PREFIX_LENGTH;
         ++j)
    {
        fprintf(fh, "--%s %s. Alias for --%s\n", appOptions[j].name + 1,
                SK_OPTION_HAS_ARG(appOptions[j]), appOptions[j].name);
    }

    /* print remaining options */
    fprintf(fh, "\nSWITCHES:\n");
    skOptionsDefaultUsage(fh);
    for ( ; appOptions[i].name; ++i) {
        fprintf(fh, "--%s %s. %s\n", appOptions[i].name,
                SK_OPTION_HAS_ARG(appOptions[i]), appHelp[i]);
    }

    skOptionsCtxOptionsUsage(optctx, fh);
    skIPv6PolicyUsage(fh);
    skCompMethodOptionsUsage(fh);
    skOptionsNotesUsage(fh);
    sksiteOptionsUsage(fh);
}
Ejemplo n.º 3
0
/*
 *  appUsageLong();
 *
 *    Print complete usage information to USAGE_FH.  Pass this
 *    function to skOptionsSetUsageCallback(); skOptionsParse() will
 *    call this funciton and then exit the program when the --help
 *    option is given.
 */
static void
appUsageLong(
    void)
{
#define USAGE_MSG                                                             \
    ("[SWITCHES] [FILES]\n"                                                   \
     "\tSummarize SiLK Flow records across time, producing textual output\n"  \
     "\twith counts of bytes, packets, and flow records for each time bin.\n" \
     "\tWhen no files given on command line, flows are read from STDIN.\n")

    FILE *fh = USAGE_FH;
    int i;

    fprintf(fh, "%s %s", skAppName(), USAGE_MSG);
    fprintf(fh, "\nSWITCHES:\n");
    skOptionsDefaultUsage(fh);

    for (i = 0; appOptions[i].name; ++i) {
        fprintf(fh, "--%s %s. ", appOptions[i].name,
                SK_OPTION_HAS_ARG(appOptions[i]));
        switch (appOptions[i].val) {
          case OPT_LOAD_SCHEME:
            loadschemeUsage(fh);
            break;
          case OPT_TIMESTAMP_FORMAT:
            timestampFormatUsage(fh);
            break;
          default:
            fprintf(fh, "%s\n", appHelp[i]);
            break;
        }
    }
    for (i = 0; deprecatedOptions[i].name; ++i) {
        fprintf(fh, "--%s %s. %s\n", deprecatedOptions[i].name,
                SK_OPTION_HAS_ARG(deprecatedOptions[i]), deprecatedHelp[i]);
    }

    skOptionsCtxOptionsUsage(optctx, fh);
    sksiteOptionsUsage(fh);
}
Ejemplo n.º 4
0
/*
 *  appUsageLong();
 *
 *    Print complete usage information to USAGE_FH.  Pass this
 *    function to skOptionsSetUsageCallback(); skOptionsParse() will
 *    call this funciton and then exit the program when the --help
 *    option is given.
 */
static void
appUsageLong(
    void)
{
#define USAGE_MSG                                                       \
    ("<SWITCHES>\n"                                                     \
     "\tA utility to simply print to stdout the list of files\n"        \
     "\tthat rwfilter would normally process for a given set of\n"      \
     "\tfile selection switches.\n")

    FILE *fh = USAGE_FH;
    int i;

    fprintf(fh, "%s %s", skAppName(), USAGE_MSG);
    fprintf(fh, "\nAPPLICATION SWITCHES\n");
    skOptionsDefaultUsage(fh);
    for (i = 0; appOptions[i].name; ++i) {
        fprintf(fh, "--%s %s. %s\n", appOptions[i].name,
                SK_OPTION_HAS_ARG(appOptions[i]), appHelp[i]);
    }
    fglobUsage(fh);
}