Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are parsing a network using C++ display different protocols. And I am stuck The network frame usually has multiple headers from different protocols. We

You are parsing a network using C++ display different protocols. And I am stuck

image text in transcribedimage text in transcribedimage text in transcribed
The network frame usually has multiple headers from different protocols. We have received an ethernet frame with 54 bytes with hexadecimal values given below: 525400123502080027BDD8360800450000282CE44000400602200A 00020F226BDD52C6920050D5EAB6B2012304DE5010A4880BE70000 We need to parse the ethernet frame and extract the fields of the different protocol headers. Below are some of the protocol headers: Ethernet Header: Destination MAC address Source MAC address EtherType 1. Destination MAC address: 6-bytes 2. Source MAC address: 6-bytes 3. EtherType: 2-bytes. The following are some of the popular values for EtherType: EtherType Network Protocol Ox0800 Internet Protocol version 4 (IPv4) Ox0806 Address Resolution Protocol (ARP) Ox86DD Internet Protocol Version 6 (IPV6) IP Header: Ver IHL DSCF ECN Total Length Identification Flags Fragment Offset TTL Protocol Header Checksum Source IP address Destination IP address 1. Ver: 4-bit, Version 2. IHL: 4-bit, Internet Header Length (number of 32-bit words) 3. DSCP: 6-bit, Differentiated Services Code Point.LidD I. DICS and Dytes 4. ECN: 2-bit, Explicit Congestion Notification. 5. Total Length: 16-bit, Total length of the packet. 6. Identification: 16-bit, Fragment ID 7. Flags: 3-bit, Fragmentation Flag 8. Fragment Offset: 13-bit 9. TTL: 8-bit, Time To Live 10. Protocol: 8-bit 11. Header Checksum: 16-bit 12. Source IP Address: 32-bit 13. Destination IP Address: 32-bit 14. TCP Header: Source Port Destination Port Sequence number Acknowledgment number Data Offset Res 2 6 Window Size Checksum Urgent Pointer 1. Source Port: 2-bytes 2. Destination Port: 2-bytes . Sequence Number: 4-bytes 4. Acknowledgment Number: 4-bytes 5. Data Offset: 4-bit 6. Res: 3-bit reserved 7. NS: 1-bit, Explicit Congestion Notification Nonce. 8. CWR: 1-bit, Congestion Window Reduction Flag 9. ECE: 1-bit, Explicit Congestion Notification Echo. 10. URG: 1-bit, Urgent Flag 11. ACK: 1-bit, Acknowledgement Flag 12. PSH: 1-bit, Push Flag 13. RST: 1-bit, Reset Flag 14. SYN: 1-bit, Sync Flag 15. FIN: 1-bit, Finish Flag 16. Window Size: 16-bit, Window Size 17. Checksum: 16-bit, Checksum 18. Urgent Pointer: 16-bit, Urgent Pointer I' Note: The bytes of the header for the frames start from the left to the right as follows: 1) Ethernet Header 2) IP Header 3) TCP Header Finish the C++ code shown in Listing 9 to parse and print the fields of all the different protocols.Listing :1 - incompIEIe coue - rarsung a rrame The output of the listing above is: Ethernet Header: Destination MAC Address: 52 54 00 12 35 02 So, repeat what we did to get the destination MAC address field and print the other fields. [1%) Note: You can clear the bits of the a given bitset by using the reset() member function. For example, in the previous listing if we want to clear all the bits of the bitset result, then you can achieve that by: result.reset() I]? Note: The methods used in this lab to work with bits and bytes are not the most efficient, however, this will serve very well for understanding the concepts

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions