22 #include <boost/io/ios_state.hpp> 45 boost::io::ios_all_saver ias(os);
46 if (p->type_length() <= 1500)
47 os <<
"Ethernet 802.3";
48 else if (p->type_length() >= 0x600)
49 os <<
"Ethernet II (DIX)";
51 os <<
"Ethernet 802.3 (bad ethertype >1500 and <1536)";
71 p->type_length() << k;
73 p->type_length() << n.data().size();
83 boost::io::ios_all_saver ias(os);
84 os <<
"Ethernet 802.1ad (VLAN S-Tag):\n" 89 <<
"0x" << std::hex << std::setw(4) << std::setfill(
'0')
90 << std::right << p->type_length() << std::endl;
103 boost::io::ios_all_saver ias(os);
104 os <<
"Ethernet 802.1q (VLAN C-Tag):\n" 109 <<
"0x" << std::hex << std::setw(4) << std::setfill(
'0')
110 << std::right << p->type_length() << std::endl;
123 boost::io::ios_all_saver ias(os);
124 os <<
"Ethernet OUI Extension:\n" 125 << std::hex << std::setfill(
'0') << std::right
126 <<
senf::fieldName(
"OUI") << std::setw(3) <<
"0x" << p->oui() << std::endl
127 <<
senf::fieldName(
"Ext. EtherType") << std::setw(2) <<
"0x" << p->ext_type() << std::endl;
static void finalize(packet p)
EthernetPacket public header.
SENF_PACKET_INSTANTIATE_TEMPLATE(senf::EthernetPacket)
static optional_key_t key(Packet const &p)
Find key of packet from registry.
SENF_PACKET_REGISTRY_REGISTER(senf::EtherTypes, 0x6558, senf::EthernetPacket)
static void finalize(packet p)
static void finalize(packet p)
static boost::uint32_t oui(key_t key)
std::string fieldName(std::string const &s)
static const EtherTypes::key_t etherType
static void dump(packet p, std::ostream &os)
Dump given EthernetPacket in readable form to given output stream.
boost::optional< key_t > optional_key_t
static const EtherTypes::key_t etherType
static boost::uint16_t ext_type(key_t key)
static factory_t nextPacketType(packet p)
Protocol specific packet handle.
Packet next() const
Get next packet in chain.
static void dump(packet p, std::ostream &os)
Dump given EthVLanPacket in readable form to given output stream.
static const EtherTypes::key_t etherType
static void finalize(packet p)
static void dump(packet p, std::ostream &os)
Dump given EthVLanPacket in readable form to given output stream.
static factory_t no_factory()
static PacketTypeBase::factory_t lookup(key_t key)
Lookup the key in the registry.
static factory_t factory()
Return factory for packets of specific type.
static void dump(packet p, std::ostream &os)
Factory const * factory_t