次の方法で共有


CreateSortedAddressPairs (Compact 2013)

3/26/2014

This function takes a supplied list of potential IP destination addresses, pairs the destination addresses together with the host machine's local IP addresses, and sorts the pairs according to which address pair is best suited for communication between the two peers.

Syntax

NETIOAPI_API  CreateSortedAddressPairs(
  __in_opt  const PSOCKADDR_IN6 SourceAddressList,
  __in      ULONG SourceAddressCount,
  __in      const PSOCKADDR_IN6 DestinationAddressList,
  __in      ULONG DestinationAddressCount,
  __in      ULONG AddressSortOptions,
  __out     PSOCKADDR_IN6_PAIR* SortedAddressPairList,
  __out     ULONG* SortedAddressPairCount
);

Parameters

  • SourceAddressList
    Reserved; set to NULL.
  • SourceAddressCount
    Reserved; set to 0 (zero).
  • DestinationAddressList
    A pointer to an array of SOCKADDR_IN6 structures that contain a list of potential IPv6 destination addresses. Any IPv4 addresses must be represented in the IPv4-mapped IPv6 address format which enables an IPv6 only application to communicate with an IPv4 node.
  • DestinationAddressCount
    The number of destination addresses pointed to by the DestinationAddressList parameter.
  • AddressSortOptions
    Reserved.
  • SortedAddressPairList
    A pointer to store an array of SOCKADDR_IN6_PAIR structures that contain a list of pairs of IPv6 addresses sorted in the preferred order of communication, if the function call is successful.
  • SortedAddressPairCount
    A pointer to store the number of address pairs pointed to by the SortedAddressPairList parameter, if the function call is successful.

Return Value

Return code

Description

NO_ERROR

The function succeeds.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function. This error is returned if the DestinationAddressList, SortedAddressPairList, or SortedAddressPairCount parameters NULL, or the DestinationAddressCount was greater than 500. This error is also returned if the SourceAddressList is not NULL or the SourceAddressPairCount parameter is not zero.

ERROR_NOT_ENOUGH_MEMORY

Not enough storage is available to process this command.

ERROR_NOT_SUPPORTED

The request is not supported. This error is returned if no IPv6 stack is located on the local device.

Other

Use FormatMessage to obtain the message string for the returned error.

Remarks

The CreateSortedAddressPairs function takes a list of source and destination IPv6 addresses, and returns a list of pairs of addresses in sorted order. The list is sorted by which address pair is best suited for communication between the source and destination address.

The list of source addresses pointed to by the SourceAddressList is currently reserved and must be a NULL pointer. The SourceAddressCount is currently reserved and must be zero. The CreateSortedAddressPairs function currently uses all the host machine's local addresses for the source address list.

The list of destination addresses is pointed to by the DestinationAddressList parameter. The list of destination addresses is an array of SOCKADDR_IN6 structures. Any IPv4 addresses must be represented in the IPv4-mapped IPv6 address format which enables an IPv6 only application to communicate with an IPv4 node. The DestinationAddressCount parameter contains the number of destination addresses pointed to by the DestinationAddressList parameter. The CreateSortedAddressPairs function supports a maximum of 500 destination addresses.

If the CreateSortedAddressPairs function is successful, the SortedAddressPairList parameter points to an array of SOCKADDR_IN6_PAIR structures that contain the sorted address pairs. When this returned list is no longer required, free the memory used by the list by calling the FreeMibTable function.

See Also

Reference

IP Helper Functions
FreeMibTable
sockaddr
SOCKADDR_IN6_PAIR