︙ | | |
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
return @"any";
default:
return [OFString stringWithFormat: @"%u", DNSClass];
}
}
OFString *
of_dns_resource_record_type_to_string(of_dns_resource_record_type_t recordType)
of_dns_record_type_to_string(of_dns_record_type_t recordType)
{
switch (recordType) {
case OF_DNS_RESOURCE_RECORD_TYPE_A:
case OF_DNS_RECORD_TYPE_A:
return @"A";
case OF_DNS_RESOURCE_RECORD_TYPE_NS:
case OF_DNS_RECORD_TYPE_NS:
return @"NS";
case OF_DNS_RESOURCE_RECORD_TYPE_CNAME:
case OF_DNS_RECORD_TYPE_CNAME:
return @"CNAME";
case OF_DNS_RESOURCE_RECORD_TYPE_SOA:
case OF_DNS_RECORD_TYPE_SOA:
return @"SOA";
case OF_DNS_RESOURCE_RECORD_TYPE_PTR:
case OF_DNS_RECORD_TYPE_PTR:
return @"PTR";
case OF_DNS_RESOURCE_RECORD_TYPE_HINFO:
case OF_DNS_RECORD_TYPE_HINFO:
return @"HINFO";
case OF_DNS_RESOURCE_RECORD_TYPE_MX:
case OF_DNS_RECORD_TYPE_MX:
return @"MX";
case OF_DNS_RESOURCE_RECORD_TYPE_TXT:
case OF_DNS_RECORD_TYPE_TXT:
return @"TXT";
case OF_DNS_RESOURCE_RECORD_TYPE_RP:
case OF_DNS_RECORD_TYPE_RP:
return @"RP";
case OF_DNS_RESOURCE_RECORD_TYPE_AAAA:
case OF_DNS_RECORD_TYPE_AAAA:
return @"AAAA";
case OF_DNS_RESOURCE_RECORD_TYPE_SRV:
case OF_DNS_RECORD_TYPE_SRV:
return @"SRV";
case OF_DNS_RESOURCE_RECORD_TYPE_ALL:
case OF_DNS_RECORD_TYPE_ALL:
return @"all";
default:
return [OFString stringWithFormat: @"%u", recordType];
}
}
of_dns_class_t of_dns_class_parse(OFString *string)
|
︙ | | |
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
@throw [OFInvalidArgumentException exception];
objc_autoreleasePoolPop(pool);
return DNSClass;
}
of_dns_resource_record_type_t of_dns_resource_record_type_parse(
OFString *string)
of_dns_record_type_t of_dns_record_type_parse(OFString *string)
{
void *pool = objc_autoreleasePoolPush();
of_dns_resource_record_type_t recordType;
of_dns_record_type_t recordType;
string = string.uppercaseString;
if ([string isEqual: @"A"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_A;
recordType = OF_DNS_RECORD_TYPE_A;
else if ([string isEqual: @"NS"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_NS;
recordType = OF_DNS_RECORD_TYPE_NS;
else if ([string isEqual: @"CNAME"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_CNAME;
recordType = OF_DNS_RECORD_TYPE_CNAME;
else if ([string isEqual: @"SOA"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_SOA;
recordType = OF_DNS_RECORD_TYPE_SOA;
else if ([string isEqual: @"PTR"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_PTR;
recordType = OF_DNS_RECORD_TYPE_PTR;
else if ([string isEqual: @"HINFO"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_HINFO;
recordType = OF_DNS_RECORD_TYPE_HINFO;
else if ([string isEqual: @"MX"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_MX;
recordType = OF_DNS_RECORD_TYPE_MX;
else if ([string isEqual: @"TXT"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_TXT;
recordType = OF_DNS_RECORD_TYPE_TXT;
else if ([string isEqual: @"RP"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_RP;
recordType = OF_DNS_RECORD_TYPE_RP;
else if ([string isEqual: @"AAAA"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_AAAA;
recordType = OF_DNS_RECORD_TYPE_AAAA;
else if ([string isEqual: @"SRV"])
recordType = OF_DNS_RESOURCE_RECORD_TYPE_SRV;
recordType = OF_DNS_RECORD_TYPE_SRV;
else
@throw [OFInvalidArgumentException exception];
objc_autoreleasePoolPop(pool);
return recordType;
}
@implementation OFDNSResourceRecord
@synthesize name = _name, DNSClass = _DNSClass, recordType = _recordType;
@synthesize TTL = _TTL;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
self = [super init];
@try {
_name = [name copy];
_DNSClass = DNSClass;
|
︙ | | |
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
-
+
-
+
-
+
|
@"<%@:\n"
@"\tName = %@\n"
@"\tClass = %@\n"
@"\tType = %@\n"
@"\tTTL = %" PRIu32 "\n"
@">",
self.className, _name, of_dns_class_to_string(_DNSClass),
of_dns_resource_record_type_to_string(_recordType), _TTL];
of_dns_record_type_to_string(_recordType), _TTL];
}
@end
@implementation OFADNSResourceRecord
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
address: (const of_socket_address_t *)address
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: OF_DNS_CLASS_IN
recordType: OF_DNS_RESOURCE_RECORD_TYPE_A
recordType: OF_DNS_RECORD_TYPE_A
TTL: TTL];
_address = *address;
return self;
}
|
︙ | | |
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
-
+
-
+
|
of_socket_address_ip_string(&_address, NULL), _TTL];
}
@end
@implementation OFAAAADNSResourceRecord
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
address: (const of_socket_address_t *)address
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: OF_DNS_CLASS_IN
recordType: OF_DNS_RESOURCE_RECORD_TYPE_AAAA
recordType: OF_DNS_RECORD_TYPE_AAAA
TTL: TTL];
_address = *address;
return self;
}
|
︙ | | |
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
-
+
-
+
|
@end
@implementation OFCNAMEDNSResourceRecord
@synthesize alias = _alias;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
alias: (OFString *)alias
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_CNAME
recordType: OF_DNS_RECORD_TYPE_CNAME
TTL: TTL];
@try {
_alias = [alias copy];
} @catch (id e) {
[self release];
@throw e;
|
︙ | | |
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
|
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
-
+
-
+
|
@end
@implementation OFHINFODNSResourceRecord
@synthesize CPU = _CPU, OS = _OS;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
CPU: (OFString *)CPU
OS: (OFString *)OS
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_HINFO
recordType: OF_DNS_RECORD_TYPE_HINFO
TTL: TTL];
@try {
_CPU = [CPU copy];
_OS = [OS copy];
} @catch (id e) {
[self release];
|
︙ | | |
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
|
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
-
+
-
+
|
@end
@implementation OFMXDNSResourceRecord
@synthesize preference = _preference, mailExchange = _mailExchange;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
preference: (uint16_t)preference
mailExchange: (OFString *)mailExchange
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_MX
recordType: OF_DNS_RECORD_TYPE_MX
TTL: TTL];
@try {
_preference = preference;
_mailExchange = [mailExchange copy];
} @catch (id e) {
[self release];
|
︙ | | |
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
|
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
-
+
-
+
|
@end
@implementation OFNSDNSResourceRecord
@synthesize authoritativeHost = _authoritativeHost;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
authoritativeHost: (OFString *)authoritativeHost
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_NS
recordType: OF_DNS_RECORD_TYPE_NS
TTL: TTL];
@try {
_authoritativeHost = [authoritativeHost copy];
} @catch (id e) {
[self release];
@throw e;
|
︙ | | |
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
|
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
|
-
+
-
+
|
@end
@implementation OFPTRDNSResourceRecord
@synthesize domainName = _domainName;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
domainName: (OFString *)domainName
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_PTR
recordType: OF_DNS_RECORD_TYPE_PTR
TTL: TTL];
@try {
_domainName = [domainName copy];
} @catch (id e) {
[self release];
@throw e;
|
︙ | | |
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
|
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
|
-
+
-
+
|
@end
@implementation OFRPDNSResourceRecord
@synthesize mailbox = _mailbox, TXTDomainName = _TXTDomainName;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
mailbox: (OFString *)mailbox
TXTDomainName: (OFString *)TXTDomainName
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_RP
recordType: OF_DNS_RECORD_TYPE_RP
TTL: TTL];
@try {
_mailbox = [mailbox copy];
_TXTDomainName = [TXTDomainName copy];
} @catch (id e) {
[self release];
|
︙ | | |
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
|
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
|
-
+
-
+
|
@synthesize responsiblePerson = _responsiblePerson;
@synthesize serialNumber = _serialNumber, refreshInterval = _refreshInterval;
@synthesize retryInterval = _retryInterval;
@synthesize expirationInterval = _expirationInterval, minTTL = _minTTL;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
primaryNameServer: (OFString *)primaryNameServer
responsiblePerson: (OFString *)responsiblePerson
serialNumber: (uint32_t)serialNumber
refreshInterval: (uint32_t)refreshInterval
retryInterval: (uint32_t)retryInterval
expirationInterval: (uint32_t)expirationInterval
minTTL: (uint32_t)minTTL
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_SOA
recordType: OF_DNS_RECORD_TYPE_SOA
TTL: TTL];
@try {
_primaryNameServer = [primaryNameServer copy];
_responsiblePerson = [responsiblePerson copy];
_serialNumber = serialNumber;
_refreshInterval = refreshInterval;
|
︙ | | |
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
|
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
|
-
+
-
+
|
@implementation OFSRVDNSResourceRecord
@synthesize priority = _priority, weight = _weight, target = _target;
@synthesize port = _port;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
priority: (uint16_t)priority
weight: (uint16_t)weight
target: (OFString *)target
port: (uint16_t)port
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: OF_DNS_CLASS_IN
recordType: OF_DNS_RESOURCE_RECORD_TYPE_SRV
recordType: OF_DNS_RECORD_TYPE_SRV
TTL: TTL];
@try {
_priority = priority;
_weight = weight;
_target = [target copy];
_port = port;
|
︙ | | |
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
|
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
-
+
-
+
|
@end
@implementation OFTXTDNSResourceRecord
@synthesize textData = _textData;
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
recordType: (of_dns_resource_record_type_t)recordType
recordType: (of_dns_record_type_t)recordType
TTL: (uint32_t)TTL
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
DNSClass: (of_dns_class_t)DNSClass
textData: (OFData *)textData
TTL: (uint32_t)TTL
{
self = [super initWithName: name
DNSClass: DNSClass
recordType: OF_DNS_RESOURCE_RECORD_TYPE_TXT
recordType: OF_DNS_RECORD_TYPE_TXT
TTL: TTL];
@try {
_textData = [textData copy];
} @catch (id e) {
[self release];
@throw e;
|
︙ | | |