Lines Matching defs:netaddr
1 /* $NetBSD: netaddr.c,v 1.10 2025/01/26 16:25:37 christos Exp $ */
24 #include <isc/netaddr.h>
124 isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
132 REQUIRE(netaddr != NULL);
134 switch (netaddr->family) {
136 type = &netaddr->type.in;
139 type = &netaddr->type.in6;
144 r = inet_ntop(netaddr->family, type, abuf, sizeof(abuf));
153 if (netaddr->family == AF_INET6 && netaddr->zone != 0) {
154 zlen = snprintf(zbuf, sizeof(zbuf), "%%%u", netaddr->zone);
286 isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina) {
287 memset(netaddr, 0, sizeof(*netaddr));
288 netaddr->family = AF_INET;
289 netaddr->type.in = *ina;
293 isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6) {
294 memset(netaddr, 0, sizeof(*netaddr));
295 netaddr->family = AF_INET6;
296 netaddr->type.in6 = *ina6;
300 isc_netaddr_setzone(isc_netaddr_t *netaddr, uint32_t zone) {
302 REQUIRE(netaddr->family == AF_INET6);
304 netaddr->zone = zone;
308 isc_netaddr_getzone(const isc_netaddr_t *netaddr) {
309 return netaddr->zone;
331 isc_netaddr_any(isc_netaddr_t *netaddr) {
332 memset(netaddr, 0, sizeof(*netaddr));
333 netaddr->family = AF_INET;
334 netaddr->type.in.s_addr = INADDR_ANY;
338 isc_netaddr_any6(isc_netaddr_t *netaddr) {
339 memset(netaddr, 0, sizeof(*netaddr));
340 netaddr->family = AF_INET6;
341 netaddr->type.in6 = in6addr_any;
345 isc_netaddr_unspec(isc_netaddr_t *netaddr) {
346 memset(netaddr, 0, sizeof(*netaddr));
347 netaddr->family = AF_UNSPEC;