Skip to content

Commit

Permalink
cix(libsinsp): add function to set compiler filter and filter string
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo committed Jul 26, 2024
1 parent 64fe187 commit 21a39c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,13 @@ void sinsp::set_filter(const std::string& filter)
m_internal_flt_ast = compiler.get_filter_ast();
}

void sinsp::set_filter(const std::string& filterstring, std::unique_ptr<sinsp_filter> filter)
{
set_filter(filter);
m_filterstring = filterstring;
}


std::string sinsp::get_filter() const
{
return m_filterstring;
Expand Down
11 changes: 11 additions & 0 deletions userspace/libsinsp/sinsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ class SINSP_PUBLIC sinsp : public capture_stats_source
*/
void set_filter(std::unique_ptr<sinsp_filter> filter);

/*!
\brief Installs the given capture runtime filter object and accordingly
sets the filter string.
\param filter the filter string. Refer to the filtering language
section for information about the filtering
syntax.
\param filter the runtime filter object
*/
void set_filter(const std::string& filterstring, std::unique_ptr<sinsp_filter> filter);

/*!
\brief Return the filter set for this capture.
Expand Down

0 comments on commit 21a39c2

Please sign in to comment.