<< senf::fieldName("cfi") << p->cfi() << "\n"
<< senf::fieldName("vlan-ID") << p->vlanId() << "\n"
<< senf::fieldName("ethertype")
- << " 0x" << std::hex << std::setw(4) << std::setfill('0') << p->type() << "\n";
+ << " 0x" << std::hex << std::setw(4) << std::setfill('0') << std::right << p->type() << "\n";
}
prefix_ void senf::EthVLanPacketType::finalize(packet p)
<< senf::fieldName("ttl") << unsigned(p->ttl()) << "\n"
<< senf::fieldName("protocol") << unsigned(p->protocol()) << "\n"
<< senf::fieldName("checksum")
- << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << std::dec << "\n"
+ << "0x" << std::hex << std::setw(4) << std::setfill('0') << std::right << p->checksum() << std::dec << "\n"
<< senf::fieldName("source") << p->source() << "\n"
<< senf::fieldName("destination") << p->destination() << "\n";
}
os << "Internet protocol Version 6:\n"
<< senf::fieldName("version") << unsigned(p->version()) << "\n"
<< senf::fieldName("traffic class")
- << "0x" << std::hex << std::setw(2) << std::setfill('0') << unsigned(p->trafficClass()) << "\n"
+ << "0x" << std::hex << std::setw(2) << std::setfill('0') << std::right << unsigned(p->trafficClass()) << "\n"
<< senf::fieldName("flow label")
- << "0x" << std::hex << std::setw(5) << std::setfill('0') << unsigned(p->flowLabel()) << "\n"
+ << "0x" << std::hex << std::setw(5) << std::setfill('0') << std::right << unsigned(p->flowLabel()) << "\n"
<< senf::fieldName("payload length") << std::dec << unsigned(p->length()) << "\n"
<< senf::fieldName("next header") << unsigned(p->nextHeader()) << "\n"
<< senf::fieldName("hop limit") << unsigned(p->hopLimit()) << "\n"
{
boost::io::ios_all_saver ias(os);
os << "LLC/SNAP:\n"
- << std::hex << std::setfill('0')
+ << std::hex << std::setfill('0') << std::right
<< " LLC\n"
<< senf::fieldName(" dsap") << "0x" << unsigned(p->dsap()) << "\n"
<< senf::fieldName(" ssap") << "0x" << unsigned(p->ssap()) << "\n"
<< senf::fieldName("fin flag") << p->finf() << "\n"
<< senf::fieldName("window size") << p->window() << "\n"
<< senf::fieldName("checksum")
- << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n"
+ << "0x" << std::hex << std::setw(4) << std::setfill('0') << std::right << p->checksum() << "\n"
<< senf::fieldName("urgent pointer") << p->urgentpointer() << "\n";
}
<< senf::fieldName("dest port") << p->destination() << "\n"
<< senf::fieldName("length") << p->length() << "\n"
<< senf::fieldName("checksum")
- << "0x" << std::hex << std::setw(4) << std::setfill('0') << p->checksum() << "\n";
+ << "0x" << std::hex << std::setw(4) << std::setfill('0') << std::right << p->checksum() << "\n";
}
prefix_ void senf::UDPPacketType::finalize(packet p)
prefix_ std::ostream & senf::operator<<(std::ostream & os, EUI64 const & eui)
{
boost::io::ios_all_saver ias(os);
- os << std::hex << std::setfill('0')
+ os << std::hex << std::setfill('0') << std::right
<< std::setw(2) << unsigned(eui[0]) << ":"
<< std::setw(2) << unsigned(eui[1]) << ":"
<< std::setw(2) << unsigned(eui[2]) << ":"
}
}
+SENF_AUTO_UNIT_TEST(eui64_fillRight)
+{
+ std::string eui64Str ("01:02:03:ff-fe:04:05:06");
+ senf::EUI64 eui64 (senf::EUI64::from_string( eui64Str));
+
+ std::stringstream ss;
+ ss << std::left << eui64;
+ BOOST_CHECK_EQUAL( ss.str(), eui64Str);
+}
+
//-/////////////////////////////////////////////////////////////////////////////////////////////////
#undef prefix_
prefix_ std::ostream & senf::operator<<(std::ostream & os, MACAddress const & mac)
{
boost::io::ios_all_saver ias (os);
- os << std::hex << std::setfill('0');
+ os << std::hex << std::setfill('0') << std::right;
for (MACAddress::const_iterator i (mac.begin()); i != mac.end(); ++i) {
if (i != mac.begin())
os << ':';
if (noformat_) {
if (timeBase_ == -1) timeBase_ = timestamp;
time_type delta (timestamp - timeBase_);
- datestream_ << std::setfill('0') << std::setw(10)
- << (delta / 1000000000ll) << '.'
- << std::setfill('0') << std::setw(9)
- << (delta % 1000000000ll);
+ datestream_ << std::setfill('0') << std::right
+ << std::setw(10) << (delta / 1000000000ll) << '.'
+ << std::setw(9) << (delta % 1000000000ll);
}
else
datestream_ << senf::ClockService::abstime(timestamp);
ascii_ = "";
}
os_ << " "
- << std::hex << std::setw(4) << std::setfill('0')
+ << std::hex << std::setw(4) << std::setfill('0') << std::right
<< offset_ << ' ';
} else if ((offset_ % block_size_) == block_size_/2) {
os_ << " ";