chiark / gitweb /
return any locally configured IP address if they exist
[elogind.git] / netlink.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #ifndef foonetlinkhfoo
4 #define foonetlinkhfoo
5
6 /***
7   This file is part of nss-myhostname.
8
9   Copyright 2008-2011 Lennart Poettering
10
11   nss-myhostname is free software; you can redistribute it and/or
12   modify it under the terms of the GNU Lesser General Public License
13   as published by the Free Software Foundation; either version 2.1 of
14   the License, or (at your option) any later version.
15
16   nss-myhostname is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19   Lesser General Public License for more details.
20
21   You should have received a copy of the GNU Lesser General Public
22   License along with nss-myhostname; If not, see
23   <http://www.gnu.org/licenses/>.
24 ***/
25
26 #include <inttypes.h>
27 #include <sys/types.h>
28 #include <assert.h>
29
30 struct address {
31         unsigned char family;
32         uint8_t address[16];
33         unsigned char scope;
34         int ifindex;
35 };
36
37 int netlink_acquire_addresses(struct address **_list, unsigned *_n_list);
38
39 static inline size_t PROTO_ADDRESS_SIZE(int proto) {
40         assert(proto == AF_INET || proto == AF_INET6);
41
42         return proto == AF_INET6 ? 16 : 4;
43 }
44
45 #endif