ngtcp2_select_version

Synopsis

#include <ngtcp2/ngtcp2.h>

uint32_t ngtcp2_select_version(const uint32_t *preferred_versions, size_t preferred_versionslen, const uint32_t *offered_versions, size_t offered_versionslen)

ngtcp2_select_version() selects and returns a version from the version set offered_versions of offered_versionslen elements. preferred_versions of preferred_versionslen elements specifies the preference of versions, which is sorted in the order of preference. All versions included in preferred_versions must be supported by the library, that is, passing any version in the array to ngtcp2_is_supported_version() must return nonzero. This function is intended to be used by client when it receives Version Negotiation packet. If no version is selected, this function returns 0.