SockDiag.hpp

1. Overview

INET_DIAG lookup interface. Declares socket metadata and kernel diagnostic lookup functions for TCP and UDP endpoints.

The original source path is:

include/bsc/net/SockDiag.hpp

2. Role in the Daemon

This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.


3. Namespaces

  • bsc::net

4. Dependencies and Included Interfaces

  • cstdint
  • optional
  • string

5. Declared Types

  • struct SockInfo

6. API and Functions

The file declares or implements the following callable entry points:

  • std::optional<SockInfo> sockdiag_lookup_tcp(const std::string& src_ip, std::uint16_t src_port, const std::string& dst_ip, std::uint16_t dst_port)
  • std::optional<SockInfo> sockdiag_lookup_udp(const std::string& src_ip, std::uint16_t src_port, const std::string& dst_ip, std::uint16_t dst_port)

7. Security Considerations

  • The component processes privileged operating-system or network data and should run with only the capabilities required by its backend.

8. Implementation Considerations

  • Linux /proc data can disappear between reads because processes and sockets are inherently short-lived.

9. Licensing and Attribution

  • Copyright (C) 2025–2026 Calogero Scarnà
  • GPL-3.0

10. Source Metrics

MetricValue
File size2291 bytes
Lines59
Detected API entries2
Detected types1