TCPIP_IPV4_PacketFormatTx Function

C

void TCPIP_IPV4_PacketFormatTx(
    IPV4_PACKET* pPkt, 
    uint8_t protocol, 
    uint16_t ipLoadLen, 
    TCPIP_IPV4_PACKET_PARAMS* pParams
);

Description

The necessary fields are set into the IPv4 packet.

Preconditions

Properly allocated pPkt. The source and destination addresses should be updated in the packet. The network interface should be updated in the IPV4_PACKET.

Parameters

ParametersDescription
pPktThe packet to be formatted.
protocolThe protocol associated with the packet.
ipLoadLenThe IPv4 packet payload length.
pParamsPointer to a structure containing parameters for this packet. If NULL, then default values are used.

Returns

None.

Remarks

The segments should be properly updated with the right number of bytes ( segLen). The IP payload length (ipLoadLen) is added only to the 1st segment of the packet. Other segments (for packets having multiple packets) are not touched.