SoAd¶
文档信息 Document Information¶
版本历史 Version History¶
日期(Date) |
作者(Author) |
版本(Version) |
状态(Status) |
说明(Description) |
|---|---|---|---|---|
2025/3/5 |
fupeng.yu |
V0.1 |
发布(Release) |
首次发布(First release) |
2025/04/04 |
fupeng.yu |
V1.0 |
发布(Release) |
正式发布(Official release) |
参考文档 References¶
编号(Number) |
分类(Classification) |
标题(Title) |
版本(Version) |
|---|---|---|---|
1 |
Autosar |
AUTOSAR_CP_SRS_Ethernet.pdf |
R23-11 |
2 |
Autosar |
AUTOSAR_CP_SWS_SocketAdaptor.pdf |
R23-11 |
术语与简写 Terms and Abbreviations¶
术语 Terms¶
术语(Terms) |
解释(Explanation) |
|---|---|
AUTOSAR Connetor |
SoAd(Socket Adaptor)充当不同PDU(协议数据单元)源/供应者与TCP/IP协议栈之间以及TCP/IP协议栈与不同PDU接收者/消费者之间的(解)复用器。术语AUTOSAR连接器指的是PDU的源/供应者或接收者/消费者。(SoAd (Socket Adaptor) serves as a (solution) multiplexer between different PDU (Protocol Data Unit) sources/providers and the TCP/IP protocol stack, as well as between the TCP/IP protocol stack and different PDU receivers/consumers.) The term AUTOSAR connector refers to the source/supplier or receiver/consumer of PDU.) |
TCP socket connection |
TCP传输协议的套接字连接 |
UDP socket connection(UDP socket connection) |
UDP传输协议的套接字连接 |
IF-PDU(IF-PDU is the PDU sent/received via SoAd’s IF-API) |
IF-PDU是通过SoAd的IF-API发送/接收的PDU |
TP-PDU(TP-PDU is the PDU sent/received via SoAd’s TP-API) |
TP-PDU是通过SoAd的TP-API发送/接收的PDU |
简写 Abbreviations¶
简写(Abbreviation) |
全称(Full name) |
解释(Explanation) |
|---|---|---|
ARP |
Address Resolution Protocol |
地址解析协议 |
DEM |
Diagnostic Event Manager |
诊断事件管理器 |
DET |
Default Error Tracer |
默认错误跟踪 |
DHCPv4 |
Dynamic Host Configuration Protocol |
动态主机配置协议 |
DHCPv6 |
Dynamic Host Configuration Protocol for Internet Protocol Version 6 |
IPv6版的动态主机配置协议 |
DoIP |
Diagnostics over IP |
IP的诊断 |
HTTP |
HyperText Transfer Protocol |
超文本传输协议 |
IANA |
Internet Assigned Numbers Authority |
互联网分配号码机构 |
ICMPv4 |
Internet Control Message Protocol |
Internet v4控制消息协议 |
ICMPv6 |
Internet Control Message Protocol for Internet Protocol Version 6 |
Internet v6控制消息协议 |
IETF |
Internet Engineering Task Force |
互联网工程任务组 |
IP |
Internet Protocol |
互联网协议 |
IPv4 |
Internet Protocol version 4 |
互联网协议版本4 |
IPv6 |
Internet Protocol version 6 |
互联网协议版本6 |
NDP |
Neighbor Discovery Protocol |
IPv6邻居发现协议 |
Sd |
Service Discovery |
服务发现 |
TCP |
Transmission Control Protocol |
传输控制协议 |
TCP/IP |
A family of communication protocols used in computer networks |
计算机网络中使用的通信协议家族 |
TLS |
Transport Layer Security |
安全传输层协议 |
TP |
Transport Protocol |
传输协议 |
UDP |
User Datagram Protocol |
用户数据报协议 |
UdpNm |
AUTOSAR UDP Network Management |
AUTOSAR UDP网络管理 |
简介 Introduction¶
SoAd 作为“通信桥梁”将上层基于 I-PDU 的通信,与下层基于 Socket 的TCP/UDP 通信连接起来。同时实现基于 Socket Connection 的连接控制,以及I-PDU 与 Socket Connection 的路由控制,并为上层提供相应接口。
SoAd, as the “communication bridge”, connects the I-PDU-based upper layer communication and Socket-based lower layer TCP/UDP communication. It can also realize the connection control based on Socket Connection, as well as routing control between I-PDU and Socket Connection, and provide corresponding interfaces for the upper layer.
SoAd Architecture in AUTOSAR¶
如图 SoAd Architecture in AUTOSAR 所示,SoAd模块处于AUTOSAR架构中的通信服务层,其下层模块为TcpIp模块,上层模块为PduR,Sd,DoIP,UDPNm。
As shown in the figure SoAd Architecture in AUTOSAR , the SoAd module is in the communication service layer of the AUTOSAR architecture. Its lower and upper layer modules are the TcpIp module, and the PduR, Sd, DoIP, UDPNm.
功能描述 Functional Description¶
特性 Features¶
Socket Connections 功能 Function of Socket Connections¶
为了实现上层 PDUs 与下层 Sockets 之前的通信映射, SoAd 模块定义了 Socket Connection 的概念。一个 Socket Connection 表示一个本端 socket(本端 IP 和本端 Port)与远端 socket(远端 IP 和远端 Port)的链接,以及该链接基于的传 输协议(UDP/TCP),是否使用 PDU Header,是否需求 buffer,传输协议相关参数等。
The SoAd module defines the concept of Socket Connection to realize the communication mapping between upper level PDUs and lower level Sockets. A Socket Connection indicates the linkage between a local socket (local IP and local Port) and a remote socket (remote IP and remote Port), the transmission protocol (UDP/TCP) on which the linkage is based, and that whether PDU headers are used, and whether buffers and transmission protocol-related parameters are required.
每个 Socket Connection 的模式根据 SoAd_SoConModeType 定义分为三种:SOAD_SOCON_ONLINE、 SOAD_SOCON_RECONNECT、SOAD_SOCON_OFFLINE。
By the definition of SoAd_SoConModeType, each Socket Connection can be divided into: SOAD_SOCON_ONLINE, SOAD_SOCON_RECONNECT and SOAD_SOCON_OFFLINE.
1.Socket Connection Open:
当我们需要使能通信时,首先需要开启相应的 Socket Connections。开启的方式分为两种:手动方式(需上层模块调用 SoAd_OpenSoCon)、自动方式。初始化之后,每个 Socket Connection 都处于 SOAD_SOCON_OFFLINE 模式,执行Open 操作时根据每个 Socket Connection 的配置属性,其模式切换路线分两种:
To enable communication, open the corresponding Socket Connections first. There are two ways to enable it: Manual mode (calling SoAd_openSoCon by the upper layer) and automatic mode. After initialization, each Socket Connection will be under SOAD_SOCON_OFFLINE mode. When Open operation is executed, the mode switching line can be divided into two kinds based on the configuration attribute of each Socket Connection:
SOAD_SOCON_OFFLINE→SOAD_SOCON_ONLINE;SOAD_SOCON_OFFLINE→SOAD_SOCON_RECONNECT→SOAD_SOCON_ONLINE。只有当处于 SOAD_SOCON_ONLINE 模式时才能通过该 SocketConnection 发送/接收数据(属于 UDP 的 Socket Connection 可以在SOAD_SOCON_RECONNECT 模式下响应 SoAd_RxIndication,在该 API 中先切换到 SOAD_SOCON_ONLINE 模式,再执行数据接收处理)。
SOAD_SOCON_OFFLINE→SOAD_SOCON_ONLINE; SOAD_SOCON_OFFLINE→SOAD_SOCON_RECONNECT→SOAD_SOCON_ONLINE. Data be sent/received through this SocketConnection only under SOAD_SOCON_ONLINE (Socket Connection that belongs to UDP can respond to SoAd_rxCondition in SOAD_SOCON-CONNECT mode, switch to SOAD_SOCON-ONLINE mode in this API first, and then receive and process data).
2.Socket Connection Close:
Socket Connection 的关闭分为主动请求关闭(上层模块调用 SoAd_CloseSoCon),以及异常关闭,如下层模块检测到错误事件,通过SoAd_TcpIpEvent 通知到 SoAd 模块; UDP 报文接收超时; TP PDU 收发过程中出现错误/取消等。只有在执行主动请求关闭时, Socket Connection 的模式才能切换到 SOAD_SOCON_OFFLINE,别的情况都切换到SOAD_SOCON_RECONNECT 模式。
The closing Socket Connection can be further divided into active request closing (calling SoAd_ClosseSoCon by upper layer module) and abnormal closing. Upon detecting an error event, the lower layer module will notify the SoAd module through SoAd_TcpIpEvent; UDP packet reception timeout; errors/cancellations occur during the transmission and receiving process of TP PDUs. While executing active request closing, Socket Connection mode will be switched to SOAD_SOCON_OFFLINE but to SOAD_SOCON_RECONNECT mode under other circumstances.
3.Socket Connection Open/Close Sequence Remarks:
Socket Connection 的开启及关闭是异步的,任务队列只能缓存两个不同的任务请求,多余的任务根据策略进行舍弃或者撤销(revoke)队列中的任务。
The opening and closing of Socket Connection are asynchronous. The task queue can only cache two different task requests. Excess tasks will be discarded or revoked from the tasks in the queue according to the strategy.
4.Notifications:
当 Socket Connection 的模式切换时,可以通过调用<Up>_SoConModeChg()函数通知上层模块。
Switch the mode of Socket Connection after notifying the upper layer module by calling <Up>_SoConModeChg() function.
当 Socket Connection 关联的 IP 地址(本端)状态切换时,可以通过调<Up>_LocalIpAddrAssignmentChg()函数通知上层。
Switch the status of the IP address (local) linked with Socket Connection after notifying the upper layer by calling <Up>_LocalIpAddrAssignmentChg() function.
PDU Transmission 功能 Function of PDU Transmission¶
SoAd 通过 PDU route(SoAdPduRoute, SoAdPduRouteDest)将 PDU 映射到socket connection,进而通过其关联的 UDP/TCP Socket 进行发送。SoAd 提供 IF、TP 两种 PDU 发送方式。
SoAd maps PDUs to socket connections through PDU route (SoAdPduRoute, SoAdPduRouteDest), and then sends them via the linked UDP/TCP sockets. SoAd supports PDU sending by IF and TP.
1.PDU Transmission via IF-API:
对于数据长度较小的 PDU,通常使用 IF 发送方式。在 SoAd 中支持 IF PDU的 1: n 路由发送。
For PDUs with smaller data lengths, IF transmission is generally used. 1: n routing transmission for IF PDU is supported in SoAd.
2.PDU Transmission via IF-API and nPduUdpTxBuffer:
当 Socket Connection(UDP 类型)关联的所有发送 PDU 都是“IF”类型,使能PDU Header,其关联的 SoAdPduRouteDests 至少有一个 SoAdTxUdpTriggerMode配置为 TRIGGER_NEVER 模式。SoAd 将使能该 Socket Connection 的nPduUdpTxBuffer 机制。
When all PDU sending linked with Socket Connection (UDP type) is of “IF” type and PDU Header is enabled, the linked SoAdPduRouteDests must have at least one SoAdTxUdpTriggerMode that is configured as TRIGGER_NEVER mode. SoAd will enable the nPduUdpTxBuffer mechanism of this Socket Connection.
nPduUdpTxBuffer 机制,能够将多个 IF PDU 封装在一个 UDP 报文中进行统一发送,以达到节省带宽的目的。
The nPduUdpTxBuffer mechanism can encapsulate several IF PDUs into one UDP packet for unified transmission, in order to save bandwidth.
3.PDU Transmission via IfRoutingGroupTransmit API:
SoAd 支持上层模块(通常为 Sd 模块),通过 Trigger Transmit 方式请求RoutingGroup 关联的部分或者所有 IF PDUs 的发送。
SoAd supports upper level modules (Sd modules in general) to request the sending of part or all IF PDUs linked with RoutingGroup through Trigger Transmit.
上面提到的部分 IF PDUs 指的是关联到某一特定 Socket Connection 的 PDUs。
Some IF PDUs above refer to the PDUs linked with a specific Socket Connection.
4.PDU Transmission via TP-API:
对于上层模块数据长度较大的 PDU,通常通过 TP 方式进行发送。TP 发送不支持 PDU 的 1: n 路由。
PDUs with longer data lengths in upper level modules are generally sent through TP. TP transmission does not support 1: n routing of PDU.
PDU Header option 功能 Function of PDU Header option¶
SoAd 支持 PDU Header 功能, PDU Header 由 4 字节的 Header ID,4 字节的PDU 数据长度组成(大端字节序)。当 Socket Connection 关联到多个接收 PDU,以及需要用到 nPduUdpTxBuffer 机制等情况时,都需要 PDU Header 功能的支持。
SoAd supports PDU Header function. PDU Header consists of a 4-byte Header ID and a 4-byte PDU data length (big endian byte order). PDU Header is required, when Socket Connection links with several receiving PDUs and requires nPduUdpTxBuffer mechanism.
PDU Reception 功能 Function of PDU Reception¶
PDU 的接收,在 SoAd 中通过 Socket Route (SoAdSocketRoute,SoAdSocketRouteDest)来实现,将通过 UDP/TCP Socket 获取的报文映射到 PDUs。当前 Socket Route 仅支持 1: 1 路由(即一个 SoAdSocketRoute 只能包含一个SoAdSocketRouteDest),但需注意的是一个 Socket Connection 可以关联多个SoAdSocketRoute。SoAd 与上层模块 PDU 接收同样有两种方式: IF 接收、 TP 接收。
In SoAd, PDUs is received through Socket Route (SoAdSocketRoute, SoAdSocketRouteDest) and is mapped by the message obtained through UDP/TCP Socket. At present, Socket Route only supports 1:1 routing (i.e. one SoAdSocketRoute can only contain one SoAdSocketRouteDest). However, a Socket Connection can be linked with multiple SoAdSocketRoutes. There are two receiving methods for SoAd and upper layer module PDU: IF and TP.
Best Match Algorithm 功能 Function of Best Match Algorithm¶
该最佳匹配算法是根据提供的 remote address(IP 和 Port)从 SocketConnection Group 中选择出最佳匹配的 Socket Connection。
The best matching algorithm is the most matched Socket Connection selected from the SocketConnection Group based on the provided remote address (IP and Port).
Message Acceptance Policy 功能 Function of Message Acceptance Policy¶
该功能用于接收远端节点(remote nodes)发送报文的过滤。当该功能使能时, Socket Connection 只能接收指定的某个/某些远端节点发送来的报文。当该功能不使能时, Socket Connection 将接收所有远端节点发送来的报文。
This function is used for filtering the messages sent by remote nodes. After this function is enabled, Socket Connection can receive messages from the designated one or some remote nodes only. If this function is not enabled, Socket Connection can receive the messages from all remote nodes.
TP PDU Cancelation 功能 Function of TP PDU Cancelation¶
TP PDU 的传输支持中途取消,分为接收取消和发送取消。
The transmission of TP PDU can be cancelled in the middle way and can be further divided into receiving cancellation and sending cancellation.
Disconnection and recovery 功能 Function of Disconnection and recovery¶
在 SoAd_MainFunction 中,将会对需要断开连接的 Socket Connection 进行连接关闭,其关闭后 Socket Connection 状态分为两种情况:SOAD_SOCON_OFFLINE 和 SOAD_SOCON_RECONNECT。对于处于 SOAD_SOCON_RECONNECT 状态的 Socket Connection, SoAd 将会自动尝试恢复连接。
In SoAd_SainFunction, the Socket Connection that needs to be disconnected will be closed. After being closed, the Socket Connection status will have two conditions: SOAD_SOCON_OFFLINE and SOAD_SOCON_RECONNECT.For Socket Connection under the status of SOAD_SOCON_RECONNECT, SoAd will try to recover connection automatically.
Routing Groups 功能 Function of Routing Groups¶
SoAd 支持对每个 Routing Group 的使能状态进行控制,进而控制各 RoutingGroup 关联的 SoAdPduRouteDest 或者 SoAdSocketRouteDest。只有当 RouteDest处于使能状态时,才能执行新 PDU 的收发。
SoAd can control the enabling status of each Routing Group, thereby controlling the SoAdPduRouteDest or SoAdSocketRouteDest linked with each Routing Group. The new PDU cannot be sent or received until RouteDest is enabled.
Buffer handling 功能 Function of Buffer handling¶
在 SoAd 的报文收发过程中,有些情况下需要用到合适的 buffer 来缓存需要发送的数据及接收到的数据。
When the messages in SoAd are sent or received, appropriate buffers are needed in some cases to cache the data that needs sending and receiving.
偏差 Deviation¶
None
扩展 Extension¶
None
集成 Integration¶
文件列表 File List¶
静态文件 Static Files¶
文件(File) |
描述(Description) |
|---|---|
SoAd.h |
实现SoAd模块全部外部接口的声明(除了回调函数),以及配置文件中全局变量的声明。(Declares all external interfaces of the SoAd module (except for callback functions) and the global variables in the configuration file.) |
SoAd_Internal.h |
实现SoAd模块内部的数据类型和宏定义,还有接口的声明。(Declares the realization of data types and macro definitions within the SoAd module, as well as interface.) |
SoAd_Types.h |
实现外部/内部类型的定义,包括 AUTOSAR 标准定义的类型,以及 PB/PC 配置参数结构体类型,以及内部运行时结构体类型。(Implements definitions of external/internal types, including types defined by AUTOSAR standards, PB/PC configuration parameter structure types, and internal runtime structure types.) |
SoAd_Cbk.h |
实现 SoAd 模块全部回调函数的声明。(Implements the declaration of all callback functions of the SoAd module) |
SoAd.c |
作为 SoAd 模块的核心文件,实现 SoAd 模块全部对外接口,以及实现 SoAd 模块功能所必须的 local 函数, local 宏定义, local 变量定义。(As the core file of SoAd module, it can realize all external interfaces of SoAd module, as well as all local functions, local macro definitions and local variable definitions which are required for realizing SoAd module function.) |
动态文件 Dynamic Files¶
文件(File) |
描述(Description) |
|---|---|
SoAd_Cfg.h |
定义 SoAd 模块 PC 配置的宏定义。(Defines the macro definitions for SoAd module PC configuration.) |
SoAd_Cfg.c |
定义 SoAd 模块 PC 配置的结构体参数。(Defines the structural parameters for SoAd module PC configuration.) |
SoAd_PBcfg.h |
声明 SoAd 模块 PB 配置的结构体。(Declares the structure of the SoAd module PB configuration.) |
SoAd_PBcfg.c |
定义 SoAd 模块 PB 配置的结构体参数。(Defines the structural parameters for the PB configuration of the SoAd module.) |
错误处理 Error Handling¶
开发错误 Development Errors¶
Error code |
Value[hex] |
Description |
|---|---|---|
SOAD_E_NOTINIT |
0x01 |
API service called before initializing the module |
SOAD_E_PARAM_POINTER |
0x02 |
API service called with NULL pointer |
SOAD_E_INV_ARG |
0x03 |
Invalid argument |
SOAD_E_INV_PDUID |
0x06 |
Invalid PDU ID |
SOAD_E_INV_SOCKETID |
0x07 |
Invalid socket address |
SOAD_E_INIT_FAILED |
0x08 |
Invalid configuration set selection |
SOAD_E_INVALID_PARTITION |
0x80 |
Invalid partition ID |
产品错误 Product Errors¶
None
运行时错误 Runtime Errors¶
Error code |
Value[hex] |
Description |
|---|---|---|
SOAD_E_NOBUFS |
0x04 |
No buffer space available |
SOAD_E_INV_PDUHEADER_ID |
0x05 |
Unknown PduHeader ID |
SOAD_E_TCP_AUTOCONNECT_FAILED |
0x10 |
Automatic TCP connection failed |
接口描述 Interface Description¶
类型定义 Type Definitions¶
Type Name |
Type |
Description |
|---|---|---|
SoAd_SoConIdType |
uint8 |
Define socket connection id type. |
SoAd_RoutingGroupIdType |
uint8 |
SoAd Routing Group identifier. |
SoAd_uintx |
uint16 |
SoAd Internal unknown type definition. |
SoAd_MeasurementIdxType |
uint8 |
SoAd Measurement index type definition. |
SoAd_Init_StateType |
enum SoAd_Init_StateTypeTag |
SoAd module initialization state. |
SoAd_SoConModeType |
enum SoAd_SoConModeTypeTag |
SoAd socket connection mode. |
SoAd_UpLayerFuncType |
struct SoAd_UpLayerFuncTypeTag |
SoAd support uplayer function table. |
SoAd_PcCfgType |
struct SoAd_PcCfgTypeTag |
SoAd support uplayer configuration type definition. |
SoAd_UpLayerModuleType |
enum SoAd_UpLayerModuleTypeTag |
SoAd support uplayer configuration type definition. |
SoAd_SoBufferCfgType |
struct SoAd_SoBufferCfgTypeTag |
SoAd socket connection buffer configuration type definition. |
SoAd_SocketUdpType |
struct SoAd_SocketUdpTypeTag |
SoAd socket connection UDP protocol configuration type definition. |
SoAd_SocketTcpType |
struct SoAd_SocketTcpTypeTag |
SoAd socket connection TCP protocol configuration type definition. |
SoAd_SocketProtocolType |
struct SoAd_SocketProtocolTypeTag |
SoAd socket connection protocol configuration type definition. |
SoAd_SocketLocalAddressRefType |
struct SoAd_SocketLocalAddressRefTypeTag |
SoAd socket connection reference address configuration type definition. |
SoAd_SocketConnectionType |
struct SoAd_SocketConnectionTypeTag |
SoAd socket connection configuration type definition. |
SoAd_SocketConnectionGroupType |
struct SoAd_SocketConnectionGroupTypeTag |
SoAd socket connection group configuration type definition. |
SoAd_UpperLayerType |
enum SoAd_UpperLayerTypeTag |
SoAd support uplayer type definition. |
SoAd_SocketRouteDestType |
struct SoAd_SocketRouteDestTypeTag |
SoAd socket route dest type definition. |
SoAd_SocketRouteType |
struct SoAd_SocketRouteTypeTag |
SoAd socket route type definition. |
SoAd_TriggerModeType |
enum SoAd_TriggerModeTypeTag |
SoAd transmission Udp Trigger Mode type definition. |
SoAd_PduRouteDestType |
struct SoAd_PduRouteDestTypeTag |
SoAd Pdu route dest type definition. |
SoAd_PduRouteType |
struct SoAd_PduRouteTypeTag |
SoAd Pdu route type definition. |
SoAd_RoutingGroupType |
struct SoAd_RoutingGroupTypeTag |
SoAd routing group type definition. |
SoAd_MultiPartitionInfoType |
struct SoAd_MultiPartitionInfoTypeTag |
SoAd multiple partition infomation type definition. |
SoAd_PartitionInfoType |
struct SoAd_SoAd_PartitionInfoTypeTag |
SoAd multiple partition infomation type definition. |
SoAd_SocketCloseType |
enum SoAd_SocketCloseTypeTag |
SoAd socket close type definition. |
SoAd_SoConRequestType |
enum SoAd_SoConRequestTypeTag |
SoAd socket connection request type definition. |
SoAd_InnerSocketConManageType |
struct SoAd_InnerSocketConManageTypeTag |
SoAd socket connection manage type definition. |
SoAd_InnerSocketConGroupManageType |
struct SoAd_InnerSocketConGroupManageTypeTag |
SoAd socket connection group manage type definition. |
SoAd_InnerRoutingGroupManageType |
struct SoAd_SoAd_InnerRoutingGroupManageTypeTag |
SoAd routing group manage type definition. |
SoAd_InnerPduRouteDestManagerType |
struct SoAd_InnerPduRouteDestManagerTypeTag |
SoAd PDU route dest manage type definition. |
SoAd_InnerSocketRouteDestManagerType |
struct SoAd_InnerSocketRouteDestManagerTypeTag |
SoAd socket route dest manage type definition. |
SoAd_InnerPduRoutManageType |
struct SoAd_InnerPduRoutManageTypeTag |
SoAd PDU route manage type definition. |
SoAd_SoTxBufManType |
struct SoAd_SoTxBufManTypeTag |
SoAd socket connection transmission buffer manage type definition. |
SoAd_SoRxBufferManType |
struct SoAd_SoRxBufferManTypeTag |
SoAd socket connection receive buffer manage type definition. |
SoAd_ConfigType |
struct SoAd_ConfigTypeTag |
SoAd configuration data structure type definition. |
SoAd_Init_StateTypeTag |
enum |
SoAd module initialization state. |
SoAd_SoConModeTypeTag |
enum |
SoAd socket connection mode. |
SoAd_UpLayerModuleTypeTag |
enum |
SoAd support uplayer configuration type definition. |
SoAd_UpperLayerTypeTag |
enum |
SoAd support uplayer type definition. |
SoAd_TriggerModeTypeTag |
enum |
SoAd transmission Udp Trigger Mode type definition. |
SoAd_SocketCloseTypeTag |
enum |
SoAd socket close type definition. |
SoAd_SoConRequestTypeTag |
enum |
SoAd socket connection request type definition. |
提供的服务 Services¶
SoAd_Init¶
void SoAd_Init(const SoAd_ConfigType *SoAdConfigPtr)
Initializes internal and external interfaces and variables of SoAd module.
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoAdConfigPtr |
Pointer to the configuration data of the SoAd module. |
- Return type
void
SoAd_GetVersionInfo¶
void SoAd_GetVersionInfo(Std_VersionInfoType *versioninfo)
Returns the version information of SoAd module.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[out] |
versioninfo |
Pointer to where to store the version information of this module. |
- Return type
void
SoAd_IfRoutingGroupTransmit¶
Std_ReturnType SoAd_IfRoutingGroupTransmit(SoAd_RoutingGroupIdType id)
Triggers the transmission of all If-TxPDUs identified by the parameter id after requesting the data from the related upper layer.
- Sync/Async
FALSE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier indirectly specifying PDUs to be transmitted (after requesting the newest data from the related upper layer). |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
request was successful. |
E_NOT_OK |
request was not successful. |
SoAd_IfSpecificRoutingGroupTransmit¶
Std_ReturnType SoAd_IfSpecificRoutingGroupTransmit(SoAd_RoutingGroupIdType id, SoAd_SoConIdType SoConId)
Triggers the transmission of all If-TxPDUs identified by the parameter id on the socket connection specified by SoConId after requesting the data from the related upper layer.
- Sync/Async
FALSE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier indirectly specifying PDUs to be transmitted (after requesting the newest data from the related upper layer). |
[in] |
SoConId |
socket connection index specifying the socket connection on which the PDUs shall be transmitted. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_GetSoConId¶
Std_ReturnType SoAd_GetSoConId(PduIdType TxPduId, SoAd_SoConIdType *SoConIdPtr)
Returns socket connection index related to the specified TxPduId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Transmit PduId specifying the SoAd socket connection for which the socket connection index shall be returned. |
[out] |
SoConIdPtr |
Pointer to memory receiving the socket connection index asked for. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_OpenSoCon¶
Std_ReturnType SoAd_OpenSoCon(SoAd_SoConIdType SoConId)
This service opens the socket connection specified by SoConId.
- Sync/Async
FALSE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection which shall be opened |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_CloseSoCon¶
Std_ReturnType SoAd_CloseSoCon(SoAd_SoConIdType SoConId, boolean abort)
This service closes the socket connection specified by SoConId.
- Sync/Async
FALSE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection which shall be closed. |
[in] |
abort |
TRUE-socket connection will immediately be terminated. FALSE-socket connection will be terminated if no other upper layer is using this socket connection. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_RequestIpAddrAssignment¶
Std_ReturnType SoAd_RequestIpAddrAssignment(SoAd_SoConIdType SoConId, TcpIp_IpAddrAssignmentType Type, const TcpIp_SockAddrType *LocalIpAddrPtr, uint8 Netmask, const TcpIp_SockAddrType *DefaultRouterPtr)
By this API service the local IP address assignment which shall be used for the socket connection specified by SoConId is initiated.
- Sync/Async
FALSE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
Socket connection index specifying the socket connection for which the IP address shall be set |
[in] |
Type |
Type of IP address assignment which shall be initiated. |
[in] |
LocalIpAddrPtr |
Pointer to structure containing the IP address which shall be assigned to the EthIf controller indirectly specified via SoConId.Note: This parameter is only used in case the parameter Type is set to TCPIP_IPADDR_ASSIGNMENT_STATIC, can be set to NULL_PTR otherwise. |
[in] |
Netmask |
Network mask of IPv4 address or address prefix of IPv6 address in CIDR Notation. Note: This parameter is only used in case the parameter Type is set to TCPIP_IPADDR_ASSIGNMENT_STATIC. |
[in] |
DefaultRouterPtr |
Pointer to structure containing the IP address of the default router (gateway) which shall be assigned. Note: This parameter is only used in case the parameter Type is set to TCPIP_IPADDR_ASSIGNMENT_STATIC, can be set to NULL_PTR otherwise. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request has not been accepted. |
SoAd_ReleaseIpAddrAssignment¶
Std_ReturnType SoAd_ReleaseIpAddrAssignment(SoAd_SoConIdType SoConId)
By this API service the local IP address assignment used for the socket connection specified by SoConId is released.
- Sync/Async
FALSE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection for which the IP address shall be released |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request has not been accepted. |
SoAd_GetLocalAddr¶
Std_ReturnType SoAd_GetLocalAddr(SoAd_SoConIdType SoConId, TcpIp_SockAddrType *LocalAddrPtr, uint8 *NetmaskPtr, TcpIp_SockAddrType *DefaultRouterPtr)
Retrieves the local address (IP address and port) actually used for the SoAd socket connection specified by SoConId, the netmask and default router.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index representing the SoAd socket connection for which the actual local IP address shall be obtained. |
[inout] |
LocalAddrPtr |
Pointer to a struct where the local address (IP address and port) is stored. |
[out] |
NetmaskPtr |
Pointer to memory where Network mask of IPv4 address or address prefix of IPv6 address in CIDR Notation is stored |
[inout] |
DefaultRouterPtr |
Pointer to struct where the IP address of the default router (gateway) is stored (struct member “port” is not used and of arbitrary value). |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_GetPhysAddr¶
Std_ReturnType SoAd_GetPhysAddr(SoAd_SoConIdType SoConId, uint8 *PhysAddrPtr)
Retrieves the physical source address of the EthIf controller used by the SoAd socket connection specified by SoConId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index representing the SoAd socket connection for which the physical source address of the related EthIf controller shall be obtained. |
[out] |
PhysAddrPtr |
Pointer to the memory where the physical source address (MAC address) in network byte order is stored. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_GetRemoteAddr¶
Std_ReturnType SoAd_GetRemoteAddr(SoAd_SoConIdType SoConId, TcpIp_SockAddrType *IpAddrPtr)
Retrieves the remote address (IP address and port) actually used for the SoAd socket connection specified by SoConId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index representing the SoAd socket connection for which the actually specified remote address shall be obtained. |
[out] |
IpAddrPtr |
Pointer to a struct where the retrieved remote address (IP address and port) is stored. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_EnableRouting¶
Std_ReturnType SoAd_EnableRouting(SoAd_RoutingGroupIdType id)
Enables routing of a group of PDUs in the SoAd related to the RoutingGroup specified by parameter id. Routing of PDUs can be either forwarding of PDUs from the upper layer to a TCP or UDP socket of the TCP/IP stack specified by a PduRoute or the other way around specified by a SocketRoute.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier specifying the routing group to be enabled |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_EnableSpecificRouting¶
Std_ReturnType SoAd_EnableSpecificRouting(SoAd_RoutingGroupIdType id, SoAd_SoConIdType SoConId)
Enables routing of a group of PDUs in the SoAd related to the RoutingGroup specified by parameter id only on the socket connection identified by SoConId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier specifying the routing group to be enabled |
[in] |
SoConId |
socket connection index specifying the socket connection on which the routing group shall be enabled |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_DisableRouting¶
Std_ReturnType SoAd_DisableRouting(SoAd_RoutingGroupIdType id)
Disables routing of a group of PDUs in the SoAd related to the RoutingGroup specified by parameter id. Routing of PDUs can be either forwarding of PDUs from the upper layer to a TCP or UDP socket of the TCP/IP stack specified by a PduRoute or the other way around specified by a SocketRoute.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier specifying the routing group to be disabled |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_DisableSpecificRouting¶
Std_ReturnType SoAd_DisableSpecificRouting(SoAd_RoutingGroupIdType id, SoAd_SoConIdType SoConId)
Disables routing of a group of PDUs in the SoAd related to the RoutingGroup specified by parameter id only on the socket connection identified by SoConId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
routing group identifier specifying the routing group to be disabled |
[in] |
SoConId |
socket connection index specifying the socket connection on which the routing group shall be disabled |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request was successful. |
E_NOT_OK |
The request was not successful. |
SoAd_SetRemoteAddr¶
Std_ReturnType SoAd_SetRemoteAddr(SoAd_SoConIdType SoConId, const TcpIp_SockAddrType *RemoteAddrPtr)
By this API service the remote address (IP address and port) of the specified socket connection shall be set.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection for which the remote address shall be set |
[in] |
RemoteAddrPtr |
Struct containint the IP address and port to be set. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request has not been accepted. |
SoAd_SetUniqueRemoteAddr¶
Std_ReturnType SoAd_SetUniqueRemoteAddr(SoAd_SoConIdType SoConId, const TcpIp_SockAddrType *RemoteAddrPtr, SoAd_SoConIdType *AssignedSoConIdPtr)
This API service shall either return the socket connection index of the SoAdSocketConnection Group where the specified remote address (IP address and port) is set or assign the remote address to an unused socket connection from the same SoAdSocketConnectionGroup.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
Index of any socket connection that is part of the SoAdSocket ConnectionGroup. |
[in] |
RemoteAddrPtr |
Pointer to the structure containing the requested remote IP address and port. |
[out] |
AssignedSoConIdPtr |
Pointer to the SoAd_SoConIdType where the index of the socket connection configured with the remote address (RemoteAddrPtr) shall be stored. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request was rejected, AssignedSoConIdPtr remains unchanged. |
SoAd_ReleaseRemoteAddr¶
void SoAd_ReleaseRemoteAddr(SoAd_SoConIdType SoConId)
By this API service the remote address (IP address and port) of the specified socket connection shall be released, i.e. set back to the configured remote address setting.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
Index of the socket connection for which the remote address shall be released. |
- Return type
void
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request was rejected, AssignedSoConIdPtr remains unchanged. |
SoAd_TpChangeParameter¶
Std_ReturnType SoAd_TpChangeParameter(PduIdType id, TPParameterType parameter, uint16 value)
Request to change a specific transport protocol parameter (e.g. block size).
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
id |
Identification of the PDU which the parameter change shall affect. |
[in] |
parameter |
ID of the parameter that shall be changed. |
[in] |
value |
The new value of the parameter. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The parameter was changed successfully. |
E_NOT_OK |
The parameter change was rejected. |
SoAd_ReadDhcpHostNameOption¶
Std_ReturnType SoAd_ReadDhcpHostNameOption(SoAd_SoConIdType SoConId, uint8 *length, uint8 *data)
By this API service an upper layer of the SoAd can read the currently configured hostname, i.e. FQDN option in the DHCP submodule of the TCP/IP stack.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection for which the hostname shall be read. |
[in] |
length |
As input parameter, contains the length of the provided data buffer. Will be overwritten with the length of the actual data. |
[in] |
data |
Pointer to provided memory buffer the hostname, i.e. the Fully Qualified Domain Name (FQDN) according to IETF RFC 4702/IETF RFC 4704 will be copied to. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request has not been accepted. |
SoAd_WriteDhcpHostNameOption¶
Std_ReturnType SoAd_WriteDhcpHostNameOption(SoAd_SoConIdType SoConId, uint8 length, const uint8 *data)
By this API service an upper layer of the SoAd can set the hostname, i.e. FQDN option in the DHCP submodule of the TCP/IP stack.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection for which the hostname shall be changed |
[in] |
length |
Length of hostname to be set. |
[in] |
data |
Pointer to memory containing the hostname, i.e. the Fully Qualified Domain Name (FQDN) according to IETF RFC 4702/IETF RFC 4704. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
The request has been accepted. |
E_NOT_OK |
The request has not been accepted. |
SoAd_GetSoConMode¶
void SoAd_GetSoConMode(SoAd_SoConIdType SoConId, SoAd_SoConModeType *ModePtr)
Returns current state of the socket connection specified by SoConId.
- Sync/Async
TRUE
- Reentrancy
Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
socket connection index specifying the socket connection for which the state shall be returned. |
[out] |
ModePtr |
Pointer to memory where the socket connection state shall be stored. |
- Return type
void
SoAd_IfTransmit¶
Std_ReturnType SoAd_IfTransmit(PduIdType TxPduId, const PduInfoType *PduInfoPtr)
Requests transmission of a PDU.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Identifier of the PDU to be transmitted |
[in] |
PduInfoPtr |
Length of and pointer to the PDU data and pointer to MetaData. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
Transmit request has been accepted. |
E_NOT_OK |
Transmit request has not been accepted. |
SoAd_TpTransmit¶
Std_ReturnType SoAd_TpTransmit(PduIdType TxPduId, const PduInfoType *PduInfoPtr)
Requests transmission of a PDU.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Identifier of the PDU to be transmitted |
[in] |
PduInfoPtr |
Length of and pointer to the PDU data and pointer to MetaData. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
Transmit request has been accepted. |
E_NOT_OK |
Transmit request has not been accepted. |
SoAd_TpCancelReceive¶
Std_ReturnType SoAd_TpCancelReceive(PduIdType RxPduId)
Requests cancellation of an ongoing reception of a PDU in a lower layer transport protocol module.
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
RxPduId |
Identification of the PDU to be cancelled. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
Cancellation was executed successfully by the destination module. |
E_NOT_OK |
Cancellation was rejected by the destination module. |
SoAd_TpCancelTransmit¶
Std_ReturnType SoAd_TpCancelTransmit(PduIdType TxPduId)
Requests cancellation of an ongoing transmission of a PDU in a lower layer communication module.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different PduIds. Non reentrant for the same PduId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
TxPduId |
Identification of the PDU to be cancelled. |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
Cancellation was executed successfully by the destination module. |
E_NOT_OK |
Cancellation was rejected by the destination module. |
SoAd_IsConnectionReady¶
TcpIp_ReturnType SoAd_IsConnectionReady(SoAd_SoConIdType SoConId, const TcpIp_SockAddrType *RemoteAddrPtr)
API allows to check if a communication over this socket connection is possible for a dedicated remote address. It includes that the socket connection is bound to a socket, a physical address is available for the requested remote address and if a security association is configured that a ecured connection is already established.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SoConIds. Non reentrant for the same SoConId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SoConId |
Socket connection index specifying the socket connection for the request. |
[in] |
RemoteAddrPtr |
Pointer to the structure containing the requested remote IP address and port. |
- Return type
TcpIp_ReturnType
Return values
Name |
Description |
|---|---|
TCPIP_E_OK |
Connection is ready for communication. |
TCPIP_E_NOT_OK |
Request was rejected. |
TCPIP_E_PENDING |
Connection establishment in progress. |
回调函数 Callback Function¶
SoAd_RxIndication¶
void SoAd_RxIndication(TcpIp_SocketIdType SocketId, const TcpIp_SockAddrType *RemoteAddrPtr, uint8 *BufPtr, uint16 Length)
The TCP/IP stack calls this primitive after the reception of data on a socket. The socket identifier along with configuration information determines which module is to be called.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SocketIds. Non reentrant for the same SocketId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource. |
[in] |
RemoteAddrPtr |
Pointer to memory containing IP address and port of the |
[in] |
BufPtr |
Pointer to the received data |
[in] |
Length |
Data length of the received TCP segment or UDP datagram |
- Return type
void
SoAd_CopyTxData¶
BufReq_ReturnType SoAd_CopyTxData(TcpIp_SocketIdType SocketId, uint8 *BufPtr, uint16 BufLength)
This service requests to copy data for transmission to the buffer indicated. This call is triggered by TcpIp_Transmit(). Note: The call to <Up>_CopyTxData() may happen in the context of TcpIp_Transmit()
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SocketIds. Non reentrant for the same SocketId
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource |
[in] |
BufPtr |
Pointer to buffer for transmission data |
[in] |
BufLength |
Length of provided data buffer |
- Return type
BufReq_ReturnType
Return values
Name |
Description |
|---|---|
BUFREQ_OK |
Data has been copied to the transmit buffer completely as requested |
BUFREQ_E_NOT_OK |
Data has not been copied. Request failed |
SoAd_TxConfirmation¶
void SoAd_TxConfirmation(TcpIp_SocketIdType SocketId, uint16 Length)
The TCP/IP stack calls this function after the data has been acknowledged by the peer for TCP. Caveats: The upper layer might not be able to determine exactly which data bytes have been confirmed.
- Sync/Async
TRUE
- Reentrancy
Reentrant for different SocketIds. Non reentrant for the same SocketId.
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource. |
[in] |
Length |
Number of transmitted data bytes. |
- Return type
void
SoAd_TcpAccepted¶
Std_ReturnType SoAd_TcpAccepted(TcpIp_SocketIdType SocketId, TcpIp_SocketIdType SocketIdConnected, const TcpIp_SockAddrType *RemoteAddrPtr)
This service gets called if the stack put a socket into the listen mode before (as server) and a peer connected to it (as client).In detail: The TCP/IP stack calls this function after a socket was set into the listen state with TcpIp_TcpListen() and a TCP connection is requested by the peer.
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource which has been used at TcpIp_Bind() |
[in] |
SocketIdConnected |
Socket identifier of the local socket resource used for the established connection |
[in] |
RemoteAddrPtr |
IP address and port of the remote host |
- Return type
Std_ReturnType
Return values
Name |
Description |
|---|---|
E_OK |
upper layer accepts the established connection |
E_NOT_OK |
upper layer refuses the established |
SoAd_TcpConnected¶
void SoAd_TcpConnected(TcpIp_SocketIdType SocketId)
This service gets called if the stack initiated a TCP connection before (as client) and the peer (the server) acknowledged the connection set up.In detail:The TCP/IP stack calls this function after a socket was requested to connect with TcpIp_TcpConnect() and a TCP connection is confirmed by the peer.The parameter value of SocketId equals the SocketId value of the preceding TcpIp_TcpConnect() call.
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource |
- Return type
void
SoAd_TcpIpEvent¶
void SoAd_TcpIpEvent(TcpIp_SocketIdType SocketId, TcpIp_EventType Event)
This service gets called if the stack encounters a condition described by the values in Event.
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
SocketId |
Socket identifier of the related local socket resource |
[in] |
Event |
This parameter contains a description of the event just encountered |
- Return type
void
SoAd_LocalIpAddrAssignmentChg¶
void SoAd_LocalIpAddrAssignmentChg(TcpIp_LocalAddrIdType IpAddrId, TcpIp_IpAddrStateType State)
This service gets called by the TCP/IP stack if an IP address assignment changes (i.e. new address assigned or assigned address becomes invalid).
- Sync/Async
TRUE
- Reentrancy
Non Reentrant
Parameters
Dir |
Name |
Description |
|---|---|---|
[in] |
IpAddrId |
IP address Identifier, representing an IP address specified in the TcpIp module configuration (e.g. static IPv4 address on EthIf controller 0) |
[in] |
State |
state of IP address assignment |
- Return type
void
依赖的服务 Applicable Services¶
强制接口 Compulsory interface¶
API Function |
Header File |
Description |
|---|---|---|
Det_ReportRuntimeError |
Det.h |
Service to report runtime errors. If a callout has been configured then this callout shall be called. |
TcpIp_<Up>GetSocket |
TcpIp.h |
By this API service the TCP/IP stack is requested to allocate a new socket. Note: Each accepted incoming TCP connection also allocates a socket resource. |
TcpIp_Bind |
TcpIp.h |
By this API service the TCP/IP stack is requested to bind a UDP or TCP socket to a local resource. |
TcpIp_ChangeParameter |
TcpIp.h |
By this API service the TCP/IP stack is requested to change a parameter of a socket. E.g. the Nagle algorithm may be controlled by this API. |
TcpIp_Close |
TcpIp.h |
By this API service the TCP/IP stack is requested to close the socket and release all related resources. |
TcpIp_GetCtrlIdx |
TcpIp.h |
TcpIp_GetCtrlIdx returns the index of the controller related to LocalAddrId. |
TcpIp_GetIpAddr |
TcpIp.h |
Obtains the local IP address actually used by Local AddrId, the netmask and default router |
TcpIp_GetPhysAddr |
TcpIp.h |
Obtains the physical source address used by the EthIf controller implicitly specified via LocalAddrId. |
TcpIp_GetRemotePhysAddr |
TcpIp.h |
TcpIp_GetRemotePhysAddr queries the IP/physical address translation table specified by CtrlIdx and returns the physical address related to the IP address specified by IpAddrPtr. In case no physical address can be retrieved and parameter initRes is TRUE, address resolution for the specified IP address is initiated on the local network. |
TcpIp_ReleaseIpAddrAssignment |
TcpIp.h |
By this API service the local IP address assignment for the IP address specified by LocalAddrId shall be released. |
TcpIp_RequestComMode |
TcpIp.h |
By this API service the TCP/IP stack is requested to change the TcpIp state of the communication network identified by EthIf controller index. |
TcpIp_RequestIpAddrAssignment |
TcpIp.h |
By this API service the local IP address assignment for the IP address specified by LocalAddrId shall be initiated. |
TcpIp_TcpConnect |
TcpIp.h |
By this API service the TCP/IP stack is requested to establish a TCP connection to the configured peer. |
TcpIp_TcpListen |
TcpIp.h |
By this API service the TCP/IP stack is requested to listen on the TCP socket specified by the socket identifier. |
TcpIp_TcpReceived |
TcpIp.h |
By this API service the reception of socket data is confirmed to the TCP/IP stack. |
TcpIp_TcpTransmit |
TcpIp.h |
This service requests transmission of data via TCP to a remote node. The transmission of the data is decoupled. |
TcpIp_UdpTransmit |
TcpIp.h |
This service transmits data via UDP to a remote node. The transmission of the data is immediately performed with this function call by forwarding it to EthIf. |
可选接口 Optional Interface¶
API Function |
Header File |
Description |
|---|---|---|
Det_ReportError |
Det.h |
Service to report development errors. |
PduR_SoAdTpCopyRxData |
PduR_SoAd.h |
This function is called to provide the received data of an I-PDU segment (N-PDU) to the upper layer. Each call to this function provides the next part of the I-PDU data. The size of the remaining buffer is written to the position indicated by bufferSizePtr. |
TcpIp_DhcpReadOption |
TcpIp.h |
By this API service the TCP/IP stack retrieves DHCP option data identified by parameter option for already received DHCP options. |
TcpIp_DhcpV6ReadOption |
TcpIp.h |
By this API service the TCP/IP stack retrieves DHCPv6 option data identified by parameter option for already received DHCPv6 options. |
TcpIp_DhcpV6WriteOption |
TcpIp.h |
By this API service the TCP/IP stack writes the DHCPv6 option data identified by parameter option. |
TcpIp_DhcpWriteOption |
TcpIp.h |
By this API service the TCP/IP stack writes the DHCP option data identified by parameter option. |
配置接口 Configuration Interfaces¶
API Function |
Header File |
Description |
|---|---|---|
<Up>_[SoAd][If]RxIndication |
PduR_SoAd.h/UdpNm.h/Sd.h/DoIP_Cbk.h/XcpOnEth_Cbk.h/CDD_Cbk.h |
Indication of a received PDU from a lower layer communication interface module. |
<Up>_[SoAd][If]TriggerTransmit |
PduR_SoAd.h |
Within this API, the upper layer module (called module) shall check whether the available data fits into the buffer size reported by PduInfoPtr->SduLength. |
<Up>_[SoAd][If]TxConfirmation |
PduR_SoAd.h/UdpNm.h |
The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU. |
<Up>_[SoAd][Tp]StartOfReception |
PduR_SoAd.h/DoIP_Cbk.h |
This function is called at the start of receiving an N-SDU. The N-SDU might be fragmented into multiple N-PDUs (FF with one or more following CFs) or might consist of a single N-PDU (SF). The service shall provide the currently available maximum buffer size when invoked with TpSdu Length equal to 0. |
<Up>_[SoAd][Tp]CopyRxData |
PduR_SoAd.h/DoIP_Cbk.h |
This function is called to provide the received data of an I-PDU segment (N-PDU) to the upper layer. Each call to this function provides the next part of the I-PDU data. The size of the remaining buffer is written to the position indicated by bufferSizePtr. |
<Up>_[SoAd][Tp]RxIndication |
PduR_SoAd.h/DoIP_Cbk.h |
Called after an I-PDU has been received via the TP API, the result indicates whether the transmission was successful or not. |
<Up>_[SoAd][Tp]CopyTxData |
PduR_SoAd.h/DoIP_Cbk.h |
This function is called to acquire the transmit data of an I-PDU segment (N-PDU). Each call to this function provides the next part of the I-PDU data unless retry->TpDataState is TP_DATARETRY. |
<Up>_[SoAd][Tp]TxConfirmation |
PduR_SoAd.h/DoIP_Cbk.h |
This function is called after the I-PDU has been transmitted on its network, the result indicates whether the transmission was successful or not. |
<Up>_SoConModeChg |
PduR_SoAd.h/DoIP_Cbk.h/Sd.h |
Notification about a SoAd socket connection state change, e.g. socket connection gets online |
<Up>_LocalIpAddrAssignmentChg |
PduR_SoAd.h/DoIP_Cbk.h/Sd.h |
This function gets called by the SoAd if an IP address assignment related to a socket connection changes (i.e. new address assigned or assigned address becomes invalid). |
配置 Configuration¶
SoAd Socket Connection¶
SoAdSocketConnectionGroup¶
SoAd模块的Socket Connection是在SoAdSocketConnectionGroup中配置的,SoAdSocketConnectionGroup配置了该Socket Connection的端口,是否自动连接,PduHeader是否使能,是否通知上层Ip地址分配变化和连接模式改变,TP接收缓存大小的配置等。而SoAdSocketConnection中配置了远端的IP和端口,在SoAdSocketConnectionGroup中还要配置该连接是UDP还是TCP连接
The Socket Connection of the SoAd module is configured in the SoAdSocketconnectionGroup, which comes with the port for the Socket Connection, in order to realize automatic connection, enabling of PduHeader, and the upper layer is notified of the changes on IP address allocation and connection mode, and the configuration of TP receiving cache size.The remote IP and port are configured in SoAdSocketConnection. In SoAdSocketConnection Group, configure the specific connection (UDP or TCP).
发送PDU Send PDU¶
SoAdPduRouteDest¶
上层发送PDU 是在SoAdPduRoute中配置的,可以配置该PDU路由(SoAdPduRouteDest)到不同的SocketConnection中让后将其发出,SoAdPduRouteDest还可以选择关联RoutingGroup,通过RoutingGroup控制该PDU的发送。
The PDU sending by upper layer is configured in SoAdPduRoute. The PDU can be routed (SoAdPduRouteDest) to different SocketConnections for sending. SoAdPduRouteDest can also be linked with RoutingGroup to control PDU sending.
接收PDU Receive PDU¶
SoAdSocketRouteDest¶
接收PDU在SoAdSocketRoute配置,通过SocketConnection接收的报文转化为PDU后,把该PDU通知给上层模块,可以将加收的PDU通过SoAdSocketRouteDest配置后路由到多个上层模块中
Receive the configuration of PDU in SoAdSocketRoute; after converting the received message into PDU through SocketConnection, notify the upper layer module of the PDU. The received PDU can be routed to several upper layer modules through SoAdSocketRouteDest configuration