From da89e7ee6e1f2217a29c8023a082a7d26ff59b08 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jun 2025 21:10:08 +0530 Subject: [PATCH 1/4] Renamed --- scripts/base/init-bare.zeek | 6 +++--- src/script_opt/FuncInfo.cc | 2 +- src/zeek.bif | 8 ++++---- testing/btest/Baseline/bifs.get_tags_by_category/out | 2 -- ...t_tags_by_category.zeek => get_plugin_components.zeek} | 2 +- testing/btest/opt/ZAM-bif-tracking.zeek | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 testing/btest/Baseline/bifs.get_tags_by_category/out rename testing/btest/bifs/{get_tags_by_category.zeek => get_plugin_components.zeek} (79%) diff --git a/scripts/base/init-bare.zeek b/scripts/base/init-bare.zeek index cbe4b6fb8b..347313c0c0 100644 --- a/scripts/base/init-bare.zeek +++ b/scripts/base/init-bare.zeek @@ -375,15 +375,15 @@ type endpoint_stats: record { ## Record containing information about a tag. ## -## .. zeek:see:: get_tags_by_category -type tag_component: record { +## .. zeek:see:: get_plugin_components +type PluginComponent: record { name: string; canonical_name: string; tag: string; enabled: bool; }; -type tag_component_vec : vector of tag_component; +type PluginComponent_vec : vector of PluginComponent; ## Arguments given to Zeek from the command line. In order to use this, Zeek ## must use a ``--`` command line argument immediately followed by a script diff --git a/src/script_opt/FuncInfo.cc b/src/script_opt/FuncInfo.cc index 1ff3036e05..29f9a42ae2 100644 --- a/src/script_opt/FuncInfo.cc +++ b/src/script_opt/FuncInfo.cc @@ -317,7 +317,7 @@ static std::unordered_map func_attrs = { {"global_ids", ATTR_IDEMPOTENT}, {"global_options", ATTR_IDEMPOTENT}, {"gsub", ATTR_FOLDABLE}, - {"get_tags_by_category", ATTR_NO_ZEEK_SIDE_EFFECTS}, + {"get_plugin_components", ATTR_NO_ZEEK_SIDE_EFFECTS}, {"has_event_group", ATTR_NO_ZEEK_SIDE_EFFECTS}, {"has_module_events", ATTR_NO_ZEEK_SIDE_EFFECTS}, {"have_spicy", ATTR_IDEMPOTENT}, diff --git a/src/zeek.bif b/src/zeek.bif index 75e0ed1676..c4cf56588c 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -5653,7 +5653,7 @@ function find_in_zeekpath%(p: string%): string ## ## Returns: A vector of records containing the tags of all plugin components ## that belong to the specified category. -function get_tags_by_category%(category: string%): tag_component_vec +function get_plugin_components%(category: string%): PluginComponent_vec %{ std::string cat = category->CheckString(); auto type = CategoryStringToEnum(cat); @@ -5664,12 +5664,12 @@ function get_tags_by_category%(category: string%): tag_component_vec return nullptr; } - static auto vec_type = zeek::id::find_type("tag_component_vec"); - static auto rec_type = zeek::id::find_type("tag_component"); + static auto vec_type = zeek::id::find_type("PluginComponent_vec"); + static auto rec_type = zeek::id::find_type("PluginComponent"); if ( ! vec_type || ! rec_type ) { - reporter->Error("Required types not found (tag_component or component_vec)"); + reporter->Error("Required types not found (PluginComponent or PluginComponent_vec)"); return nullptr; } diff --git a/testing/btest/Baseline/bifs.get_tags_by_category/out b/testing/btest/Baseline/bifs.get_tags_by_category/out deleted file mode 100644 index d1f9bbac57..0000000000 --- a/testing/btest/Baseline/bifs.get_tags_by_category/out +++ /dev/null @@ -1,2 +0,0 @@ -### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. -[name=FTP, canonical_name=FTP, tag=ANALYZER_FTP, enabled=T] diff --git a/testing/btest/bifs/get_tags_by_category.zeek b/testing/btest/bifs/get_plugin_components.zeek similarity index 79% rename from testing/btest/bifs/get_tags_by_category.zeek rename to testing/btest/bifs/get_plugin_components.zeek index 7fe8e85549..d5cd92a8b0 100644 --- a/testing/btest/bifs/get_tags_by_category.zeek +++ b/testing/btest/bifs/get_plugin_components.zeek @@ -4,7 +4,7 @@ event zeek_init() { - local result = get_tags_by_category("ANALYZER"); + local result = get_plugin_components("ANALYZER"); for (i in result) { diff --git a/testing/btest/opt/ZAM-bif-tracking.zeek b/testing/btest/opt/ZAM-bif-tracking.zeek index c65d4932a0..687871038c 100644 --- a/testing/btest/opt/ZAM-bif-tracking.zeek +++ b/testing/btest/opt/ZAM-bif-tracking.zeek @@ -345,7 +345,7 @@ global known_BiFs = set( "get_reporter_stats", "get_resp_seq", "get_script_comments", - "get_tags_by_category", + "get_plugin_components", "get_thread_stats", "get_timer_stats", "getenv", From 1fba346f5dc121ff52d281ecfa3a8c2b9b7002b2 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jun 2025 21:22:21 +0530 Subject: [PATCH 2/4] Added Baseline --- testing/btest/Baseline/bifs.get_plugin_components/out | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 testing/btest/Baseline/bifs.get_plugin_components/out diff --git a/testing/btest/Baseline/bifs.get_plugin_components/out b/testing/btest/Baseline/bifs.get_plugin_components/out new file mode 100644 index 0000000000..d1f9bbac57 --- /dev/null +++ b/testing/btest/Baseline/bifs.get_plugin_components/out @@ -0,0 +1,2 @@ +### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. +[name=FTP, canonical_name=FTP, tag=ANALYZER_FTP, enabled=T] From 722381366b97b3ec144ce37db647736155fefc81 Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Wed, 25 Jun 2025 22:51:43 +0530 Subject: [PATCH 3/4] Update init-bare.zeek --- scripts/base/init-bare.zeek | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/base/init-bare.zeek b/scripts/base/init-bare.zeek index 347313c0c0..11d7a665b7 100644 --- a/scripts/base/init-bare.zeek +++ b/scripts/base/init-bare.zeek @@ -383,7 +383,7 @@ type PluginComponent: record { enabled: bool; }; -type PluginComponent_vec : vector of PluginComponent; +type plugin_component_vec : vector of PluginComponent; ## Arguments given to Zeek from the command line. In order to use this, Zeek ## must use a ``--`` command line argument immediately followed by a script From f9c34f29c7fc36cd85341a263a8828e93d8cc03d Mon Sep 17 00:00:00 2001 From: bhaskarbhar <126053496+bhaskarbhar@users.noreply.github.com> Date: Wed, 25 Jun 2025 22:53:29 +0530 Subject: [PATCH 4/4] Update zeek.bif --- src/zeek.bif | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zeek.bif b/src/zeek.bif index c4cf56588c..6e60ed9904 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -5653,7 +5653,7 @@ function find_in_zeekpath%(p: string%): string ## ## Returns: A vector of records containing the tags of all plugin components ## that belong to the specified category. -function get_plugin_components%(category: string%): PluginComponent_vec +function get_plugin_components%(category: string%): plugin_component_vec %{ std::string cat = category->CheckString(); auto type = CategoryStringToEnum(cat); @@ -5664,12 +5664,12 @@ function get_plugin_components%(category: string%): PluginComponent_vec return nullptr; } - static auto vec_type = zeek::id::find_type("PluginComponent_vec"); + static auto vec_type = zeek::id::find_type("plugin_component_vec"); static auto rec_type = zeek::id::find_type("PluginComponent"); if ( ! vec_type || ! rec_type ) { - reporter->Error("Required types not found (PluginComponent or PluginComponent_vec)"); + reporter->Error("Required types not found (PluginComponent or plugin_component_vec)"); return nullptr; }