Simple mDNS + DNS-SD impl

Main TODOs:
1. the spec requires the impl to resend the reply once and
   to send gratuitous updates

2. advertise our clubby services as DNS-SD sub-services.

---

Tested with:

1. https://play.google.com/store/apps/details?id=com.grokkt.android.bonjour&hl=en
2. https://play.google.com/store/apps/details?id=com.druk.bonjour.browser&hl=en
3. osx `dns-sd`

Works well enough; it doesn't have some glitches due the fact that we
don't retransmit yet and we don't send gratuitous updates.

PUBLISHED_FROM=38d7a50beb274d4aeeda5b0b58e44dfa0789da84
This commit is contained in:
Marko Mikulicic
2016-09-28 08:51:47 +00:00
committed by Cesanta Bot
parent d63fb70c69
commit 286fa90ee9
6 changed files with 33 additions and 7 deletions
@@ -28,6 +28,13 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p) {
struct mbuf *io = &nc->recv_mbuf;
(void) p;
switch (ev) {
case MG_EV_POLL: {
const char *peer;
peer = inet_ntoa(nc->sa.sin.sin_addr);
printf("nc->sa: %s %d\n", peer, ntohs(nc->sa.sin.sin_port));
break;
}
case MG_EV_RECV:
printf("Received (%zu bytes): '%.*s'\n", io->len, (int) io->len, io->buf);
mbuf_remove(io, io->len);