blob: 478cec3eedcd60c16515aa72a7304a577583e8c4 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef RTC_BASE_NET_HELPERS_H_
12#define RTC_BASE_NET_HELPERS_H_
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000013
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020014#if defined(WEBRTC_POSIX)
Yves Gerey988cc082018-10-23 12:03:01 +020015#include <sys/socket.h>
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020016#elif WEBRTC_WIN
17#include <winsock2.h> // NOLINT
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010018
19#include "rtc_base/win32.h"
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020020#endif
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000021
Ali Tofigh2ab914c2022-04-13 12:55:15 +020022#include "absl/strings/string_view.h"
Mirko Bonadei62ba3792023-01-20 17:32:07 +000023#include "rtc_base/system/rtc_export.h"
Ali Tofigh2ab914c2022-04-13 12:55:15 +020024
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020025namespace rtc {
26
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020027// rtc namespaced wrappers for inet_ntop and inet_pton so we can avoid
28// the windows-native versions of these.
Yves Gerey665174f2018-06-19 15:03:05 +020029const char* inet_ntop(int af, const void* src, char* dst, socklen_t size);
Ali Tofigh2ab914c2022-04-13 12:55:15 +020030int inet_pton(int af, absl::string_view src, void* dst);
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020031
Mirko Bonadei62ba3792023-01-20 17:32:07 +000032RTC_EXPORT bool HasIPv4Enabled();
33RTC_EXPORT bool HasIPv6Enabled();
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010034
Henrik Kjellanderec78f1c2017-06-29 07:52:50 +020035} // namespace rtc
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000036
Steve Anton10542f22019-01-11 09:11:00 -080037#endif // RTC_BASE_NET_HELPERS_H_