Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/Networking.md
2026-04-17 14:55:32 -04:00

86 lines
6.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- Common/DTS.Common/Interface/Networking/INetworkingView.cs
- Common/DTS.Common/Interface/Networking/INetworkAdapterView.cs
- Common/DTS.Common/Interface/Networking/INetworkAdapterViewModel.cs
- Common/DTS.Common/Interface/Networking/INetworkingViewModel.cs
generated_at: "2026-04-16T03:00:05.086114+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "3ef2c7de36c1e3c6"
---
# Networking
## Documentation: Networking Interface Module
### 1. Purpose
This module defines the core interfaces for the networking layers view-model and view components within the DTS system. It establishes a contract for UI components responsible for displaying and managing network adapter selection and SLICE6 multicast communication settings. The interfaces are part of a layered architecture (likely MVVM), where `*ViewModel` interfaces encapsulate state and behavior, and `*View` interfaces represent the UI presentation layer—both inheriting from `IBaseView`/`IBaseViewModel` to integrate with the common base framework.
### 2. Public Interface
- **`INetworkingView`**
```csharp
public interface INetworkingView : IBaseView { }
```
*Represents the UI view for the networking module.* No additional members beyond the base view contract—implementation is expected to handle rendering of networking-related UI (e.g., adapter list, multicast config fields).
- **`INetworkAdapterView`**
```csharp
public interface INetworkAdapterView : IBaseView { }
```
*Represents the UI view for network adapter selection.* Like `INetworkingView`, it only inherits `IBaseView`, implying its implementation is responsible for UI-specific adapter display (e.g., a dropdown or list of `NetworkInterface` objects).
- **`INetworkAdapterViewModel`**
```csharp
public interface INetworkAdapterViewModel : IBaseViewModel
{
NetworkInterface SelectedNetworkInterface { get; set; }
}
```
*Manages state for network adapter selection.* Exposes a single property, `SelectedNetworkInterface`, which holds the currently selected `System.Net.NetworkInformation.NetworkInterface`. The property is read-write, implying the view model supports both programmatic and user-driven selection updates.
- **`INetworkingViewModel`**
```csharp
public interface INetworkingViewModel : IBaseViewModel
{
INetworkingView View { get; set; }
string SLICE6MulticastAddress { get; set; }
bool SLICE6MulticastAddressHasError { get; }
int SLICE6MulticastCommandPort { get; set; }
int SLICE6MulticastResponsePort { get; set; }
void SetStatus(StatusInfo.StatusState status, string message = "", decimal percentage = -1, int processId = 0);
}
```
*Manages state and behavior for the main networking configuration UI.*
- `View`: Binds to the associated `INetworkingView` instance (likely set by a framework or presenter).
- `SLICE6MulticastAddress`: Gets/sets the multicast IP address string used for SLICE6 communication.
- `SLICE6MulticastAddressHasError`: Read-only flag indicating whether the current `SLICE6MulticastAddress` value is invalid (e.g., malformed or unresolvable).
- `SLICE6MulticastCommandPort` / `SLICE6MulticastResponsePort`: Get/set integer port numbers for command and response multicast channels.
- `SetStatus(...)`: Updates the UI status bar with a `StatusInfo.StatusState` (e.g., `Idle`, `Processing`, `Error`), optional message, progress percentage (1 if not applicable), and process ID for tracking.
### 3. Invariants
- `INetworkingViewModel` implementations must ensure `SLICE6MulticastAddressHasError` accurately reflects the validity of `SLICE6MulticastAddress` (e.g., `true` if the address is null, empty, or not a valid IPv4/IPv6 multicast address).
- `SelectedNetworkInterface` in `INetworkAdapterViewModel` must be non-null only when a valid `NetworkInterface` is selected; setting it to `null` likely indicates no selection.
- `View` property in `INetworkingViewModel` must be assigned before the view model is used to interact with the UI (e.g., before calling `SetStatus`).
- `SetStatus` must be thread-safe or callable from UI thread only (implementation-dependent; not specified in interface).
### 4. Dependencies
- **Internal dependencies**:
- `DTS.Common.Base` namespace (provides `IBaseView`, `IBaseViewModel`, and likely `StatusInfo.StatusState`).
- `System.Net.NetworkInformation` (for `NetworkInterface` type).
- `System.Threading.Tasks` (imported but no async methods declared—possibly reserved for future use or implementation).
- `DTS.Common.Events` (imported but no event types used in interface—likely for status change events or command bindings).
- **Consumers**:
- View implementations (e.g., WPF/WinForms controls) implementing `INetworkingView`/`INetworkAdapterView`.
- View model implementations (e.g., `NetworkingViewModel`, `NetworkAdapterViewModel`) implementing `INetworkingViewModel`/`INetworkAdapterViewModel`.
- Likely consumed by a presenter or controller layer (not visible in this module).
### 5. Gotchas
- `SLICE6MulticastAddressHasError` is read-only—validation logic must be implemented internally (e.g., on property setter or external validation trigger). The interface does not specify *when* or *how* this flag is updated.
- `SetStatus` parameters `percentage` and `processId` have defaults (`-1` and `0`), but their semantics (e.g., whether `percentage = -1` means "indeterminate" or "not applicable") are not documented here.
- `SelectedNetworkInterface` is a direct reference to `NetworkInterface`—implementations must handle disposal or lifecycle concerns if the underlying interface becomes unavailable (e.g., network cable unplugged).
- No methods for loading or refreshing the list of available network interfaces are exposed—assumed to be handled by external logic (e.g., in a concrete view model not shown).
- None of the interfaces define events (e.g., `PropertyChanged`, selection changed), implying eventing is handled via `IBaseViewModel`/`IBaseView` base contracts or external mechanisms (e.g., `DTS.Common.Events`).
*Note: No implementation details (e.g., validation rules for multicast addresses, error handling for port ranges) are present in the source—these must be inferred from concrete implementations.*