Skip to content

added attributes in services #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/mdns_cpp/defs.hpp
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ class ServiceRecord {
public:
const char *service;
const char *hostname;
const char *txt_rec;
uint32_t address_ipv4;
uint8_t *address_ipv6;
uint16_t port;
4 changes: 2 additions & 2 deletions src/mdns.cpp
Original file line number Diff line number Diff line change
@@ -344,11 +344,10 @@ int service_callback(int sock, const struct sockaddr *from, size_t addrlen, mdns
MDNS_LOG << " --> answer " << service_record->hostname << "." << service_record->service << " port "
<< service_record->port << " (" << (unicast ? "unicast" : "multicast") << ")\n";
if (!unicast) addrlen = 0;
char txt_record[] = "asdf=1";
mdns_query_answer(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, service_record->service,
service_length, service_record->hostname, strlen(service_record->hostname),
service_record->address_ipv4, service_record->address_ipv6, (uint16_t)service_record->port,
txt_record, sizeof(txt_record));
service_record->txt_rec, strlen(service_record->txt_rec));
}
} else if (rtype == static_cast<uint16_t>(mdns_record_type::MDNS_RECORDTYPE_SRV)) {
mdns_record_srv_t service =
@@ -423,6 +422,7 @@ void mDNS::runMainLoop() {
ServiceRecord service_record{};
service_record.service = name_.data();
service_record.hostname = hostname_.data();
service_record.txt_rec = txt_record_.data();
service_record.address_ipv4 = has_ipv4_ ? service_address_ipv4_ : 0;
service_record.address_ipv6 = has_ipv6_ ? service_address_ipv6_ : 0;
service_record.port = port_;