Layers
Requires: | com.ioninja.layer |
IO Ninja has two kinds of plugin — sessions and layers. The whole idea here is to separates heavy and light plugins.
Creating a full-fledged session plugin involves quite some work. At the very least, you need to create transport objects, create a transport-specific UI, define transport-specific log records, process UI events (and in response, perform certain IO operations), and finally, process IO events (and in response, write data to log and update the UI). Sounds intimidating, isn't it?
So, what if you just want to write a simple test application which would, let's say, wait for incoming commands over TCP connection and send something in return? We already have a TCP connection plugin, should we re-implement the whole thing? Besides, what if our simple test application also needs to run over Serial, not just TCP? Wouldn't it be better if we could write a simple piece of code which would reuse the existing connection and just add the desired features?
That's what IO Ninja layers are for.
A layer is a module you attach on top of an existing session. This session provides basic transport functionality, and the layer extends it. A layer can:
- Add custom UI to perform layer-specific operations (e.g., XModem send and receive);
- Listen for log records — and do something in response;
- Transmit data by passing to the underlying session;
- Filter the log — hide unwanted records according to some custom logic;
- Convert the log — produce a secondary log with decoded messages, thus analyzing an application-level protocol (e.g., Modbus)
All this allows writing different kinds of protocol analyzers, protocol emulators, filters, hilighters, testing programs and other useful utilities — which are capable of working independently from the underlying transport.