restructure of verify module for better code organizations
This commit is contained in:
27
modules/verify/include/cli_parsers.hpp
Normal file
27
modules/verify/include/cli_parsers.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
/**
|
||||
* @enum Command
|
||||
* @brief Enumeration of supported commands for the verify module
|
||||
*/
|
||||
enum Command {
|
||||
CMD_UNKNOWN, /**< Unknown or unsupported command */
|
||||
CMD_HELP, /**< Display help information */
|
||||
CMD_CHECKSUM, /**< Verify package checksums */
|
||||
CMD_SIGNATURE, /**< Verify package signatures */
|
||||
CMD_CHECK /**< Check build module integration */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Parses a command string into a Command enum value
|
||||
*
|
||||
* Converts a command string to the appropriate Command enum value
|
||||
* for internal routing.
|
||||
*
|
||||
* @param cmd_str The command string to parse
|
||||
* @return The corresponding Command enum value
|
||||
*/
|
||||
Command parse_command(const char* cmd_str);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file verify_commands.hpp
|
||||
* @file commands.hpp
|
||||
* @brief Header file for the verify module command handlers
|
||||
*
|
||||
* Defines functions and enumerations for the verify module which verifies
|
||||
@@ -19,18 +19,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <filesystem>
|
||||
|
||||
/**
|
||||
* @enum Command
|
||||
* @brief Enumeration of supported commands for the verify module
|
||||
*/
|
||||
enum Command {
|
||||
CMD_UNKNOWN, /**< Unknown or unsupported command */
|
||||
CMD_HELP, /**< Display help information */
|
||||
CMD_CHECKSUM, /**< Verify package checksums */
|
||||
CMD_SIGNATURE, /**< Verify package signatures */
|
||||
CMD_CHECK /**< Check build module integration */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Handler for the checksum command
|
||||
*
|
||||
@@ -121,17 +109,6 @@ int cmd_check_help(int argc, char** argv);
|
||||
*/
|
||||
int cmd_unknown(const char* command, int argc, char** argv);
|
||||
|
||||
/**
|
||||
* @brief Parses a command string into a Command enum value
|
||||
*
|
||||
* Converts a command string to the appropriate Command enum value
|
||||
* for internal routing.
|
||||
*
|
||||
* @param cmd_str The command string to parse
|
||||
* @return The corresponding Command enum value
|
||||
*/
|
||||
Command parse_command(const char* cmd_str);
|
||||
|
||||
/**
|
||||
* @brief Helper function to check and load the build module
|
||||
*
|
||||
57
modules/verify/include/verification.hpp
Normal file
57
modules/verify/include/verification.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @file verification.hpp
|
||||
* @brief Functions for verifying package integrity and signatures
|
||||
*
|
||||
* Defines functions for verifying checksums and signatures of DPM packages
|
||||
* and package stage directories.
|
||||
*
|
||||
* @copyright Copyright (c) 2025 SILO GROUP LLC
|
||||
* @author Chris Punches <chris.punches@silogroup.org>
|
||||
*
|
||||
* Part of the Dark Horse Linux Package Manager (DPM)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <dpmdk/include/CommonModuleAPI.hpp>
|
||||
|
||||
/**
|
||||
* @brief Verifies checksums for a package file
|
||||
*
|
||||
* Checks the integrity of a package file by verifying its checksums.
|
||||
*
|
||||
* @param package_path Path to the package file
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
int verify_checksums_package(const std::string& package_path);
|
||||
|
||||
/**
|
||||
* @brief Verifies checksums for a package stage directory
|
||||
*
|
||||
* Checks the integrity of a package stage directory by verifying its checksums.
|
||||
*
|
||||
* @param stage_dir Path to the stage directory
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
int verify_checksums_stage(const std::string& stage_dir);
|
||||
|
||||
/**
|
||||
* @brief Verifies signatures for a package file
|
||||
*
|
||||
* Checks the signatures of a package file.
|
||||
*
|
||||
* @param package_path Path to the package file
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
int verify_signature_package(const std::string& package_path);
|
||||
|
||||
/**
|
||||
* @brief Verifies signatures for a package stage directory
|
||||
*
|
||||
* Checks the signatures of a package stage directory.
|
||||
*
|
||||
* @param stage_dir Path to the stage directory
|
||||
* @return 0 on success, non-zero on failure
|
||||
*/
|
||||
int verify_signature_stage(const std::string& stage_dir);
|
||||
Reference in New Issue
Block a user