Skip to content

feat(interfaces): add unified transport interfaces (IHttpClient, IUdpClient)#235

Merged
kcenon merged 2 commits into
mainfrom
feature/issue-233-transport-interfaces
Dec 26, 2025
Merged

feat(interfaces): add unified transport interfaces (IHttpClient, IUdpClient)#235
kcenon merged 2 commits into
mainfrom
feature/issue-233-transport-interfaces

Conversation

@kcenon

@kcenon kcenon commented Dec 26, 2025

Copy link
Copy Markdown
Owner

Summary

Add abstract transport interfaces to common_system for dependency injection across the ecosystem, resolving circular dependency risks between monitoring_system and network_system.

Priority: CRITICAL - This is a blocking dependency for Epic #232 (Cross-Module Circular Dependency Resolution)

Changes

New Files

  • include/kcenon/common/interfaces/transport/http_client_interface.h - HTTP client interface
  • include/kcenon/common/interfaces/transport/udp_client_interface.h - UDP client interface
  • include/kcenon/common/interfaces/transport.h - Umbrella header
  • tests/transport_interface_test.cpp - Unit tests (26 tests)

Interface Features

IHttpClient

  • http_request/http_response structs with builder pattern
  • Status helpers: is_success(), is_client_error(), is_server_error()
  • HttpClientFactory and IHttpClientProvider for DI
  • null_http_client no-op implementation

IUdpClient

  • Connected mode: connect() + send() with kernel routing optimization
  • Connectionless mode: send_to() for ad-hoc delivery
  • Statistics tracking: packets_sent, bytes_sent, send_failures
  • String convenience methods for metric strings
  • UdpClientFactory and IUdpClientProvider for DI
  • null_udp_client no-op implementation

Design Decisions

  • Header-only: No runtime dependencies, matches existing common_system architecture
  • C++20 required: Uses std::span for zero-copy data transfer
  • Builder pattern: Fluent API for request construction
  • Null implementations: Enable testing and graceful degradation

Test Plan

  • All 26 unit tests pass
  • HttpClientInterfaceTest: 10 tests (request construction, chaining, response checks, mock client)
  • UdpClientInterfaceTest: 13 tests (endpoint, statistics, connect/send, string convenience)
  • TransportInterfacePolymorphismTest: 3 tests (polymorphism verification)
  • Header compiles with C++20

Downstream Impact

Repository Change Required
monitoring_system Implement IHttpClient, IUdpClient adapters
network_system Implement IHttpClient, IUdpClient for clients

Related Issues

…Client)

Add abstract interfaces for HTTP and UDP client transport layers to enable
clean dependency injection across the ecosystem. This resolves the circular
dependency risk between monitoring_system and network_system.

New interfaces:
- IHttpClient: HTTP client interface with request/response structs
- IUdpClient: UDP client interface with connected and connectionless modes
- null_http_client/null_udp_client: No-op implementations for disabled transport

Features:
- Builder pattern support for HTTP requests (set_content_type, set_authorization)
- Response status helpers (is_success, is_client_error, is_server_error)
- UDP statistics tracking with packets_sent, bytes_sent, send_failures
- String convenience methods for UDP send operations
- Factory function types for creating client instances

The interfaces are header-only with no runtime dependencies, matching
the existing common_system architecture.

Closes #233
Add documentation for IHttpClient and IUdpClient interfaces in both
English and Korean changelog files.
@kcenon kcenon merged commit 4c93cb8 into main Dec 26, 2025
19 checks passed
@kcenon kcenon deleted the feature/issue-233-transport-interfaces branch December 26, 2025 01:43
kcenon added a commit that referenced this pull request Apr 13, 2026
…Client) (#235)

* feat(interfaces): add unified transport interfaces (IHttpClient, IUdpClient)

Add abstract interfaces for HTTP and UDP client transport layers to enable
clean dependency injection across the ecosystem. This resolves the circular
dependency risk between monitoring_system and network_system.

New interfaces:
- IHttpClient: HTTP client interface with request/response structs
- IUdpClient: UDP client interface with connected and connectionless modes
- null_http_client/null_udp_client: No-op implementations for disabled transport

Features:
- Builder pattern support for HTTP requests (set_content_type, set_authorization)
- Response status helpers (is_success, is_client_error, is_server_error)
- UDP statistics tracking with packets_sent, bytes_sent, send_failures
- String convenience methods for UDP send operations
- Factory function types for creating client instances

The interfaces are header-only with no runtime dependencies, matching
the existing common_system architecture.

Closes #233

* docs: update changelog for transport interfaces

Add documentation for IHttpClient and IUdpClient interfaces in both
English and Korean changelog files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deps: Add unified transport interfaces (IHttpClient, IUdpClient)

1 participant