The UDP binding of SOME/IP is straight forward by transporting SOME/IP messages in UDP packets. The SOME/IP messages shall not be fragmented. Therefore care shall be taken that SOME/IP messages are not too big, i.e. up to 1400 Bytes of SOME/IP payload. Messages with bigger payload shall not be transported over UDP but with e.g. TCP. 通过在UDP数据包中传输SOME / IP消息,SOME / IP的UDP绑定是直接的。 SOME / IP消息不应该被分段。 因此,应注意SOME / IP消息不要太大,即SOME / IP payload最多1400字节。 payload较大的消息不得通过UDP传输但是可以通过TCP传输。
The header format allows transporting more than one SOME/IP message in a single UDP packet. The SOME/IP implementation shall identify the end of a SOME/IP message by means of the SOME/IP length field. Based on the UDP length field, SOME/IP shall determine if there are additional SOME/IP messages in the UDP packet. Header格式允许在单个UDP数据包中传输多个SOME / IP消息。 SOME / IP实现应通过SOME / IP length字段识别SOME / IP消息的结束。 根据UDP length字段,SOME / IP应确定是否有其他SOME / IP消息在UDP数据包中。
Each SOME/IP payload shall have its own SOME/IP header. 每个SOME / IP payload都应有自己的SOME / IP header。
In order to transport SOME/IP messages of IP different transport protocols may be used. SOME/IP currently supports UDP and TCP. Their bindings are explained in the following sections. 为了传输SOME / IP消息,可以使用不同的传输协议。 SOME / IP目前支持UDP和TCP。它们的绑定在以下部分中进行了解释。
If a server runs different instances of the same service, messages belonging to different service instances shall be mapped to the service instance by the transport protocol port on the server side. 如果服务端运行相同服务的不同实例,则属于不同服务实例的消息应通过服务端的传输协议端口映射到服务实例。
All Transport Protocol Bindings shall support transporting more than one SOME/IP message in a Transport Layer PDU (i.e. UDP packet or TCP segment). 所有传输协议绑定应支持在传输层PDU(即UDP数据包或TCP段)中传输多个SOME / IP消息。
The receiving SOME/IP implementation shall be capable of receiving unaligned SOME/IP messages transported by UDP or TCP. 接收SOME / IP的实现,应能够接收由UDP或TCP传输的未对齐SOME / IP消息。
Rationale合理性: When transporting multiple SOME/IP payloads in UDP or TCP the alignment of the payloads can be only guaranteed, if the length of every payloads is a multiple of the alignment size (e.g. 32 bits). 当以UDP或TCP传输多个SOME / IP payload时,如果每个payload的长度是对齐大小的倍数(例如: 32位),则仅可以保证有效载荷的对齐。
Basic Data types The following basic datatypes shall be supported:
Type
Description
Size [bit]
Remark
boolean
TRUE/FALSE value
8
FALSE(0),TURE(1)
uint8
unsigned Integer
8
uint16
unsigned Integer
16
uint32
unsigned Integer
32
sint8
signed Integer
8
sint16
signed Integer
16
sint32
signed Integer
32
float32
floating point number
32
IEEE 754 binary32 (Single Precision)
float64
floating point number
64
IEEE 754 binary64 (Double Precision)
The Byte Order is specified for each parameter by the interface definition. In addition, uint64 and sint64 types shall be supported at least on infotainment ECUs.
Structured Datatypes (structs)
String
Serialization of string (fixed length)
Serialization of string (dynamic length)
Arrays (fixed length)
One-dimensional array, fixed length: a[n]
Multi-dimensional array, fixed length: a[n][m]
Dynamic Length Arrays / Variable Size Arrays
One-dimensional array, dynamic length
Multi-dimensional array, dynamic length
Union
The default serialization layout of unions in SOME/IP is shown as following. SOME / IP中 union的默认序列化布局。
SOME/IP allows to add a length field of 8, 16 or 32 bit in front of unions. SOME / IP允许在union前添加8,16或32位的长度字段。
The length field of a union describes the number of bytes in the union. This allows the deserializer to quickly calculate the position where the data after the union begin in the serialized data stream. This gets necessary if the union contains data which are larger than expected, for example if a struct was extended with appended new members and only the first “old” members are deserialized by the SOME/IP transformer. union的长度字段描述联合中的字节数。 这允许deserializer快速计算串行数据流中union开始后的数据的位置。 如果联合包含比预期更大的数据,则这是必要的,例如,如果一个结构体扩展了附加的新成员,并且只有第一个“旧”成员被SOME / IP transformer反序列化。
Example: Union of uint8/uint16 both padded to 32 bit. uint8 / uint16的联合都填充为32位。 In this example a length of the length field is specified as 32 bits. The union shall support a uint8 and a uint16 as elements. Both are padded to the 32 bit boundary (length=4 Bytes). 在这个例子中,长度字段的长度被指定为32位。 union应支持uint8和uint16作为元素。 两者都填充到32位边界(长度= 4字节)。
A uint8 will be serialized like this: uint8将会像这样被序列化:
Lentgh =4 Bytes
Type =1
uint 8
Padding 0x00
Padding 0x00
Padding 0x00
A uint16 will be serialized like this: uint16将会像这样被序列化:
In the payload field the parameters are carried. Parameter被携带于Payload字段中 。
The size of the SOME/IP payload field depends on the transport protocol used. With UDP the SOME/IP payload shall be between 0 and 1400 Bytes. The limitation to 1400 Bytes is needed in order to allow for future changes to protocol stack (e.g. changing to IPv6 or adding security means). Since TCP supports segmentation of payloads, larger sizes are automatically supported. SOME / IP payload字段的大小取决于使用的传输协议。 对于UDP,SOME / IP有效载荷应该在0到1400字节之间。限制为1400字节是为了允许将来对协议栈进行更改(例如更改为IPv6或添加安全机制)。 由于TCP支持有效载荷的分段,所以自动支持更大的尺寸。
The Return Code is used to signal whether a request was successfully been processed. For simplification of the header layout, every message transports the field Return Code.
Return Code用于表示request是否已成功处理。 为了简化header布局,每条消息都传输Return代码。
Messages of Type REQUEST, REQUEST_NO_RETURN, and Notification have to set the Return Code to 0x00 (E_OK). The allowed Return Codes for specific message types are:
类型为REQUEST, REQUEST_NO_RETURN和Notification的消息必须将返回码设置为0x00(E_OK)。 允许的特定消息类型的返回码是:
Number
Value
Return code
0x00
REQUEST
0x00 (E_OK)
0x01
REQUEST_NO_RETURN
0x00 (E_OK)
0x02
NOTIFICATION
0x00 (E_OK)
0x40
REQUEST_ACK
0x41
REQUEST_NO_RETURN_ACK
0x42
NOTIFICATION_ACK
0x80
RESPONSE
0x81
ERROR
Shall not be 0x00 (E_OK).
0xC0
RESPONSE_ACK
0xC1
ERROR_ACK
ID
Name
Description
0x00
E_OK
No error occurred
0x01
E_NOT_OK
An unspecified error occurred
0x02
E_UNKNOWN_SERVICE
The requested Service ID is unknown.
0x03
E_UNKNOWN_METHOD
The requested Method ID is unknown. Service ID is known.
0x04
E_NOT_READY
Service ID and Method ID are known. Application not running.
0x05
E_NOT_REACHABLE
System running the service is not reachable (internal error code only).
0x06
E_TIMEOUT
A timeout occurred (internal error code only).
0x07
E_WRONG_PROTOCOL_ VERSION
Version of SOME/IP protocol not supported
0x08
E_WRONG_INTERFACE_ VERSION
Interface version mismatch
0x09
E_MALFORMED_MESSAGE
Deserialization error, so that payload cannot be deserialized.
0x0a
E_WRONG_MESSAGE_TYPE
An unexpected message type was received (e.g. REQUEST_NO_RETURN for a method defined as REQUEST.)
0x0b – 0x1f
RESERVED
Reserved for generic SOME/IP errors. These errors will be specified in future versions of this document.
0x20 – 0x3f
RESERVED
Reservedforspecificerrorsofservicesand methods. These errors are specified by the interface specification.
Note注意: The Return Code is is not applicable for SOME/IP-SD. Return Code不适用于SOME / IP-SD。