objc2_system_configuration/generated/
SCDynamicStoreKey.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#[cfg(feature = "SCDynamicStore")]
9impl SCDynamicStore {
10    /// Creates a dynamic store key that can be used to access
11    /// a specific global (as opposed to a per-service or per-interface)
12    /// network configuration entity.
13    ///
14    /// Parameter `allocator`: The CFAllocator that should be used to allocate
15    /// memory for this key.
16    /// This parameter may be NULL in which case the current
17    /// default CFAllocator is used. If this reference is not
18    /// a valid CFAllocator, the behavior is undefined.
19    ///
20    /// Parameter `domain`: A string specifying the desired domain, such as the
21    /// requested configuration (kSCDynamicStoreDomainSetup) or the
22    /// actual state (kSCDynamicStoreDomainState).
23    ///
24    /// Parameter `entity`: A string containing the specific global entity, such
25    /// as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
26    ///
27    /// Returns: Returns a string containing the formatted key.
28    #[doc(alias = "SCDynamicStoreKeyCreateNetworkGlobalEntity")]
29    #[inline]
30    pub fn key_create_network_global_entity(
31        allocator: Option<&CFAllocator>,
32        domain: &CFString,
33        entity: &CFString,
34    ) -> CFRetained<CFString> {
35        extern "C-unwind" {
36            fn SCDynamicStoreKeyCreateNetworkGlobalEntity(
37                allocator: Option<&CFAllocator>,
38                domain: &CFString,
39                entity: &CFString,
40            ) -> Option<NonNull<CFString>>;
41        }
42        let ret = unsafe { SCDynamicStoreKeyCreateNetworkGlobalEntity(allocator, domain, entity) };
43        let ret =
44            ret.expect("function was marked as returning non-null, but actually returned NULL");
45        unsafe { CFRetained::from_raw(ret) }
46    }
47
48    /// Creates a dynamic store key that can be used to access
49    /// the network interface configuration information stored in
50    /// the dynamic store.
51    ///
52    /// Parameter `allocator`: The CFAllocator that should be used to allocate
53    /// memory for this key.
54    /// This parameter may be NULL in which case the current
55    /// default CFAllocator is used. If this reference is not
56    /// a valid CFAllocator, the behavior is undefined.
57    ///
58    /// Parameter `domain`: A string specifying the desired domain, such as the
59    /// requested configuration (kSCDynamicStoreDomainSetup) or the
60    /// actual state (kSCDynamicStoreDomainState).
61    ///
62    /// Returns: Returns a string containing the formatted key.
63    #[doc(alias = "SCDynamicStoreKeyCreateNetworkInterface")]
64    #[inline]
65    pub fn key_create_network_interface(
66        allocator: Option<&CFAllocator>,
67        domain: &CFString,
68    ) -> CFRetained<CFString> {
69        extern "C-unwind" {
70            fn SCDynamicStoreKeyCreateNetworkInterface(
71                allocator: Option<&CFAllocator>,
72                domain: &CFString,
73            ) -> Option<NonNull<CFString>>;
74        }
75        let ret = unsafe { SCDynamicStoreKeyCreateNetworkInterface(allocator, domain) };
76        let ret =
77            ret.expect("function was marked as returning non-null, but actually returned NULL");
78        unsafe { CFRetained::from_raw(ret) }
79    }
80
81    /// Creates a dynamic store key that can be used to access
82    /// the per-interface network configuration information stored in
83    /// the dynamic store.
84    ///
85    /// Parameter `allocator`: The CFAllocator that should be used to allocate
86    /// memory for this key.
87    /// This parameter may be NULL in which case the current
88    /// default CFAllocator is used. If this reference is not
89    /// a valid CFAllocator, the behavior is undefined.
90    ///
91    /// Parameter `domain`: A string specifying the desired domain, such as the
92    /// requested configuration (kSCDynamicStoreDomainSetup) or the
93    /// actual state (kSCDynamicStoreDomainState).
94    ///
95    /// Parameter `ifname`: A string containing the interface name or a regular
96    /// expression pattern.
97    ///
98    /// Parameter `entity`: A string containing the specific global entity, such
99    /// as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
100    ///
101    /// Returns: Returns a string containing the formatted key.
102    #[doc(alias = "SCDynamicStoreKeyCreateNetworkInterfaceEntity")]
103    #[inline]
104    pub fn key_create_network_interface_entity(
105        allocator: Option<&CFAllocator>,
106        domain: &CFString,
107        ifname: &CFString,
108        entity: Option<&CFString>,
109    ) -> CFRetained<CFString> {
110        extern "C-unwind" {
111            fn SCDynamicStoreKeyCreateNetworkInterfaceEntity(
112                allocator: Option<&CFAllocator>,
113                domain: &CFString,
114                ifname: &CFString,
115                entity: Option<&CFString>,
116            ) -> Option<NonNull<CFString>>;
117        }
118        let ret = unsafe {
119            SCDynamicStoreKeyCreateNetworkInterfaceEntity(allocator, domain, ifname, entity)
120        };
121        let ret =
122            ret.expect("function was marked as returning non-null, but actually returned NULL");
123        unsafe { CFRetained::from_raw(ret) }
124    }
125
126    /// Creates a dynamic store key that can be used to access
127    /// the per-service network configuration information stored in
128    /// the dynamic store.
129    ///
130    /// Parameter `allocator`: The CFAllocator that should be used to allocate
131    /// memory for this key.
132    /// This parameter may be NULL in which case the current
133    /// default CFAllocator is used. If this reference is not
134    /// a valid CFAllocator, the behavior is undefined.
135    ///
136    /// Parameter `domain`: A string specifying the desired domain, such as the
137    /// requested configuration (kSCDynamicStoreDomainSetup) or the
138    /// actual state (kSCDynamicStoreDomainState).
139    ///
140    /// Parameter `serviceID`: A string containing the service ID or a regular
141    /// expression pattern.
142    ///
143    /// Parameter `entity`: A string containing the specific global entity, such
144    /// as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
145    ///
146    /// Returns: Returns a string containing the formatted key.
147    #[doc(alias = "SCDynamicStoreKeyCreateNetworkServiceEntity")]
148    #[inline]
149    pub fn key_create_network_service_entity(
150        allocator: Option<&CFAllocator>,
151        domain: &CFString,
152        service_id: &CFString,
153        entity: Option<&CFString>,
154    ) -> CFRetained<CFString> {
155        extern "C-unwind" {
156            fn SCDynamicStoreKeyCreateNetworkServiceEntity(
157                allocator: Option<&CFAllocator>,
158                domain: &CFString,
159                service_id: &CFString,
160                entity: Option<&CFString>,
161            ) -> Option<NonNull<CFString>>;
162        }
163        let ret = unsafe {
164            SCDynamicStoreKeyCreateNetworkServiceEntity(allocator, domain, service_id, entity)
165        };
166        let ret =
167            ret.expect("function was marked as returning non-null, but actually returned NULL");
168        unsafe { CFRetained::from_raw(ret) }
169    }
170
171    /// Creates a key that can be used in conjuntion with
172    /// SCDynamicStoreSetNotificationKeys function to receive
173    /// notifications when the current computer name changes.
174    ///
175    /// Parameter `allocator`: The CFAllocator that should be used to allocate
176    /// memory for this key.
177    /// This parameter may be NULL in which case the current
178    /// default CFAllocator is used. If this reference is not
179    /// a valid CFAllocator, the behavior is undefined.
180    ///
181    /// Returns: Returns a notification string for the current computer or
182    /// host name.
183    #[doc(alias = "SCDynamicStoreKeyCreateComputerName")]
184    #[inline]
185    pub fn key_create_computer_name(allocator: Option<&CFAllocator>) -> CFRetained<CFString> {
186        extern "C-unwind" {
187            fn SCDynamicStoreKeyCreateComputerName(
188                allocator: Option<&CFAllocator>,
189            ) -> Option<NonNull<CFString>>;
190        }
191        let ret = unsafe { SCDynamicStoreKeyCreateComputerName(allocator) };
192        let ret =
193            ret.expect("function was marked as returning non-null, but actually returned NULL");
194        unsafe { CFRetained::from_raw(ret) }
195    }
196
197    /// Creates a key that can be used in conjunction with
198    /// SCDynamicStoreSetNotificationKeys function to receive
199    /// notifications when the current console user changes.
200    ///
201    /// Parameter `allocator`: The CFAllocator that should be used to allocate
202    /// memory for this key.
203    /// This parameter may be NULL in which case the current
204    /// default CFAllocator is used. If this reference is not
205    /// a valid CFAllocator, the behavior is undefined.
206    ///
207    /// Returns: Returns a notification string for the current console user.
208    #[doc(alias = "SCDynamicStoreKeyCreateConsoleUser")]
209    #[inline]
210    pub fn key_create_console_user(allocator: Option<&CFAllocator>) -> CFRetained<CFString> {
211        extern "C-unwind" {
212            fn SCDynamicStoreKeyCreateConsoleUser(
213                allocator: Option<&CFAllocator>,
214            ) -> Option<NonNull<CFString>>;
215        }
216        let ret = unsafe { SCDynamicStoreKeyCreateConsoleUser(allocator) };
217        let ret =
218            ret.expect("function was marked as returning non-null, but actually returned NULL");
219        unsafe { CFRetained::from_raw(ret) }
220    }
221
222    /// Creates a key that can be used in conjunction with the
223    /// SCDynamicStoreSetNotificationKeys function to receive
224    /// notifications when the HostNames entity changes.  The
225    /// HostNames entity includes the local host name.
226    ///
227    /// Parameter `allocator`: The CFAllocator that should be used to allocate
228    /// memory for this key.
229    /// This parameter may be NULL in which case the current
230    /// default CFAllocator is used. If this reference is not
231    /// a valid CFAllocator, the behavior is undefined.
232    ///
233    /// Returns: Returns a notification string for the HostNames entity.
234    #[doc(alias = "SCDynamicStoreKeyCreateHostNames")]
235    #[inline]
236    pub fn key_create_host_names(allocator: Option<&CFAllocator>) -> CFRetained<CFString> {
237        extern "C-unwind" {
238            fn SCDynamicStoreKeyCreateHostNames(
239                allocator: Option<&CFAllocator>,
240            ) -> Option<NonNull<CFString>>;
241        }
242        let ret = unsafe { SCDynamicStoreKeyCreateHostNames(allocator) };
243        let ret =
244            ret.expect("function was marked as returning non-null, but actually returned NULL");
245        unsafe { CFRetained::from_raw(ret) }
246    }
247
248    /// Creates a key that can be used in conjunction with the
249    /// SCDynamicStoreSetNotificationKeys function to receive
250    /// notifications when the location identifier changes.
251    ///
252    /// Parameter `allocator`: The CFAllocator that should be used to allocate
253    /// memory for this key.
254    /// This parameter may be NULL in which case the current
255    /// default CFAllocator is used. If this reference is not
256    /// a valid CFAllocator, the behavior is undefined.
257    ///
258    /// Returns: Returns a notification string for the current location
259    /// identifier.
260    #[doc(alias = "SCDynamicStoreKeyCreateLocation")]
261    #[inline]
262    pub fn key_create_location(allocator: Option<&CFAllocator>) -> CFRetained<CFString> {
263        extern "C-unwind" {
264            fn SCDynamicStoreKeyCreateLocation(
265                allocator: Option<&CFAllocator>,
266            ) -> Option<NonNull<CFString>>;
267        }
268        let ret = unsafe { SCDynamicStoreKeyCreateLocation(allocator) };
269        let ret =
270            ret.expect("function was marked as returning non-null, but actually returned NULL");
271        unsafe { CFRetained::from_raw(ret) }
272    }
273
274    /// Creates a key that can be used in conjunction with
275    /// the SCDynamicStoreSetNotificationKeys function to receive
276    /// notifications when the current network proxy settings
277    /// (such as HTTP or FTP) are changed.
278    ///
279    /// Parameter `allocator`: The CFAllocator that should be used to allocate
280    /// memory for this key.
281    /// This parameter may be NULL in which case the current
282    /// default CFAllocator is used. If this reference is not
283    /// a valid CFAllocator, the behavior is undefined.
284    ///
285    /// Returns: Returns a notification string for the current proxy settings.
286    #[doc(alias = "SCDynamicStoreKeyCreateProxies")]
287    #[inline]
288    pub fn key_create_proxies(allocator: Option<&CFAllocator>) -> CFRetained<CFString> {
289        extern "C-unwind" {
290            fn SCDynamicStoreKeyCreateProxies(
291                allocator: Option<&CFAllocator>,
292            ) -> Option<NonNull<CFString>>;
293        }
294        let ret = unsafe { SCDynamicStoreKeyCreateProxies(allocator) };
295        let ret =
296            ret.expect("function was marked as returning non-null, but actually returned NULL");
297        unsafe { CFRetained::from_raw(ret) }
298    }
299}
300
301#[deprecated = "renamed to `SCDynamicStore::key_create_network_global_entity`"]
302#[inline]
303pub extern "C-unwind" fn SCDynamicStoreKeyCreateNetworkGlobalEntity(
304    allocator: Option<&CFAllocator>,
305    domain: &CFString,
306    entity: &CFString,
307) -> CFRetained<CFString> {
308    extern "C-unwind" {
309        fn SCDynamicStoreKeyCreateNetworkGlobalEntity(
310            allocator: Option<&CFAllocator>,
311            domain: &CFString,
312            entity: &CFString,
313        ) -> Option<NonNull<CFString>>;
314    }
315    let ret = unsafe { SCDynamicStoreKeyCreateNetworkGlobalEntity(allocator, domain, entity) };
316    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
317    unsafe { CFRetained::from_raw(ret) }
318}
319
320#[deprecated = "renamed to `SCDynamicStore::key_create_network_interface`"]
321#[inline]
322pub extern "C-unwind" fn SCDynamicStoreKeyCreateNetworkInterface(
323    allocator: Option<&CFAllocator>,
324    domain: &CFString,
325) -> CFRetained<CFString> {
326    extern "C-unwind" {
327        fn SCDynamicStoreKeyCreateNetworkInterface(
328            allocator: Option<&CFAllocator>,
329            domain: &CFString,
330        ) -> Option<NonNull<CFString>>;
331    }
332    let ret = unsafe { SCDynamicStoreKeyCreateNetworkInterface(allocator, domain) };
333    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
334    unsafe { CFRetained::from_raw(ret) }
335}
336
337#[deprecated = "renamed to `SCDynamicStore::key_create_network_interface_entity`"]
338#[inline]
339pub extern "C-unwind" fn SCDynamicStoreKeyCreateNetworkInterfaceEntity(
340    allocator: Option<&CFAllocator>,
341    domain: &CFString,
342    ifname: &CFString,
343    entity: Option<&CFString>,
344) -> CFRetained<CFString> {
345    extern "C-unwind" {
346        fn SCDynamicStoreKeyCreateNetworkInterfaceEntity(
347            allocator: Option<&CFAllocator>,
348            domain: &CFString,
349            ifname: &CFString,
350            entity: Option<&CFString>,
351        ) -> Option<NonNull<CFString>>;
352    }
353    let ret =
354        unsafe { SCDynamicStoreKeyCreateNetworkInterfaceEntity(allocator, domain, ifname, entity) };
355    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
356    unsafe { CFRetained::from_raw(ret) }
357}
358
359#[deprecated = "renamed to `SCDynamicStore::key_create_network_service_entity`"]
360#[inline]
361pub extern "C-unwind" fn SCDynamicStoreKeyCreateNetworkServiceEntity(
362    allocator: Option<&CFAllocator>,
363    domain: &CFString,
364    service_id: &CFString,
365    entity: Option<&CFString>,
366) -> CFRetained<CFString> {
367    extern "C-unwind" {
368        fn SCDynamicStoreKeyCreateNetworkServiceEntity(
369            allocator: Option<&CFAllocator>,
370            domain: &CFString,
371            service_id: &CFString,
372            entity: Option<&CFString>,
373        ) -> Option<NonNull<CFString>>;
374    }
375    let ret = unsafe {
376        SCDynamicStoreKeyCreateNetworkServiceEntity(allocator, domain, service_id, entity)
377    };
378    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
379    unsafe { CFRetained::from_raw(ret) }
380}
381
382#[deprecated = "renamed to `SCDynamicStore::key_create_computer_name`"]
383#[inline]
384pub extern "C-unwind" fn SCDynamicStoreKeyCreateComputerName(
385    allocator: Option<&CFAllocator>,
386) -> CFRetained<CFString> {
387    extern "C-unwind" {
388        fn SCDynamicStoreKeyCreateComputerName(
389            allocator: Option<&CFAllocator>,
390        ) -> Option<NonNull<CFString>>;
391    }
392    let ret = unsafe { SCDynamicStoreKeyCreateComputerName(allocator) };
393    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
394    unsafe { CFRetained::from_raw(ret) }
395}
396
397#[deprecated = "renamed to `SCDynamicStore::key_create_console_user`"]
398#[inline]
399pub extern "C-unwind" fn SCDynamicStoreKeyCreateConsoleUser(
400    allocator: Option<&CFAllocator>,
401) -> CFRetained<CFString> {
402    extern "C-unwind" {
403        fn SCDynamicStoreKeyCreateConsoleUser(
404            allocator: Option<&CFAllocator>,
405        ) -> Option<NonNull<CFString>>;
406    }
407    let ret = unsafe { SCDynamicStoreKeyCreateConsoleUser(allocator) };
408    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
409    unsafe { CFRetained::from_raw(ret) }
410}
411
412#[deprecated = "renamed to `SCDynamicStore::key_create_host_names`"]
413#[inline]
414pub extern "C-unwind" fn SCDynamicStoreKeyCreateHostNames(
415    allocator: Option<&CFAllocator>,
416) -> CFRetained<CFString> {
417    extern "C-unwind" {
418        fn SCDynamicStoreKeyCreateHostNames(
419            allocator: Option<&CFAllocator>,
420        ) -> Option<NonNull<CFString>>;
421    }
422    let ret = unsafe { SCDynamicStoreKeyCreateHostNames(allocator) };
423    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
424    unsafe { CFRetained::from_raw(ret) }
425}
426
427#[deprecated = "renamed to `SCDynamicStore::key_create_location`"]
428#[inline]
429pub extern "C-unwind" fn SCDynamicStoreKeyCreateLocation(
430    allocator: Option<&CFAllocator>,
431) -> CFRetained<CFString> {
432    extern "C-unwind" {
433        fn SCDynamicStoreKeyCreateLocation(
434            allocator: Option<&CFAllocator>,
435        ) -> Option<NonNull<CFString>>;
436    }
437    let ret = unsafe { SCDynamicStoreKeyCreateLocation(allocator) };
438    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
439    unsafe { CFRetained::from_raw(ret) }
440}
441
442#[deprecated = "renamed to `SCDynamicStore::key_create_proxies`"]
443#[inline]
444pub extern "C-unwind" fn SCDynamicStoreKeyCreateProxies(
445    allocator: Option<&CFAllocator>,
446) -> CFRetained<CFString> {
447    extern "C-unwind" {
448        fn SCDynamicStoreKeyCreateProxies(
449            allocator: Option<&CFAllocator>,
450        ) -> Option<NonNull<CFString>>;
451    }
452    let ret = unsafe { SCDynamicStoreKeyCreateProxies(allocator) };
453    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
454    unsafe { CFRetained::from_raw(ret) }
455}