How srijan023/seamless_sync works
Main Components
• User Interface (UI): Built using GTK (GTK4) with its implementation split between the src/ui directory (functions such as createButton, createMainWindow, and other UI components) and the related header files in include.
• Core Business Logic: Located in src, which includes the main application logic as well as specific functions for file sending, receiving, starting scans, etc. This layer orchestrates interactions between the UI, network, and encryption modules.
• Network Communication Layer: This handles direct LAN communication using sockets. Notice the presence of UDP, SSDP, and TCP client/server code spread between archive and src as well as helper functions in include (like getClientSocket, getServerSocket). This layer is responsible for both the file transfer and the integrated chat function.
• Security/Encryption Module: Provides AES encryption (files AES.h and AES.c) and RSA-based key initialization and operations. This ensures that encryption/decryption happen seamlessly when files or messages are transmitted.
• Utility/Helper Components: A set of functions that handle tasks like error handling (SSDPErrorHandle.c, UDPErrorHandler.c), IP retrieval (getMyIp.c), and configuration settings (headerConfig.c). These are part of the overall orchestration but help maintain modularity.
Relationships & Interactions
• The UI Layer communicates with the Core Business Logic through callback functions (onStartClicked, onSsdpScanCompleted, etc.) which then trigger network actions or file transfer procedures.
• The Core Logic triggers calls to the Network Communication Layer to establish connections (using sockets) and exchange data between devices. It also calls Encryption Modules to secure the transmitting data.
• The Encryption Module is used by both the file sender and receiver for encrypting and decrypting data respectively.
• Utility functions are utilized throughout, for error handling, configuration, and establishing network connections.
• The archive folder contains sample implementations and tests that provide additional clarity on how socket communication and different protocols are implemented, though the main logic is in the src folder.
Architectural Patterns & Design Principles
• Modularity: The code is separated into directories by concerns—headers (include), source (src), and experimental/demo code (archive). This allows for easier testing and debugging.
• Layered Architecture: There are clear layers—from the presentation (GTK driven UI in src/ui) to the business logic and network/encryption layers.
• Separation of Concerns: By isolating network operations, UI interactions, and security features, the design encourages loose coupling and better maintainability.
• Use of Standard Libraries & Frameworks: Integration with GTK4 for GUI and reliance on socket libraries in Linux ensures that industry-standard components are used.
Technologies, Frameworks, and Libraries
• GTK4: For building the GUI.
• GLib: Provides utilities and data structures required by GTK and overall application logic.
• CMake: Project configuration and build system.
• GCC/Clang: C compilers.
• Standard POSIX Socket Libraries for network communications.
• Custom encryption using AES and RSA.