From 98f698cf2b51192d474a8d94f72f344090ddefd7 Mon Sep 17 00:00:00 2001 From: kubistika Date: Sun, 12 May 2019 15:04:44 +0300 Subject: [PATCH] Add README for filters API --- server/proxy/filters/README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 server/proxy/filters/README.md diff --git a/server/proxy/filters/README.md b/server/proxy/filters/README.md new file mode 100644 index 000000000..c6b3b81c1 --- /dev/null +++ b/server/proxy/filters/README.md @@ -0,0 +1,27 @@ +# Proxy filter API + +`freerdp-proxy` has an API for filtering certain messages. A filter can register callbacks to events, allowing to record the data and control whether to pass/ignore the message, or right out drop the connection. + +During startup, the proxy loads its filters from the configuration: +```ini +[Filters] +; FilterName = FilterPath +DemoFilter = "server/proxy/demo.so" +``` + +## Currently supported events +* Mouse event +* Keyboard event + +## Developing a new filter +* Create a new file that includes `filters_api.h`. +* Implement the `filter_init` function and register the callbacks you are interested in. +* Each callback receives two parameters: + * `connectionInfo* info` holds connection info of the raised event. + * `void* param` holds the actual event data. It should be casted by the filter to the suitable struct from `filters_api.h`. +* Each callback must return a `PF_FILTER_RESULT`: + * `FILTER_IGNORE`: The event will not be proxied. + * `FILTER_PASS`: The event will be proxied. + * `FILTER_DROP`: The entire connection will be dropped. + +A demo can be found in `filter_demo.c`. \ No newline at end of file