Bonjour/mDNS lib, works with the new network stack

Fork of BonjourLib by Dirk-Willem van Gulik (NXP/mbed)

Revision:
1:bb6472f455e8
Parent:
0:1a198985f183
--- a/services/mDNS/mDNSResponder.cpp	Wed Aug 11 09:49:48 2010 +0000
+++ b/services/mDNS/mDNSResponder.cpp	Sat Aug 14 15:55:07 2010 +0000
@@ -45,7 +45,6 @@
 #include "lwip/opt.h"
 #if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
 
-#define __DEBUG
 #include "dbg/dbg.h"
 
 #include "mDNSResponder.h"
@@ -344,6 +343,8 @@
             p = qPTR(p,moi_local_proto);
 
             p = mPTR(p,moi_local_proto, moi_local_pglue);
+            p = mSRV(p,moi_local_pglue, moi_port, moi_local_name);
+
             if (moi_txt && * moi_txt)
                 p = mTXT(p,moi_local_pglue,moi_txt);
 
@@ -353,18 +354,17 @@
             p = qA(p,moi_local_name);
             break;
 
-        case DNS_RRTYPE_SRV:   // SRV record and a gratious A record to complete.
+        case DNS_RRTYPE_SRV:   // SRV record, optional TXT and a gratious A record to complete.
             op->aa_count = ntohs(moi_txt ? 2 : 1);
             p = qSRV(p,moi_local_pglue);
 
-            p = mPTR(p,moi_local_proto, moi_local_pglue);
+            p = mSRV(p,moi_local_pglue, moi_port, moi_local_name);
             if (moi_txt && * moi_txt)
                 p = mTXT(p,moi_local_pglue,moi_txt);
-            break;
+            break;        
     }
     p = mARR(p,moi_local_name,moi_ip);
     m_pUDPSocket->sendto(out,p-out,&dst);
-    DBG("Reply type %d sent to %s\r\n",t,dst);
 }
 
 char * mDNSResponder::decodeQBlock(char * udp, int len, char *p, char  * fqdn, int fqdn_size, uint32_t *Qclass, uint32_t *Qtype) {
@@ -470,7 +470,7 @@
             if (Qc != DNS_RRCLASS_IN)
                 continue;
 
-           DBG("IN query %x for %s\n\r", Qt, fqdn);
+           DBG("IN query 0x%x for %s\n\r", Qt, fqdn);
             
             // Normally we'll respond to a mCast query for the PTR of our conceptual
             // service; to which we reply with the services we run; and then the A