doip笔记
1. 报文封装
block-beta
columns 6
space:4 a["address"] b["uds data"]
space:3 c["doip header"] d["doip data"]:2
space:2 e["tcp/udp header"] f["tcp/udp data"]:3
space:1 g["ip header"] h["ip data"]:4
i["eth header"] j["eth data"]:5
classDef UDS fill:#A3D8FF
class a,b UDS
classDef DOIP fill:#FF8A08
class c,d DOIP
classDef TCP fill:#BACD92
class e,f TCP
classDef IP fill:#F27BBD
class g,h IP
classDef ETH fill:#E4C59E
class i,j ETH
2. 端口号
-
TCP端口号
名称 协议 端口号 通信类型 TCP_DATA TCP 13400 unsecured TCP_DATA TCP 3496 secured -
TCP_DATA
- DoIP实体监听端口13400,接收unsecured tcp链接和数据
- DoIP实体监听端口3496,接收secured tcp链接和数据
- 测试仪连接13400或者3496
-
UDP端口号
名称 协议 端口号 UDP_DISCOVER UDP 13400 UDP_TEST_EQUIPMENT_REQUEST UDP 动态分配 -
UDP_DISCOVER
- 测试仪/DoIP实体监听此端口
- 测试仪/DoIP实体主动发送数据时目的端口
-
UDP_TEST_EQUIPMENT_REQUEST
- 测试仪向DoIP实体发送报文时自定义端口
3. DoIP报文格式
block-beta
columns 9
a["ver"] b["'ver"] c["payload type"]:2 d["payload len"]:4 e["payload"]
classDef VER fill:#A3D8FF
class a,b VER
classDef TYPE fill:#FF8A08
class c TYPE
classDef DATA fill:#BACD92
class e DATA
- DoIP首部
block-beta
columns 4
a["ver"] b["'ver"] c["payload type"]:2
d["payload len"]:4
classDef VER fill:#A3D8FF
class a,b VER
classDef TYPE fill:#FF8A08
class c TYPE
- 协议版本号/协议版本号取反(ver/'ver)
- 0x00: 预留
- 0x01: DoIP ISO/IDS 13400-2:2010
- 0x02: DoIP ISO 13400-2:2012
- 0x03: DoIP ISO 13400-2:2019
- 0x04…0xFE: 预留
- 0xFF: 车辆识别请求报文默认值
- 负载类型
负载分类 协议 节点管理类 0x0000-0x0008 诊断类 0x8001-0x8003 节点状态类 0x4001-0x4004 预留 其他
- 节点管理类报文
负载类型值 负载类型名称 支持情况 协议 0x0000 DoIP首部否定响应 强制 UDP/TCP 0x0001 车辆识别请求报文 强制 UDP 0x0002 带EID的车辆识别请求报文 可选 UDP 0x0003 带VIN的车辆识别请求报文 强制 UDP 0x0004 车辆声明报文/车辆识别响应报文 强制 UDP 0x0005 路由激活请求报文 强制 TCP 0x0006 路由激活响应报文 强制 TCP 0x0007 在线检查请求报文 强制 TCP 0x0008 在线检查响应报文 强制 TCP
-
DoIP首部否定响应报文(0x0000)
block-beta columns 4 a["02 fd"] b["00 00"] c["00 00 00 01"] d["NACK code"] classDef VER fill:#A3D8FF class b VER
-
NACK Code(1字节)
数值 描述 下一步动作 强制/可选 0x00 格式错误 关闭Socket 强制 0x01 未知的负载错误 忽略报文 强制 0x02 报文过长 忽略报文 强制 0x03 超出内存 忽略报文 强制 0x04 无效的负载长度 关闭Socket 强制 -
每个DoIP实体必须支持DoIP首部否定响应
-
每个DoIP实体应该忽略收到的DoIP首部否定响应报文
-
测试仪收到不符合规范的DoIP报文不应发送首部否定应答
-
-
车辆信息请求报文
block-beta columns 4 a["02 fd"] b["payload type"] c["payload len"] d["payload"] classDef VER fill:#A3D8FF class b VER
payload名称 负载类型 数据长度 数据 车辆信息请求 0x0001 0 无 带EID的车辆识别请求报文 0x0002 6 EID:Entity identification 带VIN的车辆识别请求报文 0x0003 17 车辆VIN - 每个DoIP实体必须支持三种车辆信息请求报文
-
车辆信息响应/车辆信息声明报文
- 负载类型: 0x0004
- 负载长度: 32(+1)字节
- 负载数据:
内容 位置 长度 VIN 0 17 Logical address 17 2 EID 19 6 GID 25 6 Further action required 31 1 VIN/GID sync. Status(可选) 32 1 - Further action required
Value Description 0x00 No furyher action required 0x01-0x0F Reserved by document 0x10 Routeing activation required to initiate central security 0x11-0xFF Available for additional OEM-specific use - VIN/GID sync
Value Description 0x00 VIN and/or GID are synchronized 0x01-0x0F Reserved by document 0x10 Incomplete: VIN and GID are NOT synchronized 0x11-0xFF Reserved by docunment
-
路由激活请求报文
-
负载类型: 0x0005
-
负载长度: 7(+4)
-
负载数据:
内容 位置 长度 SA 0 2 Activation Type 2 1 Reserved for ISO 3 4 Reserved for OEM 7 4 Activation type Description Required action Support 0x00 Default none Mandatory 0x01 Diagnostic communication required by regulation none Mandatory 0x02 to 0xDF ISO/SAE reserved ISO/SAE reserved ISO/SAE reserved 0xE0 Central security OEM-specific Optional 0xE1-0xFF Availdable for additional OEM-specific use OEM-specific Optional
-
-
路由激活响应报文
-
负载类型: 0x0006
-
负载长度: 9(+4)
-
负载数据:
内容 位置 长度 TA 0 2 SA 2 2 Routing activation respond code 4 1 Reserved for ISO 5 4 Reserved for OEM 9 4 Routing Activation response code Description Required action Support 0x00 Routing activation denied due to unknown source address Do not activate routing and close this TCP_DATA socket Mandatory 0x01 Routing activation denied because all concurrently supported TCP_DATA sockets are regestered and active Do not activate routing and close this TCP_DATA socket Mandatory 0x02 Routing activation denied because the SA received is different from the table connection entry on the already activate TCP_DATA socket Do not activate routing and close this TCP_DATA socket Mandatory 0x03 Routing activation denied because the SA received is already registered and active on a different TCP_DATA socket Do not activate routing and close this TCP_DATA socket Mandatory 0x04 Routing activation denied due to missing authentication Do not activate routing and register Optional 0x05 Routing activation denied due to rejecting confirmation Do not activate routing and close this TCP_DATA socket Optional 0x06 Routing activation denied due to unsupported routing activation type Do not activate routing and close this TCP_DATA socket Mandatory 0x07 Routing activation denied because the specified activation type requires a secure TLS TCP_DATA socket Do not activate routing and close this (non-secure) TCP_DATA socket Optional 0x08 to 0x0F Reserved by this document Reserved by this document Reserved by this document 0x10 Routing successfully activated Activate routing and register SA on this TCP_DATA socket Mandatory 0x11 Routing is activated. confirmation required Only activate routing after comfirmation from whthin the vehicle Opotional 0x12 to 0xDF Reserved by this document Reserved by this document Reserved by this document 0xE0 to 0xFE Vehicle manufacturer specific Reserved by this document Reserved by this document 0xFF Reserved by this document Reserved by this document Reserved by this document
-
-
在线检测请求报文
block-beta columns 4 a["02 fd"] b["00 07"] c["00 00 00 00"] classDef VER fill:#A3D8FF class b VER
- DoIP实体主动发送
-
在线检测响应报文
block-beta columns 4 a["02 fd"] b["00 08"] c["00 00 00 02"] d["SA"] classDef VER fill:#A3D8FF class b VER
- 测试仪可以主动发起响应报文
- 测试仪在超时时间(T_TCP_Alive_Check)内未回复响应报文,DoIP实体会关闭socket,断开连接
- 诊断类报文
block-beta columns 86 a["02 fd"] b["80 01"] c["eg. 00 00 00 07"] d["eg. 0e 00"] e["eg. 0e 00"] f["eg. 22 f8 10"] classDef VER fill:#A3D8FF class b VER
负载类型值 负载类型名称 支持情况 协议 0x8001 诊断报文 强制 TCP 0x8002 诊断报文肯定应答 强制 TCP 0x8003 诊断报文否定应答 强制 TCP
- 诊断报文
- 负载类型: 0x8001
- 负载长度: 4(+N)
- 负载数据:
内容 位置 长度 SA 0 2 TA 2 2 payload 4 N
- 诊断肯定响应报文
- 负载类型: 0x8002
- 负载长度: 5(+N)
- 负载数据:
内容 位置 长度 SA 0 2 TA 2 2 ACK Code(0x00) 4 1 previous diagnostic message data 5 N
- 诊断否定响应报文
-
负载类型: 0x8003
-
负载长度: 5(+N)
-
负载数据:
内容 位置 长度 SA 0 2 TA 2 2 NACK Code 4 1 previous diagnostic message data 5 N Activation type Description Support 0x00…0x01 Reserved by document - 0x02 Invaild source address Mandatory 0x03 Unkonwn target address Mandatory 0x04 Diagnostic message too large Mandatory 0x05 Out of memory Mandatory 0x06 target unreachable Optional 0x07 Unknow network Optional 0x08 Transport protocal error Optional 0x09…0xff Reserved by document -
-
- 节点状态类报文
负载类型值 负载类型名称 支持情况 协议 0x4001 DoIP实体状态请求报文 可选 UDP 0x4002 DoIP实体状态响应报文 可选 UDP 0x4003 诊断电源模式请求报文 强制 UDP 0x4004 诊断电源模式响应报文 强制 UDP
-
DoIP实体状态请求报文
block-beta columns 4 a["02 fd"] b["40 01"] c["00 00 00 00"] classDef VER fill:#A3D8FF class b VER
- 负载类型: 0x4001
- 负载长度: 0
-
DoIP实体状态响应报文
block-beta columns 4 a["02 fd"] b["40 02"] c["00 00 00 07"] d["payload"] classDef VER fill:#A3D8FF class b VER
- 负载类型: 0x4002
- 负载长度: 3(+4)
- 负载数据:
内容 位置 长度 值 节点类型 0 1 0x00: DoIP网关,0x01: DoIP节点,0x02…0xff: 保留 最大并发TCP_DATA的连接数量 1 1 1…255 目前打开的TCP_DATA数量 2 1 1…255 最大储存空间 3 4 0…4G
-
诊断电源模式请求报文
block-beta columns 4 a["02 fd"] b["40 03"] c["00 00 00 00"] classDef VER fill:#A3D8FF class b VER
- 负载类型: 0x4003
- 负载长度: 0
-
诊断电源模式响应报文
block-beta columns 4 a["02 fd"] b["40 04"] c["00 00 00 01"] d["payload"] classDef VER fill:#A3D8FF class b VER
- 负载类型: 0x4004
- 负载长度: 1
- 负载数据:
内容 位置 长度 描述 值 support Diagnostic power mode 0 1 Identifies whether or not the vehicle is in diagnostic power mode and ready to perform reliable diagnostics 0x00: not ready, 0x01: ready, 0x02: not supported, 0x03…0xff: reserved by this document Mandatory