Refactoring various usages of new IPAddr class.

Reducing number of places that internal representation was exposed
via GetBytes/CopyIPv6.

Also fixed a bug in remask_addr bif.
This commit is contained in:
Jon Siwek 2012-02-22 14:45:44 -06:00
parent d887eb3178
commit d7dafe2fe2
24 changed files with 301 additions and 267 deletions

View file

@ -65,15 +65,14 @@ OSFingerprint::OSFingerprint(FingerprintMode arg_mode)
bool OSFingerprint::CacheMatch(const IPAddr& addr, int id)
{
uint32 bytes[4];
addr.CopyIPv6(bytes);
HashKey key = HashKey(bytes, 4);
HashKey* key = addr.GetHashKey();
int* pid = new int;
*pid=id;
int* prev = os_matches.Insert(&key, pid);
int* prev = os_matches.Insert(key, pid);
bool ret = (prev ? *prev != id : 1);
if (prev)
delete prev;
delete key;
return ret;
}