Exemplo n.º 1
0
void in6_is_addr_mc_global(void) {
    int counter = 0;
    int swap_flag = 1;
    int tmp = 0;

    while(swap_flag == 1) {
        counter = 0;
        swap_flag = 0;

        while(counter < total_ip_addr - 1) {
            if((IN6_IS_ADDR_MC_GLOBAL(&s6[print_to_ip[counter]]) == 1) &&
               (IN6_IS_ADDR_MC_GLOBAL(&s6[print_to_ip[counter + 1]]) == 0)) {
                tmp = print_to_ip[counter];
                print_to_ip[counter] = print_to_ip[counter + 1];
                print_to_ip[counter + 1] = tmp;

                swap_flag = 1;
            }
            counter++;
        }
    }

    counter = 0;
    while(counter < total_ip_addr) {
        ip_to_print[print_to_ip[counter]] = counter;
        counter++;
    }

    return;
}
Exemplo n.º 2
0
/** Determines the IPv6 scope of a specified address.
 *
 * @param[in] v6Addr - The IPv6 address to be checked.
 *
 * @return The ipv6 scope of the address.
 *
 * @remarks The @p v6Addr parameter must be pointer to a 16-byte IPv6 
 *    address in binary form.
 * 
 * @internal
 */
static int setScopeFromAddress(const struct in6_addr * v6Addr)
{
   if (IN6_IS_ADDR_MULTICAST(v6Addr))
   {
      if (IN6_IS_ADDR_MC_GLOBAL(v6Addr))
         return SLP_SCOPE_GLOBAL;

      if (IN6_IS_ADDR_MC_ORGLOCAL(v6Addr))
         return SLP_SCOPE_ORG_LOCAL;

      if (IN6_IS_ADDR_MC_SITELOCAL(v6Addr))
         return SLP_SCOPE_SITE_LOCAL;

      if (IN6_IS_ADDR_MC_NODELOCAL(v6Addr))
         return SLP_SCOPE_NODE_LOCAL;

      if (IN6_IS_ADDR_MC_LINKLOCAL(v6Addr))
         return SLP_SCOPE_LINK_LOCAL;
   }
   if (IN6_IS_ADDR_SITELOCAL(v6Addr))
      return SLP_SCOPE_SITE_LOCAL;

   if (SLP_IN6_IS_ADDR_LOOPBACK(v6Addr))
      return SLP_SCOPE_NODE_LOCAL;

   if (IN6_IS_ADDR_LINKLOCAL(v6Addr))
      return SLP_SCOPE_LINK_LOCAL;

   return 0;
}
Exemplo n.º 3
0
bool
BNetworkAddress::IsMulticastGlobal() const
{
	switch (fAddress.ss_family) {
		case AF_INET6:
			return IN6_IS_ADDR_MC_GLOBAL(&((sockaddr_in6&)fAddress).sin6_addr);

		default:
			return false;
	}
}