192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
+
-
+
-
+
-
+
|
OF_GETTER(domain, YES)
}
- (void)XMPP_lookup
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
unsigned char *answer = NULL;
size_t pageSize = [OFSystemInfo pageSize];
OFString *request;
request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", domain];
@try {
int answerLen, resourceRecordCount, i;
ns_rr resourceRecord;
ns_msg handle;
if (res_ninit(&resState))
@throw [OFAddressTranslationFailedException
exceptionWithClass: [self class]
socket: nil
host: domain];
answer = [self allocMemoryWithSize: of_pagesize];
answer = [self allocMemoryWithSize: pageSize];
answerLen = res_nsearch(&resState,
[request cStringUsingEncoding: OF_STRING_ENCODING_NATIVE],
ns_c_in, ns_t_srv, answer, (int)of_pagesize);
ns_c_in, ns_t_srv, answer, (int)pageSize);
if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
(h_errno == NO_DATA)))
return;
if (answerLen < 1 || answerLen > of_pagesize) {
if (answerLen < 1 || answerLen > pageSize) {
@throw [OFAddressTranslationFailedException
exceptionWithClass: [self class]
socket: nil
host: domain];
}
if (ns_initparse(answer, answerLen, &handle))
|