I just learned about the endianess of ethernet frame.
Bits in byte are in little endian, but bytes are in big endian.
e.g EtherType 0x0800
in cable:
00010000 00000000
Decoding order:
<------- <-------
---------------->
Then Read by Wireshark it is:
00001000 00000000
If my understanding is correct, then, if preamble and SFD can be read, since they are
in cable:
10101010 10101010 ... 10101011
Decoding order:
<------- <------- ... <-------
----------------------------->
Read by WireShark it is:
01010101 01010101 ... 11010101
Please point out if I make mistake here.
Now, what I'm not sure is the range of the little endianness.
Is the entire data stream in cable in little endianness, or it is only the ethernet frame header and footer part in little endianness?
If it is only the ethernet frame header and footer in little endianness, then I guess when I decode the frame, I should do this:
In cable:
... EtherType IP version IHL ...
... 00010000 00000000 0100 0101 ...
Decoding order:
... <------- <------- ---> ---> ...
... -----------------------------------> ...
Then I get:
- Ethertype: 0x0800, ipv4
- IP version: 0100, ipv4
- IP packet header length: 0101, 5*32bits
If the entire ethernet frame in cable is in little endianness, then I should decode it like this:
In cable:
... EtherType IP version IHL ...
... 00010000 00000000 0100 0101 ...
Decoding order:
... <------- <------- <--- <--- ...
... -----------------------------------> ...
Then I get:
- Ethertype: 0x0800, ipv4
- IP version: 0010, ipv2?
- IP packet header length: 1010, 10*32bits?
This one looks pretty weird. So I guess this one is wrong?
Which one is correct, I need a confirmation.