@@ -161,10 +161,10 @@ uint16_t DNSClient::BuildRequest(const char* aName)
161
161
// FIXME than assume there's enough space (as the code does at present)
162
162
iUdp.write ((uint8_t *)&iRequestId, sizeof (iRequestId));
163
163
164
- twoByteBuffer = htons ( QUERY_FLAG | OPCODE_STANDARD_QUERY | RECURSION_DESIRED_FLAG) ;
164
+ twoByteBuffer = QUERY_FLAG | OPCODE_STANDARD_QUERY | RECURSION_DESIRED_FLAG;
165
165
iUdp.write ((uint8_t *)&twoByteBuffer, sizeof (twoByteBuffer));
166
166
167
- twoByteBuffer = htons ( 1 ) ; // One question record
167
+ twoByteBuffer = 1 ; // One question record
168
168
iUdp.write ((uint8_t *)&twoByteBuffer, sizeof (twoByteBuffer));
169
169
170
170
twoByteBuffer = 0 ; // Zero answer records
@@ -201,10 +201,10 @@ uint16_t DNSClient::BuildRequest(const char* aName)
201
201
len = 0 ;
202
202
iUdp.write (&len, sizeof (len));
203
203
// Finally the type and class of question
204
- twoByteBuffer = htons ( TYPE_A) ;
204
+ twoByteBuffer = TYPE_A;
205
205
iUdp.write ((uint8_t *)&twoByteBuffer, sizeof (twoByteBuffer));
206
206
207
- twoByteBuffer = htons ( CLASS_IN) ; // Internet class of question
207
+ twoByteBuffer = CLASS_IN; // Internet class of question
208
208
iUdp.write ((uint8_t *)&twoByteBuffer, sizeof (twoByteBuffer));
209
209
// Success! Everything buffered okay
210
210
return 1 ;
@@ -243,7 +243,7 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
243
243
}
244
244
iUdp.read (header.byte , DNS_HEADER_SIZE);
245
245
246
- uint16_t header_flags = htons ( header.word [1 ]) ;
246
+ uint16_t header_flags = header.word [1 ];
247
247
// Check that it's a response to this request
248
248
if ((iRequestId != (header.word [0 ])) ||
249
249
((header_flags & QUERY_RESPONSE_MASK) != (uint16_t )RESPONSE_FLAG) ) {
@@ -260,15 +260,15 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
260
260
}
261
261
262
262
// And make sure we've got (at least) one answer
263
- uint16_t answerCount = htons ( header.word [3 ]) ;
263
+ uint16_t answerCount = header.word [3 ];
264
264
if (answerCount == 0 ) {
265
265
// Mark the entire packet as read
266
266
iUdp.flush (); // FIXME
267
267
return -6 ; // INVALID_RESPONSE;
268
268
}
269
269
270
270
// Skip over any questions
271
- for (uint16_t i=0 ; i < htons ( header.word [2 ]) ; i++) {
271
+ for (uint16_t i=0 ; i < header.word [2 ]; i++) {
272
272
// Skip over the name
273
273
uint8_t len;
274
274
do {
@@ -329,8 +329,8 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
329
329
// Don't need header_flags anymore, so we can reuse it here
330
330
iUdp.read ((uint8_t *)&header_flags, sizeof (header_flags));
331
331
332
- if ( (htons ( answerType) == TYPE_A) && (htons ( answerClass) == CLASS_IN) ) {
333
- if (htons ( header_flags) != 4 ) {
332
+ if ( (answerType == TYPE_A) && (answerClass == CLASS_IN) ) {
333
+ if (header_flags != 4 ) {
334
334
// It's a weird size
335
335
// Mark the entire packet as read
336
336
iUdp.flush (); // FIXME
@@ -341,7 +341,7 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress)
341
341
return SUCCESS;
342
342
} else {
343
343
// This isn't an answer type we're after, move onto the next one
344
- iUdp.read ((uint8_t *)NULL , htons ( header_flags) );
344
+ iUdp.read ((uint8_t *)NULL , header_flags);
345
345
}
346
346
}
347
347
0 commit comments