xref: /netbsd-src/external/bsd/wpa/dist/src/utils/ip_addr.h (revision bb6183629cf165db498d8e1f4e2de129f7efb21c)
18dbcf02cSchristos /*
28dbcf02cSchristos  * IP address processing
38dbcf02cSchristos  * Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
48dbcf02cSchristos  *
5e604d861Schristos  * This software may be distributed under the terms of the BSD license.
6e604d861Schristos  * See README for more details.
78dbcf02cSchristos  */
88dbcf02cSchristos 
98dbcf02cSchristos #ifndef IP_ADDR_H
108dbcf02cSchristos #define IP_ADDR_H
118dbcf02cSchristos 
128dbcf02cSchristos struct hostapd_ip_addr {
138dbcf02cSchristos 	int af; /* AF_INET / AF_INET6 */
148dbcf02cSchristos 	union {
158dbcf02cSchristos 		struct in_addr v4;
168dbcf02cSchristos #ifdef CONFIG_IPV6
178dbcf02cSchristos 		struct in6_addr v6;
188dbcf02cSchristos #endif /* CONFIG_IPV6 */
198dbcf02cSchristos 		u8 max_len[16];
208dbcf02cSchristos 	} u;
218dbcf02cSchristos };
228dbcf02cSchristos 
238dbcf02cSchristos const char * hostapd_ip_txt(const struct hostapd_ip_addr *addr, char *buf,
248dbcf02cSchristos 			    size_t buflen);
258dbcf02cSchristos int hostapd_parse_ip_addr(const char *txt, struct hostapd_ip_addr *addr);
26*bb618362Schristos bool hostapd_ip_equal(const struct hostapd_ip_addr *a,
27*bb618362Schristos 		      const struct hostapd_ip_addr *b);
288dbcf02cSchristos 
298dbcf02cSchristos #endif /* IP_ADDR_H */
30