ObjFW  Diff

Differences From Artifact [088c1eb5e1]:

To Artifact [2b5ef9baa7]:


51
52
53
54
55
56
57
58
59
60




61
62
63
64
65
66
67
68
51
52
53
54
55
56
57



58
59
60
61

62
63
64
65
66
67
68







-
-
-
+
+
+
+
-








#ifdef OF_WINDOWS
# define interface struct
# include <iphlpapi.h>
# undef interface
#endif

#ifdef OF_AMIGAOS4
# define __USE_INLINE__
# define __NOLIBBASE__
#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS4
#  define __USE_INLINE__
# endif
# define __NOGLOBALIFACE__
# include <proto/exec.h>
# include <proto/bsdsocket.h>
#endif

#ifdef OF_NINTENDO_3DS
# include <3ds.h>
#endif
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
93
94
95
96
97
98
99















100
101
102
103
104
105
106







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







# define HOSTS_PATH @"DEVS:Internet/hosts"
#elif defined(OF_AMIGAOS)
# define HOSTS_PATH @"AmiTCP:db/hosts"
# define RESOLV_CONF_PATH @"AmiTCP:db/resolv.conf"
#else
# define HOSTS_PATH @"/etc/hosts"
# define RESOLV_CONF_PATH @"/etc/resolv.conf"
#endif

#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
static struct Library *SocketBase = NULL;
static struct SocketIFace *ISocket = NULL;

OF_DESTRUCTOR()
{
	if (ISocket != NULL)
		DropInterface((struct Interface *)ISocket);

	if (SocketBase != NULL)
		CloseLibrary(SocketBase);
}
#endif

/*
 * TODO:
 *
 *  - Fallback to TCP
 */
1136
1137
1138
1139
1140
1141
1142
1143

1144
1145
1146
1147
1148
1149
1150
1151
1152

1153
1154
1155
1156
1157
1158
1159
1160
1161
1121
1122
1123
1124
1125
1126
1127

1128
1129
1130
1131
1132
1133




1134


1135
1136
1137
1138
1139
1140
1141







-
+





-
-
-
-
+
-
-







@implementation OFDNSResolver
@synthesize staticHosts = _staticHosts, nameServers = _nameServers;
@synthesize localDomain = _localDomain, searchDomains = _searchDomains;
@synthesize timeout = _timeout, maxAttempts = _maxAttempts;
@synthesize minNumberOfDotsInAbsoluteName = _minNumberOfDotsInAbsoluteName;
@synthesize usesTCP = _usesTCP, configReloadInterval = _configReloadInterval;

#ifdef OF_AMIGAOS4
#ifdef OF_AMIGAOS
+ (void)initialize
{
	if (self != [OFDNSResolver class])
		return;

	if ((SocketBase = OpenLibrary("bsdsocket.library", 4)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];

	if (!of_socket_init())
	if ((ISocket = (struct SocketIFace *)
	    GetInterface(SocketBase, "main", 1, NULL)) == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}
#endif

+ (instancetype)resolver
{