ns-allinone-2.35/olsr/OLSR_printer.cc
void
OLSR_printer::print_cmn_hdr(FILE* out, struct hdr_cmn* ch) {
	char *error, *direction;
	
	if (ch->error())
		error = "yes";
	else
		error = "no";
		
	if (ch->direction() == hdr_cmn::DOWN)
		direction = "DOWN";
	else if (ch->direction() == hdr_cmn::UP)
		direction = "UP";
	else if (ch->direction() == hdr_cmn::NONE)
		direction = "NONE";
	else
		direction = "UNKNOWN (likely a bug!)";
	
	// We could include this if we were interested in printing address type
	/*if (ch->addr_type() == NS_AF_NONE)
		addr_type = "NS_AF_NONE";
	else if (ch->addr_type() == NS_AF_ILINK)
		addr_type = "NS_AF_ILINK";
	else if (ch->addr_type() == NS_AF_INET)
		addr_type = "NS_AF_INET";
	else
		addr_type = "UNKNOWN (possibly a bug!)";*/
	
	fprintf(out,
		"  COMMON HEADER\n\tptype = %s\n\tuid = %d\n\tsize = %d\n\terror = %s\n\tdirection = %s\n\n",
		packet_info.name(ch->ptype()),
		ch->uid(),
		ch->size(),
		error,
		direction);
}
///
/// \brief Prints a given common header into a given file.
/// \warning This function is actually not used.
/// \param out	File where the common header is going to be written.
/// \param ch	Common header to be written.
///
\brief Prints a given common header into a given file.
\warning This function is actually not used.
\param out     File where the common header is going to be written.
\param ch      Common header to be written.
\ brief Prints a given common header into a given file . \ warning This function is actually not used . \ param out File where the common header is going to be written . \ param ch Common header to be written .
void
OLSR_printer::print_cmn_hdr(FILE* out, struct hdr_cmn* ch) {
	char *error, *direction;
	if (ch->error())
		error = "yes";
	else
		error = "no";
	if (ch->direction() == hdr_cmn::DOWN)
		direction = "DOWN";
	else if (ch->direction() == hdr_cmn::UP)
		direction = "UP";
	else if (ch->direction() == hdr_cmn::NONE)
		direction = "NONE";
	else
		direction = "UNKNOWN (likely a bug!)";
	fprintf(out,
		"  COMMON HEADER\n\tptype = %s\n\tuid = %d\n\tsize = %d\n\terror = %s\n\tdirection = %s\n\n",
		packet_info.name(ch->ptype()),
		ch->uid(),
		ch->size(),
		error,
		direction);
}
void OLSR_printer :: print_cmn_hdr ( FILE * out , struct hdr_cmn * ch ) { char * error , * direction ; if ( ch -> error ( ) ) error = " " ; else error = " " ; if ( ch -> direction ( ) == hdr_cmn :: DOWN ) direction = " " ; else if ( ch -> direction ( ) == hdr_cmn :: UP ) direction = " " ; else if ( ch -> direction ( ) == hdr_cmn :: NONE ) direction = " " ; else direction = " " ; fprintf ( out , " \n \t \n \t \n \t \n \t \n \t \n \n " , packet_info . name ( ch -> ptype ( ) ) , ch -> uid ( ) , ch -> size ( ) , error , direction ) ; }
\brief Prints a given common header into a given file.
\ brief Prints a given common header into a given file .
// We could include this if we were interested in printing address type /*if (ch->addr_type() == NS_AF_NONE)
		addr_type = "NS_AF_NONE";
	else if (ch->addr_type() == NS_AF_ILINK)
		addr_type = "NS_AF_ILINK";
	else if (ch->addr_type() == NS_AF_INET)
		addr_type = "NS_AF_INET";
	else
		addr_type = "UNKNOWN (possibly a bug!)";*/