以太网 Ethernet 报文解析 使用canoe 发送报文。解析这个报文
参考资料
IPv4报文协议 链接: https://blog.csdn.net/m0_61643743/article/details/128509490
UDP 报文协议
链接: https://blog.csdn.net/weixin_43142797/article/details/105648071
https://fasionchan.com/network/udp/udp-datagram/
链接: https://blog.csdn.net/weixin_43142797/article/details/105648071
UDP首部有8个字节,由4个字段构成,每个字段都是两个字节,
3、
发送报文 智能驾驶 车道线红路灯信号 NewLanelineDataNotify
New_TSR_Distance_X=10.000
不过这里有一个问题, 10.000 这个不能简单的用进制去转化,一般进制针对整形如int来说会更好。
10.000 是double类型的,那么他对于计算机底层来说 有单独的计算转换公式。
例如 用python 来转化
https://blog.csdn.net/qq_39507748/article/details/110290097
https://blog.csdn.net/cherry1307/article/details/97624014
import struct
#Vector Canoe Class
def double_to_hex(f):
return hex(struct.unpack(‘<Q’, struct.pack(‘<d’, f))[0])
if name == ‘main’:
print(double_to_hex(10.000))
输出 0x4024000000000000 (0x 代表16进制)
4、someip 的动态报文
举例: array数组 的动态意义
假如发送第一个报文里有两个 array 数组 A 、B,A 的长度是20,B的长度是0
那么这个报文payload 长度= 28 byte
= A数组长度属性(4byte)+ A数组长度(20byte)+B数组长度属性(4byte)+ B数组长度(0byte)
假如发送第二个报文里有两个 array 数组 A 、B,A 的长度是20,B的长度是20
那么这个报文payload 长度= 48 byte
= A数组长度属性(4byte)+ A数组长度(20byte)+B数组长度属性(4byte)+ B数组长度(20byte)
4、
TCP/IP 五层模型
五层组包示例
6、
正式示例展示:
Detail View
[-] Time
| 45.283859
| 0:00:00:45.283
[-] General
| Type: Ethernet Packet
| Channel: Ethernet1 (Eth 1)
| Ports: ADAS_Parking
| Packet Length: 165 bytes A5
| Direction: Rx
[-] Data
| Length 165 bytes
00 80 0F 11 70 00
02 22 23 01 02 03
08 00
45
00
00 97
00 00
00 00
40
11
72 FF
C0 A8 C3 03
C0 A8 C3 02
C8 CA
C8 34
00 83
16 67
00 0C 80 03
00 00 00 73
00 00 43 26
01
01
02
00
00 00 00 00
00 00
00 00 00 00
00 00 00 55
00 00 00 00
40 14 00 00 00 00 00 00
40 14 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
01
01
03
01
05
01
00
00
00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00
[-] Ethernet
| Destination: 00:80:0F:11:70:00
| Source: 02:22:23:01:02:03
| Type: IPv4 0800
[-] Payload
| Length 151 bytes
45
00
00 97
00 00
00 00
40
11
72 FF
C0 A8 C3 03
C0 A8 C3 02
C8 CA
C8 34
00 83
16 67
00 0C 80 03
00 00 00 73
00 00 43 26
01
01
02
00
00 00 00 00
00 00
00 00 00 00
00 00 00 55
00 00 00 00
40 14 00 00 00 00 00 00
40 14 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
01
01
03
01
05
01
00
00
00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00
[-] IPv4
| Version: 4 4
| Header Length: 20 bytes 5
[-] Differentiated Service Field DSCP=0 ECN=Not-ECT 00
| DSCP: 0 0000 00
| ECN: Not-ECT . . . . . . 00
| Total Length: 151 bytes 0097
| Identification: 0 0000
[-] Control Flags 0
| Reserved Flag: 0 0
| Don’t Fragment: 0 . 0
| More Fragments: 0 . . 0
| Fragment Offset: 0 bytes 0000
| Time to Live: 64 40
| Protocol: UDP 11
| Checksum: 29439 72FF
| Source: private 192.168.195.3
| Destination: private 192.168.195.2
[-] Payload
| Length 131 bytes
C8 CA
C8 34
00 83
16 67
00 0C 80 03
00 00 00 73
00 00 43 26
01
01
02
00
00 00 00 00
00 00
00 00 00 00
00 00 00 55
00 00 00 00
40 14 00 00 00 00 00 00
40 14 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
01
01
03
01
05
01
00
00
00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00
[-] UDP
| Source Port: 51402 C8CA
| Destination Port: 51252 C834
| Length: 131 bytes 0083 这个长度值 = 是UDP整体的长度
| Checksum: 5735 1667
[-] Payload
| Length 123 bytes
| 000h
00 0C 80 03 // message id (0-3byte)
00 00 00 73 // length (4-7byte) 这个长度值 = 123-8=115=73(16进制)
(去掉message id和 length本身长度)
00 00 43 26 // requestid (8-11byte)
01 // protocol version (12-12byte)
01 // interface version (13-13byte)
02 // message type(14-14byte)
00 // return code (15-15byte)
payload 开始
00 00 00 00 // checksum (16-19byte)
00 00 // counter (20-21byte)
00 00 00 00 //array 的长度=0 FieldLength_Line (22-25byte)
00 00 00 55 //array 的长度=85 FieldLength_TLA (26-29byte)不算当前数组长度属性
00 00 00 00 // TLAID_i (30-33byte)
40 14 00 00 00 00 00 00 // TLA_Distance_X (34-41byte)
40 14 00 00 00 00 00 00 // TLA_Distance_Y (42-49byte)
00 00 00 00 00 00 00 00 // TLA_Distance_Z (50-57byte)
00 00 00 00 00 00 00 00 // TLAPosition_confidence (58-65byte)
01 // LeftTLA_Color (66byte)
01 // LeftTLA_Type (67byte)
03 // StraightTLA_Color (68byte)
01 // StraightTLA_Type (69byte)
05 // RightTLA_Color (70byte)
01 // RightTLA_Type (71byte)
00 // New_LeftTLA_Second (72byte)
00 // New_StraightTLA_Second (73byte)
00 // New_RightTLA_Second (74byte)
00 00 00 00 00 00 00 00 // TLA_Reserved1 (75-82byte) 预留字段
00 00 00 00 00 00 00 00 // TLA_Reserved2 (83-90byte)
00 00 00 00 00 00 00 00 // TLA_Reserved3 (91-98byte)
00 00 00 00 00 00 00 00 // TLA_Reserved4 (99-106byte)
00 00 00 00 00 00 00 00 // TLA_Reserved5 (107-114byte)
00 00 00 00 //array 的长度=0 New_FieldLength_TSR (115-118byte)
00 00 00 00 //array 的长度=0 FieldLength_LanelineReserved (119-122byte)