wireshark/epan/dfilter/README.dfilter

41 lines
2.1 KiB
Plaintext
Executable File

$Id: README.dfilter,v 1.1 2004/02/27 12:00:30 obiot Exp $
How to add an operator FOO to the display filter language?
==========================================================
Go to ethereal/epan/dfilter/
Edit grammar.lemon and add the operator. Add the operator FOO and the test logic (defining TEST_OP_FOO).
Edit scanner.l and add the operator name(s) hence defining TOKEN_TEST_FOO. Also update the simple() or add the new operand's code.
Edit sttype-test.h and add the TEST_OP_FOO to the list of test operations.
Edit sttype-test.c and add TEST_OP_FOO to the num_operands() method.
Edit gencode.c, add TEST_OP_FOO in the gen_test() method by defining ANY_FOO.
Edit dfvm.h and add ANY_FOO to the enum dfvm_opcode_t structure.
Edit dfvm.c and add ANY_FOO to dfvm_dump() (for the dftest display filter test binary), to dfvm_apply() hence defining the methods fvalue_foo().
Edit semcheck.c and look at the check_relation_XXX() methods if they still apply to the foo operator; if not, amend the code. Start from the check_test() method to discover the logic.
Go to ethereal/epan/ftypes/
Edit ftypes.h and declare the fvalue_foo(), ftype_can_foo() and fvalue_foo() methods. Add the cmp_foo() method to the struct _ftype_t.
This is the first time that a make in ethereal/epan/dfilter/ can succeed. If it fails, then some code in the previously edited files must be corrected.
Edit ftypes.c and define the fvalue_foo() method with its associated logic. Define also the ftype_can_foo() and fvalue_foo() methods.
Edit all ftype-*.c files and add the required fvalue_foo() methods.
This is the point where you should be able to compile without errors in ethereal/epan/ftypes/. If not, first fix the errors.
Go to ethereal/epan/ and run make. If this one succeeds, then we're almost done as no errors should occur here.
Go to ethereal/ and run make. One thing to do is make dftest and see if you can construct valid display filters with your new operator. Or you may want to move directly to the generation of ethereal.
Look also at ethereal/gtk/dfilter_expr_dlg.c and edit the display filter expression generator.