Lines Matching refs:address

31 ipv6_mask_adress_inplace(sockaddr *address, const sockaddr *mask)
33 in6_addr &i6addr = ((sockaddr_in6 *)address)->sin6_addr;
41 /*! Routing utility function: copies address \a from into a new address
44 address.
47 \return B_OK if the address could be copied
48 \return B_NO_MEMORY if the new address could not be allocated
50 address
51 \return B_MISMATCHED_VALUES if \a address does not match family AF_INET
86 /*! Routing utility function: applies \a mask to given \a address and puts
87 the resulting address into \a result.
89 \return B_BAD_VALUE if \a address is NULL or if any of \a address or \a mask
90 refers to an uninitialized address
93 ipv6_mask_address(const sockaddr *address, const sockaddr *mask,
96 if (address == NULL || address->sa_len == 0 || result == NULL
100 memcpy(result, address, sizeof(sockaddr_in6));
108 /*! Checks if the given \a address is the empty address. By default, the port
110 \return true if \a address is NULL, uninitialized or the empty address,
120 const sockaddr_in6 *address = (const sockaddr_in6 *)_address;
121 if (checkPort && address->sin6_port != 0)
124 return IN6_IS_ADDR_UNSPECIFIED(&address->sin6_addr);
128 /*! Checks if the given \a address is an Ipv6 address.
129 \return false if \a address is NULL, or with family different from AF_INET
130 true if it has AF_INET address family
133 ipv6_is_same_family(const sockaddr *address)
135 if (address == NULL)
138 return address->sa_family == AF_INET6;
142 /*! Compares the IP-addresses of the two given address structures \a a and \a b.
161 /*! Compares the ports of the two given address structures \a a and \a b.
173 /*! Compares the IP-addresses and ports of the two given address structures
297 /*! Creates a buffer for the given \a address and prints the address into
300 \return B_OK if the address could be printed, \a buffer will point to
310 const sockaddr_in6 *address = (const sockaddr_in6 *)_address;
315 if (address == NULL) {
326 if (!ip6_sprintf(&address->sin6_addr, buffer, bufferSize))
331 sprintf(port, "]:%d", ntohs(address->sin6_port));
359 /*! Determines the port of the given \a address.
363 ipv6_get_port(const sockaddr *address)
365 if (address == NULL || address->sa_len == 0)
368 return ((sockaddr_in6 *)address)->sin6_port;
372 /*! Sets the port of the given \a address to \a port.
374 \return B_BAD_VALUE if \a address is NULL or has not been initialized
377 ipv6_set_port(sockaddr *address, uint16 port)
379 if (address == NULL || address->sa_len == 0)
382 ((sockaddr_in6 *)address)->sin6_port = port;
387 /*! Sets \a address to \a from.
388 \return B_OK if \a from has been copied into \a address
389 \return B_BAD_VALUE if either \a address or \a from is NULL or if the
390 address given in from has not been initialized
394 ipv6_set_to(sockaddr *address, const sockaddr *from)
396 if (address == NULL || from == NULL || from->sa_len == 0)
402 memcpy(address, from, sizeof(sockaddr_in6));
403 address->sa_len = sizeof(sockaddr_in6);
408 /*! Updates missing parts in \a address with the values in \a from.
409 \return B_OK if \a address has been updated from \a from
410 \return B_BAD_VALUE if either \a address or \a from is NULL or if the
411 address given in from has not been initialized
417 sockaddr_in6 *address = (sockaddr_in6 *)_address;
420 if (address == NULL || from == NULL || from->sin6_len == 0)
426 address->sin6_family = AF_INET6;
427 address->sin6_len = sizeof(sockaddr_in6);
429 if (address->sin6_port == 0)
430 address->sin6_port = from->sin6_port;
432 if (IN6_IS_ADDR_UNSPECIFIED(&address->sin6_addr)) {
433 memcpy(address->sin6_addr.s6_addr, from->sin6_addr.s6_addr,
441 /*! Sets \a address to the empty address (0.0.0.0).
442 \return B_OK if \a address has been set
443 \return B_BAD_VALUE if \a address is NULL
446 ipv6_set_to_empty_address(sockaddr *address)
448 if (address == NULL)
451 memset(address, 0, sizeof(sockaddr_in6));
452 address->sa_len = sizeof(sockaddr_in6);
453 address->sa_family = AF_INET6;
463 sockaddr_in6 *address = (sockaddr_in6 *)_address;
466 if (address == NULL || defaultMask == NULL)
484 /*! Computes a hash value of the given \a address.
490 const sockaddr_in6* address = (const sockaddr_in6*)_address;
491 if (address == NULL || address->sin6_len == 0)
495 uint32 port = includePort ? address->sin6_port : 0;
497 uint32 result = jenkins_hashword((const uint32*)&address->sin6_addr,
515 /*! Adds the given \a address to the IP-checksum \a checksum.
516 \return B_OK if \a address has been added to the checksum
517 \return B_BAD_VALUE if either \a address or \a checksum is NULL or if
518 the given address is not initialized
521 ipv6_checksum_address(Checksum *checksum, const sockaddr *address)
523 if (checksum == NULL || address == NULL || address->sa_len == 0)
526 in6_addr &a = ((sockaddr_in6 *)address)->sin6_addr;
537 sockaddr_in6 *address = (sockaddr_in6 *)_address;
538 memset(address, 0, sizeof(sockaddr_in6));
539 address->sin6_len = sizeof(sockaddr_in6);
540 address->sin6_family = AF_INET6;
541 memcpy(&address->sin6_addr, &in6addr_loopback, sizeof(in6_addr));