/** * @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); }
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); }
bool AddressResolution::findAddress(int family, void *addr) { return((ptree_match(ptree, family, addr, (family == AF_INET) ? 32 : 128) != NULL) ? true /* found */ : false /* not found */); }
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 */); }