stats->mFormat);
if ( stats->mUDP != (char)kMode_Server ) {
- // TCP Reporting
+ // TCP-like Reporting
printf( report_bw_format, stats->transferID,
stats->startTime, stats->endTime,
buffer, &buffer[sizeof(buffer)/2] );
} else {
- // UDP Reporting
+ // UDP-like Reporting
printf( report_bw_jitter_loss_format, stats->transferID,
stats->startTime, stats->endTime,
buffer, &buffer[sizeof(buffer)/2],
stats->mFormat);
if ( stats->mUDP != (char)kMode_Server ) {
- // TCP Reporting
+ // TCP-like Reporting
printf( report_sum_bw_format,
stats->startTime, stats->endTime,
buffer, &buffer[sizeof(buffer)/2] );
} else {
- // UDP Reporting
+ // UDP-like Reporting
printf( report_sum_bw_jitter_loss_format,
stats->startTime, stats->endTime,
buffer, &buffer[sizeof(buffer)/2],
reporter_printstats( stats );
}
+static char *McastIface(const unsigned if_index)
+{
+ static char ifnam[IF_NAMESIZE];
+
+ if (!if_index)
+ return "default interface";
+ if (if_indextoname(if_index, ifnam))
+ return ifnam;
+ return "unknown interface";
+}
+
/*
* Report the client or listener Settings in default style
*/
void reporter_reportsettings( ReporterData *data ) {
int win, win_requested;
- win = getsock_tcp_windowsize( data->info.transferID,
- (data->mThreadMode == kMode_Listener ? 0 : 1) );
- win_requested = data->mTCPWin;
+ win = get_buffer_sock_size(data->info.transferID,
+ data->mThreadMode != kMode_Listener);
+ win_requested = data->mWinSize;
printf( seperator_line );
if ( data->mThreadMode == kMode_Listener ) {
printf( server_port,
- (isUDP( data ) ? "UDP" : "TCP"),
+ protoName(data->mProtocol),
data->mPort );
} else {
printf( client_port,
data->mHost,
- (isUDP( data ) ? "UDP" : "TCP"),
+ protoName(data->mProtocol),
data->mPort );
}
if ( data->mLocalhost != NULL ) {
- printf( bind_address, data->mLocalhost );
- if ( SockAddr_isMulticast( &data->connection.local ) ) {
- printf( join_multicast, data->mLocalhost );
- }
+ if (SockAddr_isMulticast((struct sockaddr *)&data->connection.local))
+ printf(join_multicast, data->mLocalhost, McastIface(data->mMcastIface));
+ else
+ printf(bind_address, data->mLocalhost);
}
- if ( isUDP( data ) ) {
+ if ( isPacketOriented( data ) ) {
printf( (data->mThreadMode == kMode_Listener ?
- server_datagram_size : client_datagram_size),
+ server_datagram_size : client_datagram_size),
data->mBufLen );
- if ( SockAddr_isMulticast( &data->connection.peer ) ) {
+ 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");
+
byte_snprintf( buffer, sizeof(buffer), win,
toupper( data->info.mFormat));
- printf( "%s: %s", (isUDP( data ) ?
- udp_buffer_size : tcp_window_size), buffer );
+
+ if (data->mProtocol == kProto_TCP)
+ printf( "%s: %s", tcp_window_size, buffer);
+ else
+ printf( "%s %s: %s", protoName(data->mProtocol), dgram_buffer_size, buffer);
if ( win_requested == 0 ) {
printf( " %s", window_default );
printf( warn_window_requested, buffer );
}
printf( "\n" );
+
+ if (data->mProtocol == kProto_TCP) {
+ char *cong_requested = data->info.congAlgo,
+ cong[64];
+ Socklen_t len = sizeof(cong);
+
+ if (getsockopt(data->info.transferID, IPPROTO_TCP, TCP_CONGESTION, cong, &len) < 0) {
+ fprintf(stderr, "WARNING: cannot determine TCP congestion control algorithm (err: %d %s)\n",
+ errno, strerror(errno));
+ } else {
+ printf("TCP congestion control algorithm: %s", cong[0] == '\0' ? "default" : cong);
+
+ if (data->info.congAlgo && strcmp(cong, data->info.congAlgo))
+ printf(" (NOT \"%s\"!)", data->info.congAlgo);
+ printf("\n");
+ }
+ }
+
printf( seperator_line );
}
/*
* Report a socket's peer IP address in default style
*/
-void *reporter_reportpeer( Connection_Info *stats, int ID ) {
- if ( ID > 0 ) {
- // copy the inet_ntop into temp buffers, to avoid overwriting
- char local_addr[ REPORT_ADDRLEN ];
- char remote_addr[ REPORT_ADDRLEN ];
- struct sockaddr *local = ((struct sockaddr*)&stats->local);
- struct sockaddr *peer = ((struct sockaddr*)&stats->peer);
-
- if ( local->sa_family == AF_INET ) {
- inet_ntop( AF_INET, &((struct sockaddr_in*)local)->sin_addr,
- local_addr, REPORT_ADDRLEN);
- }
-#ifdef HAVE_IPV6
- else {
- inet_ntop( AF_INET6, &((struct sockaddr_in6*)local)->sin6_addr,
- local_addr, REPORT_ADDRLEN);
- }
-#endif
-
- if ( peer->sa_family == AF_INET ) {
- inet_ntop( AF_INET, &((struct sockaddr_in*)peer)->sin_addr,
- remote_addr, REPORT_ADDRLEN);
- }
-#ifdef HAVE_IPV6
- else {
- inet_ntop( AF_INET6, &((struct sockaddr_in6*)peer)->sin6_addr,
- remote_addr, REPORT_ADDRLEN);
- }
-#endif
-
- printf( report_peer,
- ID,
- local_addr, ( local->sa_family == AF_INET ?
- ntohs(((struct sockaddr_in*)local)->sin_port) :
-#ifdef HAVE_IPV6
- ntohs(((struct sockaddr_in6*)local)->sin6_port)),
-#else
- 0),
-#endif
- remote_addr, ( peer->sa_family == AF_INET ?
- ntohs(((struct sockaddr_in*)peer)->sin_port) :
-#ifdef HAVE_IPV6
- ntohs(((struct sockaddr_in6*)peer)->sin6_port)));
-#else
- 0));
-#endif
+void *reporter_reportpeer(Connection_Info *stats, int ID)
+{
+ if (ID > 0) {
+ char laddr[REPORT_ADDRLEN],
+ daddr[REPORT_ADDRLEN];
+ unsigned lport = SockAddr_port(&stats->local),
+ dport = SockAddr_port(&stats->peer);
+
+ SockAddr_name(&stats->local, laddr, sizeof(laddr));
+ SockAddr_name(&stats->peer, daddr, sizeof(daddr));
+ printf(report_peer, ID, laddr, lport, daddr, dport);
}
return NULL;
}
-// end ReportPeer
/* -------------------------------------------------------------------
* Report the MSS and MTU, given the MSS (or a guess thereof)