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:
- 167:ff8a2d8beeb1
- Parent:
- 165:c47826d07e0d
- Child:
- 170:3d3b2126181c
--- a/PPP-Blinky/ppp-blinky.h Sun Sep 03 19:20:11 2017 +0000 +++ b/PPP-Blinky/ppp-blinky.h Mon Sep 04 04:13:15 2017 +0000 @@ -12,11 +12,24 @@ /// PPP header typedef struct { // [ff 03 00 21] - unsigned int pppAddress : 8; // always 0xff - unsigned int pppControl : 8; // always 03 - unsigned int pppProtocol : 16; // 2100 for IP (byte reversed, should be 0021) + unsigned int address : 8; // always 0xff + unsigned int control : 8; // always 03 + unsigned int protocolR : 16; // byte reversed, 0x0021 for ip } pppHeaderType; +/// LCP and IPCP header +typedef struct { + // ppp part + unsigned int address : 8; // always 0xff + unsigned int control : 8; // always 03 + unsigned int protocolR : 16; // byte reversed, 0x0021 for ip + + // ipcp and lcp part + unsigned int code : 8; // IPCP and LCP contain a code field which identifies the requested action or response + unsigned int identifier : 8 ; + unsigned int lengthR : 16; +} ipcpHeaderType; + /// IP header typedef struct { unsigned int headerLength : 4; // ip headerlength / 4 @@ -25,26 +38,31 @@ unsigned int ce : 1; // ecn-ce unsigned int dscp : 6; // differentiated services unsigned int lengthR : 16; // ip packet length (byte-reversed) - + unsigned int identR : 16; // ident, byte reversed unsigned int fragmentOffsHi : 5; unsigned int lastFragment : 1; unsigned int dontFragment : 1; unsigned int reservedIP : 1; unsigned int fragmentOffsLo : 8; - + unsigned int ttl : 8; unsigned int protocol : 8; // next protocol unsigned int checksumR : 16; // ip checksum, byte reversed - - unsigned int srcAdrR; // source IP address - unsigned int dstAdrR; // destination IP address + union { + unsigned int srcAdrR; // source IP address + char srcAdrPtr [0]; // so we also have a char * to srcAdrR + }; + union { + unsigned int dstAdrR; // destination IP address + char dstAdrPtr [0]; // so we also have a char * to dstAdrR + }; } ipHeaderType; /// IP pseudoheader. Used in TCP/UDP checksum calculations. typedef struct { union { - char start [0]; + char start [0]; // a char * to avoid type conversions unsigned int srcAdrR; // source IP address }; unsigned int dstAdrR; // destination IP address