124 for (cPacket *pk = dynamic_cast<cPacket *>(msg);
showEncapsulatedPackets && pk; pk = pk->getEncapsulatedPacket()) {
125 std::ostringstream out;
126 INetworkDatagram *dgram =
dynamic_cast<INetworkDatagram *
>(pk);
128 srcAddr = dgram->getSourceAddress();
129 destAddr = dgram->getDestinationAddress();
131 if (dynamic_cast<IPv4Datagram *>(pk)) {
132 IPv4Datagram *ipv4dgram =
static_cast<IPv4Datagram *
>(pk);
134 if (ipv4dgram->getMoreFragments() || ipv4dgram->getFragmentOffset() > 0) {
135 out <<
" " << (ipv4dgram->getMoreFragments() ?
"" :
"last ")
136 <<
"fragment with offset=" << ipv4dgram->getFragmentOffset() <<
" of ";
140 #endif // ifdef WITH_IPv4 144 else if (dynamic_cast<EtherFrame *>(pk)) {
145 EtherFrame *eth =
static_cast<EtherFrame *
>(pk);
146 out <<
"ETH: " << eth->getSrc() <<
" > " << eth->getDest() <<
" (" << eth->getByteLength() <<
" bytes)";
148 #endif // ifdef WITH_ETHERNET 149 #ifdef WITH_TCP_COMMON 150 else if (dynamic_cast<tcp::TCPSegment *>(pk)) {
151 out << formatTCPPacket(static_cast<tcp::TCPSegment *>(pk));
153 #endif // ifdef WITH_TCP_COMMON 155 else if (dynamic_cast<UDPPacket *>(pk)) {
156 out << formatUDPPacket(static_cast<UDPPacket *>(pk));
158 #endif // ifdef WITH_UDP 160 else if (dynamic_cast<ICMPMessage *>(pk)) {
161 out << formatICMPPacket(static_cast<ICMPMessage *>(pk));
163 else if (dynamic_cast<ARPPacket *>(pk)) {
164 out << formatARPPacket(static_cast<ARPPacket *>(pk));
166 #endif // ifdef WITH_IPv4 167 #ifdef WITH_IEEE80211 168 else if (dynamic_cast<ieee80211::Ieee80211Frame *>(pk)) {
169 out << formatIeee80211Frame(static_cast<ieee80211::Ieee80211Frame *>(pk));
171 #endif // ifdef WITH_IEEE80211 172 else if (dynamic_cast<PingPayload *>(pk)) {
173 out << formatPingPayload(static_cast<PingPayload *>(pk));
176 else if (dynamic_cast<RIPPacket *>(pk)) {
177 out << formatRIPPacket(static_cast<RIPPacket *>(pk));
179 #endif // ifdef WITH_RIP 181 else if (dynamic_cast<RadioFrame *>(pk)) {
182 out << formatRadioFrame(static_cast<RadioFrame *>(pk));
184 #endif // ifdef WITH_RADIO 186 out << pk->getClassName() <<
":" << pk->getByteLength() <<
" bytes";
188 out << INFO_SEPAR << outs;
L3Address destAddr
Definition: InetPacketPrinter2.cc:87
L3Address srcAddr
Definition: InetPacketPrinter2.cc:86
bool showEncapsulatedPackets
Definition: InetPacketPrinter2.cc:85