lib-interface: Change API for interface 'options'
[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 #define IFACE_NONE_OPTION       0x00000000U
28 #define IFACE_DYNAMIC_OPTION    0x00000001U
29
30 bool ismyaddr(const struct sockaddr *ip);
31 bool ismyip_v4(struct in_addr ip);
32 bool is_local_net(const struct sockaddr *from);
33 void setup_linklocal_scope_id(struct sockaddr *pss);
34 bool is_local_net_v4(struct in_addr from);
35 int iface_count(void);
36 int iface_count_v4_nl(void);
37 const struct in_addr *first_ipv4_iface(void);
38 struct interface *get_interface(int n);
39 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
40 const struct in_addr *iface_n_ip_v4(int n);
41 const struct in_addr *iface_n_bcast_v4(int n);
42 const struct sockaddr_storage *iface_n_bcast(int n);
43 const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
44 bool iface_local(const struct sockaddr *ip);
45 void load_interfaces(void);
46 void gfree_interfaces(void);
47 bool interfaces_changed(void);
48 bool interface_ifindex_exists_with_options(int if_index, uint32_t options);
49
50 #endif /* _INTERFACE_H */