ObjFW  Check-in [74fea18d17]

Overview
Comment:Add OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES define
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 74fea18d17f8ffa40c62fdcf4a0e9e0e18d03b1e66176ddc5f59cea6a6cb48c8
User & Date: js on 2023-04-22 19:52:57
Other Links: manifest | tags
Context
2023-04-22
20:22
Rename x86_64 to AMD64 check-in: b7a4e61b88 user: js tags: trunk
19:52
Add OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES define check-in: 74fea18d17 user: js tags: trunk
19:44
+[OFSystemInfo networkInterfaces]: Add MAC address check-in: 76861c3f78 user: js tags: trunk
Changes

Modified Doxyfile from [95b2541e8f] to [864bba86b9].

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
	     OF_FILE_MANAGER_SUPPORTS_LINKS			\
	     OF_FILE_MANAGER_SUPPORTS_OWNER			\
	     OF_FILE_MANAGER_SUPPORTS_PERMISSIONS		\
	     OF_FILE_MANAGER_SUPPORTS_SYMLINKS			\
	     OF_GENERIC(...)=					\
	     OF_HAVE_BLOCKS					\
	     OF_HAVE_FILES					\
	     OF_HAVE_GETIFADDRS					\
	     OF_HAVE_SANDBOX					\
	     OF_HAVE_SOCKETS					\
	     OF_HAVE_THREADS					\
	     OF_KINDOF(...)=					\
	     OF_NO_RETURN=					\
	     OF_NO_RETURN_FUNC=					\
	     OF_NULLABLE_PROPERTY(...)=				\
	     OF_NULL_RESETTABLE_PROPERTY(...)=			\
	     OF_REQUIRES_SUPER=					\
	     OF_RETURNS_INNER_POINTER=				\
	     OF_RETURNS_NOT_RETAINED=				\
	     OF_RETURNS_RETAINED=				\
	     OF_ROOT_CLASS=					\
	     OF_SENTINEL=					\

	     OF_WARN_UNUSED_RESULT=				\
	     OF_WEAK_UNAVAILABLE=				\
	     SIGHUP						\
	     SIGUSR1						\
	     SIGUSR2
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
IGNORE_PREFIX = OF of_







<














>








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
	     OF_FILE_MANAGER_SUPPORTS_LINKS			\
	     OF_FILE_MANAGER_SUPPORTS_OWNER			\
	     OF_FILE_MANAGER_SUPPORTS_PERMISSIONS		\
	     OF_FILE_MANAGER_SUPPORTS_SYMLINKS			\
	     OF_GENERIC(...)=					\
	     OF_HAVE_BLOCKS					\
	     OF_HAVE_FILES					\

	     OF_HAVE_SANDBOX					\
	     OF_HAVE_SOCKETS					\
	     OF_HAVE_THREADS					\
	     OF_KINDOF(...)=					\
	     OF_NO_RETURN=					\
	     OF_NO_RETURN_FUNC=					\
	     OF_NULLABLE_PROPERTY(...)=				\
	     OF_NULL_RESETTABLE_PROPERTY(...)=			\
	     OF_REQUIRES_SUPER=					\
	     OF_RETURNS_INNER_POINTER=				\
	     OF_RETURNS_NOT_RETAINED=				\
	     OF_RETURNS_RETAINED=				\
	     OF_ROOT_CLASS=					\
	     OF_SENTINEL=					\
	     OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES		\
	     OF_WARN_UNUSED_RESULT=				\
	     OF_WEAK_UNAVAILABLE=				\
	     SIGHUP						\
	     SIGUSR1						\
	     SIGUSR2
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
IGNORE_PREFIX = OF of_

Modified configure.ac from [4855fb9648] to [c9359fab1e].

1761
1762
1763
1764
1765
1766
1767
1768

1769
1770
1771
1772
1773
1774
1775
				"OFSelectKernelEventObserver.m")
		])
		;;
	esac

	AC_CHECK_HEADERS(ifaddrs.h netpacket/packet.h)
	AC_CHECK_FUNC(getifaddrs, [
		AC_DEFINE(OF_HAVE_GETIFADDRS, 1, [Whether we have getifaddrs()])

	])
	AC_CHECK_TYPES([struct sockaddr_ll], [], [], [
		#ifdef HAVE_NETPACKET_PACKET_H
		# include <netpacket/packet.h>
		#endif
	])








