21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "unistd_wrapper.h"
#import "OFDNSResolver.h"
#import "OFArray.h"
#import "OFCharacterSet.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFLocalization.h"
#import "OFString.h"
#ifdef OF_WINDOWS
# import "OFWindowsRegistryKey.h"
#endif
#import "OFOpenItemFailedException.h"
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "unistd_wrapper.h"
#import "OFDNSResolver.h"
#import "OFArray.h"
#import "OFCharacterSet.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFLocale.h"
#import "OFString.h"
#ifdef OF_WINDOWS
# import "OFWindowsRegistryKey.h"
#endif
#import "OFOpenItemFailedException.h"
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
if (gethostname(hostname, 256) != 0)
return nil;
if ((domain = strchr(hostname, '.')) == NULL)
return nil;
return [OFString stringWithCString: domain + 1
encoding: [OFLocalization encoding]];
}
@implementation OFDNSResolver
@synthesize staticHosts = _staticHosts, nameServers = _nameServers;
@synthesize localDomain = _localDomain, searchDomains = _searchDomains;
@synthesize minNumberOfDotsInAbsoluteName = _minNumberOfDotsInAbsoluteName;
@synthesize usesTCP = _usesTCP;
|
|
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
if (gethostname(hostname, 256) != 0)
return nil;
if ((domain = strchr(hostname, '.')) == NULL)
return nil;
return [OFString stringWithCString: domain + 1
encoding: [OFLocale encoding]];
}
@implementation OFDNSResolver
@synthesize staticHosts = _staticHosts, nameServers = _nameServers;
@synthesize localDomain = _localDomain, searchDomains = _searchDomains;
@synthesize minNumberOfDotsInAbsoluteName = _minNumberOfDotsInAbsoluteName;
@synthesize usesTCP = _usesTCP;
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
# endif
#endif
#ifdef OF_WINDOWS
- (void)of_parseNetworkParams
{
void *pool = objc_autoreleasePoolPush();
of_string_encoding_t encoding = [OFLocalization encoding];
OFMutableArray *nameServers;
OFString *localDomain;
/*
* We need more space than FIXED_INFO in case we have more than one
* name server, but we also want it to be properly aligned, meaning we
* can't just get a buffer of bytes. Thus, we just get space for 8.
*/
|
|
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
# endif
#endif
#ifdef OF_WINDOWS
- (void)of_parseNetworkParams
{
void *pool = objc_autoreleasePoolPush();
of_string_encoding_t encoding = [OFLocale encoding];
OFMutableArray *nameServers;
OFString *localDomain;
/*
* We need more space than FIXED_INFO in case we have more than one
* name server, but we also want it to be properly aligned, meaning we
* can't just get a buffer of bytes. Thus, we just get space for 8.
*/
|