Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/os/linux/vm/ifaddrs.h
32285 views
/*1* Copyright (C) 2015 The Android Open Source Project2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* * Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* * Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in11* the documentation and/or other materials provided with the12* distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS15* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT16* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS17* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE18* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,20* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS21* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED22* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,23* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT24* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#pragma once2930/**31* @file ifaddrs.h32* @brief Access to network interface addresses.33*/3435#include <sys/cdefs.h>36#include <netinet/in.h>37#include <sys/socket.h>3839__BEGIN_DECLS4041/**42* Returned by getifaddrs() and freed by freeifaddrs().43*/44struct ifaddrs {45/** Pointer to the next element in the linked list. */46struct ifaddrs* ifa_next;4748/** Interface name. */49char* ifa_name;5051/** Interface flags (like `SIOCGIFFLAGS`). */52unsigned int ifa_flags;5354/** Interface address. */55struct sockaddr* ifa_addr;5657/** Interface netmask. */58struct sockaddr* ifa_netmask;5960union {61/** Interface broadcast address (if IFF_BROADCAST is set). */62struct sockaddr* ifu_broadaddr;6364/** Interface destination address (if IFF_POINTOPOINT is set). */65struct sockaddr* ifu_dstaddr;66} ifa_ifu;6768/** Unused. */69void* ifa_data;70};7172/** Synonym for `ifa_ifu.ifu_broadaddr` in `struct ifaddrs`. */73#define ifa_broadaddr ifa_ifu.ifu_broadaddr7475/** Synonym for `ifa_ifu.ifu_dstaddr` in `struct ifaddrs`. */76#define ifa_dstaddr ifa_ifu.ifu_dstaddr7778/**79* [getifaddrs(3)](http://man7.org/linux/man-pages/man3/getifaddrs.3.html) creates a linked list80* of `struct ifaddrs`. The list must be freed by freeifaddrs().81*82* Returns 0 and stores the list in `*__list_ptr` on success,83* and returns -1 and sets `errno` on failure.84*85* Available since API level 24.86*/87int getifaddrs(struct ifaddrs** __list_ptr); // __INTRODUCED_IN(24);8889/**90* [freeifaddrs(3)](http://man7.org/linux/man-pages/man3/freeifaddrs.3.html) frees a linked list91* of `struct ifaddrs` returned by getifaddrs().92*93* Available since API level 24.94*/95void freeifaddrs(struct ifaddrs* __ptr); // __INTRODUCED_IN(24);9697__END_DECLS9899100