Hi all,
I am implementing a software Precision Time Protocol (PTP) implementation which requires reading Raw Ethernet II frames, no TCP/IP/UDP. An example packet is copied below. Is this possible using lwIP?
I see the raw_new api accepts a proto parameter but there doesn't seem to be a protocal define for raw frames.
Protocols defined in ip.h
#define IP_PROTO_ICMP 1
#define IP_PROTO_IGMP 2
#define IP_PROTO_UDP 17
#define IP_PROTO_UDPLITE 136
#define IP_PROTO_TCP 6
Thank you.
Example PTP Raw Ethernet II frame copied from Wireshark
Frame 28: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Encapsulation type: Ethernet (1)
Arrival Time: Jul 24, 2019 16:29:02.184864000 PDT
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1564010942.184864000 seconds
[Time delta from previous captured frame: 0.008057000 seconds]
[Time delta from previous displayed frame: 0.008057000 seconds]
[Time since reference or first frame: 0.264827000 seconds]
Frame Number: 28
Frame Length: 60 bytes (480 bits)
Capture Length: 60 bytes (480 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ethertype:ptp]
[Coloring Rule Name: Broadcast]
[Coloring Rule String: eth[0] & 1]
Ethernet II, Src: Trimble_70:09:90 (00:17:47:70:09:90), Dst: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
Destination: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
Address: IeeeI&MS_00:00:00 (01:1b:19:00:00:00)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
Source: Trimble_70:09:90 (00:17:47:70:09:90)
Address: Trimble_70:09:90 (00:17:47:70:09:90)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Type: PTPv2 over Ethernet (IEEE1588) (0x88f7)
Padding: 0000
Precision Time Protocol (IEEE1588)
0000 .... = transportSpecific: 0x0
.... 0000 = messageId: Sync Message (0x0)
.... 0010 = versionPTP: 2
messageLength: 44
subdomainNumber: 24
flags: 0x0000
0... .... .... .... = PTP_SECURITY: False
.0.. .... .... .... = PTP profile Specific 2: False
..0. .... .... .... = PTP profile Specific 1: False
.... .0.. .... .... = PTP_UNICAST: False
.... ..0. .... .... = PTP_TWO_STEP: False
.... ...0 .... .... = PTP_ALTERNATE_MASTER: False
.... .... ..0. .... = FREQUENCY_TRACEABLE: False
.... .... ...0 .... = TIME_TRACEABLE: False
.... .... .... 0... = PTP_TIMESCALE: False
.... .... .... .0.. = PTP_UTC_REASONABLE: False
.... .... .... ..0. = PTP_LI_59: False
.... .... .... ...0 = PTP_LI_61: False
correction: 582.000015 nanoseconds
correction: Ns: 582 nanoseconds
correctionSubNs: 1.52587890625e-05 nanoseconds
ClockIdentity: 0x001747fffe700990
SourcePortID: 1
sequenceId: 9796
control: Sync Message (0)
logMessagePeriod: -4
originTimestamp (seconds): 1564010979
originTimestamp (nanoseconds): 187716775