Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
MDNS.cxx File Reference
#include "os/MDNS.hxx"

Go to the source code of this file.

Macros

#define MDNS_DEBUG   0
 Turn on/off debug print statements.
 

Functions

void mdns_publish (const char *name, const char *service, uint16_t port)
 Publish an mDNS name.
 
void mdns_unpublish (const char *name, const char *service)
 Unpublish an mDNS name.
 
int mdns_lookup (const char *service, struct addrinfo *hints, struct addrinfo **addr)
 Lookup an mDNS name.
 
void mdns_scan (const char *service)
 Start continuous scan for mDNS service name.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

A simple abstraction to publish/lookup mDNS sevices.

Author
Stuart Baker
Date
9 April 2017

Definition in file MDNS.cxx.

Macro Definition Documentation

◆ MDNS_DEBUG

#define MDNS_DEBUG   0

Turn on/off debug print statements.

Definition at line 38 of file MDNS.cxx.

Function Documentation

◆ mdns_lookup()

int mdns_lookup ( const char *  service,
struct addrinfo hints,
struct addrinfo **  addr 
)

Lookup an mDNS name.

Parameters
serviceservicename to lookup
hintshints about limiting the types of services that will respond
addrinfostructure containing one or more service addressess that match the enquery, else nullptr if no matching service found
Returns
0 upon success, or appropriate EAI_* error on failure

Definition at line 73 of file MDNS.cxx.

◆ mdns_publish()

void mdns_publish ( const char *  name,
const char *  service,
uint16_t  port 
)

Publish an mDNS name.

Parameters
namelocal "username" or "nodename" of the service
serviceservice name, example: "_openlcb._tcp"
portport number

Definition at line 52 of file MDNS.cxx.

◆ mdns_scan()

void mdns_scan ( const char *  service)

Start continuous scan for mDNS service name.

Parameters
serviceservicename to scan

Definition at line 88 of file MDNS.cxx.

◆ mdns_unpublish()

void mdns_unpublish ( const char *  name,
const char *  service 
)

Unpublish an mDNS name.

Parameters
namelocal "username" or "nodename" of the service
serviceservice name, example: "_openlcb._tcp"

Definition at line 61 of file MDNS.cxx.