# someip — Port 30490 AUTOSAR Zonal RPC & Service Discovery (`someip`)

> **FrameAssembly v3.3.0** · Protocol 118 of 81 · Canonical URL: https://frameassembly-lang.dev/docs/protocols/someip

- **Full Protocol Name:** Scalable service-Oriented MiddlewarE over IP & Service Discovery
- **Keyword:** `someip`
- **OSI Layer & Transport:** Layer 7 · UDP 30490 (or TCP 30490 via transport tcp)
- **Host Endpoint Rule:** Dual-Stack IPv4/IPv6
- **Standards:** AUTOSAR FO R22-11 SOME/IP Protocol, AUTOSAR SOME/IP-SD
- **Wireshark Display Filter:** `someip`
- **Wire Encapsulation:** `Ethernet II -> [802.1Q / QinQ / MPLS] -> IPv4 / IPv6 -> UDP 30490 (or TCP 30490 via transport tcp) (transport tcp|udp) -> SOME/IP & SD (AUTOSAR)`

## Overview

Modern zonal vehicle Ethernet backbones run AUTOSAR SOME/IP on port `30490` — `someip` encodes both 16-byte RPC headers (`serviceid`, `methodid`, `clientid`, `sessionid`) and `0xffff8100` Service Discovery IPv4/IPv6 Endpoint Options.

Scalable service-Oriented MiddlewarE over IP (`someip`, AUTOSAR) is the foundational in-vehicle Ethernet RPC and pub/sub middleware connecting **ADAS radar/camera sensors, zonal gateways, cockpit HPCs, and body ECUs** on **UDP or TCP port `30490`**. Standard RPC/event frames carry a 16-byte SOME/IP header (`16-bit Service ID`, `16-bit Method/Event ID`, `32-bit Length`, `16-bit Client ID`, `16-bit Session ID`, `Protocol Version = 1`, `Interface Version`, `Message Type`, and `Return Code`), while **SOME/IP Service Discovery (`Service ID 0xffff`, `Method ID 0x8100`)** dynamically advertises and subscribes to ECU endpoints using 16-byte Service/Eventgroup Entries and IPv4/IPv6 Endpoint Options.

FrameAssembly encodes both RPC/Event frames and complete **SOME/IP-SD (`findservice`, `offerservice`, `subscribe`, `subscribeack`)** structures—computing Entry Array lengths, Option Array lengths, 24-bit SD `TTL`, and IPv4/IPv6 Endpoint Options automatically.

## Minimal Quickstart (`someip_quickstart.frasm`)

```frameassembly
host adas_ecu  { ip 192.168.10.20 }
host zonal_gw  { ip 192.168.10.1 }

compile {
    adas_ecu -> zonal_gw someip offerservice sessionid 1 sdservice 0x1234 instanceid 1 majorver 1 sdttl 3 endpointip 192.168.10.20 endpointport 30509 wait 5ms
    zonal_gw -> adas_ecu someip request dstport 30509 serviceid 0x1234 methodid 0x0001 clientid 0x0010 sessionid 1 payload "GET-RADAR-TRACKS" wait 2ms
    zonal_gw <- adas_ecu someip response serviceid 0x1234 methodid 0x0001 clientid 0x0010 sessionid 1 returncode 0 payload "TRACKS-OK"
}
```

### Automatic Wire Calculations

- Defaults to UDP destination port `30490` (`transport tcp` switches to stateful TCP) and calculates the 32-bit SOME/IP `Length` field (`8 + payload_len`) automatically.
- On `findservice`, `offerservice`, `subscribe`, and `subscribeack`, automatically sets outer `Service ID = 0xffff`, `Method ID = 0x8100`, `Message Type = 0x02` (`NOTIFICATION`), SD Flags (`0x80` Reboot bit), 16-byte SD Entry, and IPv4 (`0x04`) or IPv6 (`0x06`) Endpoint Option.
- Encodes `Message Type` (`0x00` REQUEST, `0x01` REQUEST_NO_RETURN, `0x02` NOTIFICATION, `0x80` RESPONSE, `0x81` ERROR) and `Return Code` (`0x00` `E_OK`).

## Practical Lab Example: In-Vehicle 1000BASE-T1 VLAN 10 Flow: SOME/IP-SD Offer, SubscribeAck & Cyclic Radar Event (`someip_adas_sd_and_events.frasm`)

Traces a front radar ECU offering Service `0x2100` over VLAN `10` (`pcp 5`), the ADAS domain controller subscribing to Eventgroup `1`, receiving `SubscribeEventgroupAck`, and consuming a cyclic `0x8001` radar object notification.

