Fixing analyzer tag types for some Files::* functions.

This commit is contained in:
Robin Sommer 2015-02-08 18:21:23 -08:00
parent 530c3c0c6b
commit 23b9705a7b
3 changed files with 18 additions and 12 deletions

View file

@ -1,4 +1,10 @@
2.3-413 | 2015-02-08 18:23:05 -0800
* Fixing analyzer tag types for some Files::* functions. (Robin Sommer)
* Changing load order for plugin scripts. (Robin Sommer)
2.3-411 | 2015-02-05 10:05:48 -0600 2.3-411 | 2015-02-05 10:05:48 -0600
* Fix file analysis of files with total size below the bof_buffer size * Fix file analysis of files with total size below the bof_buffer size

View file

@ -1 +1 @@
2.3-411 2.3-413

View file

@ -267,7 +267,7 @@ export {
## mts: The set of MIME types, each in the form "foo/bar" (case-insensitive). ## mts: The set of MIME types, each in the form "foo/bar" (case-insensitive).
## ##
## Returns: True if the MIME types were successfully registered. ## Returns: True if the MIME types were successfully registered.
global register_for_mime_types: function(tag: Analyzer::Tag, mts: set[string]) : bool; global register_for_mime_types: function(tag: Files::Tag, mts: set[string]) : bool;
## Registers a MIME type for an analyzer. If a future file with this type is seen, ## Registers a MIME type for an analyzer. If a future file with this type is seen,
## the analyzer will be automatically assigned to parsing it. The function *adds* ## the analyzer will be automatically assigned to parsing it. The function *adds*
@ -278,20 +278,20 @@ export {
## mt: The MIME type in the form "foo/bar" (case-insensitive). ## mt: The MIME type in the form "foo/bar" (case-insensitive).
## ##
## Returns: True if the MIME type was successfully registered. ## Returns: True if the MIME type was successfully registered.
global register_for_mime_type: function(tag: Analyzer::Tag, mt: string) : bool; global register_for_mime_type: function(tag: Files::Tag, mt: string) : bool;
## Returns a set of all MIME types currently registered for a specific analyzer. ## Returns a set of all MIME types currently registered for a specific analyzer.
## ##
## tag: The tag of the analyzer. ## tag: The tag of the analyzer.
## ##
## Returns: The set of MIME types. ## Returns: The set of MIME types.
global registered_mime_types: function(tag: Analyzer::Tag) : set[string]; global registered_mime_types: function(tag: Files::Tag) : set[string];
## Returns a table of all MIME-type-to-analyzer mappings currently registered. ## Returns a table of all MIME-type-to-analyzer mappings currently registered.
## ##
## Returns: A table mapping each analyzer to the set of MIME types ## Returns: A table mapping each analyzer to the set of MIME types
## registered for it. ## registered for it.
global all_registered_mime_types: function() : table[Analyzer::Tag] of set[string]; global all_registered_mime_types: function() : table[Files::Tag] of set[string];
## Event that can be handled to access the Info record as it is sent on ## Event that can be handled to access the Info record as it is sent on
## to the logging framework. ## to the logging framework.
@ -306,8 +306,8 @@ redef record fa_file += {
global registered_protocols: table[Analyzer::Tag] of ProtoRegistration = table(); global registered_protocols: table[Analyzer::Tag] of ProtoRegistration = table();
# Store the MIME type to analyzer mappings. # Store the MIME type to analyzer mappings.
global mime_types: table[Analyzer::Tag] of set[string]; global mime_types: table[Files::Tag] of set[string];
global mime_type_to_analyzers: table[string] of set[Analyzer::Tag]; global mime_type_to_analyzers: table[string] of set[Files::Tag];
global analyzer_add_callbacks: table[Files::Tag] of function(f: fa_file, args: AnalyzerArgs) = table(); global analyzer_add_callbacks: table[Files::Tag] of function(f: fa_file, args: AnalyzerArgs) = table();
@ -401,7 +401,7 @@ function register_protocol(tag: Analyzer::Tag, reg: ProtoRegistration): bool
return result; return result;
} }
function register_for_mime_types(tag: Analyzer::Tag, mime_types: set[string]) : bool function register_for_mime_types(tag: Files::Tag, mime_types: set[string]) : bool
{ {
local rc = T; local rc = T;
@ -414,7 +414,7 @@ function register_for_mime_types(tag: Analyzer::Tag, mime_types: set[string]) :
return rc; return rc;
} }
function register_for_mime_type(tag: Analyzer::Tag, mt: string) : bool function register_for_mime_type(tag: Files::Tag, mt: string) : bool
{ {
if ( tag !in mime_types ) if ( tag !in mime_types )
{ {
@ -431,12 +431,12 @@ function register_for_mime_type(tag: Analyzer::Tag, mt: string) : bool
return T; return T;
} }
function registered_mime_types(tag: Analyzer::Tag) : set[string] function registered_mime_types(tag: Files::Tag) : set[string]
{ {
return tag in mime_types ? mime_types[tag] : set(); return tag in mime_types ? mime_types[tag] : set();
} }
function all_registered_mime_types(): table[Analyzer::Tag] of set[string] function all_registered_mime_types(): table[Files::Tag] of set[string]
{ {
return mime_types; return mime_types;
} }
@ -451,7 +451,7 @@ function describe(f: fa_file): string
return handler$describe(f); return handler$describe(f);
} }
event get_file_handle(tag: Analyzer::Tag, c: connection, is_orig: bool) &priority=5 event get_file_handle(tag: Files::Tag, c: connection, is_orig: bool) &priority=5
{ {
if ( tag !in registered_protocols ) if ( tag !in registered_protocols )
return; return;