ObjFW  Check-in [61907aff3a]

Overview
Comment:+[OFSystemInfo networkInterfaces]: Index on Win32
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 61907aff3a669cafd6e29d6d95504c3769196d9c98dbcaf2f098b4634144e3fd
User & Date: js on 2023-06-10 19:49:57
Other Links: manifest | tags
Context
2023-06-10
21:59
Use GetAdaptersAddresses() is available check-in: 826f1eb4d4 user: js tags: trunk
19:49
+[OFSystemInfo networkInterfaces]: Index on Win32 check-in: 61907aff3a user: js tags: trunk
19:40
Split out +[OFSystemInfo networkInterfaces] check-in: ac1baefd27 user: js tags: trunk
Changes

Modified src/platform/Windows/OFSystemInfo+NetworkInterfaces.m from [8e067f5c85] to [bff84018d5].

16
17
18
19
20
21
22

23
24
25
26
27
28
29
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30







+







#include "config.h"

#import "OFSystemInfo.h"
#import "OFSystemInfo+NetworkInterfaces.h"
#import "OFData.h"
#import "OFDictionary.h"
#import "OFLocale.h"
#import "OFNumber.h"
#import "OFSocket.h"
#import "OFString.h"

#include <windows.h>
#define interface struct
#include <iphlpapi.h>
#undef interface
65
66
67
68
69
70
71

72
73
74
75
76
77
78
79
80
81




82
83
84
85
86
87
88
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







+










+
+
+
+







			objc_autoreleasePoolPop(pool);
			return nil;
		}

		for (PIP_ADAPTER_INFO iter = adapterInfo; iter != NULL;
		    iter = iter->Next) {
			OFString *name, *IPString;
			OFNumber *index;
			OFMutableData *addresses;
			OFSocketAddress address;

			name = [OFString stringWithCString: iter->AdapterName
						  encoding: encoding];

			if ((interface = [ret objectForKey: name]) == nil) {
				interface = [OFMutableDictionary dictionary];
				[ret setObject: interface forKey: name];
			}

			index = [OFNumber numberWithUnsignedInt: iter->Index];
			[interface setObject: index
				      forKey: OFNetworkInterfaceIndex];

			IPString = [OFString
			    stringWithCString: iter->IpAddressList.IpAddress
						   .String
				     encoding: encoding];

			if ([IPString isEqual: @"0.0.0.0"])