MCPcopy Create free account
hub / github.com/defold/defold / BuildARData

Function BuildARData

engine/dlib/src/dlib/mdns.cpp:791–804  ·  view source on GitHub ↗

Produces canonical IPv4 A-record rdata for host probing and announcements.

Source from the content-addressed store, hash-verified

789
790 // Produces canonical IPv4 A-record rdata for host probing and announcements.
791 static bool BuildARData(const dmSocket::Address& host_address, uint8_t* data, uint32_t data_size, uint16_t* data_length)
792 {
793 if (data_size < 4 || host_address.m_family != dmSocket::DOMAIN_IPV4 || dmSocket::Empty(host_address))
794 return false;
795
796 dmSocket::Address address = host_address;
797 uint32_t ipv4 = *dmSocket::IPv4(&address);
798 data[0] = (uint8_t) ((ipv4 >> 0) & 0xff);
799 data[1] = (uint8_t) ((ipv4 >> 8) & 0xff);
800 data[2] = (uint8_t) ((ipv4 >> 16) & 0xff);
801 data[3] = (uint8_t) ((ipv4 >> 24) & 0xff);
802 *data_length = 4;
803 return true;
804 }
805
806 // Materializes one tentative unique record owned by a service. These
807 // records are the RFC 6762 "claims" used in the authority section.

Callers 2

BuildProbeRecordFunction · 0.85
WriteRecordAFunction · 0.85

Calls 2

IPv4Function · 0.85
EmptyFunction · 0.70

Tested by

no test coverage detected