feat: v0.6.0 mDNS discovery — Discoverer/Announcer interfaces - #6
Merged
Conversation
Ports cpp-RCP's mdns.hpp: abstract rcp_mdns_discoverer_t/rcp_mdns_announcer_t vtable interfaces plus a concrete rcp_mdns_static_discoverer_t (deep-copies its zone list, including host/instance_name strings, so callers don't need to keep their input alive). No concrete Announcer ships here, matching cpp-RCP — a real mDNS responder (Avahi/dns_sd) needs platform APIs outside this library's scope. tests/test_mdns.c ports cpp-RCP's test_mdns.cpp (8 requirements), including its own local TestAnnouncer test double (cpp-RCP defines this in the test file too, not in mdns.hpp itself). Fixed one real cyber-gate finding before opening this PR (a hard CI blocker, unlike the known/ticketed L004 lint bug): a calloc() call whose sizeof(*ptr) argument used the same arrow-dereferenced pointer being assigned, tripping CFUSA-CY004's malloc/calloc-then-dereference heuristic — same root cause as two earlier fixes in mock.c, just missed here on first pass. Proactively grepped the rest of src/*.c for the same pattern afterward; nothing else matched. Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Milestone 6 of
ROADMAP.md. Ports cpp-RCP'smdns.hpp:include/rcp/mdns.h+src/mdns.c— abstractrcp_mdns_discoverer_t/rcp_mdns_announcer_tvtable interfaces plus a concretercp_mdns_static_discoverer_t(deep-copies its zone list so callers don'tneed to keep the input alive). No concrete Announcer ships here — matches
cpp-RCP; a real mDNS responder needs platform APIs out of scope here.
tests/test_mdns.cports cpp-RCP'stest_mdns.cpp(8 requirements),including its own local TestAnnouncer test double (same as cpp-RCP does).
Fixed before opening this PR
A real
cfusa cyberfinding (hard CI gate, unlike the known/ticketed L004lint bug):
calloc()'ssizeof(*ptr)argument used the samearrow-dereferenced pointer being assigned on the same line, tripping
CY004's malloc/calloc-then-dereference heuristic — same root cause as two
earlier fixes in
mock.c, missed here on first pass. Fixed, thenproactively grepped the rest of
src/*.cfor the same pattern; nothingelse matched.
Test plan
ctest— 7/7 passing (was 6/6)-fsanitize=address,undefined— cleancfusa trace --req-coverage 100— metric 2 still 100%, metric 1 now 52% (104/198), non-blocking per v0.2.0cfusa analyze/cfusa cyber/cfusa qualify/cfusa vuln— all clean (0 errors)cfusa check— 3 errors, all the known/ticketed L004 false-positive, non-blocking