Jun Furutani / libMiMic

Fork of libMiMic by Ryo Iizuka

Revision:
108:8dae2a2682e7
Parent:
107:d4b14febb863
Child:
109:18f12ac01097
diff -r d4b14febb863 -r 8dae2a2682e7 core/net/mdns/NyLPC_cMDnsServer.c
--- a/core/net/mdns/NyLPC_cMDnsServer.c	Wed Nov 12 13:07:40 2014 +0000
+++ b/core/net/mdns/NyLPC_cMDnsServer.c	Thu Nov 13 14:06:19 2014 +0000
@@ -486,7 +486,17 @@
     p->ar = NyLPC_HTONS(i_ar_count);
     return sizeof(struct NyLPC_TDnsHeader);
 }
-
+static NyLPC_TUInt16 setAnnounceHeader(char* i_packet,NyLPC_TUInt16 i_an_count, NyLPC_TUInt16 i_ns_count, NyLPC_TUInt16 i_ar_count)
+{
+    struct NyLPC_TDnsHeader* p = (struct NyLPC_TDnsHeader*)i_packet;
+    p->id = 0;
+    p->flag = NyLPC_HTONS(NyLPC_TDnsHeader_FLAG_MASK_QR | NyLPC_TDnsHeader_FLAG_MASK_AA);
+    p->qd = 0;
+    p->an = NyLPC_HTONS(i_an_count);
+    p->ns = NyLPC_HTONS(i_ns_count);
+    p->ar = NyLPC_HTONS(i_ar_count);
+    return sizeof(struct NyLPC_TDnsHeader);
+}
 
 static NyLPC_TInt16 writeARecordData(char* i_packet, NyLPC_TInt16 i_spos,NyLPC_TInt16 obuflen,const struct NyLPC_TIPv4Addr* ip)
 {
@@ -772,7 +782,7 @@
         if(obuf==NULL){
             return;
         }
-        l=setResponseHeader(obuf,NULL,1+i_inst->_ref_record->num_of_srv+4,0,0);
+        l=setAnnounceHeader(obuf,1+i_inst->_ref_record->num_of_srv+4,0,0);
         //<Answer />
         //PTR
         l=writePtrRecord(i_inst->_ref_record,i2,obuf,l,obuflen);