Unison Help
- Unison Kernel
- Pthreads
- pthread_create()
- pthread_exit()
- pthread_self()
- pthread_equal()
- pthread_join()
- pthread_detach()
- pthread_setschedparam()
- pthread_getschedparam()
- pthread_attr_init()
- pthread_attr_destroy()
- pthread_attr_setstackaddr()
- pthread_attr_getstackaddr()
- pthread_attr_setstacksize()
- pthread_attr_getstacksize()
- pthread_attr_setschedparam()
- pthread_attr_getschedparam()
- pthread_attr_setdetachstate()
- pthread_attr_getdetachstate()
- pthread_stackinfo()
- pthread_setprio()
- pthread_getprio()
- sched_get_priority_max()
- sched_get_priority_min()
- sched_yield()
- Pthread Cancellation
- Mutex
- Semaphores
- Message Queues
- Conditional Variables
- Barriers
- Timers
- Clocks
- Memory Allocation
- Rendezvous
- Interrupts
- Directory Services
- Miscellaneous
- Pthreads
- Unison I/O Library
- Unison STDIO Library
- STDIO Library Calls
- clearerr()
- dprintf()
- fclose()
- fdopen()
- feof()
- ferror()
- fileno()
- fflush()
- fgetc()
- fgetpos()
- fgets()
- fopen()
- fprintf()
- fputc()
- fputs()
- fread()
- freopen()
- fscanf()
- fseek()
- fseeko()
- fsetpos()
- ftell()
- ftello()
- fwrite()
- getc()
- getc_unlocked()
- getchar()
- getchar_unlocked()
- getdelim()
- getline()
- gets()
- get_stderr_ptr()
- get_stdin_ptr()
- get_stdout_ptr()
- noperprintf()
- perprintf()
- perror()
- posix_compat()
- printf()
- putc()
- putc_unlocked()
- putchar()
- putchar_unlocked()
- puts()
- remove()
- rewind()
- scanf()
- setbuf()
- setvbuf()
- snprintf()
- sprintf()
- sscanf()
- stderr_init()
- stderr_close()
- stdin_init()
- stdin_close()
- stdout_init()
- stdout_close()
- vdprintf()
- vscanf()
- vsscanf()
- vfscanf()
- vprintf()
- vsnprintf()
- vsprintf()
- vfprintf()
- ungetc()
- Do-nothing Stubs
- STDIO Library Calls
- Unison LIBC Library
- Unison I/O Servers
- Graphics, Camera, Video, Audio
- Network Protocols
- TCP and UDP Server - tcpd
- DHCP Client Service - dhcp client
- DHCP Server - dhcpd
- Telnet Server - telnetd
- Tiny FTP Server - tftpd
- Point to Point - pppd
- Network Translation - NAT with PAT
- Firewall
- Tiny HTTP Server - thttpd
- Tiny HTTP Server with TLS
- POP3 Server
- Simple Mail Transfer Protocol Services (SMTP)
- Bootp Protocol
- File Transfer Protocol Server (FTP)
- File Transfer Client Services
- RPC / XDR
- DNS Client
- HTTP/HTTPS Client
- REST Client
- AutoIP Service - autoip client
- mDNS server - mdnsd
- SNTP Client
- SNMP Agent - Snmpd server
- SSL/TLS library
- SSH server
- IP security
- Power Control
- Serial I/O
- System Services
- Universal Serial Bus (USB)
- Wireless
- Remedy Tools for Unison
7.21.mDNS server - mdnsd #
NAME
Multicast DNS – mdnsd
SYNOPSIS
#include <mdnsd.h >
- int mdnsd_init(struct mdnsd_settings *mdnsd_settings);
void mdnsd_set_hostname(const char *hostname);
struct mdns_service *mdnsd_register_svc(const char *instance_name,
const char *type,
uint16_t port,
const char *txt[]);
struct mdnsd *mdnsd_start(void);
void mdnsd_stop(void);
DESCRIPTION
The multicast Domain Name System (mDNS) is a zero configuration host name resolution service. The mDNS protocol uses IP multicast UDP packets. To provide mDNS features user need to initialize service, setup appropriate host name and supported services, tnen start the daemon thread mdnsd.
User functions
int mdnsd_init(struct mdnsd_settings *mdnsd_settings);
Initialize mDNS service internal structures.
void mdnsd_set_hostname(const char *hostname);
Set the hostname for mdnsd.
struct mdns_service *mdnsd_register_svc(const char *instance_name,
const char *type,
uint16_t port,
const char *txt[]);
Register supported service and begin an announcement.
struct mdnsd *mdnsd_start(void);
Start mDNS service thread.
void mdnsd_stop(void);
Stop mDNS service thread.
EXAMPLE
This is the example how to start and setup mdnsd.
/*
* Start mdns daemon, set host name and register "_http" and "_print" services
*/
int mDNS_start(void)
{
int err = 0;
struct mdnsd_settings mdnsd_settings;
const char *txt[] = {
"path=/index.html",
NULL
};
// Fill init parameters
mdnsd_settings.priority = 5;
mdnsd_settings.interface = "eth0";
// Initialize mdns
err = mdnsd_init(&mdnsd_settings);
if (err != 0) {
return -1;
}
// Set host name
mdnsd_set_hostname("Unison-host.local");
// service register
mdnsd_register_svc("MyWebsite", "_http._tcp.local", 8080, txt);
// service register
mdnsd_register_svc("MyPrinter", "_print._tcp.local", 1111, NULL);
// Start mdns thread
err = mdnsd_start();
if (err != 0) {
return -1;
}
return 0;
}
NOTES
There is a demo available for the Unison and DSPnano mdnsd which is found in installdir/demos.
