Class BSimFilter

java.lang.Object
ghidra.features.bsim.query.protocol.BSimFilter

public class BSimFilter extends Object
Suitable for client side filtering by calling isFiltered with an ExecutableRecord or evaluate with a FunctionDescription. Contains information for passing filter to server side. Each 'atom' of the filter (FilterAtom) is expressed as an operator and a value string. The operator (FilterType) indicates what part of the ExecutableRecord or FunctionDescription must match (or not match) the value string.
  • Constructor Details

    • BSimFilter

      public BSimFilter()
  • Method Details

    • numAtoms

      public int numAtoms()
    • getAtom

      public FilterAtom getAtom(int i)
    • addAtom

      public void addAtom(BSimFilterType type, String val)
    • clone

      public BSimFilter clone()
      Overrides:
      clone in class Object
    • clear

      public void clear()
    • isEmpty

      public boolean isEmpty()
    • saveXml

      public void saveXml(Writer fwrite) throws IOException
      Throws:
      IOException
    • restoreXml

      public void restoreXml(XmlPullParser parser)
    • evaluate

      public boolean evaluate(FunctionDescription func)
      Returns true if all filters resolve correctly for the given function description. There are 4 main types of filters, each of which must be evaluated differently:
       1) Positive Filter:    "<filter name> matches <filter value>". 
              For these, filter out any result that does not contain all elements (at a minimum) of the 
              filter value.
              ie: FILTER = "SetA",            RESULT = "SetA" => keep it
                          FILTER = "SetA, SetB",      RESULT = "SetA" => filter out
       
       2) Negative Filter:    "<filter name> does not match <filter value>"
                      For these, filter out any result that does not contain EXACTLY the filter value.
                      ie: FILTER = "SetA",            RESULT = "SetA, SetB"   => keep it
                          FILTER = "SetA, SetB",      RESULT = "SetA, SetB"   => filter out
       
       3) Positive Exe Filter:        Same as #1, but custom exe filters are stored differently than
                      'normal' categories and must be processed separately.
       
       4) Negative Exe Filter:        Same as #2, but custom exe filters are stored differently than
                      'normal' categories and must be processed separately.
       
      Parameters:
      func - the function description
      Returns:
      true if all filters resolve to true
    • replaceWith

      public void replaceWith(BSimFilter other)
    • getFilterEntries

      public List<BSimFilter.FilterEntry> getFilterEntries()