Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more
Revision 106:dc0d65dbde48, committed 2014-11-11
- Comitter:
- nyatla
- Date:
- Tue Nov 11 13:23:54 2014 +0000
- Parent:
- 105:9ed3adccac22
- Child:
- 107:d4b14febb863
- Commit message:
- update mDNS module.; Announce?dns_sd???
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 Mon Nov 10 06:33:27 2014 +0000
+++ b/core/net/mdns/NyLPC_cMDnsServer.c Tue Nov 11 13:23:54 2014 +0000
@@ -643,9 +643,10 @@
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)
+static NyLPC_TInt16 writeSdPtrRecord(const struct NyLPC_TMDnsServiceRecord* i_srvlec, char* i_packet, NyLPC_TInt16 i_spos, NyLPC_TInt16 obuflen)
{
NyLPC_TInt16 l, s;
+ NyLPC_TUInt16* rlen;
//Header
// s=(NyLPC_TInt16)*(i_question->buf+i_question->qname_pos);
//Headerの長さチェック
@@ -665,11 +666,12 @@
if (obuflen<s + l + 2){
return 0;
}
- (*(NyLPC_TUInt16*)(i_packet + l)) = NyLPC_ntohs(s);
+ rlen=(NyLPC_TUInt16*)(i_packet + l);
l += 2;
s = str2label(i_packet + l, i_srvlec->protocol) - 1;
s += str2label(i_packet + l + s, "local");
s = compressName(i_packet, l, s);//圧縮
+ *rlen = NyLPC_ntohs(s - l);
return s;
}
@@ -763,18 +765,28 @@
char* obuf;
NyLPC_TUInt16 obuflen;
NyLPC_TUInt16 l;
- int i2;
+ int i,i2;
for(i2=0;i2<i_inst->_ref_record->num_of_srv;i2++){
//Bufferの取得
obuf=NyLPC_cUdpSocket_allocSendBuf(&(i_inst->_super),512,&obuflen,TIMEOUT_IN_MS);
if(obuf==NULL){
return;
}
- l=setResponseHeader(obuf,NULL,1,0,4);
+ l=setResponseHeader(obuf,NULL,1+i_inst->_ref_record->num_of_srv,0,4);
+ //<Answer />
+ //PTR
l=writePtrRecord(i_inst->_ref_record,i2,obuf,l,obuflen);
+ //SD-PTR
if(l<=0){
NyLPC_OnErrorGoto(ERROR);
}
+ for (i = 0; i<i_inst->_ref_record->num_of_srv; i++){
+ l = writeSdPtrRecord(&(i_inst->_ref_record->srv[i]), obuf, l, obuflen);
+ if (l <= 0){
+ NyLPC_OnErrorGoto(ERROR);
+ }
+ }
+ //<Additional/>
//SRV
l=writeSRVRecord(i_inst,i2,obuf,l,obuflen);
if(l<=0){
@@ -919,7 +931,7 @@
}
l = setResponseHeader(obuf, i_dns_header, i_inst->_ref_record->num_of_srv, 0, 0);
for (i2 = 0; i2<i_inst->_ref_record->num_of_srv; i2++){
- l = writeSdPtrRecord(q, &(i_inst->_ref_record->srv[i2]), obuf, l, obuflen);
+ l = writeSdPtrRecord(&(i_inst->_ref_record->srv[i2]), obuf, l, obuflen);
if (l <= 0){
NyLPC_OnErrorGoto(ERROR);
}
MiMic Webservice library