objc2_system_configuration/generated/
SCDynamicStore.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "dispatch2")]
8use dispatch2::*;
9#[cfg(feature = "objc2")]
10use objc2::__framework_prelude::*;
11use objc2_core_foundation::*;
12
13use crate::*;
14
15/// This is the handle to an open a dynamic store session
16/// with the system configuration daemon.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scdynamicstore?language=objc)
19#[doc(alias = "SCDynamicStoreRef")]
20#[repr(C)]
21pub struct SCDynamicStore {
22    inner: [u8; 0],
23    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
24}
25
26cf_type!(
27    unsafe impl SCDynamicStore {}
28);
29#[cfg(feature = "objc2")]
30cf_objc2_type!(
31    unsafe impl RefEncode<"__SCDynamicStore"> for SCDynamicStore {}
32);
33
34/// Structure containing user-specified data and callbacks for an
35/// SCDynamicStore session.
36/// Field: version The version number of the structure type being passed
37/// in as a parameter to the SCDynamicStore creation function.
38/// This structure is version 0.
39/// Field: info A C pointer to a user-specified block of data.
40/// Field: retain The callback used to add a retain for the info field.
41/// If this parameter is not a pointer to a function of the correct
42/// prototype, the behavior is undefined.  The value may be NULL.
43/// Field: release The calllback used to remove a retain previously added
44/// for the info field.  If this parameter is not a pointer to a
45/// function of the correct prototype, the behavior is undefined.
46/// The value may be NULL.
47/// Field: copyDescription The callback used to provide a description of
48/// the info field.
49///
50/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scdynamicstorecontext?language=objc)
51#[repr(C)]
52#[allow(unpredictable_function_pointer_comparisons)]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub struct SCDynamicStoreContext {
55    pub version: CFIndex,
56    pub info: *mut c_void,
57    pub retain: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>,
58    pub release: Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>,
59    pub copyDescription: Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>,
60}
61
62#[cfg(feature = "objc2")]
63unsafe impl Encode for SCDynamicStoreContext {
64    const ENCODING: Encoding = Encoding::Struct(
65        "?",
66        &[
67            <CFIndex>::ENCODING,
68            <*mut c_void>::ENCODING,
69            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<c_void>>>::ENCODING,
70            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>)>>::ENCODING,
71            <Option<unsafe extern "C-unwind" fn(NonNull<c_void>) -> NonNull<CFString>>>::ENCODING,
72        ],
73    );
74}
75
76#[cfg(feature = "objc2")]
77unsafe impl RefEncode for SCDynamicStoreContext {
78    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
79}
80
81/// Type of callback function used when notification of
82/// changes to the dynamic store is delivered.
83///
84/// Parameter `store`: The dynamic store session.
85///
86/// Parameter `changedKeys`: The list of changed keys.
87///
88/// The list includes any specific SCDynamicStore keys that
89/// changed (add, update, remove, notify) since the last call
90/// to SCDynamicStoreSetNotificationKeys or since the last
91/// notification callback. The list also includes any specific
92/// keys matching one of the pattern string(s) that changed.
93///
94/// An empty list indicates that the SCDynamicStore server
95/// restarted and that any assumptions based on prior content
96/// of the SCDynamicStore should be discarded.
97///
98///
99/// Parameter `info`: A C pointer to a user-specified block of data.
100///
101/// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/scdynamicstorecallback?language=objc)
102pub type SCDynamicStoreCallBack =
103    Option<unsafe extern "C-unwind" fn(NonNull<SCDynamicStore>, NonNull<CFArray>, *mut c_void)>;
104
105unsafe impl ConcreteType for SCDynamicStore {
106    /// Returns the type identifier of all SCDynamicStore instances.
107    #[doc(alias = "SCDynamicStoreGetTypeID")]
108    #[inline]
109    fn type_id() -> CFTypeID {
110        extern "C-unwind" {
111            fn SCDynamicStoreGetTypeID() -> CFTypeID;
112        }
113        unsafe { SCDynamicStoreGetTypeID() }
114    }
115}
116
117impl SCDynamicStore {
118    /// Creates a new session used to interact with the dynamic
119    /// store maintained by the System Configuration server.
120    ///
121    /// Parameter `allocator`: The CFAllocator that should be used to allocate
122    /// memory for the local dynamic store object.
123    /// This parameter may be NULL in which case the current
124    /// default CFAllocator is used. If this reference is not
125    /// a valid CFAllocator, the behavior is undefined.
126    ///
127    /// Parameter `name`: A string that describes the name of the calling
128    /// process or plug-in of the caller.
129    ///
130    /// Parameter `callout`: The function to be called when a watched value
131    /// in the dynamic store is changed.
132    /// A NULL value can be specified if no callouts are
133    /// desired.
134    ///
135    /// Parameter `context`: The SCDynamicStoreContext associated with the callout.
136    ///
137    /// Returns: Returns a reference to the new SCDynamicStore session.
138    /// You must release the returned value.
139    ///
140    /// # Safety
141    ///
142    /// - `callout` must be implemented correctly.
143    /// - `context` must be a valid pointer or null.
144    #[doc(alias = "SCDynamicStoreCreate")]
145    #[inline]
146    pub unsafe fn new(
147        allocator: Option<&CFAllocator>,
148        name: &CFString,
149        callout: SCDynamicStoreCallBack,
150        context: *mut SCDynamicStoreContext,
151    ) -> Option<CFRetained<SCDynamicStore>> {
152        extern "C-unwind" {
153            fn SCDynamicStoreCreate(
154                allocator: Option<&CFAllocator>,
155                name: &CFString,
156                callout: SCDynamicStoreCallBack,
157                context: *mut SCDynamicStoreContext,
158            ) -> Option<NonNull<SCDynamicStore>>;
159        }
160        let ret = unsafe { SCDynamicStoreCreate(allocator, name, callout, context) };
161        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
162    }
163
164    /// Creates a new session used to interact with the dynamic
165    /// store maintained by the System Configuration server.
166    ///
167    /// Parameter `allocator`: The CFAllocator that should be used to allocate
168    /// memory for the local dynamic store object.
169    /// This parameter may be NULL in which case the current
170    /// default CFAllocator is used. If this reference is not
171    /// a valid CFAllocator, the behavior is undefined.
172    ///
173    /// Parameter `name`: A string that describes the name of the calling
174    /// process or plug-in of the caller.
175    ///
176    /// Parameter `storeOptions`: A CFDictionary containing options for the
177    /// dynamic store session (such as whether all keys added or set
178    /// into the dynamic store should be per-session keys).
179    ///
180    /// Currently available options include:
181    ///
182    /// <TABLE
183    /// BORDER>
184    /// <TR
185    /// >
186    /// <TH
187    /// >key
188    /// </TD
189    /// >
190    /// <TH
191    /// >value
192    /// </TD
193    /// >
194    /// </TR
195    /// >
196    /// <TR
197    /// >
198    /// <TD
199    /// >kSCDynamicStoreUseSessionKeys
200    /// </TD
201    /// >
202    /// <TD
203    /// >CFBooleanRef
204    /// </TD
205    /// >
206    /// </TR
207    /// >
208    /// </TABLE
209    /// >
210    ///
211    /// A NULL value can be specified if no options are desired.
212    ///
213    /// Parameter `callout`: The function to be called when a watched value
214    /// in the dynamic store is changed.
215    /// A NULL value can be specified if no callouts are
216    /// desired.
217    ///
218    /// Parameter `context`: The SCDynamicStoreContext associated with the callout.
219    ///
220    /// Returns: Returns a reference to the new SCDynamicStore session.
221    /// You must release the returned value.
222    ///
223    /// # Safety
224    ///
225    /// - `store_options` generics must be of the correct type.
226    /// - `callout` must be implemented correctly.
227    /// - `context` must be a valid pointer or null.
228    #[doc(alias = "SCDynamicStoreCreateWithOptions")]
229    #[inline]
230    pub unsafe fn with_options(
231        allocator: Option<&CFAllocator>,
232        name: &CFString,
233        store_options: Option<&CFDictionary>,
234        callout: SCDynamicStoreCallBack,
235        context: *mut SCDynamicStoreContext,
236    ) -> Option<CFRetained<SCDynamicStore>> {
237        extern "C-unwind" {
238            fn SCDynamicStoreCreateWithOptions(
239                allocator: Option<&CFAllocator>,
240                name: &CFString,
241                store_options: Option<&CFDictionary>,
242                callout: SCDynamicStoreCallBack,
243                context: *mut SCDynamicStoreContext,
244            ) -> Option<NonNull<SCDynamicStore>>;
245        }
246        let ret = unsafe {
247            SCDynamicStoreCreateWithOptions(allocator, name, store_options, callout, context)
248        };
249        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
250    }
251}
252
253extern "C" {
254    /// [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kscdynamicstoreusesessionkeys?language=objc)
255    pub static kSCDynamicStoreUseSessionKeys: &'static CFString;
256}
257
258impl SCDynamicStore {
259    /// Creates a CFRunLoopSource object that can be added to the
260    /// application's run loop.  All dynamic store notifications are
261    /// delivered using this run loop source.
262    ///
263    /// Parameter `allocator`: The CFAllocator that should be used to allocate
264    /// memory for this run loop source.
265    /// This parameter may be NULL in which case the current
266    /// default CFAllocator is used. If this reference is not
267    /// a valid CFAllocator, the behavior is undefined.
268    ///
269    /// Parameter `store`: A reference to the dynamic store session.
270    ///
271    /// Parameter `order`: On platforms which support it, for source versions
272    /// which support it, this parameter determines the order in
273    /// which the sources which are ready to be processed are
274    /// handled. A lower order number causes processing before
275    /// higher order number sources. It is inadvisable to depend
276    /// on the order number for any architectural or design aspect
277    /// of code. In the absence of any reason to do otherwise,
278    /// zero should be used.
279    ///
280    /// Returns: A reference to the new CFRunLoopSource.
281    /// You must release the returned value.
282    #[doc(alias = "SCDynamicStoreCreateRunLoopSource")]
283    #[inline]
284    pub fn new_run_loop_source(
285        allocator: Option<&CFAllocator>,
286        store: &SCDynamicStore,
287        order: CFIndex,
288    ) -> Option<CFRetained<CFRunLoopSource>> {
289        extern "C-unwind" {
290            fn SCDynamicStoreCreateRunLoopSource(
291                allocator: Option<&CFAllocator>,
292                store: &SCDynamicStore,
293                order: CFIndex,
294            ) -> Option<NonNull<CFRunLoopSource>>;
295        }
296        let ret = unsafe { SCDynamicStoreCreateRunLoopSource(allocator, store, order) };
297        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
298    }
299
300    /// Initiates notifications for the Notification
301    /// Keys in store to the callback contained in store.
302    ///
303    /// Parameter `store`: A reference to the dynamic store session.
304    ///
305    /// Parameter `queue`: The dispatch queue to run the callback function on.
306    /// Pass NULL to disable notifications, and release the queue.
307    ///
308    /// Returns: Returns TRUE on success, FALSE on failure.
309    ///
310    /// # Safety
311    ///
312    /// `queue` possibly has additional threading requirements.
313    #[doc(alias = "SCDynamicStoreSetDispatchQueue")]
314    #[cfg(feature = "dispatch2")]
315    #[inline]
316    pub unsafe fn set_dispatch_queue(&self, queue: Option<&DispatchQueue>) -> bool {
317        extern "C-unwind" {
318            fn SCDynamicStoreSetDispatchQueue(
319                store: &SCDynamicStore,
320                queue: Option<&DispatchQueue>,
321            ) -> Boolean;
322        }
323        let ret = unsafe { SCDynamicStoreSetDispatchQueue(self, queue) };
324        ret != 0
325    }
326
327    /// Returns an array of CFString keys representing the
328    /// current dynamic store entries that match a specified pattern.
329    ///
330    /// Parameter `store`: The dynamic store session.
331    ///
332    /// Parameter `pattern`: A regex(3) regular expression pattern
333    /// used to match the dynamic store keys.
334    ///
335    /// Returns: Returns the list of matching keys; NULL if an error was
336    /// encountered.
337    /// You must release the returned value.
338    #[doc(alias = "SCDynamicStoreCopyKeyList")]
339    #[inline]
340    pub fn key_list(
341        store: Option<&SCDynamicStore>,
342        pattern: &CFString,
343    ) -> Option<CFRetained<CFArray>> {
344        extern "C-unwind" {
345            fn SCDynamicStoreCopyKeyList(
346                store: Option<&SCDynamicStore>,
347                pattern: &CFString,
348            ) -> Option<NonNull<CFArray>>;
349        }
350        let ret = unsafe { SCDynamicStoreCopyKeyList(store, pattern) };
351        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
352    }
353
354    /// Adds the key-value pair to the dynamic store if no
355    /// such key already exists.
356    ///
357    /// Parameter `store`: The dynamic store session.
358    ///
359    /// Parameter `key`: The key of the value to add to the dynamic store.
360    ///
361    /// Parameter `value`: The value to add to the dynamic store.
362    ///
363    /// Returns: Returns TRUE if the key was added; FALSE if the key was already
364    /// present in the dynamic store or if an error was encountered.
365    ///
366    /// # Safety
367    ///
368    /// `value` should be of the correct type.
369    #[doc(alias = "SCDynamicStoreAddValue")]
370    #[inline]
371    pub unsafe fn add_value(
372        store: Option<&SCDynamicStore>,
373        key: &CFString,
374        value: &CFPropertyList,
375    ) -> bool {
376        extern "C-unwind" {
377            fn SCDynamicStoreAddValue(
378                store: Option<&SCDynamicStore>,
379                key: &CFString,
380                value: &CFPropertyList,
381            ) -> Boolean;
382        }
383        let ret = unsafe { SCDynamicStoreAddValue(store, key, value) };
384        ret != 0
385    }
386
387    /// Temporarily adds the key-value pair to the dynamic store
388    /// if no such key already exists.  Unless the key is updated by another
389    /// session, the key-value pair will be removed automatically when the
390    /// session is closed.
391    ///
392    /// Parameter `store`: The dynamic store session.
393    ///
394    /// Parameter `key`: The key of the value to add to the dynamic store.
395    ///
396    /// Parameter `value`: The value to add to the dynamic store.
397    ///
398    /// Returns: Returns TRUE if the key was added; FALSE if the key was already
399    /// present in the dynamic store or if an error was encountered.
400    ///
401    /// # Safety
402    ///
403    /// `value` should be of the correct type.
404    #[doc(alias = "SCDynamicStoreAddTemporaryValue")]
405    #[inline]
406    pub unsafe fn add_temporary_value(&self, key: &CFString, value: &CFPropertyList) -> bool {
407        extern "C-unwind" {
408            fn SCDynamicStoreAddTemporaryValue(
409                store: &SCDynamicStore,
410                key: &CFString,
411                value: &CFPropertyList,
412            ) -> Boolean;
413        }
414        let ret = unsafe { SCDynamicStoreAddTemporaryValue(self, key, value) };
415        ret != 0
416    }
417
418    /// Gets the value of the specified key from the dynamic store.
419    ///
420    /// Parameter `store`: The dynamic store session.
421    ///
422    /// Parameter `key`: The key associated with the value you want to get.
423    ///
424    /// Returns: Returns the value from the dynamic store that is associated with the given
425    /// key; NULL if no value was located or an error was encountered.
426    /// You must release the returned value.
427    #[doc(alias = "SCDynamicStoreCopyValue")]
428    #[inline]
429    pub fn value(
430        store: Option<&SCDynamicStore>,
431        key: &CFString,
432    ) -> Option<CFRetained<CFPropertyList>> {
433        extern "C-unwind" {
434            fn SCDynamicStoreCopyValue(
435                store: Option<&SCDynamicStore>,
436                key: &CFString,
437            ) -> Option<NonNull<CFPropertyList>>;
438        }
439        let ret = unsafe { SCDynamicStoreCopyValue(store, key) };
440        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
441    }
442
443    /// Gets the values of multiple keys in the dynamic store.
444    ///
445    /// Parameter `store`: The dynamic store session.
446    ///
447    /// Parameter `keys`: The keys associated with the values you want to get; NULL if no specific
448    /// keys are requested.
449    ///
450    /// Parameter `patterns`: An array of regex(3) pattern strings used to match the keys; NULL
451    /// if no key patterns are requested.
452    ///
453    /// Returns: Returns a dictionary containing the key-value pairs of specific keys and the
454    /// key-value pairs of keys that matched the specified patterns;
455    /// NULL if an error was encountered.
456    /// You must release the returned value.
457    ///
458    /// # Safety
459    ///
460    /// - `keys` generic must be of the correct type.
461    /// - `patterns` generic must be of the correct type.
462    #[doc(alias = "SCDynamicStoreCopyMultiple")]
463    #[inline]
464    pub unsafe fn multiple(
465        store: Option<&SCDynamicStore>,
466        keys: Option<&CFArray>,
467        patterns: Option<&CFArray>,
468    ) -> Option<CFRetained<CFDictionary>> {
469        extern "C-unwind" {
470            fn SCDynamicStoreCopyMultiple(
471                store: Option<&SCDynamicStore>,
472                keys: Option<&CFArray>,
473                patterns: Option<&CFArray>,
474            ) -> Option<NonNull<CFDictionary>>;
475        }
476        let ret = unsafe { SCDynamicStoreCopyMultiple(store, keys, patterns) };
477        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
478    }
479
480    /// Adds or replaces a value in the dynamic store for
481    /// the specified key.
482    ///
483    /// Parameter `store`: The dynamic store session.
484    ///
485    /// Parameter `key`: The key you want to set.
486    ///
487    /// Parameter `value`: The value to add to or replace in the dynamic store.
488    ///
489    /// Returns: Returns TRUE if the key was updated; FALSE if an error was encountered.
490    ///
491    /// # Safety
492    ///
493    /// `value` should be of the correct type.
494    #[doc(alias = "SCDynamicStoreSetValue")]
495    #[inline]
496    pub unsafe fn set_value(
497        store: Option<&SCDynamicStore>,
498        key: &CFString,
499        value: &CFPropertyList,
500    ) -> bool {
501        extern "C-unwind" {
502            fn SCDynamicStoreSetValue(
503                store: Option<&SCDynamicStore>,
504                key: &CFString,
505                value: &CFPropertyList,
506            ) -> Boolean;
507        }
508        let ret = unsafe { SCDynamicStoreSetValue(store, key, value) };
509        ret != 0
510    }
511
512    /// Updates multiple values in the dynamic store.
513    ///
514    /// Parameter `store`: The dynamic store session.
515    ///
516    /// Parameter `keysToSet`: A dictionary of key-value pairs you want to set into the dynamic store.
517    ///
518    /// Parameter `keysToRemove`: An array of keys you want to remove from the dynamic store.
519    ///
520    /// Parameter `keysToNotify`: An array of keys to flag as changed (without changing their values).
521    ///
522    /// Returns: Returns TRUE if the dynamic store updates were successful; FALSE if an error was encountered.
523    ///
524    /// # Safety
525    ///
526    /// - `keys_to_set` generics must be of the correct type.
527    /// - `keys_to_remove` generic must be of the correct type.
528    /// - `keys_to_notify` generic must be of the correct type.
529    #[doc(alias = "SCDynamicStoreSetMultiple")]
530    #[inline]
531    pub unsafe fn set_multiple(
532        store: Option<&SCDynamicStore>,
533        keys_to_set: Option<&CFDictionary>,
534        keys_to_remove: Option<&CFArray>,
535        keys_to_notify: Option<&CFArray>,
536    ) -> bool {
537        extern "C-unwind" {
538            fn SCDynamicStoreSetMultiple(
539                store: Option<&SCDynamicStore>,
540                keys_to_set: Option<&CFDictionary>,
541                keys_to_remove: Option<&CFArray>,
542                keys_to_notify: Option<&CFArray>,
543            ) -> Boolean;
544        }
545        let ret = unsafe {
546            SCDynamicStoreSetMultiple(store, keys_to_set, keys_to_remove, keys_to_notify)
547        };
548        ret != 0
549    }
550
551    /// Removes the value of the specified key from the
552    /// dynamic store.
553    ///
554    /// Parameter `store`: The dynamic store session.
555    ///
556    /// Parameter `key`: The key of the value you want to remove.
557    ///
558    /// Returns: Returns TRUE if the key was removed; FALSE if no value was
559    /// located or an error was encountered.
560    #[doc(alias = "SCDynamicStoreRemoveValue")]
561    #[inline]
562    pub fn remove_value(store: Option<&SCDynamicStore>, key: &CFString) -> bool {
563        extern "C-unwind" {
564            fn SCDynamicStoreRemoveValue(store: Option<&SCDynamicStore>, key: &CFString)
565                -> Boolean;
566        }
567        let ret = unsafe { SCDynamicStoreRemoveValue(store, key) };
568        ret != 0
569    }
570
571    /// Triggers a notification to be delivered for the
572    /// specified key in the dynamic store.
573    ///
574    /// Parameter `store`: The dynamic store session.
575    ///
576    /// Parameter `key`: The key that should be flagged as changed.  Any dynamic store sessions
577    /// that are monitoring this key will received a notification.  Note that the
578    /// key's value is not updated.
579    ///
580    /// Returns: Returns TRUE if the notification was processed; FALSE if an error was encountered.
581    #[doc(alias = "SCDynamicStoreNotifyValue")]
582    #[inline]
583    pub fn notify_value(store: Option<&SCDynamicStore>, key: &CFString) -> bool {
584        extern "C-unwind" {
585            fn SCDynamicStoreNotifyValue(store: Option<&SCDynamicStore>, key: &CFString)
586                -> Boolean;
587        }
588        let ret = unsafe { SCDynamicStoreNotifyValue(store, key) };
589        ret != 0
590    }
591
592    /// Specifies a set of specific keys and key patterns
593    /// that should be monitored for changes.
594    ///
595    /// Parameter `store`: The dynamic store session being watched.
596    ///
597    /// Parameter `keys`: An array of keys to be monitored; NULL if no specific keys
598    /// are to be monitored.
599    ///
600    /// Parameter `patterns`: An array of regex(3) pattern strings used to match keys to be monitored;
601    /// NULL if no key patterns are to be monitored.
602    ///
603    /// Returns: Returns TRUE if the set of notification keys and patterns was successfully
604    /// updated; FALSE if an error was encountered.
605    ///
606    /// # Safety
607    ///
608    /// - `keys` generic must be of the correct type.
609    /// - `patterns` generic must be of the correct type.
610    #[doc(alias = "SCDynamicStoreSetNotificationKeys")]
611    #[inline]
612    pub unsafe fn set_notification_keys(
613        &self,
614        keys: Option<&CFArray>,
615        patterns: Option<&CFArray>,
616    ) -> bool {
617        extern "C-unwind" {
618            fn SCDynamicStoreSetNotificationKeys(
619                store: &SCDynamicStore,
620                keys: Option<&CFArray>,
621                patterns: Option<&CFArray>,
622            ) -> Boolean;
623        }
624        let ret = unsafe { SCDynamicStoreSetNotificationKeys(self, keys, patterns) };
625        ret != 0
626    }
627
628    /// Returns an array of CFString keys representing the
629    /// dynamic store entries that have changed since this
630    /// function was last called.  If possible, your application should
631    /// use the notification functions instead of polling for the list
632    /// of changed keys returned by this function.
633    ///
634    /// Parameter `store`: The dynamic store session.
635    ///
636    /// Returns: Returns the list of changed keys;
637    /// NULL if an error was encountered.
638    /// You must release the returned value.
639    #[doc(alias = "SCDynamicStoreCopyNotifiedKeys")]
640    #[inline]
641    pub fn notified_keys(&self) -> Option<CFRetained<CFArray>> {
642        extern "C-unwind" {
643            fn SCDynamicStoreCopyNotifiedKeys(store: &SCDynamicStore) -> Option<NonNull<CFArray>>;
644        }
645        let ret = unsafe { SCDynamicStoreCopyNotifiedKeys(self) };
646        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
647    }
648}
649
650#[deprecated = "renamed to `SCDynamicStore::new`"]
651#[inline]
652pub unsafe extern "C-unwind" fn SCDynamicStoreCreate(
653    allocator: Option<&CFAllocator>,
654    name: &CFString,
655    callout: SCDynamicStoreCallBack,
656    context: *mut SCDynamicStoreContext,
657) -> Option<CFRetained<SCDynamicStore>> {
658    extern "C-unwind" {
659        fn SCDynamicStoreCreate(
660            allocator: Option<&CFAllocator>,
661            name: &CFString,
662            callout: SCDynamicStoreCallBack,
663            context: *mut SCDynamicStoreContext,
664        ) -> Option<NonNull<SCDynamicStore>>;
665    }
666    let ret = unsafe { SCDynamicStoreCreate(allocator, name, callout, context) };
667    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
668}
669
670#[deprecated = "renamed to `SCDynamicStore::with_options`"]
671#[inline]
672pub unsafe extern "C-unwind" fn SCDynamicStoreCreateWithOptions(
673    allocator: Option<&CFAllocator>,
674    name: &CFString,
675    store_options: Option<&CFDictionary>,
676    callout: SCDynamicStoreCallBack,
677    context: *mut SCDynamicStoreContext,
678) -> Option<CFRetained<SCDynamicStore>> {
679    extern "C-unwind" {
680        fn SCDynamicStoreCreateWithOptions(
681            allocator: Option<&CFAllocator>,
682            name: &CFString,
683            store_options: Option<&CFDictionary>,
684            callout: SCDynamicStoreCallBack,
685            context: *mut SCDynamicStoreContext,
686        ) -> Option<NonNull<SCDynamicStore>>;
687    }
688    let ret = unsafe {
689        SCDynamicStoreCreateWithOptions(allocator, name, store_options, callout, context)
690    };
691    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
692}
693
694#[deprecated = "renamed to `SCDynamicStore::new_run_loop_source`"]
695#[inline]
696pub extern "C-unwind" fn SCDynamicStoreCreateRunLoopSource(
697    allocator: Option<&CFAllocator>,
698    store: &SCDynamicStore,
699    order: CFIndex,
700) -> Option<CFRetained<CFRunLoopSource>> {
701    extern "C-unwind" {
702        fn SCDynamicStoreCreateRunLoopSource(
703            allocator: Option<&CFAllocator>,
704            store: &SCDynamicStore,
705            order: CFIndex,
706        ) -> Option<NonNull<CFRunLoopSource>>;
707    }
708    let ret = unsafe { SCDynamicStoreCreateRunLoopSource(allocator, store, order) };
709    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
710}
711
712#[cfg(feature = "dispatch2")]
713#[deprecated = "renamed to `SCDynamicStore::set_dispatch_queue`"]
714#[inline]
715pub unsafe extern "C-unwind" fn SCDynamicStoreSetDispatchQueue(
716    store: &SCDynamicStore,
717    queue: Option<&DispatchQueue>,
718) -> bool {
719    extern "C-unwind" {
720        fn SCDynamicStoreSetDispatchQueue(
721            store: &SCDynamicStore,
722            queue: Option<&DispatchQueue>,
723        ) -> Boolean;
724    }
725    let ret = unsafe { SCDynamicStoreSetDispatchQueue(store, queue) };
726    ret != 0
727}
728
729#[deprecated = "renamed to `SCDynamicStore::key_list`"]
730#[inline]
731pub extern "C-unwind" fn SCDynamicStoreCopyKeyList(
732    store: Option<&SCDynamicStore>,
733    pattern: &CFString,
734) -> Option<CFRetained<CFArray>> {
735    extern "C-unwind" {
736        fn SCDynamicStoreCopyKeyList(
737            store: Option<&SCDynamicStore>,
738            pattern: &CFString,
739        ) -> Option<NonNull<CFArray>>;
740    }
741    let ret = unsafe { SCDynamicStoreCopyKeyList(store, pattern) };
742    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
743}
744
745#[deprecated = "renamed to `SCDynamicStore::add_value`"]
746#[inline]
747pub unsafe extern "C-unwind" fn SCDynamicStoreAddValue(
748    store: Option<&SCDynamicStore>,
749    key: &CFString,
750    value: &CFPropertyList,
751) -> bool {
752    extern "C-unwind" {
753        fn SCDynamicStoreAddValue(
754            store: Option<&SCDynamicStore>,
755            key: &CFString,
756            value: &CFPropertyList,
757        ) -> Boolean;
758    }
759    let ret = unsafe { SCDynamicStoreAddValue(store, key, value) };
760    ret != 0
761}
762
763#[deprecated = "renamed to `SCDynamicStore::add_temporary_value`"]
764#[inline]
765pub unsafe extern "C-unwind" fn SCDynamicStoreAddTemporaryValue(
766    store: &SCDynamicStore,
767    key: &CFString,
768    value: &CFPropertyList,
769) -> bool {
770    extern "C-unwind" {
771        fn SCDynamicStoreAddTemporaryValue(
772            store: &SCDynamicStore,
773            key: &CFString,
774            value: &CFPropertyList,
775        ) -> Boolean;
776    }
777    let ret = unsafe { SCDynamicStoreAddTemporaryValue(store, key, value) };
778    ret != 0
779}
780
781#[deprecated = "renamed to `SCDynamicStore::value`"]
782#[inline]
783pub extern "C-unwind" fn SCDynamicStoreCopyValue(
784    store: Option<&SCDynamicStore>,
785    key: &CFString,
786) -> Option<CFRetained<CFPropertyList>> {
787    extern "C-unwind" {
788        fn SCDynamicStoreCopyValue(
789            store: Option<&SCDynamicStore>,
790            key: &CFString,
791        ) -> Option<NonNull<CFPropertyList>>;
792    }
793    let ret = unsafe { SCDynamicStoreCopyValue(store, key) };
794    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
795}
796
797#[deprecated = "renamed to `SCDynamicStore::multiple`"]
798#[inline]
799pub unsafe extern "C-unwind" fn SCDynamicStoreCopyMultiple(
800    store: Option<&SCDynamicStore>,
801    keys: Option<&CFArray>,
802    patterns: Option<&CFArray>,
803) -> Option<CFRetained<CFDictionary>> {
804    extern "C-unwind" {
805        fn SCDynamicStoreCopyMultiple(
806            store: Option<&SCDynamicStore>,
807            keys: Option<&CFArray>,
808            patterns: Option<&CFArray>,
809        ) -> Option<NonNull<CFDictionary>>;
810    }
811    let ret = unsafe { SCDynamicStoreCopyMultiple(store, keys, patterns) };
812    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
813}
814
815#[deprecated = "renamed to `SCDynamicStore::set_value`"]
816#[inline]
817pub unsafe extern "C-unwind" fn SCDynamicStoreSetValue(
818    store: Option<&SCDynamicStore>,
819    key: &CFString,
820    value: &CFPropertyList,
821) -> bool {
822    extern "C-unwind" {
823        fn SCDynamicStoreSetValue(
824            store: Option<&SCDynamicStore>,
825            key: &CFString,
826            value: &CFPropertyList,
827        ) -> Boolean;
828    }
829    let ret = unsafe { SCDynamicStoreSetValue(store, key, value) };
830    ret != 0
831}
832
833#[deprecated = "renamed to `SCDynamicStore::set_multiple`"]
834#[inline]
835pub unsafe extern "C-unwind" fn SCDynamicStoreSetMultiple(
836    store: Option<&SCDynamicStore>,
837    keys_to_set: Option<&CFDictionary>,
838    keys_to_remove: Option<&CFArray>,
839    keys_to_notify: Option<&CFArray>,
840) -> bool {
841    extern "C-unwind" {
842        fn SCDynamicStoreSetMultiple(
843            store: Option<&SCDynamicStore>,
844            keys_to_set: Option<&CFDictionary>,
845            keys_to_remove: Option<&CFArray>,
846            keys_to_notify: Option<&CFArray>,
847        ) -> Boolean;
848    }
849    let ret =
850        unsafe { SCDynamicStoreSetMultiple(store, keys_to_set, keys_to_remove, keys_to_notify) };
851    ret != 0
852}
853
854#[deprecated = "renamed to `SCDynamicStore::remove_value`"]
855#[inline]
856pub extern "C-unwind" fn SCDynamicStoreRemoveValue(
857    store: Option<&SCDynamicStore>,
858    key: &CFString,
859) -> bool {
860    extern "C-unwind" {
861        fn SCDynamicStoreRemoveValue(store: Option<&SCDynamicStore>, key: &CFString) -> Boolean;
862    }
863    let ret = unsafe { SCDynamicStoreRemoveValue(store, key) };
864    ret != 0
865}
866
867#[deprecated = "renamed to `SCDynamicStore::notify_value`"]
868#[inline]
869pub extern "C-unwind" fn SCDynamicStoreNotifyValue(
870    store: Option<&SCDynamicStore>,
871    key: &CFString,
872) -> bool {
873    extern "C-unwind" {
874        fn SCDynamicStoreNotifyValue(store: Option<&SCDynamicStore>, key: &CFString) -> Boolean;
875    }
876    let ret = unsafe { SCDynamicStoreNotifyValue(store, key) };
877    ret != 0
878}
879
880#[deprecated = "renamed to `SCDynamicStore::set_notification_keys`"]
881#[inline]
882pub unsafe extern "C-unwind" fn SCDynamicStoreSetNotificationKeys(
883    store: &SCDynamicStore,
884    keys: Option<&CFArray>,
885    patterns: Option<&CFArray>,
886) -> bool {
887    extern "C-unwind" {
888        fn SCDynamicStoreSetNotificationKeys(
889            store: &SCDynamicStore,
890            keys: Option<&CFArray>,
891            patterns: Option<&CFArray>,
892        ) -> Boolean;
893    }
894    let ret = unsafe { SCDynamicStoreSetNotificationKeys(store, keys, patterns) };
895    ret != 0
896}
897
898#[deprecated = "renamed to `SCDynamicStore::notified_keys`"]
899#[inline]
900pub extern "C-unwind" fn SCDynamicStoreCopyNotifiedKeys(
901    store: &SCDynamicStore,
902) -> Option<CFRetained<CFArray>> {
903    extern "C-unwind" {
904        fn SCDynamicStoreCopyNotifiedKeys(store: &SCDynamicStore) -> Option<NonNull<CFArray>>;
905    }
906    let ret = unsafe { SCDynamicStoreCopyNotifiedKeys(store) };
907    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
908}