|
>







1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
				"OFSelectKernelEventObserver.m")
		])
		;;
	esac

	AC_CHECK_HEADERS(ifaddrs.h netpacket/packet.h)
	AC_CHECK_FUNC(getifaddrs, [
		AC_DEFINE(OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES, 1,
			[Whether OFSystemInfo has network interfaces])
	])
	AC_CHECK_TYPES([struct sockaddr_ll], [], [], [
		#ifdef HAVE_NETPACKET_PACKET_H
		# include <netpacket/packet.h>
		#endif
	])

Modified src/OFSystemInfo.h from [4d9e8807d3] to [62b70ba89a].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import "OFString.h"

OF_ASSUME_NONNULL_BEGIN

@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFIRI;

#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS)
/**
 * @brief A key in the per-interface dictionary returned by
 *	  @ref networkInterfaces.
 *
 * Possible keys are:
 *
 *   * @ref OFNetworkInterfaceAddresses







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#import "OFString.h"

OF_ASSUME_NONNULL_BEGIN

@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFIRI;

#ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
/**
 * @brief A key in the per-interface dictionary returned by
 *	  @ref networkInterfaces.
 *
 * Possible keys are:
 *
 *   * @ref OFNetworkInterfaceAddresses
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# endif
# if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
@property (class, readonly, nonatomic) bool supportsAltiVec;
# endif
# ifdef OF_WINDOWS
@property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
# endif
# if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS)
@property (class, readonly, nonatomic) OFDictionary OF_GENERIC(OFString *,
    OFDictionary OF_GENERIC(OFNetworkInterfaceInfoKey, id) *)
    *networkInterfaces;
# endif
#endif

/**







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# endif
# if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
@property (class, readonly, nonatomic) bool supportsAltiVec;
# endif
# ifdef OF_WINDOWS
@property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
# endif
# ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
@property (class, readonly, nonatomic) OFDictionary OF_GENERIC(OFString *,
    OFDictionary OF_GENERIC(OFNetworkInterfaceInfoKey, id) *)
    *networkInterfaces;
# endif
#endif

/**
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
 * @note This method is only available on Windows.
 *
 * @return Whether the application is running on Windows NT
 */
+ (bool)isWindowsNT;
#endif

#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS)
/**
 * @brief Returns the available (though not necessarily configured) network
 *	  interfaces and information about them.
 *
 * @return The available network interfaces and information about them
 */
