ObjFW  Diff

Differences From Artifact [b4a5fc6e68]:

To Artifact [ae7cdae06b]:


10
11
12
13
14
15
16
17


18

19
20
21
22
23
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
55
56
57
58
59
60
61





62
63
64


65
66
67
68

69
70
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"



#import "OFBindIPXSocketFailedException.h"

#import "OFString.h"

@implementation OFBindIPXSocketFailedException
@synthesize port = _port, packetType = _packetType;

+ (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo
{
	OF_UNRECOGNIZED_SELECTOR
}

+ (instancetype)exceptionWithPort: (uint16_t)port



		       packetType: (uint8_t)packetType
			   socket: (id)sock
			    errNo: (int)errNo
{
	return [[[self alloc] initWithPort: port


				packetType: packetType
				    socket: sock
				     errNo: errNo] autorelease];
}

- (instancetype)initWithSocket: (id)sock errNo: (int)errNo
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)initWithPort: (uint16_t)port



		  packetType: (uint8_t)packetType
		      socket: (id)sock
		       errNo: (int)errNo
{
	self = [super initWithSocket: sock errNo: errNo];

	@try {


		_port = port;
		_packetType = packetType;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}






- (OFString *)description
{


	return [OFString stringWithFormat:
	    @"Binding to port %" @PRIx16 @" for packet type %" @PRIx8
	    @" failed in socket of type %@: %@",
	    _port, _packetType, [_socket class], OFStrError(_errNo)];

}
@end








>
>

>



|






|
>
>
>
|
|
|

|
>
>
|
|
|







|
>
>
>
|
|
|




>
>









>
>
>
>
>



>
>

|
|
|
>


10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
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
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <string.h>

#import "OFBindIPXSocketFailedException.h"
#import "OFData.h"
#import "OFString.h"

@implementation OFBindIPXSocketFailedException
@synthesize network = _network, port = _port, packetType = _packetType;

+ (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo
{
	OF_UNRECOGNIZED_SELECTOR
}

+ (instancetype)
    exceptionWithNetwork: (uint32_t)network
		    node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
		    port: (uint16_t)port
	      packetType: (uint8_t)packetType
		  socket: (id)sock
		   errNo: (int)errNo
{
	return [[[self alloc] initWithNetwork: network
					 node: node
					 port: port
				   packetType: packetType
				       socket: sock
					errNo: errNo] autorelease];
}

- (instancetype)initWithSocket: (id)sock errNo: (int)errNo
{
	OF_INVALID_INIT_METHOD
}

- (instancetype)
    initWithNetwork: (uint32_t)network
	       node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
	       port: (uint16_t)port
	 packetType: (uint8_t)packetType
	     socket: (id)sock
	      errNo: (int)errNo
{
	self = [super initWithSocket: sock errNo: errNo];

	@try {
		_network = network;
		memcpy(_node, node, sizeof(_node));
		_port = port;
		_packetType = packetType;
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)getNode: (unsigned char [IPX_NODE_LEN])node
{
	memcpy(node, _node, sizeof(_node));
}

- (OFString *)description
{
	OFData *node = [OFData dataWithItems: _node count: sizeof(_node)];

	return [OFString stringWithFormat:
	    @"Binding to network %" @PRIx16 " on node %@ with port %" @PRIx16
	    @" failed for packet type %" @PRIx8 " in socket of type %@: %@",
	    _network, node, _port, _packetType, [_socket class],
	    OFStrError(_errNo)];
}
@end