54 const char* p = aIPAddrString;
55 while (*p && ((*p ==
'.') || (*p >=
'0') || (*p <=
'9')))
66 while (*p && (segment < 4))
71 if (segmentValue > 255)
78 aResult[segment] = (byte)segmentValue;
86 segmentValue = (segmentValue * 10) + (*p -
'0');
92 if ((segmentValue > 255) || (segment > 3))
100 aResult[segment] = (byte)segmentValue;
189 uint16_t twoByteBuffer;
196 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
198 twoByteBuffer = htons(1);
199 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
202 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
204 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
206 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
209 const char* start = aName;
210 const char* end = start;
217 while (*end && (*end !=
'.'))
226 iUdp.write(&len,
sizeof(len));
228 iUdp.write((uint8_t*)start, end - start);
236 iUdp.write(&len,
sizeof(len));
238 twoByteBuffer = htons(
TYPE_A);
239 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
242 iUdp.write((uint8_t*)&twoByteBuffer,
sizeof(twoByteBuffer));
249 uint32_t startTime = millis();
252 while (
iUdp.parsePacket() <= 0)
254 if ((millis() - startTime) > aTimeout) {
281 uint16_t header_flags = htons(*((uint16_t*)&header[2]));
301 uint16_t answerCount = htons(*((uint16_t*)&header[6]));
302 if (answerCount == 0)
313 for (uint16_t i = 0; i <
HTONS(*((uint16_t*)&header[4])); i++)
334 for (
int i = 0; i < 4; i++)
345 for (uint16_t i = 0; i < answerCount; i++)
351 iUdp.read(&len,
sizeof(len));
383 uint16_t answerClass;
384 iUdp.read((uint8_t*)&answerType,
sizeof(answerType));
385 iUdp.read((uint8_t*)&answerClass,
sizeof(answerClass));
387 IF_RF24ETHERNET_DEBUG_DNS(Serial.print(F(
"RF24DNS Type: ")); Serial.println(
HTONS(answerType), HEX); Serial.print(F(
"RF24DNS Class: ")); Serial.println(
HTONS(answerClass), HEX););
396 iUdp.read((uint8_t*)&header_flags,
sizeof(header_flags));
401 if (
HTONS(header_flags) != 4)
409 iUdp.read(aAddress.raw_address(), 4);
416 for (uint16_t i = 0; i <
HTONS(header_flags); i++)