378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
- (const char*)cString
{
if (string != NULL)
return string;
asprintf(&string, "The specified node with the specified service could "
"not be translated to an address for an object of type %s. This "
"means that either the node was not found, there is no such "
asprintf(&string, "The service %s on %s could not be translated to an "
"address for an object of type %s. This means that either the node "
"was not found, there is no such service on the node, there was a "
"service on the specified node, there was a problem with the name "
"server, there was a problem with your network connection or you "
"specified an invalid node or service.", [object name]);
"problem with the name server, there was a problem with your "
"network connection or you specified an invalid node or service.",
service, node, [object name]);
return string;
}
- (const char*)node
{
return node;
}
- (const char*)service
{
return service;
}
@end
@implementation OFConnectionFailedException
+ newWithObject: (id)obj
andHost: (const char*)h
andPort: (uint16_t)p
{
return [self newWithObject: obj
andHost: h
andPort: p];
}
- initWithObject: (id)obj
andHost: (const char*)h
andPort: (uint16_t)p
{
if ((self = [super initWithObject: obj])) {
host = (h != NULL ? strdup(h) : NULL);
port = p;
}
return self;
}
- free
{
if (host != NULL)
free(host);
return [super free];
}
- (const char*)cString
{
if (string != NULL)
return string;
asprintf(&string, "A connection to %s:%d could not be established in "
"object of type %s!", host, port, [object name]);
return string;
}
- (const char*)host
{
return host;
}
- (uint16_t)port
{
return port;
}
@end
|