Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of webserverBlinky by
Diff: PPP-Blinky/ppp-blinky.h
- Revision:
- 154:18b2bd92f557
- Parent:
- 153:7993def8663f
- Child:
- 155:9c6a1d249e26
--- a/PPP-Blinky/ppp-blinky.h Fri Sep 01 15:44:06 2017 +0000 +++ b/PPP-Blinky/ppp-blinky.h Fri Sep 01 20:23:03 2017 +0000 @@ -12,76 +12,53 @@ /// structure of a PPP header typedef struct { // [ff 03 00 21] - unsigned int pppAddress : 8, // always 0xff - pppControl : 8, // always 03 - pppProtocol : 16; // 2100 for IP (byte reversed, should be 0021) + unsigned int pppAddress : 8; // always 0xff + unsigned int pppControl : 8; // always 03 + unsigned int pppProtocol : 16; // 2100 for IP (byte reversed, should be 0021) } pppHeaderType; -/// structure of an IP header for small-endian devices +/// structure of an IP header for little-endian devices typedef struct { - pppHeaderType pppHeader; // first four bytes is the PPP header [ff 03 00 21] - unsigned int headerLength : 4, // ip headerlength / 4 - version : 4, // ip version number - ect : 1, // ecn capable transport - ce : 1, // ecn-ce - dscp : 6, // differentiated services - length : 16; // ip packet length (byte-reversed) - - unsigned int fragmentOffset : 13, - reserved : 1, - dontFragment : 1, - lastFragment : 1, - ident : 16; - - unsigned int checksum : 16, - protocol : 8, // next protocol - ttl : 8; - - unsigned int srcAdr; // source IP address - - unsigned int dstAdr; // destination IP address + unsigned int headerLength : 4; // ip headerlength / 4 + unsigned int version : 4; // ip version number + unsigned int ect : 1; // ecn capable transport + unsigned int ce : 1; // ecn-ce + unsigned int dscp : 6; // differentiated services + unsigned int lengthR : 16; // ip packet length (byte-reversed) + unsigned int fragmentOffset : 13; + unsigned int reservedIP : 1; + unsigned int dontFragment : 1; + unsigned int lastFragment : 1; + unsigned int identR : 16; + unsigned int checksum : 16; + unsigned int protocol : 8; // next protocol + unsigned int ttl : 8; + unsigned int srcAdrR; // source IP address + unsigned int dstAdrR; // destination IP address } ipHeaderType; -/// structure of TCP header when ip header is 20 bytes long +/// structure of TCP header typedef struct { - ipHeaderType ip; // first part of TCP header is IP header - unsigned int srcAdr : 16, // byte reversed - dstAdr : 16; // byte reversed - unsigned int seqTcp; - unsigned int ackTcp; - unsigned int res1 : 4, - offset : 4; // tcp header length [5..15] + unsigned int srcAdrR : 16; // byte reversed + unsigned int dstAdrR : 16; // byte reversed + unsigned int seqTcpR; // byte reversed + unsigned int ackTcpR; // byte reversed + unsigned int resvd1 : 4; // reserved + unsigned int offset : 4; // tcp header length [5..15] union { - unsigned int flags : 8; + unsigned int flags : 8; // 8 tcp flag bits struct { - unsigned int f:1, s:1, r:1, p:1, a:1, u:1; + unsigned int f:1, // fin + s:1, // syn + r:1, // rst + p:1, // psh + a:1, // ack + u:1; // urg }; }; - unsigned int window : 16; // byte reversed - unsigned int checksum : 16, // byte reversed - urgentPointer : 16; // byte reversed; - unsigned int tcpOptions[10]; // 10 words of options possible -} tcpHeaderType1; + unsigned int windowR : 16; // byte reversed + unsigned int checksumR : 16; // byte reversed + unsigned int urgentPointerR : 16; // byte reversed; + unsigned int tcpOptions[10]; // up to 10 words of options possible +} tcpHeaderType; -/// structure of TCP header when ip header is 24 bytes long -typedef struct { - ipHeaderType ip; // first part of TCP header is IP header - unsigned int options; // extra 4 bytes in IP header - unsigned int srcAdr : 16, // byte reversed - dstAdr : 16; // byte reversed - unsigned int seqTcp; - unsigned int ackTcp; - unsigned int res1 : 4, - offset : 4; // tcp header length [5..15] - union { - unsigned int flags : 8; - struct { - unsigned int f:1, s:1, r:1, p:1, a:1, u:1; - }; - }; - unsigned int window : 16; // byte reversed - unsigned int checksum : 16, // byte reversed - urgentPointer : 16; // byte reversed; - unsigned int tcpOptions[10]; // 10 words of options possible -} tcpHeaderType2; -