objc2_system_configuration/generated/SCDynamicStoreCopyDHCPInfo.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8/// Copies the DHCP information for the requested serviceID,
9/// or the primary service if serviceID == NULL.
10///
11/// Parameter `store`: An SCDynamicStoreRef representing the dynamic store session
12/// that should be used for communication with the server.
13/// If NULL, a temporary session will be used.
14///
15/// Parameter `serviceID`: A CFStringRef containing the requested service.
16/// If NULL, returns information for the primary service.
17///
18/// Returns: Returns a dictionary containing DHCP information if successful;
19/// NULL otherwise.
20/// Use the DHCPInfoGetOption function to retrieve
21/// individual options from the returned dictionary.
22///
23/// A non-NULL return value must be released using CFRelease().
24#[cfg(feature = "SCDynamicStore")]
25#[inline]
26pub unsafe extern "C-unwind" fn SCDynamicStoreCopyDHCPInfo(
27 store: Option<&SCDynamicStore>,
28 service_id: Option<&CFString>,
29) -> Option<CFRetained<CFDictionary>> {
30 extern "C-unwind" {
31 fn SCDynamicStoreCopyDHCPInfo(
32 store: Option<&SCDynamicStore>,
33 service_id: Option<&CFString>,
34 ) -> Option<NonNull<CFDictionary>>;
35 }
36 let ret = unsafe { SCDynamicStoreCopyDHCPInfo(store, service_id) };
37 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
38}
39
40/// Returns a non-NULL CFDataRef containing the DHCP
41/// option data, if present.
42///
43/// Parameter `info`: The non-NULL DHCP information dictionary returned by
44/// calling SCDynamicStoreCopyDHCPInfo.
45///
46/// Parameter `code`: The DHCP option code (see RFC 2132) to return
47/// data for.
48///
49/// Returns: Returns a non-NULL CFDataRef containing the option data;
50/// NULL if the requested option data is not present.
51///
52/// The return value must NOT be released.
53#[inline]
54pub unsafe extern "C-unwind" fn DHCPInfoGetOptionData(
55 info: &CFDictionary,
56 code: u8,
57) -> Option<CFRetained<CFData>> {
58 extern "C-unwind" {
59 fn DHCPInfoGetOptionData(info: &CFDictionary, code: u8) -> Option<NonNull<CFData>>;
60 }
61 let ret = unsafe { DHCPInfoGetOptionData(info, code) };
62 ret.map(|ret| unsafe { CFRetained::retain(ret) })
63}
64
65/// Returns a CFDateRef corresponding to the lease start time,
66/// if present.
67///
68/// Parameter `info`: The non-NULL DHCP information dictionary returned by
69/// calling SCDynamicStoreCopyDHCPInfo.
70///
71/// Returns: Returns a non-NULL CFDateRef if lease start time information is
72/// present; NULL if the information is not present or if the
73/// configuration method is not DHCP.
74///
75/// The return value must NOT be released.
76#[inline]
77pub unsafe extern "C-unwind" fn DHCPInfoGetLeaseStartTime(
78 info: &CFDictionary,
79) -> Option<CFRetained<CFDate>> {
80 extern "C-unwind" {
81 fn DHCPInfoGetLeaseStartTime(info: &CFDictionary) -> Option<NonNull<CFDate>>;
82 }
83 let ret = unsafe { DHCPInfoGetLeaseStartTime(info) };
84 ret.map(|ret| unsafe { CFRetained::retain(ret) })
85}
86
87/// Returns a CFDateRef corresponding to the lease expiration time,
88/// if present.
89///
90/// Parameter `info`: The non-NULL DHCP information dictionary returned by
91/// calling SCDynamicStoreCopyDHCPInfo.
92///
93/// Returns: Returns a non-NULL CFDateRef if the DHCP lease has an expiration;
94/// NULL if the lease is infinite i.e. has no expiration, or the
95/// configuration method is not DHCP. An infinite lease can be determined
96/// by a non-NULL lease start time (see DHCPInfoGetLeaseStartTime above).
97///
98/// The return value must NOT be released.
99#[inline]
100pub unsafe extern "C-unwind" fn DHCPInfoGetLeaseExpirationTime(
101 info: &CFDictionary,
102) -> Option<CFRetained<CFDate>> {
103 extern "C-unwind" {
104 fn DHCPInfoGetLeaseExpirationTime(info: &CFDictionary) -> Option<NonNull<CFDate>>;
105 }
106 let ret = unsafe { DHCPInfoGetLeaseExpirationTime(info) };
107 ret.map(|ret| unsafe { CFRetained::retain(ret) })
108}