Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/linux/vm/ifaddrs.h
32285 views
1
/*
2
* Copyright (C) 2015 The Android Open Source Project
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in
12
* the documentation and/or other materials provided with the
13
* distribution.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
* SUCH DAMAGE.
27
*/
28
29
#pragma once
30
31
/**
32
* @file ifaddrs.h
33
* @brief Access to network interface addresses.
34
*/
35
36
#include <sys/cdefs.h>
37
#include <netinet/in.h>
38
#include <sys/socket.h>
39
40
__BEGIN_DECLS
41
42
/**
43
* Returned by getifaddrs() and freed by freeifaddrs().
44
*/
45
struct ifaddrs {
46
/** Pointer to the next element in the linked list. */
47
struct ifaddrs* ifa_next;
48
49
/** Interface name. */
50
char* ifa_name;
51
52
/** Interface flags (like `SIOCGIFFLAGS`). */
53
unsigned int ifa_flags;
54
55
/** Interface address. */
56
struct sockaddr* ifa_addr;
57
58
/** Interface netmask. */
59
struct sockaddr* ifa_netmask;
60
61
union {
62
/** Interface broadcast address (if IFF_BROADCAST is set). */
63
struct sockaddr* ifu_broadaddr;
64
65
/** Interface destination address (if IFF_POINTOPOINT is set). */
66
struct sockaddr* ifu_dstaddr;
67
} ifa_ifu;
68
69
/** Unused. */
70
void* ifa_data;
71
};
72
73
/** Synonym for `ifa_ifu.ifu_broadaddr` in `struct ifaddrs`. */
74
#define ifa_broadaddr ifa_ifu.ifu_broadaddr
75
76
/** Synonym for `ifa_ifu.ifu_dstaddr` in `struct ifaddrs`. */
77
#define ifa_dstaddr ifa_ifu.ifu_dstaddr
78
79
/**
80
* [getifaddrs(3)](http://man7.org/linux/man-pages/man3/getifaddrs.3.html) creates a linked list
81
* of `struct ifaddrs`. The list must be freed by freeifaddrs().
82
*
83
* Returns 0 and stores the list in `*__list_ptr` on success,
84
* and returns -1 and sets `errno` on failure.
85
*
86
* Available since API level 24.
87
*/
88
int getifaddrs(struct ifaddrs** __list_ptr); // __INTRODUCED_IN(24);
89
90
/**
91
* [freeifaddrs(3)](http://man7.org/linux/man-pages/man3/freeifaddrs.3.html) frees a linked list
92
* of `struct ifaddrs` returned by getifaddrs().
93
*
94
* Available since API level 24.
95
*/
96
void freeifaddrs(struct ifaddrs* __ptr); // __INTRODUCED_IN(24);
97
98
__END_DECLS
99
100