diff --git a/CHANGES b/CHANGES index 00829c6d39..6746b0e86a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,24 @@ +2.3-12 | 2014-07-10 19:17:37 -0500 + + * Include yield of vectors in Broxygen's type descriptions. + Addresses BIT-1217. (Jon Siwek) + +2.3-11 | 2014-07-10 14:49:27 -0700 + + * Fixing DataSeries output. It was using a now illegal value as its + default compression level. (Robin Sommer) + +2.3-7 | 2014-06-26 17:35:18 -0700 + + * Extending "make test-all" to include aux/bro-aux. (Robin Sommer) + +2.3-6 | 2014-06-26 17:24:10 -0700 + + * DataSeries compilation issue fixed. (mlaterman) + + * Fix a reference counting bug in ListVal ctor. (Jon Siwek) + 2.3-3 | 2014-06-26 15:41:04 -0500 * Support tilde expansion when Bro tries to find its own path. (Jon diff --git a/Makefile b/Makefile index f4b2104c73..2b8e66503b 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,7 @@ test: test-all: test test -d aux/broctl && ( cd aux/broctl && make test ) test -d aux/btest && ( cd aux/btest && make test ) + test -d aux/bro-aux && ( cd aux/bro-aux && make test ) configured: @test -d $(BUILD) || ( echo "Error: No build/ directory found. Did you run configure?" && exit 1 ) diff --git a/VERSION b/VERSION index 2fdbb31cca..e6cb320816 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3-3 +2.3-12 diff --git a/scripts/base/frameworks/logging/writers/dataseries.bro b/scripts/base/frameworks/logging/writers/dataseries.bro index 0b7b2f5a03..b24601d6b9 100644 --- a/scripts/base/frameworks/logging/writers/dataseries.bro +++ b/scripts/base/frameworks/logging/writers/dataseries.bro @@ -8,9 +8,9 @@ export { ## 'none' -- No compression. ## 'lzf' -- LZF compression (very quick, but leads to larger output files). ## 'lzo' -- LZO compression (very fast decompression times). - ## 'gz' -- GZIP compression (slower than LZF, but also produces smaller output). + ## 'zlib' -- GZIP compression (slower than LZF, but also produces smaller output). ## 'bz2' -- BZIP2 compression (slower than GZIP, but also produces smaller output). - const compression = "gz" &redef; + const compression = "zlib" &redef; ## The extent buffer size. ## Larger values here lead to better compression and more efficient writes, diff --git a/src/Type.cc b/src/Type.cc index 71dd1821c2..6a0aa35b1b 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1745,7 +1745,17 @@ void VectorType::Describe(ODesc* d) const yield_type->Describe(d); } -BroType* base_type(TypeTag tag) +void VectorType::DescribeReST(ODesc* d, bool roles_only) const + { + d->Add(fmt(":bro:type:`%s` of ", type_name(Tag()))); + + if ( yield_type->GetName().empty() ) + yield_type->DescribeReST(d, roles_only); + else + d->Add(fmt(":bro:type:`%s`", yield_type->GetName().c_str())); + } + +BroType* base_type_no_ref(TypeTag tag) { static BroType* base_types[NUM_TYPES]; @@ -1761,7 +1771,7 @@ BroType* base_type(TypeTag tag) base_types[t]->SetLocationInfo(&l); } - return base_types[t]->Ref(); + return base_types[t]; } diff --git a/src/Type.h b/src/Type.h index e0d2a23265..e3ac8e1aae 100644 --- a/src/Type.h +++ b/src/Type.h @@ -607,6 +607,7 @@ public: bool IsUnspecifiedVector() const; void Describe(ODesc* d) const; + void DescribeReST(ODesc* d, bool roles_only = false) const; protected: VectorType() { yield_type = 0; } @@ -625,8 +626,14 @@ extern OpaqueType* topk_type; extern OpaqueType* bloomfilter_type; extern OpaqueType* x509_opaque_type; +// Returns the Bro basic (non-parameterized) type with the given type. +// The reference count of the type is not increased. +BroType* base_type_no_ref(TypeTag tag); + // Returns the BRO basic (non-parameterized) type with the given type. -extern BroType* base_type(TypeTag tag); +// The caller assumes responsibility for a reference to the type. +inline BroType* base_type(TypeTag tag) + { return base_type_no_ref(tag)->Ref(); } // Returns the BRO basic error type. inline BroType* error_type() { return base_type(TYPE_ERROR); } diff --git a/src/Val.cc b/src/Val.cc index fb7a1ce4ba..5f605a178e 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -1152,7 +1152,7 @@ bool PatternVal::DoUnserialize(UnserialInfo* info) } ListVal::ListVal(TypeTag t) -: Val(new TypeList(t == TYPE_ANY ? 0 : base_type(t))) +: Val(new TypeList(t == TYPE_ANY ? 0 : base_type_no_ref(t))) { tag = t; } diff --git a/src/logging/writers/DataSeries.cc b/src/logging/writers/DataSeries.cc index 71a6428950..2c14a51e25 100644 --- a/src/logging/writers/DataSeries.cc +++ b/src/logging/writers/DataSeries.cc @@ -235,7 +235,7 @@ DataSeries::DataSeries(WriterFrontend* frontend) : WriterBackend(frontend) threading::formatter::Ascii::SeparatorInfo sep_info; ascii = new threading::formatter::Ascii(this, sep_info); - compress_type = Extent::compress_none; + compress_type = Extent::compress_mode_none; log_file = 0; log_output = 0; } @@ -343,25 +343,25 @@ bool DataSeries::DoInit(const WriterInfo& info, int num_fields, const threading: compress_type = Extent::compress_all; if( ds_compression == "lzf" ) - compress_type = Extent::compress_lzf; + compress_type = Extent::compress_mode_lzf; else if( ds_compression == "lzo" ) - compress_type = Extent::compress_lzo; + compress_type = Extent::compress_mode_lzo; - else if( ds_compression == "gz" ) - compress_type = Extent::compress_gz; + else if( ds_compression == "zlib" ) + compress_type = Extent::compress_mode_zlib; else if( ds_compression == "bz2" ) - compress_type = Extent::compress_bz2; + compress_type = Extent::compress_mode_bz2; else if( ds_compression == "none" ) - compress_type = Extent::compress_none; + compress_type = Extent::compress_mode_none; else if( ds_compression == "any" ) compress_type = Extent::compress_all; else - Warning(Fmt("%s is not a valid compression type. Valid types are: 'lzf', 'lzo', 'gz', 'bz2', 'none', 'any'. Defaulting to 'any'", ds_compression.c_str())); + Warning(Fmt("%s is not a valid compression type. Valid types are: 'lzf', 'lzo', 'zlib', 'bz2', 'none', 'any'. Defaulting to 'any'", ds_compression.c_str())); log_type = log_types.registerTypePtr(schema); log_series.setType(log_type); diff --git a/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst b/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst new file mode 100644 index 0000000000..37eabb9419 --- /dev/null +++ b/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst @@ -0,0 +1,33 @@ +.. bro:id:: test_vector0 + + :Type: :bro:type:`vector` of :bro:type:`string` + :Default: + + :: + + [] + + Yield type is documented/cross-referenced for primitize types. + +.. bro:id:: test_vector1 + + :Type: :bro:type:`vector` of :bro:type:`TestRecord` + :Default: + + :: + + [] + + Yield type is documented/cross-referenced for composite types. + +.. bro:id:: test_vector2 + + :Type: :bro:type:`vector` of :bro:type:`vector` of :bro:type:`TestRecord` + :Default: + + :: + + [] + + Just showing an even fancier yield type. + diff --git a/testing/btest/doc/broxygen/vectors.bro b/testing/btest/doc/broxygen/vectors.bro new file mode 100644 index 0000000000..62fb31d436 --- /dev/null +++ b/testing/btest/doc/broxygen/vectors.bro @@ -0,0 +1,20 @@ +# @TEST-EXEC: bro -b -X broxygen.config %INPUT +# @TEST-EXEC: btest-diff autogen-reST-vectors.rst + +@TEST-START-FILE broxygen.config +identifier test_vector* autogen-reST-vectors.rst +@TEST-END-FILE + +type TestRecord: record { + field1: bool; + field2: count; +}; + +## Yield type is documented/cross-referenced for primitize types. +global test_vector0: vector of string; + +## Yield type is documented/cross-referenced for composite types. +global test_vector1: vector of TestRecord; + +## Just showing an even fancier yield type. +global test_vector2: vector of vector of TestRecord;