예제 #1
0
/**
 * @brief Check if the host matches the specifed host tree
 *
 * @param ptree     The hosts allowed to be accessed.
 * @return true if the host matches the ptre, false otherwise.
 */
bool IpAddress::match(patricia_tree_t *ptree) {
  patricia_node_t *node;

  if(ptree == NULL) return(true);

  if(addr.ipVersion == 4)
    node = ptree_match(ptree, AF_INET, (void*)&addr.ipType.ipv4, 32);
  else
    node = ptree_match(ptree, AF_INET6, (void*)&addr.ipType.ipv6, 128);

  return((node == NULL) ? false : true);
}
예제 #2
0
int16_t AddressTree::findAddress(int family, void *addr) {
  patricia_node_t *node = ptree_match(ptree, family, addr, (family == AF_INET) ? 32 : 128);

  if(node == NULL)
    return(-1);
  else
    return(node->user_data);
}
예제 #3
0
bool AddressResolution::findAddress(int family, void *addr) {
  return((ptree_match(ptree, family, addr, (family == AF_INET) ? 32 : 128) != NULL) ? true /* found */ : false /* not found */);
}
예제 #4
0
파일: Ntop.cpp 프로젝트: bemehow/ntopng
bool Ntop::isLocalInterfaceAddress(int family, void *addr) {
  return((ptree_match(local_interface_addresses, family, addr,
		      (family == AF_INET) ? 32 : 128) != NULL) ? true /* found */ : false /* not found */);
}