SOME/IP-SD -- 协议英文原文教学5

打印 上一主题 下一主题

主题 910|帖子 910|积分 2730

媒介
SOME/IP协议越来越多的用于汽车电子行业中,关于协议具体完全的中文资料却没有,所以我将联合工作经验并对照英文原版协议做一系列的文章。根天职三大块:
1. SOME/IP协议教学
2. SOME/IP-SD协议教学
3. python/C++举例调试教学

5.1.2.5 Service Entries
Entries 教学


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也必须不一样。
 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

嚴華

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表