```frameassembly
host radar_front { ip 10.10.10.41 mac 02:00:5e:10:00:41 }
host adas_hpc    { ip 10.10.10.10 mac 02:00:5e:10:00:10 }

compile {
    // 1. SOME/IP-SD FindService (0x00) from ADAS HPC -> OfferService (0x01) from Front Radar
    adas_hpc -> radar_front someip findservice sessionid 1 sdservice 0x2100 instanceid 1 majorver 1 sdttl 3 vlan 10 pcp 5 wait 2ms
    radar_front -> adas_hpc someip offerservice sessionid 1 sdservice 0x2100 instanceid 1 majorver 1 minorver 2 sdttl 3 endpointip 10.10.10.41 endpointport 30509 vlan 10 pcp 5 wait 3ms
    // 2. Eventgroup Subscribe (0x06) & SubscribeEventgroupAck (0x07)
    adas_hpc -> radar_front someip subscribe sessionid 2 sdservice 0x2100 instanceid 1 majorver 1 sdttl 3 endpointip 10.10.10.10 endpointport 30510 vlan 10 pcp 5 wait 2ms
    radar_front -> adas_hpc someip subscribeack sessionid 2 sdservice 0x2100 instanceid 1 majorver 1 sdttl 3 vlan 10 pcp 5 wait 10ms
    // 3. Unicast Radar Object Event Notification (Event ID 0x8001 has bit 15 set per AUTOSAR)
    radar_front -> adas_hpc someip notification srcport 30509 dstport 30510 serviceid 0x2100 methodid 0x8001 clientid 0x0000 sessionid 101 ifacever 1 hexpayload "000201f4003c" vlan 10 pcp 6
}
```

```bash
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show someip_adas_sd_and_events.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly someip_adas_sd_and_events.frasm someip_adas_sd_and_events.pcap
frameassembly someip_adas_sd_and_events.frasm someip_adas_sd_and_events.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse someip_adas_sd_and_events.pcap someip_adas_sd_and_events_edited.frasm

# 4. Verify dissected protocol fields in tshark
tshark -r someip_adas_sd_and_events.pcap
```

## All `someip` Keywords & Header Options

Packet line pattern: `src_host -> dst_host someip [findservice | offerservice | subscribe | subscribeack | request | requestnoreply | notification | response | error | msgtype "<text_or_num>"] [serviceid <0..65535>] [methodid <0..65535>] [clientid <0..65535>] [sessionid <0..65535>] [protover <0..255>] [ifacever <0..255>] [returncode <0..255>] [flags <0..255>] [sdservice <0..65535>] [instanceid <0..65535>] [majorver <0..255>] [sdttl <0..16777215>] [minorver <number>] [endpointip <ip>] [endpointport <0..65535>] [transport <udp|tcp>]`

| Keyword / Option | Accepted Value | Default | Effect on Packet |
| --- | --- | --- | --- |
| `findservice \| offerservice \| subscribe \| subscribeack \| request \| requestnoreply \| notification \| response \| error \| msgtype "<text_or_num>"` | SOME/IP-SD Entry selector or SOME/IP Message Type (`0x00`..`0x81`) | `request (0x00)` | Selects either a full `0xffff:0x8100` SOME/IP-SD frame (`findservice`/`offerservice`/`subscribe`/`subscribeack`) or standard SOME/IP `Message Type`. |
| `serviceid <0..65535> \| methodid <0..65535>` | 16-bit Service ID & Method/Event ID (`0x8000+` for Events) | `serviceid 0x1234, methodid 0x0001 (or 0xffff/0x8100 on SD)` | Writes the 32-bit SOME/IP `Message ID` (`Service ID << 16 \| Method ID`) in bytes 0..3. |
| `clientid <0..65535> \| sessionid <0..65535>` | 16-bit Client ID & 16-bit Session ID (`1..65535`) | `clientid 1, sessionid 1` | Writes the 32-bit `Request ID` in bytes 8..11. |
| `protover <0..255> \| ifacever <0..255> \| returncode <0..255>` | 8-bit Protocol Version (`1`), Interface Major Version, and Return Code (`0x00` E_OK) | `protover 1, ifacever 1, returncode 0` | Writes bytes 12, 13, and 15 of the 16-byte SOME/IP header. |
| `sdservice <0..65535> \| instanceid <0..65535> \| majorver <0..255> \| minorver <number> \| sdttl <0..16777215>` | SOME/IP-SD 16-byte Service/Eventgroup Entry fields | `sdservice 0x1234, instanceid 1, majorver 1, minorver 0, sdttl 3` | Populates the SOME/IP-SD Entry (`sdttl 0` signifies `StopOfferService` / `StopSubscribeEventgroup`). |
| `endpointip <ip> \| endpointport <0..65535> \| flags <0..255>` | IPv4/IPv6 SD Endpoint Option address + L4 port + 8-bit SD Flags | `Host IP / port 30509 / flags 0x80` | Appends an IPv4 (`12-byte`) or IPv6 (`24-byte`) Endpoint Option to `offerservice` / `subscribe` SD messages. |
| `transport <udp\|tcp>` | `udp` or `tcp` | `udp` | Switches Layer 4 transport (and SD Endpoint Option L4-Proto byte `0x11` UDP vs `0x06` TCP). |

