RFID Guardian Software:Library:Generic library modules:Filter
From RFID Guardian
The filter is the datastructure that is used to dispatch incoming RFID frames to any module that is interested in seeing them. Dispatching is implemented by allowing modules to register filter callbacks with the filter. The aim of this implementation is maximum flexibility. The filter also offers its customer modules the possibility to send a response frame, or a (partially) corrupted response frame for jamming.
Each filter instantiation is tied to one port. In its turn, the filter registers port callbacks with its port to receive incoming untyped RFID frames (symbol streams) of the kinds it is interested in. Upon reception, the filter unmarshalls the symbol stream into an appropriately typed RFID frame. A somewhat special case is formed by those reader commands that consist of an isolated EOF only, like the slot markers in 15693 16-slot anticollision. For this kind of message, the filter registers a special handler with its port.
Filter callbacks can be invoked at different stages within the traversal of the frame through the filter. Specifically, there are 3 places where filters are invoked:
- pre callbacks
- are run at the start of a filter invocation, immediately after unmarshalling of the RFID frame. These callbacks return a command to indicate whether a response must be sent, and if so, they must provide a correctly formatted response. The obvious client is the spoofer module;
- second-chance callbacks
- are run after all pre callbacks have been run. Currently, the single client is the fuzzing module, which needs the opportunity to manipulate complete responses
- post callbacks
- that run after response marshalling and sending, if a pre filter has seen fit. An obvious client is the logger that logs requests, and optionally responses, in the latency.
The 15693 filter implementation transforms 16-slot inventories into equivalent 1-slot inventories. A reader that performs 16-slot inventory marks its slots by sending isolated EOF shapes. The filter implementation transforms each EOF punctuation into an equivalent 1-slot INVENTORY request frame: the values of mask/masklen are equivalent to the current mask in this slot of 16-slot inventory.
|Source||[ src/rfid-filter/mrg_rfid_filter.c ]|