Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ifaddrs.h
Go to the documentation of this file.
1// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_BIN_IFADDRS_H_
6#define RUNTIME_BIN_IFADDRS_H_
7
8// On Android getifaddrs API which is only supported directly by
9// Bionic starting at API level 24 so we provide our own implementation
10// which is API compatible. Otherwise we just include system ifaddrs.h
11
12#if defined(ANDROID) && __ANDROID_API__ < 24
13#include <sys/socket.h>
14
15namespace dart {
16namespace bin {
17
18struct ifaddrs {
19 struct ifaddrs* ifa_next;
20 char* ifa_name;
21 unsigned int ifa_flags;
22 struct sockaddr* ifa_addr;
23 struct sockaddr* ifa_netmask;
24 union {
25 struct sockaddr* ifu_broadaddr;
26 struct sockaddr* ifu_dstaddr;
27 } ifa_ifu;
28 void* ifa_data;
29};
30
31void freeifaddrs(struct ifaddrs* __ptr);
32int getifaddrs(struct ifaddrs** __list_ptr);
33
34} // namespace bin
35} // namespace dart
36
37#else
38
39#include <ifaddrs.h>
40
41#endif // defined(ANDROID) && __ANDROID_API__ < 24
42
43#endif // RUNTIME_BIN_IFADDRS_H_