+ (OFDictionary OF_GENERIC(OFString *, OFDictionary







|







367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
 * @note This method is only available on Windows.
 *
 * @return Whether the application is running on Windows NT
 */
+ (bool)isWindowsNT;
#endif

#ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
/**
 * @brief Returns the available (though not necessarily configured) network
 *	  interfaces and information about them.
 *
 * @return The available network interfaces and information about them
 */
+ (OFDictionary OF_GENERIC(OFString *, OFDictionary

Modified src/OFSystemInfo.m from [5cf06ea45f] to [9e9c77f12d].

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

#if defined(OF_X86_64) || defined(OF_X86)
struct X86Regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS)
OFConstantString *const OFNetworkInterfaceAddresses =
    @"OFNetworkInterfaceAddresses";
OFConstantString *const OFNetworkInterfaceEthernetAddress =
    @"OFNetworkInterfaceEthernetAddress";
#endif

static size_t pageSize = 4096;







|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

#if defined(OF_X86_64) || defined(OF_X86)
struct X86Regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

#ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
OFConstantString *const OFNetworkInterfaceAddresses =
    @"OFNetworkInterfaceAddresses";
OFConstantString *const OFNetworkInterfaceEthernetAddress =
    @"OFNetworkInterfaceEthernetAddress";
#endif

static size_t pageSize = 4096;
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
#ifdef OF_WINDOWS
+ (bool)isWindowsNT
{
	return !(GetVersion() & 0x80000000);
}
#endif

#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS)
static OFSocketAddress
wrapSockaddr(struct sockaddr *sa)
{
	OFSocketAddress address;

	switch (sa->sa_family) {
	case AF_INET:







|







834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
#ifdef OF_WINDOWS
+ (bool)isWindowsNT
{
	return !(GetVersion() & 0x80000000);
}
#endif

#ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
static OFSocketAddress
wrapSockaddr(struct sockaddr *sa)
{
	OFSocketAddress address;

	switch (sa->sa_family) {
	case AF_INET:

Modified src/objfw-defs.h.in from [b5f598373d] to [e2e8bf6055].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#undef OF_HAVE_BUILTIN_BSWAP16
#undef OF_HAVE_BUILTIN_BSWAP32
#undef OF_HAVE_BUILTIN_BSWAP64
#undef OF_HAVE_CHMOD
#undef OF_HAVE_CHOWN
#undef OF_HAVE_FILES
#undef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR
#undef OF_HAVE_GETIFADDRS
#undef OF_HAVE_IPV6
#undef OF_HAVE_IPX
#undef OF_HAVE_LIMITS_H
#undef OF_HAVE_LINK
#undef OF_HAVE_MAX_ALIGN_T
#undef OF_HAVE_NETATALK_AT_H
#undef OF_HAVE_NETAT_APPLETALK_H







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
#undef OF_HAVE_BUILTIN_BSWAP16
#undef OF_HAVE_BUILTIN_BSWAP32
#undef OF_HAVE_BUILTIN_BSWAP64
#undef OF_HAVE_CHMOD
#undef OF_HAVE_CHOWN
#undef OF_HAVE_FILES
#undef OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR

#undef OF_HAVE_IPV6
#undef OF_HAVE_IPX
#undef OF_HAVE_LIMITS_H
#undef OF_HAVE_LINK
#undef OF_HAVE_MAX_ALIGN_T
#undef OF_HAVE_NETATALK_AT_H
#undef OF_HAVE_NETAT_APPLETALK_H
49
50
51
52
53
54
55

56
57
58
#undef OF_HAVE__THREAD_LOCAL
#undef OF_HAVE___THREAD
#undef OF_NINTENDO_3DS
#undef OF_NINTENDO_DS
#undef OF_NINTENDO_SWITCH
#undef OF_NO_SHARED
#undef OF_OBJFW_RUNTIME

#undef OF_UNIVERSAL
#undef OF_WII
#undef OF_WII_U







>



48
49
50
51
52
53
54
55
56
57
58
#undef OF_HAVE__THREAD_LOCAL
#undef OF_HAVE___THREAD
#undef OF_NINTENDO_3DS
#undef OF_NINTENDO_DS
#undef OF_NINTENDO_SWITCH
#undef OF_NO_SHARED
#undef OF_OBJFW_RUNTIME
#undef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
#undef OF_UNIVERSAL
#undef OF_WII
#undef OF_WII_U

Modified tests/OFSystemInfoTests.m from [ad02101851] to [79a55a5faf].

102
103
104
105
106
107
108






109
110
111
112
	    [OFSystemInfo supportsSHAExtensions]];
#endif

#ifdef OF_POWERPC
	[OFStdOut writeFormat: @"[OFSystemInfo] Supports AltiVec: %d\n",
	    [OFSystemInfo supportsAltiVec]];
#endif







	objc_autoreleasePoolPop(pool);
}
@end







>
>
>
>
>
>




102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	    [OFSystemInfo supportsSHAExtensions]];
#endif

#ifdef OF_POWERPC
	[OFStdOut writeFormat: @"[OFSystemInfo] Supports AltiVec: %d\n",
	    [OFSystemInfo supportsAltiVec]];
#endif

#ifdef OF_SYSTEM_INFO_HAS_NETWORK_INTERFACES
	[OFStdOut writeFormat: @"[OFSystemInfo] Network interfaces: %@\n",
			       [[[OFSystemInfo networkInterfaces] allKeys]
			       componentsJoinedByString: @", "]];
#endif

	objc_autoreleasePoolPop(pool);
}
@end