blob: 7871932334a1c40803271c83e7a7959286f31f06 [file] [log] [blame]
Davidc4ef7b12013-01-12 20:39:47 +08001#if HAVE_GETIFADDRS
2#include <sys/types.h>
3#include <ifaddrs.h>
4#else
5#ifdef __cplusplus
6extern "C" {
7#endif
8/*
Andy Greenb5b23192013-02-11 17:13:32 +08009 * Copyright (c) 2000 Kungliga Tekniska H�gskolan
Davidc4ef7b12013-01-12 20:39:47 +080010 * (Royal Institute of Technology, Stockholm, Sweden).
11 * All rights reserved.
Andy Greenb5b23192013-02-11 17:13:32 +080012 *
Davidc4ef7b12013-01-12 20:39:47 +080013 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
Andy Greenb5b23192013-02-11 17:13:32 +080016 *
Davidc4ef7b12013-01-12 20:39:47 +080017 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
Andy Greenb5b23192013-02-11 17:13:32 +080019 *
Davidc4ef7b12013-01-12 20:39:47 +080020 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
Andy Greenb5b23192013-02-11 17:13:32 +080023 *
Davidc4ef7b12013-01-12 20:39:47 +080024 * 3. Neither the name of the Institute nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
Andy Greenb5b23192013-02-11 17:13:32 +080027 *
Davidc4ef7b12013-01-12 20:39:47 +080028 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 */
40
41/* $KTH: ifaddrs.hin,v 1.3 2000/12/11 00:01:13 assar Exp $ */
42
43#ifndef __ifaddrs_h__
44#define __ifaddrs_h__
45
46/*
47 * the interface is defined in terms of the fields below, and this is
48 * sometimes #define'd, so there seems to be no simple way of solving
49 * this and this seemed the best. */
50
51#undef ifa_dstaddr
52
53struct ifaddrs {
Andy Greenb5b23192013-02-11 17:13:32 +080054 struct ifaddrs *ifa_next;
55 char *ifa_name;
56 unsigned int ifa_flags;
57 struct sockaddr *ifa_addr;
58 struct sockaddr *ifa_netmask;
59 struct sockaddr *ifa_dstaddr;
60 void *ifa_data;
Davidc4ef7b12013-01-12 20:39:47 +080061};
62
63#ifndef ifa_broadaddr
64#define ifa_broadaddr ifa_dstaddr
65#endif
66
Andy Greenb5b23192013-02-11 17:13:32 +080067int getifaddrs(struct ifaddrs **);
Davidc4ef7b12013-01-12 20:39:47 +080068
Andy Greenb5b23192013-02-11 17:13:32 +080069void freeifaddrs(struct ifaddrs *);
Davidc4ef7b12013-01-12 20:39:47 +080070
71#endif /* __ifaddrs_h__ */
72
73#ifdef __cplusplus
74}
75#endif
76#endif