Merge remote-tracking branch 'origin/master' into topic/bernhard/sqlite

This commit is contained in:
Bernhard Amann 2012-06-14 15:15:58 -07:00
commit 0a439b6b61
12 changed files with 64 additions and 40 deletions

12
CHANGES
View file

@ -1,4 +1,16 @@
2.0-608 | 2012-06-11 15:59:00 -0700
* Add more error handling code to logging of enum vals. Addresses
#829. (Jon Siwek)
2.0-606 | 2012-06-11 15:55:56 -0700
* Fix summary lines for BIF documentation and corrected the
description of "fmt" and "floor" BIFs. (Daniel Thayer)
* Fix val_size BIF tests and improve docs. (Daniel Thayer)
2.0-602 | 2012-06-07 15:06:19 -0700 2.0-602 | 2012-06-07 15:06:19 -0700
* Include header for usleep(), caused compile failure on Archlinux. (Jon Siwek) * Include header for usleep(), caused compile failure on Archlinux. (Jon Siwek)

View file

@ -1 +1 @@
2.0-602 2.0-608

@ -1 +1 @@
Subproject commit b4094cb75e0a7769123f7db1f5d73f3f9f1c3977 Subproject commit 6f43a8115d8e6483a50957c5d21c5d69270ab3aa

@ -1 +1 @@
Subproject commit f938c81ada94641ab5f0231983edc2ba866b9a1f Subproject commit c6391412e902e896836450ab98910309b2ca2d9b

@ -1 +1 @@
Subproject commit 4e17842743fef8df6abf0588c7ca86c6937a2b6d Subproject commit 0d139c09d5a9c8623ecc2a5f395178f0ddcd7e16

@ -1 +1 @@
Subproject commit 589cb04c3d7e28a81aa07454e2b9b6b092f0e1af Subproject commit 880f3e48d33bb28d17184656f858a4a0e2e1574c

2
cmake

@ -1 +1 @@
Subproject commit 96f3d92acadbe1ae64f410e974c5ff503903394b Subproject commit 2a72c5e08e018cf632033af3920432d5f684e130

View file

