Jump to main content

##

# 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

Parameters | Description
--- | ---
pPkt | The packet to be formatted.
protocol | The protocol associated with the packet.
ipLoadLen | The IPv4 packet payload length.
pParams | Pointer 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.