SOME/IP
The SOME/IP header, byte by byte
The SOME/IP header of lesson 4 is exactly 16 bytes: four rows of four. This lesson gives every header field its size, its byte position and its allowed values.
The layout
Field by field
Bytes 0–3 form the Message ID, bytes 8–11 the Request ID. The table splits them into their parts.
| Bytes | Field | Values |
|---|---|---|
| 0–1 | Service ID | 0x0000 reserved · 0xFF00–0xFF5F test and ECU-internal ranges · 0xFFFE non-SOME/IP services offered via SOME/IP-SD · 0xFFFF SOME/IP and SOME/IP-SD itself |
| 2–3 | Method ID or Event ID | Highest bit 0: Method ID, 0x0000–0x7FFF. Highest bit 1: Event ID of an event or field notifier, 0x8000–0xFFFF. 0x0000, 0x7FFF, 0x8000 and 0xFFFF are reserved. |
| 4–7 | Length | Number of bytes from byte 8 to the end of the message: 8 + payload length. So a message without payload has Length 8 and is 16 bytes long. |
| 8–9 | Client ID | Identifies the client inside its ECU; may carry a fixed prefix (for example the upper byte) to be unique in the vehicle. 0x0000 for notifications. |
| 10–11 | Session ID | 0x0000 when session handling is off; otherwise 0x0001–0xFFFF, wrapping from 0xFFFF to 0x0001. |
| 12 | Protocol Version | Always 0x01. |
| 13 | Interface Version | Major version of the service interface. |
| 14 | Message Type | See the next table. |
| 15 | Return Code | 0x00 for everything except RESPONSE and ERROR. See below. |
Big-endian (network byte order: the most significant byte goes first): Service ID 0x1234 is sent as 12 34, Length 12 as 00 00 00 0C. The header is always big-endian; the byte order of the payload is a configuration choice (lesson 29).
Message Type
| Value | Name | Meaning | Segment (TP flag set) |
|---|---|---|---|
0x00 | REQUEST | method call expecting a response (even an empty one) | 0x20 TP_REQUEST |
0x01 | REQUEST_NO_RETURN | fire&forget method call | 0x21 TP_REQUEST_NO_RETURN |
0x02 | NOTIFICATION | event or field notifier, no response | 0x22 TP_NOTIFICATION |
0x80 | RESPONSE | response to a REQUEST | 0xA0 TP_RESPONSE |
0x81 | ERROR | response carrying an error | 0xA1 TP_ERROR |
The TP flag is bit value 0x20, the third-highest bit of the byte. SOME/IP TP sets it on every segment and clears it again after reassembly (lesson 32). The top bit 0x80 marks the answers.
Return Code
| Value | Name | Value | Name |
|---|---|---|---|
0x00 | E_OK | 0x08 | E_WRONG_INTERFACE_VERSION |
0x01 | E_NOT_OK | 0x09 | E_MALFORMED_MESSAGE |
0x02 | E_UNKNOWN_SERVICE | 0x0A | E_WRONG_MESSAGE_TYPE |
0x03 | E_UNKNOWN_METHOD | 0x0B–0x0F | E2E errors (see below) |
0x04 | E_NOT_READY | 0x10–0x1F | reserved for generic SOME/IP errors |
0x05 | E_NOT_REACHABLE (internal only) | 0x20–0x5E | service- and method-specific errors |
0x06 | E_TIMEOUT (internal only) | ||
0x07 | E_WRONG_PROTOCOL_VERSION |
In the Classic Platform an ApplicationError of a client-server operation (range 0x01–0x3F) travels as its value plus 0x1F, which lands in 0x20–0x5E. On E2E: the R20-11 protocol specification lists five E2E codes, 0x0B E_E2E_REPEATED to 0x0F E_E2E_NO_NEW_DATA; the SOME/IP transformer specification of the same release lists only 0x0B E_E2E and reserves 0x0C–0x1F.
Special messages of service 0xFFFF
In service 0xFFFF, Method ID 0x0000 and Event ID 0x8000 are the Magic Cookie messages (16-byte marker messages that test tools can insert into a TCP stream so a receiver finds the message boundaries again). They have Length 8 and Request ID DE AD BE EF: 0x0000 goes from client to server as REQUEST_NO_RETURN, 0x8000 from server to client as NOTIFICATION. Event ID 0x8100 marks the SOME/IP-SD message (lesson 30).
Try it
Build a SOME/IP header, or paste bytes and decode them. Click any byte to see its header field.
Things to notice. Switching from Method ID to Event ID only changes the top bit of byte 2: 0x0001 becomes 0x8001. The Length grows by exactly one for every payload byte. Decode the Magic Cookie preset: its Length is 8, so the message ends right after byte 15. Change the Message Type to a TP value and the decoder points out the SOME/IP TP header that must follow.
Check yourself optional
New terms in this lesson
| Term | Meaning |
|---|---|
| big-endian | Network byte order: the most significant byte goes first. The SOME/IP header is always big-endian. |
| Magic Cookie | A 16-byte marker message of service 0xFFFF (Method ID 0x0000 or Event ID 0x8000) that lets a receiver find message boundaries in a TCP stream |
Source: SOME/IP Protocol Specification, R20-11, sections 4.1.2, 4.1.3, 4.2.1.2 (magic cookies) and 4.2.6.1; SOME/IP-SD Protocol Specification, R20-11, section 4.1.7 (reserved IDs); SOME/IP Transformer, R20-11, section 7.3.4.1.