Files
lotherkandClaude Opus 5.5 31e4398026 mcde: McdeSys finds the computers on the network and connects to them
mcde_sys_net_browse lists the computers that announce SMB, AFP, NFS, SSH
or just themselves by DNS-SD: on NetBSD through mdnsd with dns_sd.h from
base (DNSServiceBrowse per type, DNSServiceResolve per service, select
until the time is up; docs/reference/dns-sd.txt), on Linux with
avahi-browse -atrpk (its \DDD escapes decoded).  mcde_sys_net_shares
lists NFS exports (showmount -e) and SMB shares (smbclient -g -N -L);
mcde_sys_net_mount connects sftp:// (sshfs, a password on its standard
input), nfs:// (mount_nfs / mount.nfs) and afp:// (afpfs-ng's mount_afp)
to a folder; mcde_sys_net_unmount (fusermount -u, else umount).  Host
and user names are checked before they reach a command line.

mcde_sys_capture_limited ends a child after a time: showmount waited
minutes for an rpcbind that was not there (measured in the build VM);
the share lists wait 8 seconds.

Measured: on the Linux host 4 computers with their services (KITT,
N95 with SMB; two laptops with SMB and SSH), the local SMB share and NFS
export listed, a host name with ';' refused.  In the build VM: it builds
with -ldns_sd; without mdnsd a clear message; with mdnsd started the
browse ran and found none (qemu's user network carries no multicast);
showmount gave up after 8 s.  Mounting is not measured yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 12:47:12 +00:00

87 lines
3.7 KiB
Plaintext

DNS-SD (mDNSResponder's dns_sd.h in NetBSD base: libdns_sd, comp set; mdnsd, dns-sd in base). Collected 2026-11-11 for McdeSys mcde_sys_net_browse.
Source: src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h
-- src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h:1688
typedef void (DNSSD_API *DNSServiceBrowseReply)
(
DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *serviceName,
const char *regtype,
const char *replyDomain,
void *context
);
/*!
* @brief
-- src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h:1752
DNSServiceErrorType DNSSD_API DNSServiceBrowse
(
DNSServiceRef *sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
const char *regtype,
const char *domain, /* may be NULL */
DNSServiceBrowseReply callBack,
void *context
);
/*!
* @brief
* The definition of the DNSServiceResolve callback function.
-- src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h:1804
typedef void (DNSSD_API *DNSServiceResolveReply)
(
DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
DNSServiceErrorType errorCode,
const char *fullname,
const char *hosttarget,
uint16_t port, /* In network byte order */
uint16_t txtLen,
const unsigned char *txtRecord,
void *context
);
-- src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h:1901
DNSServiceErrorType DNSSD_API DNSServiceResolve
(
DNSServiceRef *sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
const char *name,
const char *regtype,
const char *domain,
DNSServiceResolveReply callBack,
void *context
);
/*********************************************************************************************
*
-- src/external/apache2/mDNSResponder/dist/mDNSShared/dns_sd.h:1086
*
* @discussion
* The DNS Service Discovery implementation uses this socket to communicate between the client and
* the daemon. The application MUST NOT directly read from or write to this socket.
* Access to the socket is provided so that it can be used as a kqueue event source, a CFRunLoop
* event source, in a select() loop, etc. When the underlying event management subsystem (kqueue/
* select/CFRunLoop etc.) indicates to the client that data is available for reading on the
* socket, the client should call DNSServiceProcessResult(), which will extract the daemon's
* reply from the socket, and pass it to the appropriate application callback. By using a run
* loop or select(), results from the daemon can be processed asynchronously. Alternatively,
* a client can choose to fork a thread and have it loop calling "DNSServiceProcessResult(ref);"
* If DNSServiceProcessResult() is called when no data is available for reading on the socket, it
* will block until data does become available, and then process the data and return to the caller.
* The application is responsible for checking the return value of DNSServiceProcessResult()
* to determine if the socket is valid and if it should continue to process data on the socket.
* When data arrives on the socket, the client is responsible for calling DNSServiceProcessResult(ref)
* in a timely fashion -- if the client allows a large backlog of data to build up the daemon
* may terminate the connection.
*/
DNSSD_EXPORT
dnssd_sock_t DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
/*!