Skip to content

Commit

Permalink
[WIN32] added TXT Records to service announcement. Thanks Memphiz
Browse files Browse the repository at this point in the history
  • Loading branch information
wsoltys committed Oct 1, 2011
1 parent b1ed4e3 commit d4bf50e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xbmc/network/windows/ZeroconfWIN.cpp
Expand Up @@ -50,17 +50,21 @@ bool CZeroconfWIN::doPublishService(const std::string& fcr_identifier,

CLog::Log(LOGDEBUG, "CZeroconfWIN::doPublishService identifier: %s type: %s name:%s port:%i", fcr_identifier.c_str(), fcr_type.c_str(), fcr_name.c_str(), f_port);

TXTRecordRef txtRecord;
TXTRecordCreate(&txtRecord, 0, NULL);

//add txt records
if(!txt.empty())
{
// nothin useful yet and I dunno what to do with it
for(std::map<std::string, std::string>::const_iterator it = txt.begin(); it != txt.end(); ++it)
{
CLog::Log(LOGDEBUG, "CZeroconfWIN: key:%4, value:%s",it->first.c_str(),it->second.c_str());
CLog::Log(LOGDEBUG, "CZeroconfWIN: key:%s, value:%s",it->first.c_str(),it->second.c_str());
uint8_t txtLen = (uint8_t)strlen(it->second.c_str());
TXTRecordSetValue(&txtRecord, it->first.c_str(), txtLen, it->second.c_str());
}
}

DNSServiceErrorType err = DNSServiceRegister(&netService, flags, 0, fcr_name.c_str(), fcr_type.c_str(), NULL, NULL, f_port, 0, NULL, registerCallback, NULL);
DNSServiceErrorType err = DNSServiceRegister(&netService, flags, 0, fcr_name.c_str(), fcr_type.c_str(), NULL, NULL, f_port, TXTRecordGetLength(&txtRecord), TXTRecordGetBytesPtr(&txtRecord), registerCallback, NULL);

if (err != kDNSServiceErr_NoError)
{
Expand All @@ -76,6 +80,8 @@ bool CZeroconfWIN::doPublishService(const std::string& fcr_identifier,
m_services.insert(make_pair(fcr_identifier, netService));
}

TXTRecordDeallocate(&txtRecord);

return err == kDNSServiceErr_NoError;
}

Expand Down

0 comments on commit d4bf50e

Please sign in to comment.