In short
Every SOME/IP message has a 16-byte big-endian header: service and method ID, length, client and session ID, versions, message type and return code. Service discovery is itself SOME/IP, on service 0xFFFF method 0x8100, usually UDP port 30490, and its OfferService entries tell you which ECU provides which service at which IP and port.
Best for: CAN engineers moving to automotive Ethernet, and anyone decoding SOME/IP traffic in Wireshark
On CAN, a message is a CAN ID and some bytes, and a DBC says what they mean. On automotive Ethernet, much of the application data travels as SOME/IP: Scalable service-Oriented MiddlewarE over IP, specified by AUTOSAR. Instead of broadcasting signals, ECUs offer services with methods (request and response) and events (notifications), and other ECUs find them at runtime through SOME/IP-SD, the service discovery protocol. This guide goes through both, byte by byte, using the AUTOSAR R22-11 specifications.
The header
Every SOME/IP message, over UDP or TCP, starts with the same 16 bytes. All header fields are big endian.
| Bytes | Field | Meaning |
|---|---|---|
| 2 | Service ID | Which service |
| 2 | Method ID | Which method or event of that service |
| 4 | Length | Bytes from the Request ID to the end of the message, so payload + 8 |
| 2 | Client ID | Which client sent a request |
| 2 | Session ID | Counter that pairs a response with its request |
| 1 | Protocol version | Always 0x01 |
| 1 | Interface version | Major version of the service interface |
| 1 | Message type | Request, response, notification... |
| 1 | Return code | 0x00 E_OK, or an error |
| n | Payload | The serialised parameters |
Service ID and Method ID together form the 32-bit Message ID. AUTOSAR recommends method IDs 0x0000–0x7FFF for methods and IDs with the top bit set, from 0x8000, for events, which makes events easy to spot in a capture.
Message types and return codes
| Message type | Name | Use |
|---|---|---|
0x00 | REQUEST | Method call that expects a response |
0x01 | REQUEST_NO_RETURN | Fire-and-forget call |
0x02 | NOTIFICATION | Event or field notification |
0x80 | RESPONSE | Answer to a request |
0x81 | ERROR | Answer that carries an error |
Bit 0x20 is the TP flag: a set flag means the message is one segment of a larger message split by SOME/IP-TP, so 0x20 is a segmented request and 0xA0 a segmented response. Over UDP, a SOME/IP payload is limited to 1400 bytes, and larger data needs SOME/IP-TP or TCP.
| Return code | Name |
|---|---|
0x00 | E_OK |
0x01 | E_NOT_OK |
0x02 | E_UNKNOWN_SERVICE |
0x03 | E_UNKNOWN_METHOD |
0x04 | E_NOT_READY |
0x07 | E_WRONG_PROTOCOL_VERSION |
0x08 | E_WRONG_INTERFACE_VERSION |
0x09 | E_MALFORMED_MESSAGE |
Requests and notifications always carry 0x00. Errors only appear in RESPONSE and ERROR messages.
Three messages, byte by byte
A request to method 0x0001 of service 0x1234, its response, and an event:
import struct
HEADER = struct.Struct(">HHIHHBBBB") # 16 bytes, big endian
MESSAGE_TYPES = {0x00: "REQUEST", 0x01: "REQUEST_NO_RETURN", 0x02: "NOTIFICATION", 0x80: "RESPONSE", 0x81: "ERROR"}
RETURN_CODES = {0x00: "E_OK", 0x01: "E_NOT_OK", 0x02: "E_UNKNOWN_SERVICE", 0x03: "E_UNKNOWN_METHOD",
0x04: "E_NOT_READY", 0x07: "E_WRONG_PROTOCOL_VERSION", 0x08: "E_WRONG_INTERFACE_VERSION",
0x09: "E_MALFORMED_MESSAGE"}
def someip(service, method, payload=b"", client=0x0000, session=0x0001,
interface_version=1, message_type=0x00, return_code=0x00):
length = 8 + len(payload) # from the Request ID to the end of the message
return HEADER.pack(service, method, length, client, session, 0x01,
interface_version, message_type, return_code) + payload
def parse_someip(data):
service, method, length, client, session, protocol, interface, mtype, rcode = HEADER.unpack(data[:16])
tp = " (TP segment)" if mtype & 0x20 else ""
return {
"message": f"0x{service:04X}.0x{method:04X}" + (" event" if method & 0x8000 else ""),
"type": MESSAGE_TYPES.get(mtype & ~0x20, hex(mtype)) + tp,
"session": f"0x{client:04X}/0x{session:04X}",
"return": RETURN_CODES.get(rcode, hex(rcode)),
"payload": data[16:8 + length].hex(" "),
}
request = someip(0x1234, 0x0001, b"\x0a", client=0x0010, session=0x0005)
response = someip(0x1234, 0x0001, b"\x01", client=0x0010, session=0x0005, message_type=0x80)
event = someip(0x1234, 0x8001, struct.pack(">h", -125), message_type=0x02)
for packet in (request, response, event):
print(packet.hex(" "))
print(" ", parse_someip(packet))
Output:
12 34 00 01 00 00 00 09 00 10 00 05 01 01 00 00 0a
{'message': '0x1234.0x0001', 'type': 'REQUEST', 'session': '0x0010/0x0005', 'return': 'E_OK', 'payload': '0a'}
12 34 00 01 00 00 00 09 00 10 00 05 01 01 80 00 01
{'message': '0x1234.0x0001', 'type': 'RESPONSE', 'session': '0x0010/0x0005', 'return': 'E_OK', 'payload': '01'}
12 34 80 01 00 00 00 0a 00 00 00 01 01 01 02 00 ff 83
{'message': '0x1234.0x8001 event', 'type': 'NOTIFICATION', 'session': '0x0000/0x0001', 'return': 'E_OK', 'payload': 'ff 83'}
Read the first line left to right: service 12 34, method 00 01, length 00 00 00 09 (8 header bytes + 1 payload byte), client 00 10, session 00 05, protocol 01, interface 01, type 00 (request), return code 00, payload 0a. The response copies the client and session IDs, which is how the client matches it to its request. When session handling is active, the session ID counts up per call and wraps from 0xFFFF to 0x0001.
The payload has no labels
The header tells you which method or event a message belongs to, but the payload is just serialised parameters in the order the interface defines, with no names or types inside. ff 83 above is a signed 16-bit value of −125 only because the interface says so. The byte order of the payload is set by configuration, unlike the header. The interface definition lives in ARXML or FIBEX files, the Ethernet equivalent of a DBC. Without them, you work out payloads the same way you work out CAN signals.
Service discovery: SOME/IP-SD
ECUs do not have fixed addresses for services. They announce them with SOME/IP-SD, which is a SOME/IP message with fixed header values:
| Field | Value |
|---|---|
| Service ID / Method ID | 0xFFFF / 0x8100 |
| Client ID | 0x0000 |
| Protocol / interface version | 0x01 / 0x01 |
| Message type | 0x02 (NOTIFICATION) |
| Return code | 0x00 |
| Transport | UDP, typically port 30490, unicast and multicast |
After the header come a flags byte (bit 7 reboot, bit 6 unicast), 3 reserved bytes, the entries array and the options array, each with a 4-byte length in front.
Entries
Each entry is 16 bytes. The type byte says what it is:
| Type | Entry | With TTL = 0 |
|---|---|---|
0x00 | FindService: a client looks for a service | |
0x01 | OfferService: a server provides a service | StopOfferService |
0x06 | SubscribeEventgroup: a client wants events | StopSubscribeEventgroup |
0x07 | SubscribeEventgroupAck | SubscribeEventgroupNack |
A service entry contains the service ID, instance ID (0xFFFF in a FindService means any instance), major version, a 24-bit TTL in seconds and a 32-bit minor version. Eventgroup entries carry an eventgroup ID instead of the minor version. Each entry references up to two runs of options by index.
Options
Options carry the details. The most important is the IPv4 endpoint option (type 0x04, length 0x0009): an IPv4 address, the transport protocol (0x11 UDP or 0x06 TCP) and a port. In an OfferService it says where to reach the service; in a SubscribeEventgroup it says where the client wants its events. Other options include configuration strings (0x01), load balancing (0x02) and IPv6 endpoints (0x06).
An OfferService, built and parsed
import ipaddress
ENTRY_TYPES = {0x00: "FindService", 0x01: "OfferService", 0x06: "SubscribeEventgroup", 0x07: "SubscribeEventgroupAck"}
def sd_offer(service, instance, major, minor, ttl, ip, port, udp=True, session=1):
"""SOME/IP-SD message with one OfferService entry and one IPv4 endpoint option."""
entry = struct.pack(">BBBBHHB", 0x01, 0, 0, 0x10, service, instance, major) # 1 option in run 1
entry += ttl.to_bytes(3, "big") + struct.pack(">I", minor)
option = struct.pack(">HBB4sBBH", 0x0009, 0x04, 0x00, ipaddress.IPv4Address(ip).packed,
0x00, 0x11 if udp else 0x06, port)
payload = (bytes([0xC0, 0, 0, 0]) # flags: reboot and unicast; 24 reserved bits
+ struct.pack(">I", len(entry)) + entry + struct.pack(">I", len(option)) + option)
return someip(0xFFFF, 0x8100, payload, session=session, message_type=0x02)
def parse_sd(data):
"""Entries of a SOME/IP-SD message, with the IPv4 endpoints they reference."""
payload = data[16:]
entries_length = struct.unpack(">I", payload[4:8])[0]
entries = payload[8:8 + entries_length]
options_raw = payload[12 + entries_length:]
options = []
while options_raw:
length, kind = struct.unpack(">HB", options_raw[:3])
body = options_raw[4:3 + length]
if kind == 0x04:
ip = ipaddress.IPv4Address(body[:4])
proto = {0x11: "UDP", 0x06: "TCP"}.get(body[5], hex(body[5]))
options.append(f"{ip}:{struct.unpack('>H', body[6:8])[0]}/{proto}")
else:
options.append(f"option type 0x{kind:02X}")
options_raw = options_raw[3 + length:]
result = []
for i in range(0, len(entries), 16):
kind, first, _, counts, service, instance, major = struct.unpack(">BBBBHHB", entries[i:i + 9])
ttl = int.from_bytes(entries[i + 9:i + 12], "big")
name = ENTRY_TYPES.get(kind, hex(kind))
if ttl == 0 and kind in (0x01, 0x06, 0x07):
name = {0x01: "StopOfferService", 0x06: "StopSubscribeEventgroup", 0x07: "SubscribeEventgroupNack"}[kind]
used = options[first:first + (counts >> 4)]
result.append(f"{name} service 0x{service:04X} instance 0x{instance:04X} v{major} ttl {ttl}s {used}")
return result
offer = sd_offer(0x1234, 0x0001, major=1, minor=0, ttl=3, ip="192.168.10.20", port=30509)
print(offer.hex(" "))
print(parse_sd(offer))
Output:
ff ff 81 00 00 00 00 30 00 00 00 01 01 01 02 00 c0 00 00 00 00 00 00 10 01 00 00 10 12 34 00 01 01 00 00 03 00 00 00 00 00 00 00 0c 00 09 04 00 c0 a8 0a 14 00 11 77 2d
["OfferService service 0x1234 instance 0x0001 v1 ttl 3s ['192.168.10.20:30509/UDP']"]
After the 16-byte SOME/IP header: flags c0, reserved 00 00 00, entries length 00 00 00 10 (one entry), the entry 01 00 00 10 12 34 00 01 01 00 00 03 00 00 00 00, options length 00 00 00 0c, then the endpoint option 00 09 04 00 c0 a8 0a 14 00 11 77 2d: 192.168.10.20, UDP, port 30509.
How a client gets its events
- The server repeats OfferService for service
0x1234, instance0x0001, with its IP and port. - The client sends SubscribeEventgroup for an eventgroup of that service, with its own IP endpoint.
- The server answers SubscribeEventgroupAck.
- The server sends NOTIFICATION messages for the events in that group to the client's endpoint, until the TTL expires or the client stops the subscription.
If the client never sees a subscribe acknowledgement, no events arrive, even though the server is running. That is the first thing to check when a SOME/IP consumer gets no data.
Reading SOME/IP in Wireshark
Wireshark has dissectors for the SOME/IP header and SOME/IP-SD. If a service runs on a port Wireshark does not associate with SOME/IP, use Decode As to mark it. Payloads stay raw bytes unless you enter the parameter definitions in Wireshark's SOME/IP settings, usually taken from the ARXML or FIBEX files. Useful display filters are someip for all messages and someipsd for service discovery. Capturing the traffic in the first place needs the right hardware, which the Automotive Ethernet guide for CAN engineers covers.
Frequently asked questions
What is SOME/IP?
An AUTOSAR protocol for service-oriented communication over automotive Ethernet. ECUs offer services with methods and events, identified by 16-bit service and method IDs, and exchange messages with a 16-byte header over UDP or TCP.
What is the SOME/IP header format?
16 bytes, big endian: Service ID (2), Method ID (2), Length (4), Client ID (2), Session ID (2), Protocol Version (1, always 0x01), Interface Version (1), Message Type (1) and Return Code (1). The length counts from the Client ID to the end of the payload.
What port does SOME/IP-SD use?
Service discovery is typically configured on UDP port 30490, which the AUTOSAR specification uses in its examples. The ports of the services themselves are announced in the IPv4 endpoint options of OfferService entries.
What is the difference between SOME/IP methods and events?
A method is a call: a REQUEST, usually answered by a RESPONSE. An event is a NOTIFICATION the server sends to subscribed clients, without a request. AUTOSAR recommends method IDs with the top bit set (0x8000 and above) for events.
References
DBC Utility
One desktop app for DBC files and CAN recordings.
One-time $34 · Windows & Linux · Files stay on your computer