@ -1494,6 +1494,8 @@ function sort%(v: any, ...%) : any
## v: The vector whose order to compute. ## v: The vector whose order to compute.
## ##
## Returns: A ``vector of count`` with the indices of the ordered elements. ## Returns: A ``vector of count`` with the indices of the ordered elements.
## For example, the elements of *v* in order are (assuming ``o``
## is the vector returned by ``order``): v[o[0]], v[o[1]], etc.
## ##
## .. bro:see:: sort ## .. bro:see:: sort
function order%(v: any, ...%) : index_vec function order%(v: any, ...%) : index_vec
@ -1669,9 +1671,10 @@ function cat_sep%(sep: string, def: string, ...%): string
## ##
## - ``[efg]``: Double ## - ``[efg]``: Double
## ##
## Returns: Returns the formatted string. Given no arguments, :bro:id:`fmt`. Given ## Returns: Returns the formatted string. Given no arguments, :bro:id:`fmt`
## no format string or the wrong number of additional arguments for the ## returns an empty string. Given no format string or the wrong
## given format specifier, :bro:id:`fmt` generates a run-time error. ## number of additional arguments for the given format specifier,
## :bro:id:`fmt` generates a run-time error.
## ##
## .. bro:see:: cat cat_sep string_cat cat_string_array cat_string_array_n ## .. bro:see:: cat cat_sep string_cat cat_string_array cat_string_array_n
function fmt%(...%): string function fmt%(...%): string
@ -1715,8 +1718,9 @@ function fmt%(...%): string
# #
# =========================================================================== # ===========================================================================
## Chops off any decimal digits of the given double, i.e., computes the ## Computes the greatest integer less than the given :bro:type:`double` value.
## "floor" of it. For example, ``floor(3.14)`` returns ``3.0``. ## For example, ``floor(3.14)`` returns ``3.0``, and ``floor(-3.14)``
## returns ``-4.0``.
## ##
## d: The :bro:type:`double` to manipulate. ## d: The :bro:type:`double` to manipulate.
## ##
@ -1895,8 +1899,9 @@ function reading_traces%(%): bool
return new Val(reading_traces, TYPE_BOOL); return new Val(reading_traces, TYPE_BOOL);
%} %}
## Returns statistics about the number of packets *(i)* received by Bro, ## Returns packet capture statistics. Statistics include the number of
## *(ii)* dropped, and *(iii)* seen on the link (not always available). ## packets *(i)* received by Bro, *(ii)* dropped, and *(iii)* seen on the
## link (not always available).
## ##
## Returns: A record of packet statistics. ## Returns: A record of packet statistics.
## ##
@ -1930,9 +1935,9 @@ function net_stats%(%): NetStats
return ns; return ns;
%} %}
## Returns Bro process statistics, such as real/user/sys CPU time, memory ## Returns Bro process statistics. Statistics include real/user/sys CPU time,
## usage, page faults, number of TCP/UDP/ICMP connections, timers, and events ## memory usage, page faults, number of TCP/UDP/ICMP connections, timers,
## queued/dispatched. ## and events queued/dispatched.
## ##
## Returns: A record with resource usage statistics. ## Returns: A record with resource usage statistics.
## ##
@ -2007,10 +2012,10 @@ function resource_usage%(%): bro_resources
return res; return res;
%} %}
## Returns statistics about the regular expression engine, such as the number ## Returns statistics about the regular expression engine. Statistics include
## of distinct matchers, DFA states, DFA state transitions, memory usage of ## the number of distinct matchers, DFA states, DFA state transitions, memory
## DFA states, cache hits/misses, and average number of NFA states across all ## usage of DFA states, cache hits/misses, and average number of NFA states
## matchers. ## across all matchers.
## ##
## Returns: A record with matcher statistics. ## Returns: A record with matcher statistics.
## ##
@ -2190,10 +2195,10 @@ function record_fields%(rec: any%): record_field_table
return fields; return fields;
%} %}
## Enables detailed collections of statistics about CPU/memory usage, ## Enables detailed collection of profiling statistics. Statistics include
## connections, TCP states/reassembler, DNS lookups, timers, and script-level ## CPU/memory usage, connections, TCP states/reassembler, DNS lookups,
## state. The script variable :bro:id:`profiling_file` holds the name of the ## timers, and script-level state. The script variable :bro:id:`profiling_file`
## file. ## holds the name of the file.
## ##
## .. bro:see:: net_stats ## .. bro:see:: net_stats
## resource_usage ## resource_usage
@ -2617,7 +2622,7 @@ function count_to_v4_addr%(ip: count%): addr
return new AddrVal(htonl(uint32(ip))); return new AddrVal(htonl(uint32(ip)));
%} %}
## Converts a :bro:type:`string` of bytes into an IP address. In particular, ## Converts a :bro:type:`string` of bytes into an IPv4 address. In particular,
## this function interprets the first 4 bytes of the string as an IPv4 address ## this function interprets the first 4 bytes of the string as an IPv4 address
## in network order. ## in network order.
## ##
@ -3016,8 +3021,8 @@ function decode_netbios_name_type%(name: string%): count
return new Val(return_val, TYPE_COUNT); return new Val(return_val, TYPE_COUNT);
%} %}
## Converts a string of bytes into its hexadecimal representation, e.g., ## Converts a string of bytes into its hexadecimal representation.
## ``"04"`` to ``"3034"``. ## For example, ``"04"`` would be converted to ``"3034"``.
## ##
## bytestring: The string of bytes. ## bytestring: The string of bytes.
## ##
@ -3279,7 +3284,7 @@ function mask_addr%(a: addr, top_bits_to_keep: count%): subnet
return new SubNetVal(a->AsAddr(), top_bits_to_keep); return new SubNetVal(a->AsAddr(), top_bits_to_keep);
%} %}
## Takes some top bits (e.g., subnet address) from one address and the other ## Takes some top bits (such as a subnet address) from one address and the other
## bits (intra-subnet part) from a second address and merges them to get a new ## bits (intra-subnet part) from a second address and merges them to get a new
## address. This is useful for anonymizing at subnet level while preserving ## address. This is useful for anonymizing at subnet level while preserving
## serial scans. ## serial scans.
@ -3516,7 +3521,7 @@ function skip_http_entity_data%(c: connection, is_orig: bool%): any
return 0; return 0;
%} %}
## Unescapes all characters in a URI, i.e., decodes every ``%xx`` group. ## Unescapes all characters in a URI (decode every ``%xx`` group).
## ##
## URI: The URI to unescape. ## URI: The URI to unescape.
## ##

View file

@ -828,7 +828,13 @@ threading::Value* Manager::ValToLogVal(Val* val, BroType* ty)
const char* s = const char* s =
val->Type()->AsEnumType()->Lookup(val->InternalInt()); val->Type()->AsEnumType()->Lookup(val->InternalInt());
if ( s )
lval->val.string_val = new string(s); lval->val.string_val = new string(s);
else
{
val->Type()->Error("enum type does not contain value", val);
lval->val.string_val = new string();
}
break; break;
} }

View file

@ -1,2 +0,0 @@
72
72

View file

@ -22,7 +22,6 @@ function myfunc2(a: double, b: double): int
event bro_init() event bro_init()
{ {
# TODO: these results don't make sense
# Tests without supplying a comparison function # Tests without supplying a comparison function

View file

@ -1,12 +1,16 @@
# #
# @TEST-EXEC: bro %INPUT > out # @TEST-EXEC: bro %INPUT
# @TEST-EXEC: btest-diff out
event bro_init() event bro_init()
{ {
local a = 1; local a = T;
local b = T; local b = 12;
local c: table[string] of addr = { ["a"] = 192.168.0.2, ["b"] = 10.0.0.2 };
if ( val_size(a) > val_size(b) )
exit(1);
if ( val_size(b) > val_size(c) )
exit(1);
print val_size(a);
print val_size(b);
} }