Rename paraglob_get to paraglob_match

After going back to the original bug, I think this naming makes things a
bit more understandable.

GH-268
This commit is contained in:
Johanna Amann 2019-06-24 15:42:42 -07:00
parent 54613ad2b8
commit 31973f76ce
7 changed files with 22 additions and 23 deletions

2
NEWS
View file

@ -117,7 +117,7 @@ New Functionality
local v1 = vector("*", "d?g", "*og", "d?", "d[!wl]g");
local p1 = paraglob_init(v1);
print paraglob_get(p1, "dog");
print paraglob_match(p1, "dog");
Changed Functionality
---------------------

2
doc

@ -1 +1 @@
Subproject commit 843f601f9236bef694959d5bf336cb0e4fbaea31
Subproject commit a17aedc23e4670e627b23f65b6a5b326e050cb6b

View file

@ -795,7 +795,7 @@ function sha256_hash_finish%(handle: opaque of sha256%): string
##
## Returns: A new, compiled, paraglob with the patterns in *v*
##
## .. zeek:see::paraglob_get paraglob_equals paraglob_add
## .. zeek:see::paraglob_match paraglob_equals paraglob_add
function paraglob_init%(v: any%) : opaque of paraglob
%{
if ( v->Type()->Tag() != TYPE_VECTOR ||
@ -827,18 +827,18 @@ function paraglob_init%(v: any%) : opaque of paraglob
}
%}
## Gets all the strings inside the handle associated with an input pattern.
## Gets all the patterns inside the handle associated with an input string.
##
## handle: A compiled paraglob.
##
## pattern: A glob style pattern.
## match: string to match against the paraglob.
##
## Returns: A vector of strings matching the input pattern
## Returns: A vector of strings matching the input string.
##
## ## .. zeek:see::paraglob_add paraglob_equals paraglob_init
function paraglob_get%(handle: opaque of paraglob, pat: string%): string_vec
function paraglob_match%(handle: opaque of paraglob, match: string%): string_vec
%{
return static_cast<ParaglobVal*>(handle)->Get(pat);
return static_cast<ParaglobVal*>(handle)->Get(match);
%}
## Compares two paraglobs for equality.
@ -849,7 +849,7 @@ function paraglob_get%(handle: opaque of paraglob, pat: string%): string_vec
##
## Returns: True if both paraglobs contain the same patterns, false otherwise.
##
## ## .. zeek:see::paraglob_add paraglob_get paraglob_init
## ## .. zeek:see::paraglob_add paraglob_match paraglob_init
function paraglob_equals%(p_one: opaque of paraglob, p_two: opaque of paraglob%) : bool
%{
return val_mgr->GetBool(

View file

@ -23,12 +23,12 @@ event new_connection (c : connection)
# p_eq and p1 should be the same paraglobs
print paraglob_equals(p_eq, p1);
print paraglob_get(p1, "dog");
print paraglob_match(p1, "dog");
print paraglob_get(p2, "once");
print paraglob_get(p3, "www.strange-malware-domain.gov");
print paraglob_match(p2, "once");
print paraglob_match(p3, "www.strange-malware-domain.gov");
local large_glob: opaque of paraglob = paraglob_init(v3);
print paraglob_get(large_glob, "www.strange-malware-domain.gov");
print paraglob_match(large_glob, "www.strange-malware-domain.gov");
}

View file

@ -88,6 +88,6 @@ event zeek_init()
local p2 = copy(p);
print paraglob_equals(p, p2);
# A get operation shouldn't change the paraglob
paraglob_get(p, "whitehouse.gov");
paraglob_match(p, "whitehouse.gov");
print paraglob_equals(p, p2);
}

View file

@ -19,7 +19,7 @@ global ping: event(msg: opaque of paraglob, c: count);
event zeek_init()
{
print "Starting send.";
print paraglob_get(p, "hello");
print paraglob_match(p, "hello");
Broker::subscribe("bro/event/my_topic");
Broker::peer("127.0.0.1", 9999/tcp);
print "is_remote should be F, and is", is_remote_event();
@ -93,7 +93,7 @@ event ping(msg: opaque of paraglob, n: count)
return;
}
print fmt("receiver got ping number: %s", n);
print paraglob_get(msg, "hello");
print paraglob_match(msg, "hello");
local e = Broker::make_event(pong, msg, n);
Broker::publish("bro/event/my_topic", e);

View file

@ -20,13 +20,12 @@ event zeek_init ()
print paraglob_equals(p_eq, p1);
print paraglob_equals(p1, p2);
print paraglob_get(p1, "dog");
print paraglob_match(p1, "dog");
print paraglob_get(p2, "once");
print paraglob_get(p2, "nothing");
print paraglob_get(p3, "www.strange-malware-domain.gov");
print paraglob_get(p4, "zero\0zero");
print paraglob_match(p2, "once");
print paraglob_match(p2, "nothing");
print paraglob_match(p3, "www.strange-malware-domain.gov");
print paraglob_match(p4, "zero\0zero");
# This looks like a lot, but really should complete quickly.
# Paraglob should stop addition of duplicate patterns.
@ -37,5 +36,5 @@ event zeek_init ()
}
local large_glob: opaque of paraglob = paraglob_init(v3);
print paraglob_get(large_glob, "www.strange-malware-domain.gov");
print paraglob_match(large_glob, "www.strange-malware-domain.gov");
}