The previous project architecture was far too complicated and hard to
maintain. The new one is much more simple. Although procedural macros
are cools, they are a no-go on Rust-OpenSMTPD.
Reports and filter are implemented (except data-line) but untested.
The construction of an EventHandler object should not be directly done
by the client. Instead, it is easier to use procedural macro to
automatize the process, hence exposing a nice and simple interface. Such
use of procedural macros requires to crate an additional crate.
The timestamp comes from OpenBSD's struct timeval, which defines the
number of seconds as a time_t (i64) and the number of micro-seconds as a
suseconds_t (long, hence i64 too). They are separated by a dot.
https://man.openbsd.org/gettimeofday.2
The latest OpenSMTPD draft added the timeout event, it therefore has
been added to the parser. As shown in the new sessions examples, the
timestamp format changed and the parameters are also optional.
The previous design did not handled errors correctly and was kind of
spaghetti code. With the new one, the reader and the dispatcher are
clearly separated. The filter will only exit on an error from the reader
or if EOF has been reached, any other error is displayed but does not
exit the filter, which is required by the API. If the filter must exit,
all threads are gracefully stopped.