267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
buffer[i], buffer[i + 1],
buffer[i + 2], buffer[i + 3]];
return [[[OFADNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_NS:
j = i;
data = parseName(buffer, length, &j,
ALLOWED_POINTER_LEVELS);
if (j != i + dataLength)
@throw [OFInvalidServerReplyException
exception];
return [[[OFNSDNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_CNAME:
j = i;
data = parseName(buffer, length, &j,
ALLOWED_POINTER_LEVELS);
if (j != i + dataLength)
@throw [OFInvalidServerReplyException
exception];
return [[[OFCNAMEDNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_PTR:
j = i;
data = parseName(buffer, length, &j,
ALLOWED_POINTER_LEVELS);
if (j != i + dataLength)
@throw [OFInvalidServerReplyException
exception];
return [[[OFPTRDNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_MX:
if (dataLength < 2)
@throw [OFInvalidServerReplyException
|
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
+
+
+
+
+
+
+
+
+
+
|
exception];
return [[[OFMXDNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
preference: preference
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_TXT:
data = [OFData dataWithItems: &buffer[i]
count: dataLength];
return [[[OFTXTDNSResourceRecord alloc]
initWithName: name
recordClass: recordClass
recordType: recordType
data: data
TTL: TTL] autorelease];
case OF_DNS_RESOURCE_RECORD_TYPE_AAAA:
if (dataLength != 16)
@throw [OFInvalidServerReplyException
exception];
|