A664InitICMP
CAPL Functions » AFDX » A664InitICMP Valid for: CANoe DE • CANoe4SW DEFunction Syntax
long A664InitICMP (a664Frame aFrame, dword InitType, word payloadSize, dbNode NodeName)long A664InitICMP (a664Frame aFrame, dword InitType, word payloadSize, dword srcIP, dword dstIP, word VLid)
Description
The complete Ethernet and IP headers of an AFDX packet are consistently set based on the given parameters. With calling convention (1), the initialization values are given in the attributes of a DBC object. Calling convention (2) is intended for full user-control of all the parameters. In this case, it is necessary to configure the corresponding VL, too. Otherwise, the VL definition is not complete and it is not possible to schedule the ICMP frame. Use the function A664VLConfig for setting detailed VL parameters. The IP payload area is initialized according to the parameterInitType. There are three different values possible for this parameter.
-
The
InitType=SWAP_ADRis intended for creating the ECHO REPLY out of a received packet. In this case, the parameterpayloadSizeis ignored. The IP addresses (contents of the selectors IpAdrDst and IpAdrSrc) are swapped. ICMP type and code are set to ECHO REPLY.- (1) The VL for the packet is taken from the DBC attribute ICMP_outVLid and the MAC addresses are adapted accordingly. Note that the ICMP payload is not modified.
- (2) The parameters
srcIPanddstIPare ignored. The VL for the packet is taken from parameterVLidand the MAC addresses are adapted accordingly. Note that the ICMP payload is not modified.
-
The values
InitType=ECHO_REPLYorPING_REQare used to initialize a newly created packet. The ICMP payload area is created according topayloadSizeand set to 0. Furthermore, ICMP type and code are set.- (1) The source IP address (selector IpAdrSrc) is taken from the initialization file
CAN.INI(section =AFDX; value =DefaultSrcIP). The VL-related configuration is given from the DBC object. - (2) The function provides the complete addressing information. Note that the function A664VLConfig() has to be called for setting detailed VL parameters.
- (1) The source IP address (selector IpAdrSrc) is taken from the initialization file
Parameters
- aFrame: The frame object to be initialized
- InitType:
- 1: ECHO_REPLY: initializes the type/code to ECHO REPLY
- 8: PING_REQ: initializes the type/code to PING REQUEST
- 256: SWAP_ADR: swaps addressing information (source/destination MAC and IP addresses), initializes the type/code to ECHO REPLY, the parameter payloadSize is ignored
- payloadSize: size of the optional ICMP payload places after the ICMP header (corresponds to the bytes in IpPayload following the ICMP header). The valid range is [0 .. ICMP_outVLbufSize / ICMP_inVLbufSize]
- This parameter is ignored if
InitTypeis set toSWAP_ADR.
- This parameter is ignored if
- NodeName: (1) This is the name of a node from the assigned DBC. The DBC must be an AFDX DBC file and the necessary attributes must exist.
- srcIP: (2) source IP address to be used for the Eth- and IP-headers. This parameter is ignored if
InitTypeis set toSWAP_ADR. - dstIP: (2) destination IP address to be used for the IP-headers. This parameter is ignored if
InitTypeis set toSWAP_ADR. - VLid: (2) VLId to be used for the destination Eth-header (see selector EthVlId)
Return Values
<success> 0: No error.<error> -1: InvalidInitType.<error> -2: No ICMP attributes found forNodeName.<error> -3: Invalid IP address value.<error> -4: Payload size exceeds MaxFrameSize.<error> -5: Protocol, IP-addr or VLid of incoming frame are invalid in case of SWAP_ADR.<error> -6: Setting the checksum failed.