Loading src/or/config.c +31 −13 Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ /* * Changes : * $Log$ * Revision 1.8 2002/07/11 18:38:15 montrose * added new option GlobalRole to getoptions() * * Revision 1.7 2002/07/11 14:50:26 montrose * cleaned up some, added validation to getoptions() * Loading Loading @@ -110,6 +113,8 @@ RETURN VALUE: 0 on success, non-zero on error 0, "local port on which the onion proxy is running", "<port>" }, { "TrafficShaping", 't', POPT_ARG_INT, &options->TrafficShaping, 0, "which traffic shaping policy to use", "<policy>" }, { "GlobalRole", 'g', POPT_ARG_INT, &options->GlobalRole, 0, "4-bit global role id", "<role>" }, { "Verbose", 'v', POPT_ARG_NONE, &Verbose, 0, "display options selected before execution", NULL }, POPT_AUTOHELP /* handles --usage and --help automatically */ Loading @@ -120,7 +125,12 @@ RETURN VALUE: 0 on success, non-zero on error poptReadDefaultConfig(optCon,0); /* read <popt> alias definitions */ bzero(options,sizeof(or_options_t)); /* zero out options initially */ /* assign default option values */ bzero(options,sizeof(or_options_t)); options->loglevel = LOG_DEBUG; options->CoinWeight = 0.8; options->GlobalRole = ROLE_OR_LISTEN | ROLE_OR_CONNECT_ALL | ROLE_OP_LISTEN | ROLE_AP_LISTEN; code = poptGetNextOpt(optCon); /* first we handle command-line args */ if ( code == -1 ) Loading @@ -139,7 +149,9 @@ RETURN VALUE: 0 on success, non-zero on error case -1: if ( Verbose ) /* display options upon user request */ { printf("LogLevel=%s\n",options->LogLevel); printf("LogLevel=%s, GlobalRole=%d\n", options->LogLevel, options->GlobalRole); printf("RouterFile=%s, PrivateKeyFile=%s\n", options->RouterFile, options->PrivateKeyFile); Loading Loading @@ -238,6 +250,12 @@ RETURN VALUE: 0 on success, non-zero on error code = -1; } if ( options->GlobalRole < 0 || options->GlobalRole > 15 ) { log(LOG_ERR,"GlobalRole option must be an integer between 0 and 15 (inclusive)."); code = -1; } return code; } src/or/or.h +1 −0 Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ typedef struct int APPort; int MaxConn; int TrafficShaping; int GlobalRole; int loglevel; } or_options_t; Loading Loading
src/or/config.c +31 −13 Original line number Diff line number Diff line Loading @@ -8,6 +8,9 @@ /* * Changes : * $Log$ * Revision 1.8 2002/07/11 18:38:15 montrose * added new option GlobalRole to getoptions() * * Revision 1.7 2002/07/11 14:50:26 montrose * cleaned up some, added validation to getoptions() * Loading Loading @@ -110,6 +113,8 @@ RETURN VALUE: 0 on success, non-zero on error 0, "local port on which the onion proxy is running", "<port>" }, { "TrafficShaping", 't', POPT_ARG_INT, &options->TrafficShaping, 0, "which traffic shaping policy to use", "<policy>" }, { "GlobalRole", 'g', POPT_ARG_INT, &options->GlobalRole, 0, "4-bit global role id", "<role>" }, { "Verbose", 'v', POPT_ARG_NONE, &Verbose, 0, "display options selected before execution", NULL }, POPT_AUTOHELP /* handles --usage and --help automatically */ Loading @@ -120,7 +125,12 @@ RETURN VALUE: 0 on success, non-zero on error poptReadDefaultConfig(optCon,0); /* read <popt> alias definitions */ bzero(options,sizeof(or_options_t)); /* zero out options initially */ /* assign default option values */ bzero(options,sizeof(or_options_t)); options->loglevel = LOG_DEBUG; options->CoinWeight = 0.8; options->GlobalRole = ROLE_OR_LISTEN | ROLE_OR_CONNECT_ALL | ROLE_OP_LISTEN | ROLE_AP_LISTEN; code = poptGetNextOpt(optCon); /* first we handle command-line args */ if ( code == -1 ) Loading @@ -139,7 +149,9 @@ RETURN VALUE: 0 on success, non-zero on error case -1: if ( Verbose ) /* display options upon user request */ { printf("LogLevel=%s\n",options->LogLevel); printf("LogLevel=%s, GlobalRole=%d\n", options->LogLevel, options->GlobalRole); printf("RouterFile=%s, PrivateKeyFile=%s\n", options->RouterFile, options->PrivateKeyFile); Loading Loading @@ -238,6 +250,12 @@ RETURN VALUE: 0 on success, non-zero on error code = -1; } if ( options->GlobalRole < 0 || options->GlobalRole > 15 ) { log(LOG_ERR,"GlobalRole option must be an integer between 0 and 15 (inclusive)."); code = -1; } return code; }
src/or/or.h +1 −0 Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ typedef struct int APPort; int MaxConn; int TrafficShaping; int GlobalRole; int loglevel; } or_options_t; Loading