TCPIP_IPV4_SelectSourceInterface Function

C

TCPIP_NET_HANDLE TCPIP_IPV4_SelectSourceInterface(
    TCPIP_NET_HANDLE netH, 
    const IPV4_ADDR* pDestAddress, 
    IPV4_ADDR* pSrcAddress, 
    bool srcSet
);

Description

Updates the pSrcAddress and returns the needed interface, if successful:

  • if srcSet == 1 and netH != 0, the function will not change anything

  • if srcSet == 1 and netH == 0, the call will never fail it will use whatever value in pSrcAddress (even 0) and will try to come up with an appropriate interface

  • if srcSet == 0 and netH == 0, it will use the destination address

  • if srcSet == 0 and netH != 0, it will use the address of that interface

Preconditions

netH has to be valid (if non-0).

Parameters

ParametersDescription
netHNetwork interface handle.
pDestAddressPointer to destination address.
pSrcAddressPointer to source address.
srcSetBoolean; true if address pointed by pSrcAddress is valid.

Returns

  • A valid interface - If it succeeds and a valid source interface selected.

  • 0 - Interface selection failed.

Remarks

None.