24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
@interface OFDNS: OFObject <OFApplicationDelegate>
@end
OF_APPLICATION_DELEGATE(OFDNS)
@implementation OFDNS
- (void)handleDNSResponse: (OFArray OF_GENERIC(OFDNSResourceRecord *) *)response
context: (id)context
exception: (id)exception
{
if (exception != nil) {
[of_stderr writeFormat: @"Failed to resolve: %@\n", exception];
[OFApplication terminateWithStatus: 1];
}
[of_stdout writeLine: [response description]];
[OFApplication terminate];
}
- (void)applicationDidFinishLaunching
{
OFArray OF_GENERIC(OFString *) *arguments = [OFApplication arguments];
|
>
|
>
>
|
>
>
>
>
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
@interface OFDNS: OFObject <OFApplicationDelegate>
@end
OF_APPLICATION_DELEGATE(OFDNS)
@implementation OFDNS
- (void)DNSResolver: (OFDNSResolver *)resolver
didReceiveAnswerRecords: (OFArray *)answerRecords
authorityRecords: (OFArray *)authorityRecords
additionalRecords: (OFArray *)additionalRecords
context: (id)context
exception: (id)exception
{
if (exception != nil) {
[of_stderr writeFormat: @"Failed to resolve: %@\n", exception];
[OFApplication terminateWithStatus: 1];
}
[of_stdout writeFormat: @"Answer records: %@\n"
@"Authority records: %@\n"
@"Additional records: %@\n",
answerRecords, authorityRecords,
additionalRecords];
[OFApplication terminate];
}
- (void)applicationDidFinishLaunching
{
OFArray OF_GENERIC(OFString *) *arguments = [OFApplication arguments];
|
72
73
74
75
76
77
78
79
80
81
82
83
|
[resolver setNameServers:
[OFArray arrayWithObject: [arguments objectAtIndex: 3]]];
[resolver asyncResolveHost: [arguments objectAtIndex: 0]
recordClass: recordClass
recordType: recordType
target: self
selector: @selector(handleDNSResponse:context:
exception:)
context: nil];
}
@end
|
|
>
>
|
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
[resolver setNameServers:
[OFArray arrayWithObject: [arguments objectAtIndex: 3]]];
[resolver asyncResolveHost: [arguments objectAtIndex: 0]
recordClass: recordClass
recordType: recordType
target: self
selector: @selector(DNSResolver:
didReceiveAnswerRecords:
authorityRecords:additionalRecords:
context:exception:)
context: nil];
}
@end
|