NetBSD/sbin/ifconfig/util.h
dyoung aa9db6efb2 Add to the string parse object (pstr), and its constructors, a flag that
tells whether it should detect and convert to binary a hexadecimal octet
string of the form 0x0123ABab, or leave those strings undecoded.

If the argument for a 'media', 'mediamode', 'mediaopt', '-mediaopt',
'nwkey', or 'bssid' keyword is a hexadecimal octet string, do not detect
and decode it.  (Note that setifnwkey decodes hexadecimal strings on its
own.)

This fixes a bug noticed by Jim Miller where the trailing zero-octets
were discarded from hexadecimal octet-string arguments for 'nwkey'.
2010-07-01 16:44:05 +00:00

36 lines
1.1 KiB
C

#ifndef _IFCONFIG_UTIL_H
#define _IFCONFIG_UTIL_H
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include "parse.h"
struct afswtch {
const char *af_name;
short af_af;
void (*af_status)(prop_dictionary_t, prop_dictionary_t, bool);
void (*af_addr_commit)(prop_dictionary_t, prop_dictionary_t);
SIMPLEQ_ENTRY(afswtch) af_next;
};
void print_link_addresses(prop_dictionary_t, bool);
const char *get_string(const char *, const char *, u_int8_t *, int *, bool);
const struct afswtch *lookup_af_byname(const char *);
const struct afswtch *lookup_af_bynum(int);
void print_string(const u_int8_t *, int);
int getsock(int);
struct paddr_prefix *prefixlen_to_mask(int, int);
int direct_ioctl(prop_dictionary_t, unsigned long, void *);
int indirect_ioctl(prop_dictionary_t, unsigned long, void *);
#ifdef INET6
void in6_fillscopeid(struct sockaddr_in6 *sin6);
#endif /* INET6 */
bool ifa_any_preferences(const char *, struct ifaddrs *, int);
void ifa_print_preference(const char *, const struct sockaddr *);
int16_t ifa_get_preference(const char *, const struct sockaddr *);
#endif /* _IFCONFIG_UTIL_H */