Browse Source

README-en.md edited online with Bitbucket

Jose R Ortiz Ubarri 8 years ago
parent
commit
76c1e7bdc9
1 changed files with 29 additions and 30 deletions
  1. 29
    30
      README-en.md

+ 29
- 30
README-en.md View File

112
 
112
 
113
 1. Study the file `ethernet_hdr.h`. This file contains the definition of the data structure that represents an Ethernet header.:
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
-     #define ETHER_ADDR_LEN 6
115
+         #define ETHER_ADDR_LEN 6
116
 
116
 
117
-     struct sniff_ethernet {
118
-        u_char  ether_dhost[ETHER_ADDR_LEN];    /* destination host address */
119
-        u_char  ether_shost[ETHER_ADDR_LEN];    /* source host address */
120
-        u_short ether_type;                     /* IP? ARP? RARP? etc */
121
-     };
117
+         struct sniff_ethernet {
118
+            u_char  ether_dhost[ETHER_ADDR_LEN];    /* destination host address */
119
+            u_char  ether_shost[ETHER_ADDR_LEN];    /* source host address */
120
+            u_short ether_type;                     /* IP? ARP? RARP? etc */
121
+         };
122
      
122
      
123
 
123
 
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.
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.
127
 
127
 
128
 2. The following code is the definition of the class `ethernet_packet`, that can be found in file `ethernet_packet.h`:
128
 2. The following code is the definition of the class `ethernet_packet`, that can be found in file `ethernet_packet.h`:
129
  
129
  
130
-     class ethernet_packet
131
-     {
132
-
133
-        sniff_ethernet ethernet ;
134
-        // Returns a 6 bytes MAC address in string representation.
135
-        string mac2string(u_char []) ;
136
-
137
-     public:
138
-        ethernet_packet();  // Default constructor
139
-
140
-        // Set the ethernet variable member ether_dhost to the values
141
-        // received in the array
142
-        void setEtherDHost(u_char []) ;
130
+         class ethernet_packet
131
+         {
132
+            sniff_ethernet ethernet ;
133
+            
134
+            // Returns a 6 bytes MAC address in string representation.
135
+            string mac2string(u_char []) ;
136
+
137
+         public:
138
+            ethernet_packet();  // Default constructor
139
+
140
+            // Set the ethernet variable member ether_dhost to the values
141
+            // received in the array
142
+            void setEtherDHost(u_char []) ;
143
         
143
         
144
-        // Same as above but to the ether_shost
145
-        void setEtherSHost(u_char []) ;
146
-
147
-        // Set the ethernet type to the value received.
148
-        void setEtherType(u_short) ;
144
+            // Same as above but to the ether_shost
145
+            void setEtherSHost(u_char []) ;
149
 
146
 
150
-        // returns the string representation of the ethernet addresses
151
-        string getEtherDHost() ;
152
-        string getEtherSHost() ;
147
+            // Set the ethernet type to the value received.
148
+            void setEtherType(u_short) ;
153
 
149
 
154
-        // Return the ethernet type
155
-        u_short getEtherType() ;
150
+            // returns the string representation of the ethernet addresses
151
+            string getEtherDHost() ;
152
+            string getEtherSHost() ;
156
 
153
 
157
-     };
154
+            // Return the ethernet type
155
+            u_short getEtherType() ;
156
+         };
158
 
157
 
159
      Note that each object of the class `ethernet_packet` only has one attribute: a structure of type `sniff_ethernet` named `ethernet`
158
      Note that each object of the class `ethernet_packet` only has one attribute: a structure of type `sniff_ethernet` named `ethernet`
160
 
159