Tue Feb 21 17:19:47 EST 2006
C code cleanup
looking at the C code, there's a lot of stuff that went terribly wrong.
half of it is type checking and low level list manipulation. very very wrong.
how can this be cleaned up? is it possible to remove lowlevel list manipulation?
some common practices:
* packets: stack->int->header->struct
* scalars: check type and copy to c local variable
* packets: check if packet + inspect struct to see if its workable
so it's time for some guidelines about writing plugins:
* write type checking macros. don't do this manually.
* store all temporary data on the data stack. this way multiple exits are
easy to implement
* don't access lists directly, use a set of macros
* use pf interface only for glue to existing C modules
need to fill pf/macros.h with good words and ACTUALLY USE THEM in
an example plugin.