How henrypp/simplewall works
Project Type & Purpose
• This is a lightweight network filter configuration utility that uses the WFP APIs. It is a desktop tool that provides a custom UI for both setting up permanent and temporary filtering rules.
High-Level Architectural Components
• UI/Presentation Layer:
– Displays the rules editor, notifications, and settings screens.
• Business Logic / Core Engine:
– Includes the main application logic (main.c/main.h) and functions spread across helper.c/h, messages.c/h, and timer.c/h.
– Handles the rule syntax, logging (log.c/h), and profiles (profile.c/h).
• Network & Filtering Integration:
– Modules like network.c/h and wfp.c/h handle the integration with the Windows Filtering Platform.
– Manages installation/uninstallation of filters, as well as the interfacing with low-level Windows APIs.
• Data Management / Logging:
– Modules like db.c/h and log.c/h handle persistence of filter rules and logs.
• Internationalization (i18n):
– The “bin/i18n” folder includes multiple language files which indicate that the UI supports multiple locales.
• Build & Deployment:
– The solution file (simplewall.sln) and accompanying VC++ project files illustrate how the source is compiled.
– Batch files like build.bat and build_locale.bat show the automation for building and localization.
Relationships and Data Flow
• The UI layer interacts with the Core Engine to process user input (such as adding, modifying, or deleting filter rules).
• The Core Engine then calls into the Network & Filtering Integration layer to apply these rules through the Windows Filtering Platform.
• Logging and notifications are managed by dedicated modules that capture network events and user actions, then relay them back to the UI and write to log files.
• Configuration (for portable mode, settings, etc.) and internationalization settings are read from the file system (e.g., simplewall.ini and the “bin/i18n” files).
Architectural Patterns and Design Principles
• Layered Architecture: Separate UI, business logic, and integration with external systems (such as Windows APIs).
• Modularity: Each major function (like rule editing, logging, network filtering) lives in its own module for clarity and maintainability.
• Extensibility: The rules editor design allows for both global and application-specific rules, indicating that the system is built to be extended by the end user.
• Separation of Concerns: UI components do not directly handle low-level network filtering—the core engine abstracts these details.