mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Support basic serialization of opaque.
This commit is contained in:
parent
aba8275346
commit
fa9aeeaaf1
3 changed files with 23 additions and 23 deletions
|
@ -179,6 +179,7 @@ SERIAL_TYPE(SUBNET_TYPE, 8)
|
||||||
SERIAL_TYPE(FILE_TYPE, 9)
|
SERIAL_TYPE(FILE_TYPE, 9)
|
||||||
SERIAL_TYPE(ENUM_TYPE, 10)
|
SERIAL_TYPE(ENUM_TYPE, 10)
|
||||||
SERIAL_TYPE(VECTOR_TYPE, 11)
|
SERIAL_TYPE(VECTOR_TYPE, 11)
|
||||||
|
SERIAL_TYPE(OPAQUE_TYPE, 12)
|
||||||
|
|
||||||
SERIAL_CONST2(ATTRIBUTES)
|
SERIAL_CONST2(ATTRIBUTES)
|
||||||
SERIAL_CONST2(EVENT_HANDLER)
|
SERIAL_CONST2(EVENT_HANDLER)
|
||||||
|
|
40
src/Type.cc
40
src/Type.cc
|
@ -1278,26 +1278,26 @@ void OpaqueType::Describe(ODesc* d) const
|
||||||
d->Add(name.c_str());
|
d->Add(name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Serialization semantics not yet defined.
|
IMPLEMENT_SERIAL(OpaqueType, SER_OPAQUE_TYPE);
|
||||||
//
|
|
||||||
// IMPLEMENT_SERIAL(OpaqueType, SER_OPAQUE_TYPE);
|
bool OpaqueType::DoSerialize(SerialInfo* info) const
|
||||||
//
|
{
|
||||||
// bool OpaqueType::DoSerialize(SerialInfo* info) const
|
DO_SERIALIZE(SER_OPAQUE_TYPE, BroType);
|
||||||
// {
|
|
||||||
// DO_SERIALIZE(SER_OPAQUE_TYPE, BroType);
|
// For now we only serialize the name of the type but will add type-specific
|
||||||
// return SERIALIZE(name);
|
// serialization code here when necessary.
|
||||||
// }
|
return SERIALIZE(name);
|
||||||
//
|
}
|
||||||
// bool OpaqueType::DoUnserialize(UnserialInfo* info)
|
|
||||||
// {
|
bool OpaqueType::DoUnserialize(UnserialInfo* info)
|
||||||
// DO_UNSERIALIZE(BroType);
|
{
|
||||||
//
|
DO_UNSERIALIZE(BroType);
|
||||||
// char const* n;
|
char const* n;
|
||||||
// if ( ! UNSERIALIZE_STR(&n, 0) );
|
if ( ! UNSERIALIZE_STR(&n, 0) );
|
||||||
// return false;
|
return false;
|
||||||
// name = n;
|
name = n;
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
|
|
||||||
EnumType::EnumType(const string& arg_name)
|
EnumType::EnumType(const string& arg_name)
|
||||||
: BroType(TYPE_ENUM)
|
: BroType(TYPE_ENUM)
|
||||||
|
|
|
@ -512,10 +512,9 @@ public:
|
||||||
protected:
|
protected:
|
||||||
OpaqueType() { }
|
OpaqueType() { }
|
||||||
|
|
||||||
// TODO: Serialization semantics not yet defined.
|
DECLARE_SERIAL(OpaqueType)
|
||||||
//DECLARE_SERIAL(OpaqueType)
|
|
||||||
|
|
||||||
const string name;
|
string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EnumType : public BroType {
|
class EnumType : public BroType {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue