TCPIP_IPV4_PacketOptionListGet Function

C

int TCPIP_IPV4_PacketOptionListGet(
    TCPIP_MAC_PACKET* pRxPkt, 
    TCPIP_IPV4_OPTION_DCPT* pOptions, 
    int nOptions
);

Description

This function is a helper to allow retrieving a list of options that are present in the 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.
pOptionsPointer to an array of option descriptors to receive the options present in the packet.
nOptionsNumber of elements the array can store. Could be 0, in which case pOptions is not updated.

Returns

  • The number of options found in the packet.

  • 0 - Invalid packet or packet without options.

Remarks

The packet should be a proper IPv4 packet received through the IPv4 module. Only minimal consistency check is done. On return, the pOptions is updated, up to nOptions.