TCPIP_IPV4_PacketOptionGet Function

C

int TCPIP_IPV4_PacketOptionGet(
    TCPIP_MAC_PACKET* pRxPkt, 
    TCPIP_IPV4_OPTION_TYPE optType, 
    IPV4_OPTION_FIELD* pOptField, 
    int optSize
);

Description

This function is a helper to allow retrieving a specific option that is present in an IPv4 received packet.

Preconditions

IPv4 properly initialized. pRxPkt a proper IPv4 packet received by the IPv4 module.

Parameters

ParametersDescription
pRxPktA packet received by the IPv4 module.
optTypeType of options to be searched/retrieved.
pOptFieldAddress to store the option. Could be NULL if not needed.
optSizeSize of the pOptField structure, including the optData part. If 0, pOptField will not be updated.

Returns

  • Size of the option, if found in the IPv4 packet.

  • 0 if such an option does not exist.

Remarks

The packet should be a proper IPv4 packet received through the IPv4 module. Only minimal consistency check is done.