/* * Copyright 2023 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
int err = 0; int ret = 0; // Check for protocols in a do-while loop until we provide a buffer large // enough. (WSCEnumProtocols sets protbuff_size to its desired value). // It is extremely unlikely that this will loop more than once. do {
protocols.reset(newchar[protbuff_size]);
protocol_infos = reinterpret_cast<LPWSAPROTOCOL_INFOW>(protocols.get());
ret = WSCEnumProtocols(requested_protocols, protocol_infos, &protbuff_size,
&err);
} while (ret == SOCKET_ERROR && err == WSAENOBUFS);
if (ret == SOCKET_ERROR) { returnfalse;
}
// Even if ret is positive, check specifically for IPv6. // Non-IPv6 enabled WinXP will still return a RAW protocol. for (int i = 0; i < ret; ++i) { if (protocol_infos[i].iAddressFamily == AF_INET6) { returntrue;
}
} returnfalse; #elifdefined(WEBRTC_POSIX) && !defined(__native_client__) bool has_ipv6 = false; struct ifaddrs* ifa; if (getifaddrs(&ifa) < 0) { returnfalse;
} for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) { if (cur->ifa_addr != nullptr && cur->ifa_addr->sa_family == AF_INET6) {
has_ipv6 = true; break;
}
}
freeifaddrs(ifa); return has_ipv6; #else returntrue; #endif
}
} // namespace rtc
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.