This module encapsulates and abstracts the interface with the
spawns worker threads
scanners, searching for valid strings.
A scanner is a thread with an individual search
Missioncontaining the encoding it searches for.
The input data is divided into consecutive overlapping memory chunks. A chunk is a couple of 4KB memory pages,
WIN_LENBytes in size.
Scanners are in pause state until they receive a pointer to a memory chunk with a dedicated search
All scanner-threads search simultaneously in one memory chunk only. This avoids that the threads drift to far apart.
Every scanner thread searches its encoding consecutively Byte by Byte from lower to higher memory.
When a scanner finds a valid string, it encodes it into a UTF-8 copy. Valid strings are composed of control characters and graphical characters.
The copy of the above valid string is split into one or several graphical strings. Hereby all control characters are omitted. The graphical strings are then concatenated and the result is stored in a
Finding-object also carries the memory location of the finding and a label describing the search mission. Goto 5.
A scanner stops when it passes the upper border
WIN_STEPof the current memory chunk.
The scanner stores its
Finding-objects in a vector referred as
Findings. The vector is ascending in memory location.
Every scanner sends its
Findingsto the merger-printer-thread. In order to resume later, it updates a marker in its
Mission-object pointing to the exact Byte where it has stopped scanning. Besides this marker, the scanner is stateless. Finally the scanner pauses and waits for the next memory chunk and mission.
After all scanners have finished their search in the current chunk, the merger-printer-thread receives the
Findingsand collects them in a vector.
The merger-printer-thread merges all
Findingsfrom all threads into one timeline and prints the formatted result through the output channel.
In order to prepare the next iteration, pointers are set to beginning of the next chunk. Every scanner resumes exactly where it stopped before.
Repeat until the last chunk is reached.
Holds the runtime environment for