fix acld plugin to use address instead of subnet (and add functions for

conversion)
This commit is contained in:
Johanna Amann 2015-06-05 00:00:20 -07:00
parent cedb80ff74
commit 17796182c6
6 changed files with 65 additions and 8 deletions

View file

@ -2398,7 +2398,7 @@ function to_subnet%(sn: string%): subnet
##
## a: The address to convert.
##
## Returns: The *sn* string as a :bro:type:`subnet`.
## Returns: The *a* address as a :bro:type:`subnet`.
##
## .. bro:see:: to_subset
function addr_to_subnet%(a: addr%): subnet
@ -2407,6 +2407,31 @@ function addr_to_subnet%(a: addr%): subnet
return new SubNetVal(a->AsAddr(), width);
%}
## Converts a :bro:type:`subnet` to a :bro:type:`addr` by
## extracting the prefix.
##
## s: The subnet to convert.
##
## Returns: The *s* subnet as a :bro:type:`addr`.
##
## .. bro:see:: to_subset
function subnet_to_addr%(sn: subnet%): addr
%{
return new AddrVal(sn->Prefix());
%}
## Returns the width of a :bro:type:`subnet`.
##
## s: The subnet to convert.
##
## Returns: The width of the subnet.
##
## .. bro:see:: to_subset
function subnet_width%(sn: subnet%): count
%{
return new Val(sn->Width(), TYPE_COUNT);
%}
## Converts a :bro:type:`string` to a :bro:type:`double`.
##
## str: The :bro:type:`string` to convert.