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 13struct 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 23void print_link_addresses(prop_dictionary_t, bool); 24const char *get_string(const char *, const char *, u_int8_t *, int *, bool); 25const struct afswtch *lookup_af_byname(const char *); 26const struct afswtch *lookup_af_bynum(int); 27void print_string(const u_int8_t *, int); 28int getsock(int); 29struct paddr_prefix *prefixlen_to_mask(int, int); 30int direct_ioctl(prop_dictionary_t, unsigned long, void *); 31int indirect_ioctl(prop_dictionary_t, unsigned long, void *); 32bool ifa_any_preferences(const char *, struct ifaddrs *, int); 33void ifa_print_preference(const char *, const struct sockaddr *); 34int16_t ifa_get_preference(const char *, const struct sockaddr *); 35 36#endif /* _IFCONFIG_UTIL_H */ 37