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