]> sjero.net Git - iperf/commitdiff
Actually add CCID selection ability
authorSamuel Jero <sj323707@ohio.edu>
Tue, 23 Oct 2012 03:53:29 +0000 (23:53 -0400)
committerSamuel Jero <sj323707@ohio.edu>
Tue, 23 Oct 2012 03:53:29 +0000 (23:53 -0400)
include/Locale.h
include/Reporter.h
include/Settings.hpp
include/headers.h
src/Locale.c
src/PerfSocket.cpp
src/ReportDefault.c
src/Reporter.c
src/Settings.cpp

index 5365016a251592f2c248eabe738d5b09a18be7d0..3769ae84c138464252af3041e65bb6fad000a8fc 100644 (file)
@@ -93,6 +93,12 @@ extern const char window_default[];
 
 extern const char wait_server_threads[];
 
+extern const char dccp_byte_stream_mode[];
+
+extern const char dccp_ccid_default[];
+
+extern const char dccp_ccid_val[];
+
 /* -------------------------------------------------------------------
  * reports
  * ------------------------------------------------------------------- */
index 1dbb22c0ea52447a95f8dfeaa5dd84fed5cda081..01fda0cae5119dfbb3c2a2b1d26a9ee49ceabb23 100644 (file)
@@ -129,6 +129,7 @@ typedef struct ReporterData {
     int mBufLen;                    // -l
     int mMSS;                       // -M
     int mWinSize;                    // -w
+    int mCCID;                 //-Z
     /*   flags is a BitMask of old bools
         bool   mBufLenSet;              // -l
         bool   mCompat;                 // -C
index d4c4244be91a669b9ceb6a5352d25e490481372e..6383f48a02a510b9643e8601ddac2a57fb863559 100644 (file)
@@ -160,6 +160,7 @@ typedef struct thread_Settings {
     int mBufLen;                    // -l
     int mMSS;                       // -M
     int mWinSize;                    // -w
+    int mCCID;                         // -Z
     /*   flags is a BitMask of old bools
         bool   mBufLenSet;              // -l
         bool   mCompat;                 // -C
index 05d05c3c50ef553fd162a386414f90188d3dd009..cebabf584079d14a2cc67f1aed176cc030f71a25 100644 (file)
@@ -166,7 +166,8 @@ typedef uintmax_t max_size_t;
 
 /* UDP-Lite specific definitions and includes */
 #ifdef IPPROTO_UDPLITE
-#include <netinet/udplite.h>
+/*#include <netinet/udplite.h> Ubuntu doesn't have this header*/
+#include "udplite.h"
 #else
 #define IPPROTO_UDPLITE       136
 #define SOL_UDPLITE           136
index cd05ba539762f7b6099c0fd7b034d698e70c0b29..8c5ca16cf132643fc55d5b26e2b0894ebc16f2c4 100644 (file)
@@ -88,6 +88,7 @@ Client/Server:\n\
   -M, --mss       #        set TCP maximum segment size (MTU - 40 bytes)\n\
   -N, --nodelay            set TCP no delay, disabling Nagle's Algorithm\n\
   -V, --IPv6Version        Set the domain to IPv6\n\
+  -Z, --ccid      #        Set DCCP congestion control algorithm\n\
 \n\
 Server specific:\n\
   -s, --server             run in server mode\n\
@@ -172,6 +173,15 @@ const char window_default[] =
 const char wait_server_threads[] =
 "Waiting for server threads to complete. Interrupt again to force quit.\n";
 
+const char dccp_byte_stream_mode[]=
+"NOTE: running in bytestream-mode (maximum speed)\n";
+
+const char dccp_ccid_default[]=
+"CCID: (default)\n";
+
+const char dccp_ccid_val[]=
+"CCID: %i\n";
+
 /* -------------------------------------------------------------------
  * reports
  * ------------------------------------------------------------------- */
index 1c3a779731f692aad66f50072cdf991579557939..de88a753f8709600ddd91ee1b30da4e9b842511d 100644 (file)
@@ -156,6 +156,14 @@ void SetSocketOptions( thread_Settings *inSettings )
         rc = setsockopt( inSettings->mSock, SOL_DCCP, DCCP_SOCKOPT_SERVICE,
                          &val, len );
         WARN_errno( rc == SOCKET_ERROR, "setsockopt DCCP_SOCKOPT_SERVICE" );
+
+       if(inSettings->mCCID!=0){
+               char cv=inSettings->mCCID;
+               rc=setsockopt( inSettings->mSock, SOL_DCCP, DCCP_SOCKOPT_CCID,
+                         &cv, sizeof(cv));
+
+               WARN_errno( rc == SOCKET_ERROR, "Error Setting CCID");
+       }
     }
     //  UDP-Lite specific options
     if ( inSettings->mProtocol == kProto_UDPLITE ) {
index 150df1069d333e5c12557cae9636edf870262580..8287efdaf70a6f8f85b74877f3be2d26b9ab3ab5 100644 (file)
@@ -161,7 +161,7 @@ void reporter_reportsettings( ReporterData *data ) {
                                data->mThreadMode != kMode_Listener);
     win_requested = data->mWinSize;
 
-    printf( seperator_line );
+    printf(seperator_line);
     if ( data->mThreadMode == kMode_Listener ) {
         printf( server_port,
                 protoName(data->mProtocol),
@@ -185,8 +185,17 @@ void reporter_reportsettings( ReporterData *data ) {
                 data->mBufLen );
         if (SockAddr_isMulticast((struct sockaddr *)&data->connection.peer))
             printf( multicast_ttl, data->info.mTTL);
-    } else if (data->mProtocol == kProto_DCCP)
-            printf("NOTE: running in bytestream-mode (maximum speed)\n");
+    } else if (data->mProtocol == kProto_DCCP){
+            printf(dccp_byte_stream_mode);
+    }
+
+    if (data->mProtocol == kProto_DCCP){
+               if(data->mCCID==0){
+                       printf(dccp_ccid_default);
+               }else{
+                       printf(dccp_ccid_val,data->mCCID);
+               }
+       }
 
     byte_snprintf( buffer, sizeof(buffer), win,
                    toupper( data->info.mFormat));
index f3bd21930e933b5c639af47c475e89a9f5e61559..27bb259fc27f11f6cbb7b7f50f579688b7a6dd3a 100644 (file)
@@ -450,6 +450,7 @@ void ReportSettings( thread_Settings *agent ) {
             data->info.congAlgo = agent->congAlgo;
             data->connection.peer = agent->peer;
             data->connection.local = agent->local;
+            data->mCCID=agent->mCCID;
     
     #ifdef HAVE_THREAD
             /*
index 3cb619faf3bd36ef257ec383b94f0cb8e153beb2..42c21a2bf5b22630f0c329478a2510c81ff36998 100644 (file)
@@ -124,6 +124,7 @@ const struct option long_options[] =
 {"single_udp",       no_argument, NULL, 'U'},
 {"ipv6_domian",      no_argument, NULL, 'V'},
 {"suggest_win_size", no_argument, NULL, 'W'},
+{"ccid",          required_argument, NULL, 'Z'},
 {0, 0, 0, 0}
 };
 
@@ -169,13 +170,14 @@ const struct option env_options[] =
 {"IPERF_SINGLE_UDP",       no_argument, NULL, 'U'},
 {"IPERF_IPV6_DOMAIN",      no_argument, NULL, 'V'},
 {"IPERF_SUGGEST_WIN_SIZE", required_argument, NULL, 'W'},
+{"IPERF_CCID", required_argument, NULL, 'Z'},
 {0, 0, 0, 0}
 };
 
 #define SHORT_OPTIONS()
 
 const char short_options[] =
-      "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";
+      "12b::c:df:hi:j:l:mn:o:p:rst:uvw:x:y:A:B:CDF:IJ:L:M:NP:RS:T:UV:WZ:";
 
 /* -------------------------------------------------------------------
  * defaults
@@ -669,6 +671,13 @@ void Settings_Interpret( char option, const char *optarg, thread_Settings *mExtS
             fprintf( stderr, "The -W option is not available in this release\n");
             break;
 
+       case 'Z': //DCCP CCID
+               mExtSettings->mCCID=atoi(optarg);
+               if(mExtSettings->mCCID > 255 || mExtSettings->mCCID<=0){
+                       fprintf( stderr, "CCID %s is invalid\n", optarg);
+               }
+               break;
+
         default: // ignore unknown
             break;
     }