2 * Copyright (c) 2001, 2002, 2004, 2005, 2008, 2012, 2015, 2018 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _SCDYNAMICSTORECOPYDHCPINFO_H
25 #define _SCDYNAMICSTORECOPYDHCPINFO_H
27 #include <os/availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
30 #include <SystemConfiguration/SCDynamicStore.h>
32 CF_IMPLICIT_BRIDGING_ENABLED
33 CF_ASSUME_NONNULL_BEGIN
36 @header SCDynamicStoreCopyDHCPInfo
37 @discussion The functions of the SCDynamicStoreCopyDHCPInfo API
38 provide access to information returned by the DHCP or
46 @function SCDynamicStoreCopyDHCPInfo
47 @discussion Copies the DHCP information for the requested serviceID,
48 or the primary service if serviceID == NULL.
49 @param store An SCDynamicStoreRef representing the dynamic store session
50 that should be used for communication with the server.
51 If NULL, a temporary session will be used.
52 @param serviceID A CFStringRef containing the requested service.
53 If NULL, returns information for the primary service.
54 @result Returns a dictionary containing DHCP information if successful;
56 Use the DHCPInfoGetOption function to retrieve
57 individual options from the returned dictionary.
59 A non-NULL return value must be released using CFRelease().
61 CFDictionaryRef __nullable
62 SCDynamicStoreCopyDHCPInfo (SCDynamicStoreRef __nullable store
,
63 CFStringRef __nullable serviceID
) API_AVAILABLE(macos(10.1)) SPI_AVAILABLE(ios(2.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
66 @function DHCPInfoGetOptionData
67 @discussion Returns a non-NULL CFDataRef containing the DHCP
68 option data, if present.
69 @param info The non-NULL DHCP information dictionary returned by
70 calling SCDynamicStoreCopyDHCPInfo.
71 @param code The DHCP option code (see RFC 2132) to return
73 @result Returns a non-NULL CFDataRef containing the option data;
74 NULL if the requested option data is not present.
76 The return value must NOT be released.
79 DHCPInfoGetOptionData (CFDictionaryRef info
,
80 UInt8 code
) API_AVAILABLE(macos(10.1)) SPI_AVAILABLE(ios(2.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
83 @function DHCPInfoGetLeaseStartTime
84 @discussion Returns a CFDateRef corresponding to the lease start time,
86 @param info The non-NULL DHCP information dictionary returned by
87 calling SCDynamicStoreCopyDHCPInfo.
88 @result Returns a non-NULL CFDateRef if lease start time information is
89 present; NULL if the information is not present or if the
90 configuration method is not DHCP.
92 The return value must NOT be released.
95 DHCPInfoGetLeaseStartTime (CFDictionaryRef info
) API_AVAILABLE(macos(10.1)) SPI_AVAILABLE(ios(2.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
99 @function DHCPInfoGetLeaseExpirationTime
100 @discussion Returns a CFDateRef corresponding to the lease expiration time,
102 @param info The non-NULL DHCP information dictionary returned by
103 calling SCDynamicStoreCopyDHCPInfo.
104 @result Returns a non-NULL CFDateRef if the DHCP lease has an expiration;
105 NULL if the lease is infinite i.e. has no expiration, or the
106 configuration method is not DHCP. An infinite lease can be determined
107 by a non-NULL lease start time (see DHCPInfoGetLeaseStartTime above).
109 The return value must NOT be released.
112 DHCPInfoGetLeaseExpirationTime (CFDictionaryRef info
) API_AVAILABLE(macos(10.8)) SPI_AVAILABLE(ios(6.0), tvos(9.0), watchos(1.0), bridgeos(1.0));
116 CF_ASSUME_NONNULL_END
117 CF_IMPLICIT_BRIDGING_DISABLED
119 #endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */