mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-31 11:29:28 +00:00
add dataChannelCount option
This commit is contained in:
@ -51,6 +51,7 @@ Cmdline::Cmdline(int argc, char *argv[]) // ISO C++17 not allowed: throw (std::s
|
|||||||
{"enableThroughputSet", no_argument, NULL, 'p'},
|
{"enableThroughputSet", no_argument, NULL, 'p'},
|
||||||
{"throughtputSetAsKB", required_argument, NULL, 'r'},
|
{"throughtputSetAsKB", required_argument, NULL, 'r'},
|
||||||
{"bufferSize", required_argument, NULL, 'b'},
|
{"bufferSize", required_argument, NULL, 'b'},
|
||||||
|
{"dataChannelCount", required_argument, NULL, 'c'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
{NULL, 0, NULL, 0}};
|
{NULL, 0, NULL, 0}};
|
||||||
|
|
||||||
@ -68,9 +69,10 @@ Cmdline::Cmdline(int argc, char *argv[]) // ISO C++17 not allowed: throw (std::s
|
|||||||
_p = false;
|
_p = false;
|
||||||
_r = 300;
|
_r = 300;
|
||||||
_b = 0;
|
_b = 0;
|
||||||
|
_c = 1;
|
||||||
|
|
||||||
optind = 0;
|
optind = 0;
|
||||||
while ((c = getopt_long(argc, argv, "s:t:w:x:d:r:b:enhvop", long_options, &optind)) != -1) {
|
while ((c = getopt_long(argc, argv, "s:t:w:x:d:r:b:c:enhvop", long_options, &optind)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'n':
|
case 'n':
|
||||||
_n = true;
|
_n = true;
|
||||||
@ -147,6 +149,15 @@ Cmdline::Cmdline(int argc, char *argv[]) // ISO C++17 not allowed: throw (std::s
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
_c = atoi(optarg);
|
||||||
|
if (_c <= 0) {
|
||||||
|
std::string err;
|
||||||
|
err += "parameter range error: c must be > 0";
|
||||||
|
throw(std::range_error(err));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
_h = true;
|
_h = true;
|
||||||
this->usage(EXIT_SUCCESS);
|
this->usage(EXIT_SUCCESS);
|
||||||
@ -196,6 +207,8 @@ libdatachannel client implementing WebRTC Data Channels with WebSocket signaling
|
|||||||
Send a constant data per second (KB). See throughtputSetAsKB params.\n\
|
Send a constant data per second (KB). See throughtputSetAsKB params.\n\
|
||||||
[ -r ] [ --throughtputSetAsKB ] (type=INTEGER, range>0...INT_MAX, default=300)\n\
|
[ -r ] [ --throughtputSetAsKB ] (type=INTEGER, range>0...INT_MAX, default=300)\n\
|
||||||
Send constant data per second (KB).\n\
|
Send constant data per second (KB).\n\
|
||||||
|
[ -c ] [ --dataChannelCount ] (type=INTEGER, range>0...INT_MAX, default=1)\n\
|
||||||
|
Dat Channel count to create.\n\
|
||||||
[ -h ] [ --help ] (type=FLAG)\n\
|
[ -h ] [ --help ] (type=FLAG)\n\
|
||||||
Display this help and exit.\n";
|
Display this help and exit.\n";
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ private:
|
|||||||
bool _p;
|
bool _p;
|
||||||
int _r;
|
int _r;
|
||||||
int _b;
|
int _b;
|
||||||
|
int _c;
|
||||||
|
|
||||||
/* other stuff to keep track of */
|
/* other stuff to keep track of */
|
||||||
std::string _program_name;
|
std::string _program_name;
|
||||||
@ -72,6 +73,7 @@ public:
|
|||||||
int bufferSize() const { return _b; }
|
int bufferSize() const { return _b; }
|
||||||
bool enableThroughputSet () const { return _p; }
|
bool enableThroughputSet () const { return _p; }
|
||||||
int throughtputSetAsKB() const { return _r; }
|
int throughtputSetAsKB() const { return _r; }
|
||||||
|
int dataChannelCount() const { return _c; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user