1a575c5f22b1224113d37b01dc496f9c27a9d353
[samba.git] / source3 / lib / interface.h
1 /*
2  *
3  * Unix SMB/CIFS implementation.
4  *
5  * Type definitions for interfaces
6  *
7  * Copyright (c) 2020      Andreas Schneider <asn@samba.org>
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #ifndef _INTERFACE_H
23 #define _INTERFACE_H
24
25 #include <system/network.h>
26
27 bool ismyaddr(const struct sockaddr *ip);
28 bool ismyip_v4(struct in_addr ip);
29 bool is_local_net(const struct sockaddr *from);
30 void setup_linklocal_scope_id(struct sockaddr *pss);
31 bool is_local_net_v4(struct in_addr from);
32 int iface_count(void);
33 int iface_count_v4_nl(void);
34 const struct in_addr *first_ipv4_iface(void);
35 struct interface *get_interface(int n);
36 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
37 const struct in_addr *iface_n_ip_v4(int n);
38 const struct in_addr *iface_n_bcast_v4(int n);
39 const struct sockaddr_storage *iface_n_bcast(int n);
40 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
41 bool iface_local(const struct sockaddr *ip);
42 void load_interfaces(void);
43 void gfree_interfaces(void);
44 bool interfaces_changed(void);
45 bool interface_ifindex_exists(int if_index);
46
47 #endif /* _INTERFACE_H */