mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Merge branch 'topic/bernhard/log-send-proto' into topic/bernhard/log-threads
Send protocol type to log writers - the ascii writer simply ignores this, but the input reader needs support for this. Conflicts: src/LogMgr.h src/logging/Manager.cc
This commit is contained in:
commit
115e6a18b4
4 changed files with 37 additions and 4 deletions
|
@ -117,9 +117,34 @@ bool Value::Read(SerializationFormat* fmt)
|
|||
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
case TYPE_PORT:
|
||||
return fmt->Read(&val.uint_val, "uint");
|
||||
|
||||
case TYPE_PORT: {
|
||||
int proto;
|
||||
if ( ! (fmt->Read(&val.port_val.port, "port") && fmt->Read(&proto, "proto") ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (proto) {
|
||||
case 0:
|
||||
val.port_val.proto = TRANSPORT_UNKNOWN;
|
||||
break;
|
||||
case 1:
|
||||
val.port_val.proto = TRANSPORT_TCP;
|
||||
break;
|
||||
case 2:
|
||||
val.port_val.proto = TRANSPORT_UDP;
|
||||
break;
|
||||
case 3:
|
||||
val.port_val.proto = TRANSPORT_ICMP;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
case TYPE_SUBNET:
|
||||
{
|
||||
uint32 net[4];
|
||||
|
@ -232,9 +257,11 @@ bool Value::Write(SerializationFormat* fmt) const
|
|||
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
case TYPE_PORT:
|
||||
return fmt->Write(val.uint_val, "uint");
|
||||
|
||||
case TYPE_PORT:
|
||||
return fmt->Write(val.port_val.port, "port") && fmt->Write(val.port_val.proto, "proto");
|
||||
|
||||
case TYPE_SUBNET:
|
||||
{
|
||||
uint32 net[4];
|
||||
|
|
|
@ -60,6 +60,7 @@ struct Value {
|
|||
|
||||
struct set_t { bro_int_t size; Value** vals; };
|
||||
typedef set_t vec_t;
|
||||
struct port_t { bro_uint_t port; TransportProto proto; };
|
||||
|
||||
/**
|
||||
* This union is a subset of BroValUnion, including only the types we
|
||||
|
@ -68,6 +69,7 @@ struct Value {
|
|||
union _val {
|
||||
bro_int_t int_val;
|
||||
bro_uint_t uint_val;
|
||||
port_t port_val;
|
||||
uint32 addr_val[NUM_ADDR_WORDS];
|
||||
subnet_type subnet_val;
|
||||
double double_val;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue