Skip to content

Clean up capture service, GUI, and decoder; add solution file - #2

Merged
archietownsend merged 1 commit into
masterfrom
claude/project-improvements-qmk3t8
Jul 9, 2026
Merged

archietownsend merged 1 commit into
masterfrom
claude/project-improvements-qmk3t8

Conversation

@archietownsend

Copy link
Copy Markdown
Owner

Summary

A round of small, low-risk improvements identified from a full read-through of the codebase:

  • Remove dead code: CaptureService.Capture() (single-neighbour capture) was superseded by CaptureAll() and no longer called anywhere in the app, but the ~80-line implementation and interface member remained, duplicating the open/filter/loop/close logic. Removed both.
  • Clean up stale dev comments: MainForm.cs had internal // Feature 1/2/3/4/5 markers from earlier incremental changes. Replaced with plain descriptions (or removed where the code was already self-explanatory).
  • De-duplicate the 60s listen window: the literal 60 was repeated across four status strings and the CaptureAll call. Extracted into a single MainForm.ListenSeconds constant.
  • Fix adapter-selection persistence: the last-selected adapter was saved/restored by its description, which can collide across identical NICs (e.g. two ports on the same card, or identical USB dongles). Now keyed by the stable Npcap device name instead.
  • Validate the CDP header checksum: added the standard 16-bit ones'-complement checksum check and surfaced the result as an informational RawTlvs entry (Checksum: OK / Checksum: mismatch...). Kept informational rather than rejecting frames, since Ethernet padding can affect a naive byte-range guess and this shouldn't risk discarding an otherwise well-formed neighbour announcement.
  • Fix blank "Native VLAN" line for LLDP neighbours: LinkData.Vlan is only populated by CDP's Native VLAN TLV; LLDP neighbours carry VLAN info via PortVlanId (802.1 PVID) instead, so the report used to show an empty "Native VLAN" line for every LLDP-only neighbour. It's now only printed when CDP supplied it, consistent with the other optional fields.
  • Add dotnet/LDWin.sln: there was no solution file; added one covering all three projects for local/IDE builds. (Individual CI jobs still restore/build their specific .csproj files, since the WinForms app project only builds on Windows.)

Test plan

  • dotnet test dotnet/LDWin.Tests/LDWin.Tests.csproj -c Release — all 29 existing tests pass unchanged
  • dotnet build dotnet/LDWin.Core/LDWin.Core.csproj -c Release — builds clean, 0 warnings/errors
  • Verified the new CDP checksum logic with a standalone harness: a frame with a correctly computed checksum reports Checksum: OK; a corrupted checksum byte reports Checksum: mismatch (frame may be corrupt), and the frame still decodes (informational, non-rejecting)
  • Not verified: the WinForms LDWin.exe app itself, since building/running it requires Windows (this sandbox is Linux-only) — LDWin.Core (all logic touched by this PR) is Windows-independent and fully covered by the test project

Generated by Claude Code

- Remove dead single-shot Capture() (superseded by CaptureAll, unused by the GUI)
- Drop internal "Feature N" comments in MainForm in favor of plain descriptions
- Extract the 60s listen window into a MainForm.ListenSeconds constant instead
  of repeating the literal across status strings and the CaptureAll call
- Persist the selected adapter by its stable Npcap device name instead of its
  description, which can collide across identical NICs
- Validate the CDP header checksum and surface the result as an informational
  RawTlvs entry, without rejecting frames with padding-affected checksums
- Only print "Native VLAN" in LinkData.ToReport() when CDP supplied it, so LLDP
  neighbours (which carry VLAN info via PortVlanId instead) don't show a blank line
- Add dotnet/LDWin.sln covering all three projects for local/IDE builds
@archietownsend
archietownsend marked this pull request as ready for review July 9, 2026 09:05
@archietownsend
archietownsend merged commit dc37eaa into master Jul 9, 2026
2 checks passed
@archietownsend
archietownsend deleted the claude/project-improvements-qmk3t8 branch July 14, 2026 10:50
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.

2 participants