Commit graph

10 commits

Author SHA1 Message Date
Rodolphe Bréard
dafea54dbb Log exclusively on stderr
OpenSMTPD reads filter responses on stdout, hence there must not be any
log written to this file descriptor.
2020-11-25 18:53:50 +01:00
Rodolphe Bréard
a6d4dd21c1 Rewrite the project
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.
2020-11-25 18:04:16 +01:00
Rodolphe Breard
789455668c Use procedural macros to define events
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.
2019-01-06 15:41:30 +01:00
Rodolphe Breard
d05423edba Use an intermediate function to build the handlers
Such a function may later be generated using a procedural macro.
2019-01-05 13:59:29 +01:00
Rodolphe Breard
2b87c9c3c3 Add the first draft of an event handler system 2019-01-05 13:00:09 +01:00
Rodolphe Breard
a6b9d18374 Update the entry parser
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.
2019-01-05 11:40:19 +01:00
Rodolphe Breard
98e4beadd3 Use a builder instead of a raw function
This pattern will, in the future, allow the registration of events
handlers and context objects.
2019-01-03 20:16:23 +01:00
Rodolphe Breard
c25dfb253a Add proper logging 2018-12-29 21:03:33 +01:00
Rodolphe Breard
24b332c615 Refactor the reader/dispatcher
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.
2018-12-29 20:22:37 +01:00
Rodolphe Breard
f57a201431 Read and parse incoming entries then dispatch them into session threads 2018-12-29 16:56:56 +01:00