]> sjero.net Git - iperf/blobdiff - src/Settings.cpp
Support for UDP-Lite in iperf
[iperf] / src / Settings.cpp
index 15b5ccd532b5a88605f40a8d96798f722f4500bf..3cb619faf3bd36ef257ec383b94f0cb8e153beb2 100644 (file)
@@ -101,6 +101,7 @@ const struct option long_options[] =
 {"server",           no_argument, NULL, 's'},
 {"time",       required_argument, NULL, 't'},
 {"udp",              no_argument, NULL, 'u'},
+{"udplite",    required_argument, NULL, 'u'},
 {"version",          no_argument, NULL, 'v'},
 {"window",     required_argument, NULL, 'w'},
 {"reportexclude", required_argument, NULL, 'x'},
@@ -174,7 +175,7 @@ const struct option env_options[] =
 #define SHORT_OPTIONS()
 
 const char short_options[] =
-      "12b::c:df:hi:j:l:mn:o:p:rst:uvw:x:y:A:B:CDF:IJ:L:M:NP:RS:T:UV:W";
+      "12b::c:df:hi:j:l:mn:o:p:rst:u::vw:x:y:A:B:CDF:IJ:L:M:NP:RS:T:UV:W";
 
 /* -------------------------------------------------------------------
  * defaults
@@ -472,8 +473,16 @@ void Settings_Interpret( char option, const char *optarg, thread_Settings *mExtS
             mExtSettings->mAmount = (int) (atof( optarg ) * 100.0);
             break;
 
-        case 'u': // UDP instead of TCP
-            mExtSettings->mProtocol = kProto_UDP;
+        case 'u': // UDP(-Lite) instead of TCP
+             if (optarg) {
+                mExtSettings->mProtocol = kProto_UDPLITE;
+                // Set partial checksum coverage:
+                // - 0 means entire datagram,
+                // - 1..7 is illegal and will be rounded up to 8;
+                // - 8 and greater mean genuine partial coverage.
+                mExtSettings->cscov = atoi(optarg);
+             } else
+                mExtSettings->mProtocol = kProto_UDP;
 
             setPacketOriented(mExtSettings);
             // if -b has already been processed, UDP rate will