<commit_before>/*
 * ex: set tabstop=4 ai expandtab softtabstop=4 shiftwidth=4:
 * -*- mode: c-basic-indent: 4; tab-width: 4; indent-tabls-mode: nil -*-
 *      $Id$
 */
/************************************************************************
*                                                                       *
*                           Copyright (C)  2003                         *
*                               Internet2                               *
*                           All Rights Reserved                         *
*                                                                       *
************************************************************************/
/*
 *    File:         bwctl.c
 *
 *    Author:       <NAME>
 *                  Internet2
 *
 *    Date:         Mon Sep 15 10:54:30 MDT 2003
 *
 *    Description:    
 */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include <signal.h>
#include <assert.h>
#include <syslog.h>
#include <math.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <bwlib/bwlib.h>


#if defined HAVE_DECL_OPTRESET && !HAVE_DECL_OPTRESET
int optreset;
#endif

#include "./bwctlP.h"

/*
 * The bwctl context
 */
static    ipapp_trec    app;
static    I2ErrHandle   eh;
static    uint32_t     file_offset,ext_offset;
static    int           ip_intr = 0;
static    int           ip_chld = 0;
static    int           ip_reset = 0;
static    int           ip_exit = 0;
static    int           ip_error = SIGCONT;
static    BWLContext    ctx;
static    int           first_set = False;
static    int           second_set = False;
static    ipsess_trec   first;
static    ipsess_trec   second;
static    aeskey_auth   current_auth=NULL;
static    BWLNum64      zero64;
static    BWLNum64      fuzz64;
static    BWLSID        sid;
static    uint16_t     recv_port;
static    ipsess_t      s[2];    /* receiver == 0, sender == 1 */
static    BWLBoolean    fake_daemon = False;
static    pid_t         fake_pid = -1;
static    int           fake_fd = -1;

static void
print_conn_args(
        )
{
    fprintf(stderr,"              [Connection Args]\n\n"
            "  -A authmode [AUTHMETHOD [AUTHOPTS]]\n"
            "            authmodes:\n"
            "                 [A]uthenticated, [E]ncrypted, [O]pen\n"
            "            AUTHMETHODS:\n"
            "                 AESKEY userid [keyfile]\n"
            "  -U             deprecated\n"
            "  -k             deprecated\n"
            "  -B srcaddr     use this as a local address for control connection and tests\n"
           );
}

static void
print_test_args(
        )
{
    fprintf(stderr,
            "            [Test Args]\n\n"
	    "  -T tool        select iperf, nuttcp or thrulay (default)\n"
            "  -a             allow running with unsynchronized clock\n"
            "  -i interval    report interval (seconds)\n"
            "  -l len         length of read/write buffers (bytes)\n"
            "  -u             UDP test\n"
            "  -w window      TCP window size (bytes) 0 indicates system defaults\n"
            "  -W window      Dynamic TCP window size: value used as fallback (bytes)\n"
           );
    fprintf(stderr,
            "  -P nThreads    number of concurrent connections (ENOTSUPPORTED)\n"
            "  -S TOS         type-of-service for outgoing packets\n"
            "  -b bandwidth   bandwidth to use for UDP test (bits/sec KM) (Default: 1Mb)\n"
            "  -t time        duration of test (seconds) (Default: 10)\n"
           );
    fprintf(stderr,
            "  -c recvhost [AUTHMETHOD [AUTHOPTS]]\n"
            "                 recvhost will run thrulay/nuttcp/iperf server \n"
            "            AUTHMETHODS: (See -A argument)\n"
            "  -s sendhost [AUTHMETHOD [AUTHOPTS]]\n"
            "                 sendhost will run thrulay/nuttcp/iperf client \n"
            "            AUTHMETHODS: (See -A argument)\n"
            "             [MUST SPECIFY AT LEAST ONE OF -c/-s]"
           );
}

static void<commit_msg>Corrected -h output for -a option (unsync clock offset).<commit_after>/*
 * ex: set tabstop=4 ai expandtab softtabstop=4 shiftwidth=4:
 * -*- mode: c-basic-indent: 4; tab-width: 4; indent-tabls-mode: nil -*-
 *      $Id$
 */
