mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Remove value serialization.
Note - this compiles, but you cannot run Bro anymore - it crashes immediately with a 0-pointer access. The reason behind it is that the required clone functionality does not work anymore.
This commit is contained in:
parent
9b49c7cbc6
commit
474efe9e69
78 changed files with 58 additions and 9185 deletions
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "Hasher.h"
|
||||
#include "NetVar.h"
|
||||
#include "Serializer.h"
|
||||
#include "digest.h"
|
||||
#include "siphash24.h"
|
||||
|
||||
|
@ -41,52 +40,6 @@ Hasher::digest_vector Hasher::Hash(const HashKey* key) const
|
|||
return Hash(key->Key(), key->Size());
|
||||
}
|
||||
|
||||
bool Hasher::Serialize(SerialInfo* info) const
|
||||
{
|
||||
return SerialObj::Serialize(info);
|
||||
}
|
||||
|
||||
Hasher* Hasher::Unserialize(UnserialInfo* info)
|
||||
{
|
||||
return reinterpret_cast<Hasher*>(SerialObj::Unserialize(info, SER_HASHER));
|
||||
}
|
||||
|
||||
bool Hasher::DoSerialize(SerialInfo* info) const
|
||||
{
|
||||
DO_SERIALIZE(SER_HASHER, SerialObj);
|
||||
|
||||
if ( ! SERIALIZE(static_cast<uint16>(k)) )
|
||||
return false;
|
||||
|
||||
if ( ! SERIALIZE(static_cast<uint64>(seed.h1)) )
|
||||
return false;
|
||||
|
||||
return SERIALIZE(static_cast<uint64>(seed.h2));
|
||||
}
|
||||
|
||||
bool Hasher::DoUnserialize(UnserialInfo* info)
|
||||
{
|
||||
DO_UNSERIALIZE(SerialObj);
|
||||
|
||||
uint16 serial_k;
|
||||
if ( ! UNSERIALIZE(&serial_k) )
|
||||
return false;
|
||||
|
||||
k = serial_k;
|
||||
assert(k > 0);
|
||||
|
||||
seed_t serial_seed;
|
||||
if ( ! UNSERIALIZE(&serial_seed.h1) )
|
||||
return false;
|
||||
|
||||
if ( ! UNSERIALIZE(&serial_seed.h2) )
|
||||
return false;
|
||||
|
||||
seed = serial_seed;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Hasher::Hasher(size_t arg_k, seed_t arg_seed)
|
||||
{
|
||||
k = arg_k;
|
||||
|
@ -167,31 +120,6 @@ bool DefaultHasher::Equals(const Hasher* other) const
|
|||
return hash_functions == o->hash_functions;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(DefaultHasher, SER_DEFAULTHASHER)
|
||||
|
||||
bool DefaultHasher::DoSerialize(SerialInfo* info) const
|
||||
{
|
||||
DO_SERIALIZE(SER_DEFAULTHASHER, Hasher);
|
||||
|
||||
// Nothing to do here, the base class has all we need serialized already.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultHasher::DoUnserialize(UnserialInfo* info)
|
||||
{
|
||||
DO_UNSERIALIZE(Hasher);
|
||||
|
||||
hash_functions.clear();
|
||||
for ( size_t i = 0; i < K(); ++i )
|
||||
{
|
||||
Hasher::seed_t s = Seed();
|
||||
s.h1 += bro_prng(i);
|
||||
hash_functions.push_back(UHF(s));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DoubleHasher::DoubleHasher(size_t k, seed_t seed)
|
||||
: Hasher(k, seed), h1(seed + bro_prng(1)), h2(seed + bro_prng(2))
|
||||
{
|
||||
|
@ -223,22 +151,3 @@ bool DoubleHasher::Equals(const Hasher* other) const
|
|||
return h1 == o->h1 && h2 == o->h2;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(DoubleHasher, SER_DOUBLEHASHER)
|
||||
|
||||
bool DoubleHasher::DoSerialize(SerialInfo* info) const
|
||||
{
|
||||
DO_SERIALIZE(SER_DOUBLEHASHER, Hasher);
|
||||
|
||||
// Nothing to do here, the base class has all we need serialized already.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DoubleHasher::DoUnserialize(UnserialInfo* info)
|
||||
{
|
||||
DO_UNSERIALIZE(Hasher);
|
||||
|
||||
h1 = UHF(Seed() + bro_prng(1));
|
||||
h2 = UHF(Seed() + bro_prng(2));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue