src/Reporter.c
/*
 * ReportServerUDP will generate a report of the UDP
 * statistics as reported by the server on the client
 * side.
 */
ReportServerUDP will generate a report of the UDP
statistics as reported by the server on the client
side.
ReportServerUDP will generate a report of the UDP statistics as reported by the server on the client side .
void ReportServerUDP( thread_Settings *agent, server_hdr *server ) {
    unsigned int flags = ntohl(server->base.flags);
    if (isServerReport(agent) && ((flags & HEADER_VERSION1) != 0)) {
	ReportHeader *reporthdr = malloc( sizeof(ReportHeader) );
	Transfer_Info *stats = &reporthdr->report.info;
	if ( !reporthdr ) {
	    FAIL(1, "Out of Memory!!\n", agent);
	}
	stats->transferID = agent->mSock;
	stats->groupID = (agent->multihdr != NULL ? agent->multihdr->groupID \
			  : -1);
	reporthdr->agentindex = -1;
	reporthdr->reporterindex = -1;
	reporthdr->report.type = SERVER_RELAY_REPORT;
	reporthdr->report.mode = agent->mReportMode;
	stats->mFormat = agent->mFormat;
	stats->jitter = ntohl( server->base.jitter1 );
	stats->jitter += ntohl( server->base.jitter2 ) / (double)rMillion;
	stats->TotalLen = (((max_size_t) ntohl( server->base.total_len1 )) << 32) + \
	    ntohl( server->base.total_len2 );
	stats->startTime = 0;
	stats->endTime = ntohl( server->base.stop_sec );
	stats->endTime += ntohl( server->base.stop_usec ) / (double)rMillion;
	stats->cntError = ntohl( server->base.error_cnt );
	stats->cntOutofOrder = ntohl( server->base.outorder_cnt );
#ifndef HAVE_SEQNO64b
	stats->cntDatagrams = ntohl( server->base.datagrams );
#else
	stats->cntDatagrams = (((max_size_t) ntohl( server->base.datagrams2 )) << 32) + \
	    ntohl( server->base.datagrams );
#endif
	if ((flags & HEADER_EXTEND) != 0) {
	    stats->mEnhanced = 1;
	    stats->transit.minTransit = ntohl( server->extend.minTransit1 );
	    stats->transit.minTransit += ntohl( server->extend.minTransit2 ) / (double)rMillion;
	    stats->transit.maxTransit = ntohl( server->extend.maxTransit1 );
	    stats->transit.maxTransit += ntohl( server->extend.maxTransit2 ) / (double)rMillion;
	    stats->transit.sumTransit = ntohl( server->extend.sumTransit1 );
	    stats->transit.sumTransit += ntohl( server->extend.sumTransit2 ) / (double)rMillion;
	    stats->transit.meanTransit = ntohl( server->extend.meanTransit1 );
	    stats->transit.meanTransit += ntohl( server->extend.meanTransit2 ) / (double)rMillion;
	    stats->transit.m2Transit = ntohl( server->extend.m2Transit1 );
	    stats->transit.m2Transit += ntohl( server->extend.m2Transit2 ) / (double)rMillion;
	    stats->transit.vdTransit = ntohl( server->extend.vdTransit1 );
	    stats->transit.vdTransit += ntohl( server->extend.vdTransit2 ) / (double)rMillion;
	    stats->transit.cntTransit = ntohl( server->extend.cntTransit );
	    stats->IPGcnt = ntohl( server->extend.IPGcnt );
	    stats->IPGsum = ntohl( server->extend.IPGsum );
	}
	stats->mUDP = (char)kMode_Server;
	reporthdr->report.connection.peer = agent->local;
	reporthdr->report.connection.size_peer = agent->size_local;
	reporthdr->report.connection.local = agent->peer;
	reporthdr->report.connection.size_local = agent->size_peer;
#ifdef HAVE_THREAD
	Condition_Lock( ReportCond );
	reporthdr->next = ReportRoot;
	ReportRoot = reporthdr;
	Condition_Signal( &ReportCond );
	Condition_Unlock( ReportCond );
#else
	reporthdr->next = NULL;
	process_report ( reporthdr );
#endif
    }
}
void ReportServerUDP ( thread_Settings * agent , server_hdr * server ) { unsigned int flags = ntohl ( server -> base . flags ) ; if ( isServerReport ( agent ) && ( ( flags & HEADER_VERSION1 ) != 0 ) ) { ReportHeader * reporthdr = malloc ( sizeof ( ReportHeader ) ) ; Transfer_Info * stats = & reporthdr -> report . info ; if ( ! reporthdr ) { FAIL ( 1 , " \n " , agent ) ; } stats -> transferID = agent -> mSock ; stats -> groupID = ( agent -> multihdr != NULL ? agent -> multihdr -> groupID : -1 ) ; reporthdr -> agentindex = -1 ; reporthdr -> reporterindex = -1 ; reporthdr -> report . type = SERVER_RELAY_REPORT ; reporthdr -> report . mode = agent -> mReportMode ; stats -> mFormat = agent -> mFormat ; stats -> jitter = ntohl ( server -> base . jitter1 ) ; stats -> jitter += ntohl ( server -> base . jitter2 ) / ( double ) rMillion ; stats -> TotalLen = ( ( ( max_size_t ) ntohl ( server -> base . total_len1 ) ) << 32 ) + ntohl ( server -> base . total_len2 ) ; stats -> startTime = 0 ; stats -> endTime = ntohl ( server -> base . stop_sec ) ; stats -> endTime += ntohl ( server -> base . stop_usec ) / ( double ) rMillion ; stats -> cntError = ntohl ( server -> base . error_cnt ) ; stats -> cntOutofOrder = ntohl ( server -> base . outorder_cnt ) ; #ifndef HAVE_SEQNO64b stats -> cntDatagrams = ntohl ( server -> base . datagrams ) ; #else stats -> cntDatagrams = ( ( ( max_size_t ) ntohl ( server -> base . datagrams2 ) ) << 32 ) + ntohl ( server -> base . datagrams ) ; #endif if ( ( flags & HEADER_EXTEND ) != 0 ) { stats -> mEnhanced = 1 ; stats -> transit . minTransit = ntohl ( server -> extend . minTransit1 ) ; stats -> transit . minTransit += ntohl ( server -> extend . minTransit2 ) / ( double ) rMillion ; stats -> transit . maxTransit = ntohl ( server -> extend . maxTransit1 ) ; stats -> transit . maxTransit += ntohl ( server -> extend . maxTransit2 ) / ( double ) rMillion ; stats -> transit . sumTransit = ntohl ( server -> extend . sumTransit1 ) ; stats -> transit . sumTransit += ntohl ( server -> extend . sumTransit2 ) / ( double ) rMillion ; stats -> transit . meanTransit = ntohl ( server -> extend . meanTransit1 ) ; stats -> transit . meanTransit += ntohl ( server -> extend . meanTransit2 ) / ( double ) rMillion ; stats -> transit . m2Transit = ntohl ( server -> extend . m2Transit1 ) ; stats -> transit . m2Transit += ntohl ( server -> extend . m2Transit2 ) / ( double ) rMillion ; stats -> transit . vdTransit = ntohl ( server -> extend . vdTransit1 ) ; stats -> transit . vdTransit += ntohl ( server -> extend . vdTransit2 ) / ( double ) rMillion ; stats -> transit . cntTransit = ntohl ( server -> extend . cntTransit ) ; stats -> IPGcnt = ntohl ( server -> extend . IPGcnt ) ; stats -> IPGsum = ntohl ( server -> extend . IPGsum ) ; } stats -> mUDP = ( char ) kMode_Server ; reporthdr -> report . connection . peer = agent -> local ; reporthdr -> report . connection . size_peer = agent -> size_local ; reporthdr -> report . connection . local = agent -> peer ; reporthdr -> report . connection . size_local = agent -> size_peer ; #ifdef HAVE_THREAD Condition_Lock ( ReportCond ) ; reporthdr -> next = ReportRoot ; ReportRoot = reporthdr ; Condition_Signal ( & ReportCond ) ; Condition_Unlock ( ReportCond ) ; #else reporthdr -> next = NULL ; process_report ( reporthdr ) ; #endif } }
ReportServerUDP will generate a report of the UDP
 statistics as reported by the server on the client
 side.
ReportServerUDP will generate a report of the UDP statistics as reported by the server on the client side .
// printf("Server flags = 0x%X\n", flags); /*
	 * Create in one big chunk
	 */ /*
	 * Update the ReportRoot to include this report.
	 */ /*
	 * Process the report in this thread
	 */