Builds canonical SRV rdata once so probes, responses, and tiebreak comparisons all operate on the same byte representation.
| 743 | // Builds canonical SRV rdata once so probes, responses, and tiebreak |
| 744 | // comparisons all operate on the same byte representation. |
| 745 | static bool BuildSrvRData(const RegisteredService& service, uint8_t* data, uint32_t data_size, uint16_t* data_length) |
| 746 | { |
| 747 | uint32_t data_offset = 0; |
| 748 | if (!WriteU16(data, data_size, &data_offset, 0) // priority |
| 749 | || !WriteU16(data, data_size, &data_offset, 0) // weight |
| 750 | || !WriteU16(data, data_size, &data_offset, service.m_Port) |
| 751 | || !WriteName(data, data_size, &data_offset, service.m_HostLocal)) |
| 752 | { |
| 753 | return false; |
| 754 | } |
| 755 | |
| 756 | *data_length = (uint16_t) data_offset; |
| 757 | return true; |
| 758 | } |
| 759 | |
| 760 | // Encodes the TXT payload exactly as it will appear on the wire so probe |
| 761 | // authority claims and incoming tiebreak records can be compared bytewise. |
no test coverage detected