2#include <ns3/core-module.h>
26 std::ostringstream output;
29 std::time_t now = std::time(
nullptr);
30 std::tm *lt = std::localtime(&now);
31 output <<
"[" << std::put_time(lt,
"%H:%M:%S") <<
"] ";
34 output <<
"[" << tag <<
"] " << message;
35 NS_LOG_UNCOND(output.str());
47 std::ostringstream msg;
48 msg <<
"Issued certificate to Node " << nodeId <<
" | Role: " << role
49 <<
" | Expiry: " << expiry;
50 Log(
"ZT-CERT", msg.str());
59 Log(
"ZT-CERT",
"Validation for Node " + std::to_string(nodeId) +
60 (valid ?
": VALID" :
": INVALID"));
68 Log(
"ZT-CERT",
"Node " + std::to_string(nodeId) +
" certificate revoked");
76 Log(
"ZT-CERT",
"Certificate rejected: " + reason);
87 Log(
"ZT-ENC",
"Payload encrypted | IV: " + ivHex +
" | Data: " + payload);
95 Log(
"ZT-DEC",
"Decrypted Payload: " + payload);
102 Log(
"ZT-DEC",
"Decryption failed: Invalid session or corrupt data");
static void LogCertRejected(const std::string &reason)
Logs a rejected certificate attempt with a reason.
static void LogCertIssued(uint32_t nodeId, const std::string &role, time_t expiry)
Logs a certificate issuance event.
static void LogCertRevoked(uint32_t nodeId)
Logs a certificate revocation event.
static void LogDecryption(const std::string &payload)
Logs a successful decryption event.
static void LogCertValidationResult(uint32_t nodeId, bool valid)
Logs the result of certificate validation.
static void LogDecryptionFailure()
Logs a decryption failure event.
static void EnableTimestamps(bool enable)
Enables or disables timestamp logging.
static void Log(const std::string &tag, const std::string &message)
Logs a general message with a specified tag.
static void LogEncryption(const std::string &payload, const std::string &ivHex)
Logs an encryption event with payload and IV.
static bool timestampsEnabled
Flag to indicate if timestamps are enabled in logs.