This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Fork of libMiMic by Ryo Iizuka

Files at this revision

API Documentation at this revision

Comitter:
nyatla
Date:
Mon Nov 10 04:07:48 2014 +0000
Parent:
103:853ddf4a1b81
Child:
105:9ed3adccac22
Commit message:
mDNS; AAAA????????; TTL???

Changed in this revision

core/net/mdns/NyLPC_cMDnsServer.c Show annotated file Show diff for this revision Revisions of this file
--- a/core/net/mdns/NyLPC_cMDnsServer.c	Thu Oct 30 14:03:31 2014 +0000
+++ b/core/net/mdns/NyLPC_cMDnsServer.c	Mon Nov 10 04:07:48 2014 +0000
@@ -37,7 +37,8 @@
 #define MDNS_MCAST_PORT         5353
 static const struct NyLPC_TIPv4Addr MDNS_MCAST_IPADDR = NyLPC_TIPv4Addr_pack(224, 0, 0, 251);
 #define TIMEOUT_IN_MS       1000
-#define NyLPC_TcMDns_TTL (120)    //120
+#define NyLPC_TcMDns_RES_TTL (120)    //120
+#define NyLPC_TcMDns_STD_TTL (30*60)  //(30min
 
 
 struct NyLPC_TDnsHeader
@@ -446,7 +447,7 @@
 }
 
 
