MCPcopy Create free account
hub / github.com/SFML/SFML / readName

Function readName

src/SFML/Network/Dns.cpp:212–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212std::string readName(const char*& ptr, const char* end, const char* begin)
213{
214 std::string name;
215 while (true)
216 {
217 const auto count = readU8(ptr, end);
218 if (count == 0)
219 break;
220 if (count & 0b11000000)
221 {
222 // Compressed data
223 const auto offset = (static_cast<int>(count & 0b00111111) << 8) + readU8(ptr, end);
224 const auto* messagePtr = begin + offset;
225 name += readName(messagePtr, end, begin);
226 break;
227 }
228 name += std::string(ptr, count) + '.';
229 ptr += count;
230 }
231 if (!name.empty() && (name.back() == '.'))
232 name.pop_back();
233 return name;
234}
235
236struct Query
237{

Callers 4

queryDnsFunction · 0.85
queryNsMethod · 0.85
queryMxMethod · 0.85
querySrvMethod · 0.85

Calls 1

readU8Function · 0.85

Tested by

no test coverage detected