/************************************************************************
*                                                                       *
*                           Copyright (C)  2003                         *
*                               Internet2                               *
*                           All Rights Reserved                         *
*                                                                       *
************************************************************************/
/*
 *    File:         bwctl.c
 *
 *    Author:       <NAME>
 *                  Internet2
 *
 *    Date:         Mon Sep 15 10:54:30 MDT 2003
 *
 *    Description:    
 */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include <signal.h>
#include <assert.h>
#include <syslog.h>
#include <math.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <bwlib/bwlib.h>


#if defined HAVE_DECL_OPTRESET && !HAVE_DECL_OPTRESET
int optreset;
#endif

#include "./bwctlP.h"

/*
 * The bwctl context
 */
static    ipapp_trec    app;
static    I2ErrHandle   eh;
static    uint32_t     file_offset,ext_offset;
static    int           ip_intr = 0;
static    int           ip_chld = 0;
static    int           ip_reset = 0;
static    int           ip_exit = 0;
static    int           ip_error = SIGCONT;
static    BWLContext    ctx;
static    int           first_set = False;
static    int           second_set = False;
static    ipsess_trec   first;
static    ipsess_trec   second;
static    aeskey_auth   current_auth=NULL;
static    BWLNum64      zero64;
static    BWLNum64      fuzz64;
static    BWLSID        sid;
static    uint16_t     recv_port;
static    ipsess_t      s[2];    /* receiver == 0, sender == 1 */
static    BWLBoolean    fake_daemon = False;
static    pid_t         fake_pid = -1;
static    int           fake_fd = -1;

static void
print_conn_args(
        )
{
    fprintf(stderr,"              [Connection Args]\n\n"
            "  -A authmode [AUTHMETHOD [AUTHOPTS]]\n"
            "            authmodes:\n"
            "                 [A]uthenticated, [E]ncrypted, [O]pen\n"
            "            AUTHMETHODS:\n"
            "                 AESKEY userid [keyfile]\n"
            "  -U             deprecated\n"
            "  -k             deprecated\n"
            "  -B srcaddr     use this as a local address for control connection and tests\n"
           );
}

static void
print_test_args(
        )
{
    fprintf(stderr,
            "            [Test Args]\n\n"
	    "  -T tool        select iperf, nuttcp or thrulay (default)\n"
            "  -a offset      allow unsynchronized clock - good within offset (seconds)\n"
            "  -i interval    report interval (seconds)\n"
            "  -l len         length of read/write buffers (bytes)\n"
            "  -u             UDP test\n"
            "  -w window      TCP window size (bytes) 0 indicates system defaults\n"
            "  -W window      Dynamic TCP window size: value used as fallback (bytes)\n"
           );
    fprintf(stderr,
            "  -P nThreads    number of concurrent connections (ENOTSUPPORTED)\n"
            "  -S TOS         type-of-service for outgoing packets\n"
            "  -b bandwidth   bandwidth to use for UDP test (bits/sec KM) (Default: 1Mb)\n"
            "  -t time        duration of test (seconds) (Default: 10)\n"
           );
    fprintf(stderr,
            "  -c recvhost [AUTHMETHOD [AUTHOPTS]]\n"
            "                 recvhost will run thrulay/nuttcp/iperf server \n"
            "            AUTHMETHODS: (See -A argument)\n"
            "  -s sendhost [AUTHMETHOD [AUTHOPTS]]\n"
            "                 sendhost will run thrulay/nuttcp/iperf client \n"
            "            AUTHMETHODS: (See -A argument)\n"
            "             [MUST SPECIFY AT LEAST ONE OF -c/-s]"
           );
}

static void
{'fraction_non_alphanumeric': 0.13033654417885598, 'fraction_numerical': 0.011654180045189678, 'mean_word_length': 1.394646924829157, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '173068', 'n_tokens_mistral': 2565, 'n_tokens_neox': 2451, 'n_words': 656}