-static NyLPC_TInt16 writeSrvResourceHeader(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 buflen, const struct NyLPC_TDnsRecord* i_recode, int i_sid, NyLPC_TUInt16 i_type, NyLPC_TUInt16 i_class)
+static NyLPC_TInt16 writeSrvResourceHeader(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 buflen, const struct NyLPC_TDnsRecord* i_recode, NyLPC_TInt16 i_sid, NyLPC_TUInt16 i_type, NyLPC_TUInt16 i_class,NyLPC_TUInt16 i_ttl)
 {
     NyLPC_TInt16 s;
     NyLPC_TInt16 l = (NyLPC_TInt16)(1 + strlen(i_recode->name) + 1 + strlen(i_recode->srv[i_sid].protocol) + 1 + 5 + 1);
@@ -459,7 +460,7 @@
     l = compressName(i_packet, i_spos, s);//圧縮
     (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(i_type);
     (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(i_class);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(i_ttl);
     return l + 2 + 2 + 4;
 }
 
@@ -485,24 +486,14 @@
     p->ar = NyLPC_HTONS(i_ar_count);
     return sizeof(struct NyLPC_TDnsHeader);
 }
-/**
-* ドメイン名からAレコードレスポンスを書きだす。
-*/
-static NyLPC_TInt16 writeARecord(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const NyLPC_TChar* i_name, const struct NyLPC_TIPv4Addr* ip)
+
+
+static NyLPC_TInt16 writeARecordData(char* i_packet, NyLPC_TInt16 i_spos,NyLPC_TInt16 obuflen,const struct NyLPC_TIPv4Addr* ip)
 {
-    NyLPC_TInt16 s;
-    //AnswerはAレコードのみ
-    NyLPC_TInt16 l = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
-    if (obuflen<i_spos + l + 4 + 4){
-        return 0;
-    }
-    s = str2label(i_packet + i_spos, i_name) - 1;
-    s += str2label(i_packet + i_spos + s, "local");
-    //レコード圧縮
-    l = compressName(i_packet, i_spos, s);
+    NyLPC_TInt16 l=i_spos;
     (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_A);
     (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_RES_TTL);
     l += 2 + 2 + 4;
     //A record header
     if (obuflen<l + 6){
@@ -512,7 +503,23 @@
     //IPADDR
     (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(4);
     (*(NyLPC_TUInt32*)(i_packet + l + 2)) = ip->v;
-    return l + 6;
+    return l + 6;//NEXT_SPOS
+}
+/**
+* ドメイン名からAレコードレスポンスを書きだす。
+*/
+static NyLPC_TInt16 writeARecord(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const NyLPC_TChar* i_name, const struct NyLPC_TIPv4Addr* ip)
+{
+    //AnswerはAレコードのみ
+    NyLPC_TInt16 s = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
+    if (obuflen<i_spos + s + 4 + 4){
+        return 0;
+    }
+    s = str2label(i_packet + i_spos, i_name) - 1;
+    s += str2label(i_packet + i_spos + s, "local");
+    //レコード圧縮
+    s = compressName(i_packet, i_spos, s);
+    return writeARecordData(i_packet,s,obuflen,ip);
 }
 
 /**
@@ -520,49 +527,22 @@
 */
 static NyLPC_TInt16 writeARecordByQuery(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const struct NyLPC_TDnsQuestion* i_query, const struct NyLPC_TIPv4Addr* ip)
 {
-    NyLPC_TInt16 s;
-    //AnswerはAレコードのみ
-    NyLPC_TInt16 l;
-    s = query2label(i_packet, i_spos, obuflen, i_query);
+    NyLPC_TInt16 s = query2label(i_packet, i_spos, obuflen, i_query);
     if (s == 0){
         return 0;
     }
-
     //レコード圧縮
-    l = compressName(i_packet, i_spos, s);
-    (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_A);
-    (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
-    l += 2 + 2 + 4;
-    //A record header
-    if (obuflen<l + 6){
-        return 0;
-    }
-    //Aレコードを書く
-    //IPADDR
-    (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(4);
-    (*(NyLPC_TUInt32*)(i_packet + l + 2)) = ip->v;
-    return l + 6;
+    s = compressName(i_packet, i_spos, s);
+    return writeARecordData(i_packet,s,obuflen,ip);
 }
 
-/**
-* AレコードクエリからAレコードレスポンスを書きだす。
-*/
-static NyLPC_TInt16 writeAAAARecordByQuery(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const struct NyLPC_TDnsQuestion* i_query, const struct NyLPC_TIPv4Addr* ip)
+/*
+static NyLPC_TInt16 writeAAAARecordByQueryData(char* i_packet, NyLPC_TInt16 i_spos,NyLPC_TInt16 obuflen,const struct NyLPC_TIPv4Addr* ip)
 {
-    NyLPC_TInt16 s;
-    //AnswerはAレコードのみ
-    NyLPC_TInt16 l;
-    s = query2label(i_packet, i_spos, obuflen, i_query);
-    if (s == 0){
-        return 0;
-    }
-
-    //レコード圧縮
-    l = compressName(i_packet, i_spos, s);
+    NyLPC_TInt16 l=i_spos;
     (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_AAAA);
     (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_RES_TTL);
     l += 2 + 2 + 4;
     //A record header
     if (obuflen<l + 2 + 16){
@@ -575,59 +555,44 @@
     (*(NyLPC_TUInt16*)(i_packet + l + 2 + 10)) = 0xffff;
     (*(NyLPC_TUInt32*)(i_packet + l + 2 + 12)) = ip->v;
     return l + 2 + 16;
-}
+}*/
+
+
 /**
 * AレコードクエリからAレコードレスポンスを書きだす。
-*/
+*//*
+static NyLPC_TInt16 writeAAAARecordByQuery(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const struct NyLPC_TDnsQuestion* i_query, const struct NyLPC_TIPv4Addr* ip)
+{
+    NyLPC_TInt16 s = query2label(i_packet, i_spos, obuflen, i_query);
+    if (s == 0){
+        return 0;
+    }
+    //レコード圧縮
+    s = compressName(i_packet, i_spos, s);
+    return writeAAAARecordByQueryData(i_packet,s,obuflen,ip);
+}*/
+/**
+* AレコードクエリからAレコードレスポンスを書きだす。
+*//*
 static NyLPC_TInt16 writeAAAARecord(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const NyLPC_TChar* i_name, const struct NyLPC_TIPv4Addr* ip)
 {
-    NyLPC_TInt16 s;
-    //AnswerはAレコードのみ
-    NyLPC_TInt16 l = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
-    if (obuflen<i_spos + l + 4 + 4){
+    NyLPC_TInt16 s = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
+    if (obuflen<i_spos + s + 4 + 4){
         return 0;
     }
     s = str2label(i_packet + i_spos, i_name) - 1;
     s += str2label(i_packet + i_spos + s, "local");
+    //レコード圧縮
+    s = compressName(i_packet, i_spos, s);
+    return writeAAAARecordByQueryData(i_packet,s,obuflen,ip);
+}*/
 
-    //レコード圧縮
-    l = compressName(i_packet, i_spos, s);
-    (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_AAAA);
-    (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
-    l += 2 + 2 + 4;
-    //A record header
-    if (obuflen<l + 2 + 16){
-        return 0;
-    }
-    //AAAAレコードを書く
-    //IPADDR
-    (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(16);
-    memset(i_packet + l + 2, 0, 10);
-    (*(NyLPC_TUInt16*)(i_packet + l + 2 + 10)) = 0xffff;
-    (*(NyLPC_TUInt32*)(i_packet + l + 2 + 12)) = ip->v;
-    return l + 2 + 16;
-}
-/**
-* NSECレコードレスポンスを書きだす。
-* IPv6わからんし。
-*/
-static NyLPC_TInt16 writeNSECRecord(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const NyLPC_TChar* i_name)
+static NyLPC_TInt16 writeNSECRecordData(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen,NyLPC_TInt16 i_next_domain)
 {
-    NyLPC_TInt16 s;
-    //AnswerはAレコードのみ
-    NyLPC_TInt16 l = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
-    if (obuflen<i_spos + l + 4 + 4){
-        return 0;
-    }
-    s = str2label(i_packet + i_spos, i_name) - 1;
-    s += str2label(i_packet + i_spos + s, "local");
-
-    //レコード圧縮
-    l = i_spos + s;//compressName(i_packet,i_spos,s);
+    NyLPC_TInt16 l=i_spos;
     (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_NSEC);
     (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_RES_TTL);
     l += 2 + 2 + 4;
     //A record header
     if (obuflen<l + 2 + 2 + 6){
@@ -637,10 +602,27 @@
     *((NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(2 + 6);
     l += 2;
     *(i_packet + l) = 0xc0;
-    *(i_packet + l + 1) = (NyLPC_TUInt8)i_spos;
+    *(i_packet + l + 1) = (NyLPC_TUInt8)i_next_domain;
     l += 2;
     memcpy(i_packet + l, "\x00\x04\x00\x00\x00\x08", 6);
-    return l + 6;
+    return l + 6;    
+}
+/**
+* NSECレコードレスポンスを書きだす。
+* IPv6わからんし。
+*/
+static NyLPC_TInt16 writeNSECRecord(char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen, const NyLPC_TChar* i_name)
+{
+    //AnswerはAレコードのみ
+    NyLPC_TInt16 s = 1 + (NyLPC_TInt16)strlen(i_name) + 1 + 5 + 1;
+    if (obuflen<i_spos + s + 4 + 4){
+        return 0;
+    }
+    s = str2label(i_packet + i_spos, i_name) - 1;
+    s += str2label(i_packet + i_spos + s, "local");
+    //レコード圧縮
+    s = i_spos + s;//compressName(i_packet,i_spos,s);
+    return writeNSECRecordData(i_packet,s,obuflen,i_spos);
 }
 /**
 * NSECレコードレスポンスを書きだす。
@@ -650,32 +632,17 @@
 {
     NyLPC_TInt16 s;
     //AnswerはAレコードのみ
-    NyLPC_TInt16 l;
     s = query2label(i_packet, i_spos, obuflen, i_query);
     if (s == 0){
         return 0;
     }
 
     //レコード圧縮
-    l = i_spos + s;
+    s = i_spos + s;
     //    l=compressName(i_packet,i_spos,s);
-    (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_NSEC);
-    (*(NyLPC_TUInt16*)(i_packet + l + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
-    (*(NyLPC_TUInt32*)(i_packet + l + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
-    l += 2 + 2 + 4;
-    //A record header
-    if (obuflen<l + 2 + 2 + 6){
-        return 0;
-    }
-    //NSECレコードを書く
-    *((NyLPC_TUInt16*)(i_packet + l)) = NyLPC_HTONS(2 + 6);
-    l += 2;
-    *(i_packet + l) = 0xc0;
-    *(i_packet + l + 1) = (NyLPC_TUInt8)i_spos;
-    l += 2;
-    memcpy(i_packet + l, "\x00\x04\x00\x00\x00\x08", 6);
-    return l + 6;
+    return writeNSECRecordData(i_packet,s,obuflen,i_spos);
 }
+
 static NyLPC_TInt16 writeSdPtrRecord(const struct NyLPC_TDnsQuestion* i_question, const struct NyLPC_TMDnsServiceRecord* i_srvlec, char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen)
 {
     NyLPC_TInt16 l, s;
@@ -690,7 +657,7 @@
     s = compressName(i_packet, i_spos, 30);
     (*(NyLPC_TUInt16*)(i_packet + s)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_PTR);
     (*(NyLPC_TUInt16*)(i_packet + s + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN);
-    (*(NyLPC_TUInt32*)(i_packet + s + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + s + 4)) = NyLPC_HTONL(NyLPC_TcMDns_STD_TTL);
     l = s + 2 + 2 + 4;
 
     //Resourceの書込み
@@ -705,6 +672,7 @@
     s = compressName(i_packet, l, s);//圧縮
     return s;
 }
+
 static NyLPC_TInt16 writePtrRecord(const struct NyLPC_TDnsRecord* i_recode, NyLPC_TInt16 i_sid, char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen)
 {
     NyLPC_TInt16 l, s;
@@ -721,7 +689,7 @@
     s = compressName(i_packet, i_spos, s);
     (*(NyLPC_TUInt16*)(i_packet + s)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QTYPR_PTR);
     (*(NyLPC_TUInt16*)(i_packet + s + 2)) = NyLPC_HTONS(NyLPC_TDnsQuestion_QCLASS_IN);
-    (*(NyLPC_TUInt32*)(i_packet + s + 4)) = NyLPC_HTONL(NyLPC_TcMDns_TTL);
+    (*(NyLPC_TUInt32*)(i_packet + s + 4)) = NyLPC_HTONL(NyLPC_TcMDns_STD_TTL);
     l = s + 2 + 2 + 4;
 
     //Resourceの書込み
@@ -745,7 +713,7 @@
     NyLPC_TUInt16* rlen;
 
     //SRV Record
-    s = writeSrvResourceHeader(i_packet, i_spos, obuflen, i_inst->_ref_record, i_sid, NyLPC_TDnsQuestion_QTYPR_SRV, NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
+    s = writeSrvResourceHeader(i_packet, i_spos, obuflen, i_inst->_ref_record, i_sid, NyLPC_TDnsQuestion_QTYPR_SRV, NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH,NyLPC_TcMDns_RES_TTL);
     if (s == 0){
         return 0;
     }
@@ -771,7 +739,7 @@
     NyLPC_TInt16 ret;
     NyLPC_TInt16 l;
     //Answer
-    ret = writeSrvResourceHeader(i_packet, i_spos, obuflen, i_inst->_ref_record, i_sid, NyLPC_TDnsQuestion_QTYPR_TXT, NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH);
+    ret = writeSrvResourceHeader(i_packet, i_spos, obuflen, i_inst->_ref_record, i_sid, NyLPC_TDnsQuestion_QTYPR_TXT, NyLPC_TDnsQuestion_QCLASS_IN | NyLPC_TDnsQuestion_QCLASS_CACHE_FLUSH,NyLPC_TcMDns_STD_TTL);
     if (ret == 0){
         return 0;
     }
@@ -802,7 +770,7 @@
         if(obuf==NULL){
             return;
         }
-        l=setResponseHeader(obuf,NULL,1,0,5);
+        l=setResponseHeader(obuf,NULL,1,0,4);
         l=writePtrRecord(i_inst->_ref_record,i2,obuf,l,obuflen);
         if(l<=0){
             NyLPC_OnErrorGoto(ERROR);
@@ -822,11 +790,11 @@
         if(l<=0){
             NyLPC_OnErrorGoto(ERROR);
         }
-        //AAAAレコード
-        l=writeAAAARecord(obuf,l,obuflen,i_inst->_ref_record->a,&(i_inst->_super.uip_udp_conn.lipaddr));
-        if(l<=0){
-            NyLPC_OnErrorGoto(ERROR);
-        }        
+//        //AAAAレコード
+//        l=writeAAAARecord(obuf,l,obuflen,i_inst->_ref_record->a,&(i_inst->_super.uip_udp_conn.lipaddr));
+//        if(l<=0){
+//            NyLPC_OnErrorGoto(ERROR);
+//        }
         //NSEC
         l=writeNSECRecord(obuf,l,obuflen,i_inst->_ref_record->a);
         if(l<=0){
@@ -865,7 +833,7 @@
             goto DROP;
         }
         //SRV,(TXT,A,AAAA,NSEC)
-        l = setResponseHeader(obuf, i_dns_header, 1, 0, 4);
+        l = setResponseHeader(obuf, i_dns_header, 1, 0, 3);
         l = writeSRVRecord(i_inst, ptr_recode, obuf, l, obuflen);
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
@@ -879,18 +847,18 @@
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
         }
-        //AAAAレコード
-        l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
-        if (l <= 0){
-            NyLPC_OnErrorGoto(ERROR);
-        }
+//        //AAAAレコード
+//        l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
+//        if (l <= 0){
+//            NyLPC_OnErrorGoto(ERROR);
+//        }
         //NSEC
         l = writeNSECRecord(obuf, l, obuflen, i_inst->_ref_record->a);
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
         }
         break;
-    case NyLPC_TDnsQuestion_QTYPR_AAAA:
+/*    case NyLPC_TDnsQuestion_QTYPR_AAAA:
         //自分宛?(name.local)
         if (!NyLPC_TDnsQuestion_isEqualName(q, i_inst->_ref_record->a, "")){
             goto DROP;
@@ -918,7 +886,7 @@
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
         }
-        break;
+        break;*/
     case NyLPC_TDnsQuestion_QTYPR_A:
         //自分宛?(name.local)
         if (!NyLPC_TDnsQuestion_isEqualName(q, i_inst->_ref_record->a, "")){
@@ -968,7 +936,7 @@
             if (obuf == NULL){
                 goto DROP;
             }
-            l = setResponseHeader(obuf, i_dns_header, 1, 0, 5);
+            l = setResponseHeader(obuf, i_dns_header, 1, 0, 4);
             l = writePtrRecord(i_inst->_ref_record, ptr_recode, obuf, l, obuflen);
             if (l <= 0){
                 NyLPC_OnErrorGoto(ERROR);
@@ -988,11 +956,11 @@
             if (l <= 0){
                 NyLPC_OnErrorGoto(ERROR);
             }
-            //AAAAレコード
-            l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
-            if (l <= 0){
-                NyLPC_OnErrorGoto(ERROR);
-            }
+//            //AAAAレコード
+//            l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
+//            if (l <= 0){
+//                NyLPC_OnErrorGoto(ERROR);
+//            }
             //NSEC
             l = writeNSECRecord(obuf, l, obuflen, i_inst->_ref_record->a);
             if (l <= 0){
@@ -1008,7 +976,7 @@
         }
         //Bufferの取得
         obuf = NyLPC_cUdpSocket_allocSendBuf(&(i_inst->_super), 512, &obuflen, 0);
-        l = setResponseHeader(obuf, i_dns_header, 1, 0, 3);
+        l = setResponseHeader(obuf, i_dns_header, 1, 0, 2);
         l = writeTXTRecord(i_inst, ptr_recode, obuf, l, obuflen);
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
@@ -1018,11 +986,11 @@
         if (l <= 0){
             NyLPC_OnErrorGoto(ERROR);
         }
-        //AAAAレコード
-        l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
-        if (l <= 0){
-            NyLPC_OnErrorGoto(ERROR);
-        }
+//        //AAAAレコード
+//        l = writeAAAARecord(obuf, l, obuflen, i_inst->_ref_record->a, &(i_inst->_super.uip_udp_conn.lipaddr));
+//        if (l <= 0){
+//            NyLPC_OnErrorGoto(ERROR);
+//        }
         //NSEC
         l = writeNSECRecord(obuf, l, obuflen, i_inst->_ref_record->a);
         if (l <= 0){
@@ -1085,8 +1053,8 @@
     if(NyLPC_cStopwatch_isExpired(&((NyLPC_TcMDnsServer_t*)i_inst)->_periodic_sw)){
         //アナウンス
         sendAnnounse(((NyLPC_TcMDnsServer_t*)i_inst));
-        //TTL(msec)*1000*80%
-        NyLPC_cStopwatch_startExpire((&((NyLPC_TcMDnsServer_t*)i_inst)->_periodic_sw),NyLPC_TcMDns_TTL*1000*4/5);
+        //TTL(msec)*1000*60%
+        NyLPC_cStopwatch_startExpire((&((NyLPC_TcMDnsServer_t*)i_inst)->_periodic_sw),NyLPC_TcMDns_STD_TTL*1000*3/5);
     }
 }