xref: /netbsd-src/sbin/ifconfig/util.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 #ifndef _IFCONFIG_UTIL_H
2 #define _IFCONFIG_UTIL_H
3 
4 #include <netinet/in.h>
5 #include <sys/types.h>
6 #include <sys/socket.h>
7 #include <ifaddrs.h>
8 
9 #include "parse.h"
10 
11 struct afswtch {
12 	const char *af_name;
13 	short af_af;
14 	void (*af_status)(prop_dictionary_t, prop_dictionary_t, bool);
15 	void (*af_addr_commit)(prop_dictionary_t, prop_dictionary_t);
16 	bool (*af_addr_tentative)(struct ifaddrs *);
17 	bool (*af_addr_tentative_or_detached)(struct ifaddrs *);
18 	SIMPLEQ_ENTRY(afswtch)	af_next;
19 };
20 
21 void print_link_addresses(prop_dictionary_t, bool);
22 const char *get_string(const char *, const char *, u_int8_t *, int *, bool);
23 const struct afswtch *lookup_af_byname(const char *);
24 const struct afswtch *lookup_af_bynum(int);
25 void	print_string(const u_int8_t *, int);
26 int    getsock(int);
27 struct paddr_prefix *prefixlen_to_mask(int, int);
28 int direct_ioctl(prop_dictionary_t, unsigned long, void *);
29 int indirect_ioctl(prop_dictionary_t, unsigned long, void *);
30 bool ifa_any_preferences(const char *, struct ifaddrs *, int);
31 void ifa_print_preference(const char *, const struct sockaddr *);
32 int16_t ifa_get_preference(const char *, const struct sockaddr *);
33 
34 #endif /* _IFCONFIG_UTIL_H */
35