add partial support for filters, theoretical event support, more work on subscription interface

far too many things in this commit, unfortunately I cannot finish the work without async support, so I think it is better to merge as-is so we avoid big merge effort later
The event api might also have to be changed later, it is far from perfect.
I checked that everything compiles and tests work
Where is this file placed?