#include <Ipv4ProtocolPrinter.h>
|
| virtual void | print (const Ptr< const Chunk > &chunk, const Protocol *protocol, const cMessagePrinter::Options *options, Context &context) const override |
| | Prints the given chunk of protocol according to options into context. More...
|
| |
◆ print()
| void inet::Ipv4ProtocolPrinter::print |
( |
const Ptr< const Chunk > & |
chunk, |
|
|
const Protocol * |
protocol, |
|
|
const cMessagePrinter::Options * |
options, |
|
|
Context & |
context |
|
) |
| const |
|
overridevirtual |
Prints the given chunk of protocol according to options into context.
Implements inet::ProtocolPrinter.
20 if (
auto header = dynamicPtrCast<const Ipv4Header>(chunk)) {
21 context.sourceColumn << header->getSrcAddress();
22 context.destinationColumn << header->getDestAddress();
23 B payloadLength =
B(header->getTotalLengthField()) - header->getChunkLength();
24 context.infoColumn <<
"IPv4"
25 <<
" id:" << header->getIdentification()
26 <<
" ttl:" << header->getTimeToLive();
27 if (header->getDontFragment())
28 context.infoColumn <<
" DontFrag";
29 if (header->getMoreFragments() || header->getFragmentOffset() > 0) {
30 context.infoColumn <<
" frag:[" << header->getFragmentOffset() <<
".." << header->getFragmentOffset() + payloadLength.get();
31 if (!header->getMoreFragments())
32 context.infoColumn <<
" End";
33 context.infoColumn <<
")";
35 auto payloadProtocol = header->getProtocol();
37 context.infoColumn <<
" payload:" << payloadProtocol->getName() <<
" " << payloadLength;
39 context.infoColumn <<
" payload: protocol(" << header->getProtocolId() <<
") " << payloadLength;
43 context.infoColumn <<
"(IPv4) " << chunk;
The documentation for this class was generated from the following files: