SOME/IP-SD -- 協議英文原文講解5

前言
SOME/IP協議越來越多的用于汽車電子行業中,關于協議詳細完全的中文資料卻沒有,所以我將結合工作經驗并對照英文原版協議做一系列的文章。基本分三大塊:

1. SOME/IP協議講解

2. SOME/IP-SD協議講解

3. python/C++舉例調試講解


5.1.2.5 Service Entries
find/offer/stop offer Entries 講解

注:find/offer/stop offer Entries 發出的報文只提供服務ID信息 說明哪個服務可以被訂閱,但不提供事件組 即顯示哪些事件組可以被訂閱 -- 隱藏起來了。所以client訂閱時要參照客戶發出的矩陣表訂閱。

5.1.2.5.1 Find Service Entry
find報文entry

[PRS_SOMEIPSD_00350]
Upstream requirements: RS_SOMEIPSD_00008, RS_SOMEIPSD_00021
The Find Service entry type shall be used for finding service instances and shall
only be sent if the current state of a service is unknown (no current Service Offer was
received and is still valid).
find報文是在沒有offer的情況下發出的,否則不能發送find報文了

[PRS_SOMEIPSD_00351]
Upstream requirements: RS_SOMEIPSD_00008, RS_SOMEIPSD_00021
Find Service entries shall set the entry fields in the following way:
? Type shall be set to 0x00 (FindService). -- 固定值
? Service ID shall be set to the Service ID of the service that shall be found.
? Instance ID shall be set to 0xFFFF, if all service instances shall be returned. It
shall be set to the Instance ID of a specific service instance, if just a single service
instance shall be returned.
0xFFFF 找所有的Instance 或是找指定的Instance 前面文章有講

? Major Version shall be set to 0xFF, that means that services with any version shall
be returned. If set to value different than 0xFF, services with this specific major
version shall be returned only.
匹配所有的主版本號,則設置為0xff,否則設置為需要的版本號

? Minor Version shall be set to 0xFFFF FFFF, that means that services with any
version shall be returned. If set to a value different to 0xFFFF FFFF, services
with this specific minor version shall be returned only.
道理同 上面主版本號,只不過是值大了些

? TTL is not used for FindService entries and can be set to an arbitrary value.The
field is only defined for backward compatibility, and the value shall be ignored by
the receiver of the message.
對于 find報文來說 TTL不用設置 ,接收端應該忽略此值。一般設置為0 就行。

Note: It is expected that the Major Version on client side is configured to a specific
value in normal operation since the client should look for an specific interface version.
Different Major Versions are not compatible to each other.
[PRS_SOMEIPSD_00528]
Upstream requirements: RS_SOMEIPSD_00008, RS_SOMEIPSD_00025
A sender shall not reference Endpoint Options nor Multicast Options in a Find Service
Entry.
find報文不用設置 單播、多播 選項,如果有 接收端應該忽略。
其它選項可以配置

[PRS_SOMEIPSD_00529]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
A receiver shall ignore Endpoint Options and Multicast Options in a Find Service
Entry.
[PRS_SOMEIPSD_00530]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
Other Options (neither Endpoint nor Multicast Options), shall still be allowed to be
used in a Find Service Entry.
[PRS_SOMEIPSD_00825]
Upstream requirements: RS_SOMEIPSD_00008, RS_SOMEIPSD_00013
When receiving a FindService Entry the Service ID, Instance ID, Major Version, and
Minor Version shall match exactly to the configured values to identify a Service Instance, except if "any values" are in the Entry (i.e. 0xFFFF for Service ID, 0xFFFF for
Instance ID, 0xFF for Major Version, and 0xFFFFFFFF for Minor Version.)
接收端接收到 find報文,對于entry中的配置項 如果是指定的值 應該精確匹配 成功后再回復offer,否則是通配值 的話就算了

[PRS_SOMEIPSD_00839]
Upstream requirements: RS_SOMEIPSD_00008, RS_SOMEIPSD_00013
If a FindService Entry is received within the Initial Wait Phase for this Server Service
Instance, it shall be ignored.
初始化階段 收到find 應該忽略 不用先解析 等到初始化完成給回復

5.1.2.5.2 Offer Service Entry

[PRS_SOMEIPSD_00355]
Upstream requirements: RS_SOMEIPSD_00013
The Offer Service entry type shall be used to offer a service to other communication
partners.
[PRS_SOMEIPSD_00356] -- 以下為格式定義 容易理解
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
Offer Service entries shall set the entry fields in the following way:
? Type shall be set to 0x01 (OfferService).
? Service ID shall be set to the Service ID of the service instance offered.
? Instance ID shall be set to the Instance ID of the service instance that is offered.
? Major Version shall be set to the Major Version of the service instance that is
offered.
? Minor Version shall be set to the Minor Version of the service instance that is
offered.
? TTL shall be set to the lifetime of the service instance. After this lifetime the
service instance shall considered not been offered.
offer的有效期 超過后 服務會失效。
? If TTL is set to 0xFFFFFF, the Offer Service entry shall be considered valid until
the next reboot. 長期有效
? If CYCLIC_OFFER_DELAY is defined, TTL shall be greater or equal to the value
for CYCLIC_OFFER_DELAY. 客戶指定這個值 則應設置 >=這個值
? TTL shall not be set to 0x000000 since this is considered to be the Stop Offer
Service Entry. 設置為0 表示stop offer 所有offer中不能設置為0.

[PRS_SOMEIPSD_00357]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
Offer Service entries shall always reference either an IPv4 or IPv6 Endpoint Option to
signal how the service is reachable.
offer應該攜帶IPv4或IPv6選項 表示服務的發出方式 和 源地址源Port
[PRS_SOMEIPSD_00358]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
For each Transport Layer Protocol needed for the service (i.e. UDP and/or TCP) an
IPv4 Endpoint option shall be added if IPv4 is supported.
[PRS_SOMEIPSD_00359]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
For each Transport Layer Protocol needed for the service (i.e. UDP and/or TCP) an
IPv6 Endpoint option shall be added if IPv6 is supported.

[PRS_SOMEIPSD_00826]
Upstream requirements: RS_SOMEIPSD_00012, RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
When receiving the initial OfferService Entry the Service ID, Instance ID, Major Version and Minor Version shall match exactly to the configured values to identify a Service Instance, except if "any values" are in the service configuration (i.e. 0xFFFF for
Instance ID and 0xFFFFFFFF for Minor Version.)
[PRS_SOMEIPSD_00827]
Upstream requirements: RS_SOMEIPSD_00012, RS_SOMEIPSD_00013, RS_SOMEIPSD_-
00025
When receiving a subsequent OfferService Entry or a StopOfferService Entry the
Service ID, Instance ID, Major Version shall match exactly to the values in the initial
OfferService entry to identify a Service Instance.
在收到offer/stopoffer時 要精確匹配Service ID, Instance ID, Major Version 檢查是否是自己需要訂閱的

注意:sub /suback/ subnack entry 在5.1.3.1章節講解

5.1.2.5.3 Stop Offer Service Entry

[PRS_SOMEIPSD_00363]
Upstream requirements: RS_SOMEIPSD_00014
The Stop Offer Service entry type shall be used to stop offering service instances.
[PRS_SOMEIPSD_00364]
Upstream requirements: RS_SOMEIPSD_00014
dStop Offer Service entries shall set the entry fields exactly like the Offer Service entry
they are stopping, except:
? TTL shall be set to 0x000000. -- 和offer報文基本一致除了要改TTL為0x000000

[PRS_SOMEIPSD_00840]
Upstream requirements: RS_SOMEIPSD_00014
A StopOfferService (type 0x01), shall carry, i.e. reference, the same options as the
entries trying to stop.


5.1.2.5.4 Usage of Options in Entries 不同類型entries?攜帶 options數量說明

5.1.2.6 Endpoint Handling for Services and Events -- 針對offer報文的講解

[PRS_SOMEIPSD_00476]
Upstream requirements: RS_SOMEIPSD_00025
The Service Discovery shall overwrite IP Addresses and Port Numbers with those
transported in Endpoint and Multicast Options if the statically configured values are
different from those in these options.
Note: In other words if a mix of a static and dynamic configuration exists (static configuration that defines the communication endpoints exists and at the same time endpoint
options are exchanged via SD messages at runtime) and the endpoint options in the
static configuration are different from the endpoint options received via SD then the
endpoints options received over SD take precedence over the preconfigured endpoint
options.
SD報文中的IP和PORT 如果和靜態配置不一致 則優先動態報文中的 ,并覆蓋靜態配置
其它 選項 也是優先 動態 覆蓋靜態

[PRS_SOMEIPSD_00360]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
The IP addresses and port numbers of the Endpoint Options shall also be used for
transporting events and notification events.
端點選項的ip /port用來 傳輸 事件、通知。

[PRS_SOMEIPSD_00361]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
In case of UDP the endpoint option shall be used for the source address and the
source port of the events and notification events, it is also the address the client can
send method requests to.
offer報文中 UDP 端點選項的ip /port用來 傳輸 事件、通知。同時client也可通過這個IP、PORT請求method
[PRS_SOMEIPSD_00362]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
In case of TCP the endpoint option shall be used for the IP address and port the client
needs to open a TCP connection in order to receive events using TCP.
接收TCP的事件時 要先 tcp握手建鏈

[PRS_SOMEIPSD_00801]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
SOME/IP shall allow services to use UDP and TCP at the same time.
同一個服務 可以同時使用TCP和UDP

[PRS_SOMEIPSD_00802]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
Which message is sent by which underlying transport protocol shall be determined by
configuration: A Service can use UDP and TCP endpoints at the same time. But per
element of the service it shall to be configured whether TCP or UDP is used.
Note: It needs to be restricted in the configuration which methods and which events
are provided over TCP/UDP. This also means that the same event can not be provided
over TCP and UDP.
雖然可以同時使用TCP和UDP,但是對于具體的event/method/field 只能用一種 不能同時支持。

5.1.2.6.1 Service Endpoints offer報文中 服務端點的講解

The referenced Endpoint Options of the Offer Service entries denotes the
? IP Address and Port Numbers the service instance is reachable at the server.
? IP Address and Port Numbers the service instance sends the events from.
offfer中的 端點選項中IP、PORT 是可以被訪問的 且是用來發送events的,
注:如果這個報文沒有events 就不用發送offer

[PRS_SOMEIPSD_00480]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
Events of this service instance shall not be sent from any other Endpoints than those
given in the Endpoint Options of the Offer Service entries.
事件不能通過除了選項中描述的IP、PORT之外的地址發送。

[PRS_SOMEIPSD_00481]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00025
If an ECU offers multiple service instances, SOME/IP messages of these service
instances shall be differentiated by the information transported in the Endpoint Options
referenced by the Offer Service entries.
就算是同一服務的不同instance 在同一個ECU中,端點的IP、PORT也必須不一樣。

5.1.2.6.2 Eventgroup Endpoints

[PRS_SOMEIPSD_00484]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
The Endpoint Options referenced in the Subscribe Eventgroup entries shall also be
used to send unicast UDP or TCP SOME/IP events for this Service Instance.
Thus the Endpoint Options referenced in the Subscribe Eventgroup entries are the IP
Address and the Port Numbers on the client side.

client發送訂閱包時,訂閱entry對應的Option中的ip/port 是client的,用以發送udp單播或TCP的events

[PRS_SOMEIPSD_00486]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
TCP events are transported using the TCP connection the client has opened to the
server before sending the Subscribe Eventgroup entry.

如果被訂閱的事件是TCP協議類型,則client在發送訂閱之前 要先完成TCP的握手建鏈過程。

[PRS_SOMEIPSD_00487]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
The initial value of field notifiers (i.e., fields and not pure events) shall be transported
using unicast from Server to Client.
field notifiers 的別訂閱后的首次通知 要通過單播、TCP形式發送(單對單)
因為有可能有多個client訂閱 如果廣播通知的話 會讓已經訂閱的client端多次收到

[PRS_SOMEIPSD_00488]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
Subscribe Eventgroup Ack entries shall reference up to 1 Multicast Option for the
Internet Protocol used (IPv4 or IPv6).
suback報文中的 最多只能包含一條 多播option(ipv4/ipv6)

[PRS_SOMEIPSD_00489]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
The Multicast Option shall be set to UDP as transport protocol.
多播用于UDP -- 前面已經講過了

[PRS_SOMEIPSD_00490]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00025
The client shall open the Endpoint specified in the Multicast Option referenced by the
Subscribe Eventgroup Ack entry as fast as possible to not miss multicast events.
Example: Figure 5.15 shows an example with the different Endpoint and a Multicast
client收到訂閱回復中有攜帶了server events的多播地址時,要盡快配置加入到這個組播中,否則有可能錯過組播的事件

Option:
? The Server offers the Service Instance on Server UDP-Endpoint SU and Server
TCP-Endpoint ST
?? ?服務端 offer 提供服務 option中有UDP 也有TCP
? The Client opens a TCP connection client 發起并完成tcp連接
? The Client sends a Subscribe Eventgroup entry with Client UDP-Endpoint CU
(unicast) and a Client TCP-Endpoint CT. client發送訂閱報文 攜帶client的UDP單播 IP+PORT 以及 TCP IP+PORT
? The Server answers with a Subscribe Eventgroup Ack entry with Multicast MU
?? ?服務端單播回復 client 訂閱ack 包 ,并攜帶一個server的組播地址(有的事件要通過組播發送)
Then the following operations happen: 可能會有下面的交互情況
? The Client calls a method on the Server?
? client向server請求method(使用UDP協議 -- 因為假設矩陣中這個Method配置UDP協議)
??
? Request is sent from CU to SU and Response from SU to CU
?? ?server用UDP單播回復
? For TCP this would be: Request dyn to ST and RESPONSE from ST to CT
?? ?也有可能client向server請求TCP協議的method, server通過TCP 回復
? The Server sends a Unicast UDP Event: SU to CU
?? ?server發送UDP單播事件
? The Server sends a Unicast TCP Event: ST to CT
? ? server發送TCP事件
? The Server sends a Multicast UDP Event: SU to MU
?? ?server發送UDP廣播事件
Keep in mind that Multicast Endpoints use a Multicast IP Address on the receiver side,
i.e. the client, and TCP cannot be used for Multicast communication.
?? ?client端配置加入組播 但不能用組播主動發送消息。

注:30490端口號 是協議建議的SOME/IP組播端口號?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/70906.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/70906.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/70906.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

APNG格式圖片文件大小優化方案 轉WEBP

文章目錄 原因過程相關下載相關文檔后記 原因 頁面上有個特效動畫,PNG文件,APNG格式,13M大小,太占用內容了,要優化一下。 過程 直接上命令吧 ffmpeg -i input.apng -vf "formatrgba" -loop 0 output.web…

個人電腦小參數GPT預訓練、SFT、RLHF、蒸餾、CoT、Lora過程實踐——MiniMind圖文版教程

最近看到Github上開源了一個小模型的repo,是真正拉低LLM的學習門檻,讓每個人都能從理解每一行代碼, 從零開始親手訓練一個極小的語言模型。開源地址: GitHub - jingyaogong/minimind: 🚀🚀 「大模型」2小時…

PHP Zip 文件處理指南

PHP Zip 文件處理指南 引言 ZIP文件是一種流行的壓縮格式,廣泛用于文件壓縮和歸檔。PHP作為一門強大的服務器端腳本語言,提供了豐富的類和方法來處理ZIP文件。本文將詳細介紹PHP中ZIP文件的處理方法,包括創建、添加文件、提取文件以及壓縮和…

Java使用ZXing庫生成帶有Logo的二維碼圖片,并去除白邊動態伸縮上傳到阿里云OSS

文章目錄 引言二維碼基本原理1、二維碼概述2、QR Code結構3、錯誤糾正級別 QR Code生成技術1、ZXing庫2、生成二維碼的步驟 圖像處理技術1、嵌入Logo2. 去除白邊 阿里云OSS基本概念1、OSS概述2. 主要功能3. 基本概念 實戰演示1、依賴庫2、類結構3、生成普通二維碼4. 去除白邊5、…

AI工具箱最新使用教程

先克隆項目 電腦需要先安裝 git ,安裝的畫看這個 Git安裝教程(超詳細)。 git鏡像 git clone https://github.com/Escaflowne1985/MyToolsWebBackendUser.gitgitee鏡像 git clone https://gitee.com/escaflowne/MyToolsWebBackendUser.git…

Android-創建mipmap-anydpi-v26的Logo

利用 Android Studio 自動創建 創建新項目:打開 Android Studio,點擊 “Start a new Android Studio project” 創建新項目。在創建項目的過程中,當設置Target SDK Version為 26 或更高版本時,Android Studio 會在項目的res目錄下…

SEO煉金術(4)| Next.js SEO 全攻略

在上一篇文章 SEO煉金術(3)| 深入解析 SEO 關鍵要素 中,我們深入解析了 SEO 關鍵要素,包括 meta 標簽、robots.txt、canonical、sitemap.xml 和 hreflang,并探討了它們在搜索引擎優化(SEO)中的作…

面試葵花寶典之React(持續更新中)

1.談談你對HOC的理解 定義: 高階組件是一個接收組件作為參數并返回新組件的函數,用于復用組件邏輯,遵循純函數特性(無副作用,輸出僅依賴輸入)。 組合性:可嵌套使用多個 HOC。 HOC(…

數據安全管理的AI工具有哪些?

數據安全管理的AI工具在不斷演進,它們憑借強大的算法和學習能力,為企業筑起了一道堅不可摧的數字防線。 在數據安全管理領域,AI工具的應用日益廣泛,以下是一些常見的工具及其功能: AI驅動的數據分類與標記 工具: Micr…

Matplotlib 繪圖標記

Matplotlib 繪圖標記 引言 Matplotlib 是一個功能強大的 Python 繪圖庫,廣泛用于數據可視化。在 Matplotlib 中,繪圖標記(markers)是數據點在圖表中顯示的方式。正確的使用繪圖標記可以增強圖表的可讀性和美觀性。本文將詳細介紹…

【DeepSeek問答】QProcess::start是異步的嗎?會使UI卡頓嗎?

好的,我現在需要回答用戶關于QProcess::start是否是異步的,以及它是否會導致UI卡頓的問題。用戶之前已經詢問過如何開發一個調用7-Zip的Qt應用,并且我給出了示例代碼。現在用戶可能在使用過程中遇到了問題,或者想更深入了解QProce…

Android 常用命令和工具解析之存儲相關

1 基本概念 2 命令解讀 2.1 adb shell df df 命令主要用于需要檢查文件系統上已使用和可用的磁盤空間的數量。如果沒有指定文件名,則顯示在當前所有掛載的文件系統上可用的空間。其原理是從proc/mounts 或 /etc/mtab 中檢索磁盤信息。 注意:df命令并…

使用ZFile打造屬于自己的私有云系統結合內網穿透實現安全遠程訪問

文章目錄 前言1.關于ZFile2.本地部署ZFile3.ZFile本地訪問測試4.ZFile的配置5.cpolar內網穿透工具安裝6.創建遠程連接公網地址7.固定ZFile公網地址 前言 在數字化的今天,我們每個人都是信息的小能手。無論是職場高手、攝影達人還是學習狂人,每天都在創造…

HarmonyOS 5.0應用開發——鴻蒙接入高德地圖實現POI搜索

【高心星出品】 文章目錄 鴻蒙接入高德地圖實現POI搜索運行結果:準備地圖編寫ArkUI布局來加載HTML地圖 鴻蒙接入高德地圖實現POI搜索 在當今數字化時代,地圖應用已成為移動設備中不可或缺的一部分。隨著鴻蒙系統的日益普及,如何在鴻蒙應用中…

idea + Docker + 阿里鏡像服務打包部署

一、下載docker desktop軟件 官網下載docker desktop,需要結合wsl使用 啟動成功的畫面(如果不是這個畫面例如一直處理start或者是stop需要重新啟動,不行就重啟電腦) 打包成功的鏡像在這里,如果頻繁打包會導致磁盤空間被占滿,需…

IP---網絡類型

這只是IP的其中一塊內容-網絡類型,IP還有更多內容可以查看IP專欄,前一章內容為訪問服務器流程,可通過以下路徑查看IP----訪問服務器流程-CSDN博客,歡迎指正 2.網絡類型 網絡類型---根據二層(數據鏈路層)所…

【監督學習】ARIMA預測模型步驟及matlab實現

ARIMA預測模型 ARIMA預測模型1.算法步驟2.參數選擇(1)拖尾截尾判斷法(2) AIC 準則(3) BIC 準則 3.MATLAB 實現參考資料 ARIMA預測模型 #mermaid-svg-mDhjwpnuA0YcEGnE {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg…

使用git管理uniapp項目

1.本地管理 1. 在項目根目錄中新建 .gitignore 忽略文件,并配置如下: # 忽略 node_modules 目錄 /node_modules /unpackage/dist 2. 打開終端,切換到項目根目錄中,運行如下的命令,初始化本地 Git 倉庫&#xff1…

Unity中動態切換光照貼圖的方法

關鍵代碼:LightmapSettings.lightmaps lightmapDatas; LightmapData中操作三張圖:lightmapColor,lightmapDir,以及一張ShadowMap 這里只操作前兩張: using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI;public cl…

C# 運算符

C# 運算符 在C#編程語言中,運算符是用于執行數學或邏輯運算的符號。它們是構建程序邏輯和表達式的基石。C#支持多種類型的運算符,包括算術運算符、關系運算符、邏輯運算符、位運算符、賦值運算符、自增自減運算符以及一些特殊運算符。 算術運算符 算術運算符用于執行基本的…