|
@@ -112,7 +112,6 @@ The task of the sniffer programmer to decode the raw stream into human readable
|
112
|
112
|
|
113
|
113
|
1. Study the file `ethernet_hdr.h`. This file contains the definition of the data structure that represents an Ethernet header.:
|
114
|
114
|
|
115
|
|
- ```
|
116
|
115
|
#define ETHER_ADDR_LEN 6
|
117
|
116
|
|
118
|
117
|
struct sniff_ethernet {
|
|
@@ -120,7 +119,7 @@ The task of the sniffer programmer to decode the raw stream into human readable
|
120
|
119
|
u_char ether_shost[ETHER_ADDR_LEN]; /* source host address */
|
121
|
120
|
u_short ether_type; /* IP? ARP? RARP? etc */
|
122
|
121
|
};
|
123
|
|
- ```
|
|
122
|
+
|
124
|
123
|
|
125
|
124
|
The Ethernet header above is used to decode the ethernet part of the raw data in each packet. It is composed of the source MAC address (ether_shost, 6 bytes), the destiantion MAC address (ether_dhost, 6 bytes), and the type of Ethernet packet (ether_type, 2 bytes) which is used to determine if the packet is an IP packet.
|
126
|
125
|
|
|
@@ -128,7 +127,6 @@ The task of the sniffer programmer to decode the raw stream into human readable
|
128
|
127
|
|
129
|
128
|
2. The following code is the definition of the class `ethernet_packet`, that can be found in file `ethernet_packet.h`:
|
130
|
129
|
|
131
|
|
- ```
|
132
|
130
|
class ethernet_packet
|
133
|
131
|
{
|
134
|
132
|
|
|
@@ -157,7 +155,6 @@ The task of the sniffer programmer to decode the raw stream into human readable
|
157
|
155
|
u_short getEtherType() ;
|
158
|
156
|
|
159
|
157
|
};
|
160
|
|
- ```
|
161
|
158
|
|
162
|
159
|
Note that each object of the class `ethernet_packet` only has one attribute: a structure of type `sniff_ethernet` named `ethernet`
|
163
|
160
|
|