mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 13:38:19 +00:00
Support unserializing broker data into type 'any'
The receiver side will wrap the data as a Broker::Data value, which can then be type-checked/cast via 'is' or 'as' operators to a specific Bro type. For example: Sender: Broker::publish("topic", my_event, "hello") Receiver: event my_event(arg: any) { if ( arg is string ) print arg as string; }
This commit is contained in:
parent
bd3c16c6d7
commit
d873acc9e3
4 changed files with 133 additions and 0 deletions
|
@ -772,6 +772,9 @@ struct type_checker {
|
|||
|
||||
Val* bro_broker::data_to_val(broker::data d, BroType* type)
|
||||
{
|
||||
if ( type->Tag() == TYPE_ANY )
|
||||
return bro_broker::make_data_val(move(d));
|
||||
|
||||
return broker::visit(val_converter{type}, std::move(d));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue