ObjFW  Diff

Differences From Artifact [2196c79e5f]:

To Artifact [fbe82e3f08]:


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
73
74
75
76
77
78
79
80
81
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
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
232
233
234
235
236
237
#import "OFExceptions.h"

#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFException
+ newWithObject: (id)obj
{
	return [[self alloc] initWithObject: obj];
}

- initWithObject: (id)obj
{
	if ((self = [super init])) {
		object = obj;
		string = NULL;
	}

	return self;
}

- free
{
	if (string != NULL)
		free(string);

	return [super free];
}

- (id)object
{
	return object;
}

- (const char*)cString
{
	return string;
}
@end

@implementation OFNoMemException
+ newWithObject: (id)obj
	andSize: (size_t)size
{
	return [[self alloc] initWithObject: obj
				    andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super initWithObject: obj]))
		req_size = size;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Could not allocate %zu bytes for object of class "
	    "%s!", req_size, object != nil ? [object name] : "(null)");

	return string;
}

- (size_t)requestedSize
{
	return req_size;
}
@end

@implementation OFMemNotPartOfObjException
+ newWithObject: (id)obj
     andPointer: (void*)ptr
{
	return [[self alloc] initWithObject: obj
				 andPointer: ptr];
}

- initWithObject: (id)obj
      andPointer: (void*)ptr
{
	if ((self = [super initWithObject: obj]))
		pointer = ptr;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Memory at %p was not allocated as part of object "
	    "of class %s, thus the memory allocation was not changed! It is "
	    "also possible that there was an attempt to free the same memory "
	    "twice.", pointer, [object name]);

	return string;
}

- (void*)pointer
{
	return pointer;
}
@end

@implementation OFOutOfRangeException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Value out of range in object of class %s!",
	    object != nil ? [object name] : "(null)");

	return string;
}
@end

@implementation OFInvalidEncodingException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The encoding is invalid for object of classs %s!",
	    [object name]);

	return string;
}
@end

@implementation OFInvalidFormatException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The format is invalid for object of classs %s!",
	    [object name]);

	return string;
}
@end

@implementation OFInitializationFailedException
+ newWithClass: (Class)class_
{
	return [[self alloc] initWithClass: class_];
}

- initWithClass: (Class)class_
{
	if ((self = [super init])) {
		object = nil;
		string = NULL;
		class = class_;
	}

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Initialization failed for class %s!", [class name]);

	return string;
}

- (Class)class
{
	return class;
}
@end

@implementation OFOpenFileFailedException
+ newWithObject: (id)obj
	andPath: (const char*)path_
	andMode: (const char*)mode_
{
	return [[self alloc] initWithObject: obj
				    andPath: path_
				    andMode: mode_];
}

- initWithObject: (id)obj
	 andPath: (const char*)path_
	 andMode: (const char*)mode_
{
	if ((self = [super initWithObject: obj])) {
		path = (path_ != NULL ? strdup(path_) : NULL);
		mode = (mode_ != NULL ? strdup(mode_) : NULL);
		err = GET_ERR;
	}

	return self;
}







|

|


|


|














|

|









|
|

|
|


|
|

|










|
|











|
|

|
|


|
|

|













|
















|
<











|
|











|
<






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<









<
<
<
<
<



|
|
|

|
|
|


|
|
|

|







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
73
74
75
76
77
78
79
80
81
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
141
142
143
144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#import "OFExceptions.h"

#ifndef HAVE_ASPRINTF
#import "asprintf.h"
#endif

@implementation OFException
+ newWithClass: (Class)class_
{
	return [[self alloc] initWithClass: class_];
}

- initWithClass: (Class)class_
{
	if ((self = [super init])) {
		class = class_;
		string = NULL;
	}

	return self;
}

- free
{
	if (string != NULL)
		free(string);

	return [super free];
}

- (Class)class
{
	return class;
}

- (const char*)cString
{
	return string;
}
@end

@implementation OFNoMemException
+ newWithClass: (Class)class_
       andSize: (size_t)size
{
	return [[self alloc] initWithClass: class_
				   andSize: size];
}

- initWithClass: (Class)class_
	andSize: (size_t)size
{
	if ((self = [super initWithClass: class_]))
		req_size = size;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Could not allocate %zu bytes in class %s!",
		req_size, [class name]);

	return string;
}

- (size_t)requestedSize
{
	return req_size;
}
@end

@implementation OFMemNotPartOfObjException
+ newWithClass: (Class)class_
    andPointer: (void*)ptr
{
	return [[self alloc] initWithClass: class_
				andPointer: ptr];
}

- initWithClass: (Class)class_
     andPointer: (void*)ptr
{
	if ((self = [super initWithClass: class_]))
		pointer = ptr;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Memory at %p was not allocated as part of object "
	    "of class %s, thus the memory allocation was not changed! It is "
	    "also possible that there was an attempt to free the same memory "
	    "twice.", pointer, [class name]);

	return string;
}

- (void*)pointer
{
	return pointer;
}
@end

@implementation OFOutOfRangeException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Value out of range in class %s!", [class name]);


	return string;
}
@end

@implementation OFInvalidEncodingException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The encoding is invalid for classs %s!",
	    [class name]);

	return string;
}
@end

@implementation OFInvalidFormatException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The format is invalid for classs %s!", [class name]);


	return string;
}
@end

@implementation OFInitializationFailedException
















- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Initialization failed for class %s!", [class name]);

	return string;
}





@end

@implementation OFOpenFileFailedException
+ newWithClass: (Class)class_
       andPath: (const char*)path_
       andMode: (const char*)mode_
{
	return [[self alloc] initWithClass: class_
				   andPath: path_
				   andMode: mode_];
}

- initWithClass: (Class)class_
	andPath: (const char*)path_
	andMode: (const char*)mode_
{
	if ((self = [super initWithClass: class_])) {
		path = (path_ != NULL ? strdup(path_) : NULL);
		mode = (mode_ != NULL ? strdup(mode_) : NULL);
		err = GET_ERR;
	}

	return self;
}
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to open file %s with mode %s in object of "
	    "class %s! " ERRFMT, path, mode, [self name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;







|
|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to open file %s with mode %s in class %s! "
	    ERRFMT, path, mode, [self name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
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
- (char*)mode
{
	return mode;
}
@end

@implementation OFReadOrWriteFailedException
+ newWithObject: (id)obj
	andSize: (size_t)size
      andNItems: (size_t)nitems
{
	return [[self alloc] initWithObject: obj
				    andSize: size
				  andNItems: nitems];
}

+ newWithObject: (id)obj
	andSize: (size_t)size
{
	return [[self alloc] initWithObject: obj
				    andSize: size];
}

- initWithObject: (id)obj
	 andSize: (size_t)size
       andNItems: (size_t)nitems
{
	if ((self = [super initWithObject: obj])) {
		req_size = size;
		req_items = nitems;
		has_items = YES;
		err = GET_ERR;
	}

	return self;
}

- initWithObject: (id)obj
	 andSize: (size_t)size
{
	if ((self = [super initWithObject: obj])) {
		req_size = size;
		req_items = 0;
		has_items = NO;
		err = GET_ERR;
	}

	return self;







|
|
|

|
|
|


|
|

|
|


|
|
|

|









|
|

|







247
248
249
250
251
252
253
254
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
282
283
284
285
286
287
288
289
290
291
292
293
294
- (char*)mode
{
	return mode;
}
@end

@implementation OFReadOrWriteFailedException
+ newWithClass: (Class)class_
       andSize: (size_t)size
     andNItems: (size_t)nitems
{
	return [[self alloc] initWithClass: class_
				   andSize: size
				 andNItems: nitems];
}

+ newWithClass: (Class)class_
       andSize: (size_t)size
{
	return [[self alloc] initWithClass: class_
				   andSize: size];
}

- initWithClass: (Class)class_
	andSize: (size_t)size
      andNItems: (size_t)nitems
{
	if ((self = [super initWithClass: class_])) {
		req_size = size;
		req_items = nitems;
		has_items = YES;
		err = GET_ERR;
	}

	return self;
}

- initWithClass: (Class)class_
	andSize: (size_t)size
{
	if ((self = [super initWithClass: class_])) {
		req_size = size;
		req_items = 0;
		has_items = NO;
		err = GET_ERR;
	}

	return self;
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
369
370
371
372
373
374
375
376
377
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
- (const char*)cString
{
	if (string != NULL)
		return string;;

	if (has_items)
		asprintf(&string, "Failed to read %zu items of size %zu in "
		    "object of class %s! " ERRFMT, req_items, req_size,
		    [object name], ERRPARAM);
	else
		asprintf(&string, "Failed to read %zu bytes in object of class "
		    "%s! " ERRFMT, req_size, [object name], ERRPARAM);

	return string;
}
@end

@implementation OFWriteFailedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	if (has_items)
		asprintf(&string, "Failed to write %zu items of size %zu in "
		    "object of class %s! " ERRFMT, req_items, req_size,
		    [object name], ERRPARAM);
	else
		asprintf(&string, "Failed to write %zu bytes in object of "
		    "class %s! " ERRFMT, req_size, [object name], ERRFMT);

	return string;
}
@end

@implementation OFSetOptionFailedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Setting an option for an object of type type %s "
	    "failed!", [object name]);

	return string;
}
@end

@implementation OFNotConnectedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is not connected or bound!",
	    [object name]);

	return string;
}
@end

@implementation OFAlreadyConnectedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is already connected or bound "
	    "and thus can't be connected or bound again!", [object name]);

	return string;
}
@end

@implementation OFInvalidPortException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The port specified is not valid for a socket of "
	    "type %s! This usually means you tried to use port 0, which is an "
	    "invalid port.", [object name]);

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithObject: (id)obj









	andNode: (const char*)node_
     andService: (const char*)service_
{
	return [self newWithObject: obj
			   andNode: node_
			andService: service_];
}

- initWithObject: (id)obj
	 andNode: (const char*)node_
      andService: (const char*)service_
{
	if ((self = [super initWithObject: obj])) {
		node = (node_ != NULL ? strdup(node_) : NULL);
		service = (service_ != NULL ? strdup(service_) : NULL);
		err = GET_SOCK_ERR;
	}

	return self;
}







|
|

|
|













|
|

|
|











|
|












|












|













|






|
>
>
>
>
>
>
>
>
>



<
<
<
<
<
<
<
<
<
|







319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
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
368
369
370
371
372
373
374
375
376
377
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
- (const char*)cString
{
	if (string != NULL)
		return string;;

	if (has_items)
		asprintf(&string, "Failed to read %zu items of size %zu in "
		    "class %s! " ERRFMT, req_items, req_size, [class name],
		    ERRPARAM);
	else
		asprintf(&string, "Failed to read %zu bytes in class %s! "
		    ERRFMT, req_size, [class name], ERRPARAM);

	return string;
}
@end

@implementation OFWriteFailedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	if (has_items)
		asprintf(&string, "Failed to write %zu items of size %zu in "
		    "class %s! " ERRFMT, req_items, req_size, [class name],
		    ERRPARAM);
	else
		asprintf(&string, "Failed to write %zu bytes in class %s! "
		    ERRFMT, req_size, [class name], ERRFMT);

	return string;
}
@end

@implementation OFSetOptionFailedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Setting an option in class %s failed!",
	    [class name]);

	return string;
}
@end

@implementation OFNotConnectedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is not connected or bound!",
	    [class name]);

	return string;
}
@end

@implementation OFAlreadyConnectedException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The socket of type %s is already connected or bound "
	    "and thus can't be connected or bound again!", [class name]);

	return string;
}
@end

@implementation OFInvalidPortException
- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The port specified is not valid for a socket of "
	    "type %s! This usually means you tried to use port 0, which is an "
	    "invalid port.", [class name]);

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithClass: (Class)class_
       andNode: (const char*)node_
    andService: (const char*)service_
{
	return [self newWithClass: class_
			  andNode: node_
		       andService: service_];
}

- initWithClass: (Class)class_
	andNode: (const char*)node_
     andService: (const char*)service_
{









	if ((self = [super initWithClass: class_])) {
		node = (node_ != NULL ? strdup(node_) : NULL);
		service = (service_ != NULL ? strdup(service_) : NULL);
		err = GET_SOCK_ERR;
	}

	return self;
}
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

- (const char*)cString
{
	if (string != NULL)
		return string;

	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 "
	    "problem with the name server, there was a problem with your "
	    "network connection or you specified an invalid node or service. "
	    ERRFMT, service, node, [object name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;







|
|
|
|
|







439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "The service %s on %s could not be translated to an "
	    "address in class %s. This means that either the node was not "
	    "found, there is no such service on the 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. " ERRFMT,
	    service, node, [class name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
488
489
490
491
492
493
494
495









496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
- (const char*)service
{
	return service;
}
@end

@implementation OFConnectionFailedException
+ newWithObject: (id)obj









	andHost: (const char*)host_
	andPort: (uint16_t)port_
{
	return [self newWithObject: obj
			   andHost: host_
			   andPort: port_];
}

- initWithObject: (id)obj
	 andHost: (const char*)host_
	 andPort: (uint16_t)port_
{
	if ((self = [super initWithObject: obj])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		err = GET_SOCK_ERR;
	}

	return self;
}







|
>
>
>
>
>
>
>
>
>



<
<
<
<
<
<
<
<
<
|







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484









485
486
487
488
489
490
491
492
- (const char*)service
{
	return service;
}
@end

@implementation OFConnectionFailedException
+ newWithClass: (Class)class_
       andHost: (const char*)host_
       andPort: (uint16_t)port_
{
	return [self newWithClass: class_
			  andHost: host_
			  andPort: port_];
}

- initWithClass: (Class)class_
	andHost: (const char*)host_
	andPort: (uint16_t)port_
{









	if ((self = [super initWithClass: class_])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		err = GET_SOCK_ERR;
	}

	return self;
}
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "A connection to %s:%d could not be established in "
	    "object of type %s! " ERRFMT, host, port, [object name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;







|







501
502
503
504
505
506
507
508
509
510
511
512
513
514
515

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "A connection to %s:%d could not be established in "
	    "class %s! " ERRFMT, host, port, [class name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
546
547
548
549
550
551
552
553











554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
- (uint16_t)port
{
	return port;
}
@end

@implementation OFBindFailedException
+ newWithObject: (id)obj











	andHost: (const char*)host_
	andPort: (uint16_t)port_
      andFamily: (int)family_
{
	return [self newWithObject: obj
			   andHost: host_
			   andPort: port_
			 andFamily: family_];
}

- initWithObject: (id)obj
	 andHost: (const char*)host_
	 andPort: (uint16_t)port_
       andFamily: (int)family_
{
	if ((self = [super initWithObject: obj])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		family = family_;
		err = GET_SOCK_ERR;
	}

	return self;







|
>
>
>
>
>
>
>
>
>
>
>




<
<
<
<
<
<
<
<
<
<
<
|







523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545











546
547
548
549
550
551
552
553
- (uint16_t)port
{
	return port;
}
@end

@implementation OFBindFailedException
+ newWithClass: (Class)class_
       andHost: (const char*)host_
       andPort: (uint16_t)port_
     andFamily: (int)family_
{
	return [self newWithClass: class_
			  andHost: host_
			  andPort: port_
			andFamily: family_];
}

- initWithClass: (Class)class_
	andHost: (const char*)host_
	andPort: (uint16_t)port_
      andFamily: (int)family_
{











	if ((self = [super initWithClass: class_])) {
		host = (host_ != NULL ? strdup(host_) : NULL);
		port = port_;
		family = family_;
		err = GET_SOCK_ERR;
	}

	return self;
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Binding to port %d on %s using family %d failed in "
	    "object of type %s! " ERRFMT, port, host, family, [object name],
	    ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;







|
<







563
564
565
566
567
568
569
570

571
572
573
574
575
576
577

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Binding to port %d on %s using family %d failed in "
	    "class %s! " ERRFMT, port, host, family, [class name], ERRPARAM);


	return string;
}

- (int)errNo
{
	return err;
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
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
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
- (int)family
{
	return family;
}
@end

@implementation OFListenFailedException
+ newWithObject: (id)obj
     andBackLog: (int)backlog_
{
	return [[self alloc] initWithObject: obj
				 andBackLog: backlog_];
}

- initWithObject: (id)obj
      andBackLog: (int)backlog_
{
	if ((self = [super initWithObject: obj])) {
		backlog = backlog_;
		err = GET_SOCK_ERR;
	}

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to listen in socket of type %s with a back "
	    "log of %d! "ERRFMT, [object name], backlog, ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
}

- (int)backLog
{
	return backlog;
}
@end

@implementation OFAcceptFailedException
- initWithObject: (id)obj
{
	if ((self = [super initWithObject: obj]))
		err = GET_SOCK_ERR;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to accept connection in socket of type %s! "
	    ERRFMT, [object name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
}
@end







|
|

|
|


|
|

|













|
















|

|











|









590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
- (int)family
{
	return family;
}
@end

@implementation OFListenFailedException
+ newWithClass: (Class)class_
    andBackLog: (int)backlog_
{
	return [[self alloc] initWithClass: class_
				andBackLog: backlog_];
}

- initWithClass: (Class)class_
     andBackLog: (int)backlog_
{
	if ((self = [super initWithClass: class_])) {
		backlog = backlog_;
		err = GET_SOCK_ERR;
	}

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to listen in socket of type %s with a back "
	    "log of %d! "ERRFMT, [class name], backlog, ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
}

- (int)backLog
{
	return backlog;
}
@end

@implementation OFAcceptFailedException
- initWithClass: (Class)class_
{
	if ((self = [super initWithClass: class_]))
		err = GET_SOCK_ERR;

	return self;
}

- (const char*)cString
{
	if (string != NULL)
		return string;

	asprintf(&string, "Failed to accept connection in socket of type %s! "
	    ERRFMT, [class name], ERRPARAM);

	return string;
}

- (int)errNo
{
	return err;
}
@end