## Cross-Layer Options Valid with `someip`

| Option | Range / Format | Default | Effect |
| --- | --- | --- | --- |
| `wait <number><ns\|us\|ms\|s\|m>` | Time gap (ns, us, ms, s, m) | `10ms` | Advances the packet timestamp clock after sending this packet and before the next packet (`wait 0ns` sends back-to-back). |
| `comment "<text>"` | Quoted UTF-8 annotation | `Omitted` | Attaches an Enhanced Packet Block `opt_comment` annotation when compiling to `.pcapng` (Wireshark `pkt_comment` filter). |
| `payload "<text>" \| hexpayload "<hex>"` | Quoted text or hex bytes (choose one) | `Omitted` | Appends or overrides raw payload bytes (`"deadbeef"`, `"de:ad:be:ef"`, or `"\x01\x02"`) and updates packet lengths and checksums. |
| `srcmac <mac> \| dstmac <mac> \| ethertype <0..65535>` | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | `Host MAC / RFC multicast MAC / auto EtherType` | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| `fcs \| badfcs` | Ethernet CRC-32 trailer flags (choose one) | `Omitted` | `fcs` appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; `badfcs` XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| `vlan <0..4095> [pcp <0..7>] [dei <0\|1>]` | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | `Untagged` | Wraps the packet in an IEEE 802.1Q VLAN tag (`0x8100`) with optional 802.1p QoS priority. |
| `qinq <0..4095> [innervlan <0..4095>]` | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | `Untagged (innervlan 1 when qinq is set)` | Double-tags the packet with outer IEEE 802.1ad S-Tag (`0x88a8`) plus inner IEEE 802.1Q C-Tag (`0x8100`). |
| `mpls <0..1048575> [label <0..1048575>] [exp\|tc <0..7>] [bos <0\|1>] [mplsttl <0..255>]` | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | `Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)` | Prepends one or more 32-bit MPLS label shims (`0x8847`, e.g. `mpls 16000 mpls 24010`) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
| `ttl <0..255> [dscp <0..63>] [ecn <0..3>]` | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | `ttl 64, dscp 0, ecn 0` | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| `ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum]` | IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum fault | `ipid 1, flags 0, fragoffset 0, valid RFC 1071 checksum` | Sets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (`20 04 00 00`), or corrupts the 16-bit IPv4 header checksum (`badipchecksum`). |
| `flowlabel <0..1048575>` | 20-bit IPv6 Flow Label (0..1048575) | `0` | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only). |
| `srcport <0..65535> \| dstport <0..65535>` | Port number 0..65535 | `srcport 49152 (remembered), UDP 30490 (or TCP 30490 via transport tcp)` | Overrides source or destination port and remembers the port pair automatically on `<-` replies. |
| `transport <tcp\|udp\|sctp>` | `tcp`, `udp`, or `sctp` (dual TCP/UDP + universal L7 SCTP) | `transport udp` | Switches Layer 4 transport between stateful TCP, connectionless UDP, or Castagnoli CRC-32c SCTP association. |
| `badchecksum \| nochecksum` | L4 checksum fault or UDP zero-checksum flag | `Valid RFC checksum / CRC-32c` | `badchecksum` corrupts the L4 checksum for negative firewall/NIC offload tests; `nochecksum` writes `0x0000` in UDP headers. |
| `seq <number> \| acknum <number> \| win\|window <0..65535> \| urgent <0..65535> \| syn \| ack \| psh \| fin \| rst \| urg \| ece \| cwr` | TCP sequence/ack numbers, window, flags, SACK, TCP-MD5 & TFO options | `psh ack, win 65535, automatic TCP seq/acknum` | When using TCP (`transport tcp` or default TCP): overrides automatic TCP sequence tracking, flags, or `mss`/`wscale`/`sackperm`/`sackblock`/`tsval`/`tsecr`/`tcpmd5`/`tfo`. |

## Common Mistakes & Quick Fixes

### Use sdservice (Not serviceid) for the Offered Service Inside SOME/IP-SD

- **Avoid:** `ecu -> gw someip offerservice serviceid 0x2100`
- **Valid v3.3.0 Syntax:** `ecu -> gw someip offerservice sdservice 0x2100 instanceid 1`

SOME/IP-SD frames must keep outer `serviceid = 0xffff` and `methodid = 0x8100` so Wireshark dissects them as `SOME/IP-SD`; `sdservice` sets the offered Service ID *inside* the SD Entry.

### AUTOSAR Event Notifications Set Bit 15 on methodid (0x8001..0xfffe)

- **Valid v3.3.0 Syntax:** `ecu -> gw someip notification serviceid 0x2100 methodid 0x8001 payload "ev"`

Per AUTOSAR SOME/IP, `0x0000..0x7fff` denote RPC Methods while `0x8000..0xfffe` denote subscribed Events / Field Notifiers.
