objc2_system_configuration/generated/
SCDynamicStoreCopySpecific.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    /// Gets the current computer name.
11    ///
12    /// Parameter `store`: An SCDynamicStoreRef representing the dynamic store
13    /// session that should be used for communication with the server.
14    /// If NULL, a temporary session will be used.
15    ///
16    /// Parameter `nameEncoding`: A pointer to memory that, if non-NULL, will be
17    /// filled with the encoding associated with the computer or
18    /// host name.
19    ///
20    /// Returns: Returns the current computer name;
21    /// NULL if the name has not been set or if an error was encountered.
22    /// You must release the returned value.
23    ///
24    /// # Safety
25    ///
26    /// `name_encoding` must be a valid pointer or null.
27    #[doc(alias = "SCDynamicStoreCopyComputerName")]
28    #[cfg(feature = "SCDynamicStore")]
29    #[inline]
30    pub unsafe fn computer_name(
31        store: Option<&SCDynamicStore>,
32        name_encoding: *mut CFStringEncoding,
33    ) -> Option<CFRetained<CFString>> {
34        extern "C-unwind" {
35            fn SCDynamicStoreCopyComputerName(
36                store: Option<&SCDynamicStore>,
37                name_encoding: *mut CFStringEncoding,
38            ) -> Option<NonNull<CFString>>;
39        }
40        let ret = unsafe { SCDynamicStoreCopyComputerName(store, name_encoding) };
41        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
42    }
43
44    /// Gets the name, user ID, and group ID of the currently
45    /// logged-in user.
46    ///
47    /// Note: this function only provides information about the
48    /// primary console.  It does not provide any details
49    /// about console sessions that have fast user switched
50    /// out or about other consoles.
51    ///
52    /// Parameter `store`: An SCDynamicStoreRef representing the dynamic store
53    /// session that should be used for communication with the server.
54    /// If NULL, a temporary session will be used.
55    ///
56    /// Parameter `uid`: A pointer to memory that will be filled with the user ID
57    /// of the current console user. If NULL, this value will not
58    /// be returned.
59    ///
60    /// Parameter `gid`: A pointer to memory that will be filled with the group ID
61    /// of the current console user. If NULL, this value will not be
62    /// returned.
63    ///
64    /// Returns: Returns the user currently logged into the system;
65    /// NULL if no user is logged in or if an error was encountered.
66    /// You must release the returned value.
67    ///
68    /// # Safety
69    ///
70    /// - `uid` must be a valid pointer or null.
71    /// - `gid` must be a valid pointer or null.
72    #[doc(alias = "SCDynamicStoreCopyConsoleUser")]
73    #[cfg(all(feature = "SCDynamicStore", feature = "libc"))]
74    #[inline]
75    pub unsafe fn console_user(
76        store: Option<&SCDynamicStore>,
77        uid: *mut libc::uid_t,
78        gid: *mut libc::gid_t,
79    ) -> Option<CFRetained<CFString>> {
80        extern "C-unwind" {
81            fn SCDynamicStoreCopyConsoleUser(
82                store: Option<&SCDynamicStore>,
83                uid: *mut libc::uid_t,
84                gid: *mut libc::gid_t,
85            ) -> Option<NonNull<CFString>>;
86        }
87        let ret = unsafe { SCDynamicStoreCopyConsoleUser(store, uid, gid) };
88        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
89    }
90
91    /// Gets the current local host name.
92    ///
93    /// Parameter `store`: An SCDynamicStoreRef representing the dynamic store
94    /// session that should be used for communication with the server.
95    /// If NULL, a temporary session will be used.
96    ///
97    /// Returns: Returns the current local host name;
98    /// NULL if the name has not been set or if an error was encountered.
99    /// You must release the returned value.
100    #[doc(alias = "SCDynamicStoreCopyLocalHostName")]
101    #[cfg(feature = "SCDynamicStore")]
102    #[inline]
103    pub fn local_host_name(store: Option<&SCDynamicStore>) -> Option<CFRetained<CFString>> {
104        extern "C-unwind" {
105            fn SCDynamicStoreCopyLocalHostName(
106                store: Option<&SCDynamicStore>,
107            ) -> Option<NonNull<CFString>>;
108        }
109        let ret = unsafe { SCDynamicStoreCopyLocalHostName(store) };
110        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
111    }
112
113    /// Gets the current location identifier.
114    ///
115    /// Parameter `store`: An SCDynamicStoreRef representing the dynamic store
116    /// session that should be used for communication with the server.
117    /// If NULL, a temporary session will be used.
118    ///
119    /// Returns: Returns a string representing the current location identifier;
120    /// NULL if no location identifier has been defined or if an error
121    /// was encountered.
122    /// You must release the returned value.
123    #[doc(alias = "SCDynamicStoreCopyLocation")]
124    #[cfg(feature = "SCDynamicStore")]
125    #[inline]
126    pub fn location(store: Option<&SCDynamicStore>) -> Option<CFRetained<CFString>> {
127        extern "C-unwind" {
128            fn SCDynamicStoreCopyLocation(
129                store: Option<&SCDynamicStore>,
130            ) -> Option<NonNull<CFString>>;
131        }
132        let ret = unsafe { SCDynamicStoreCopyLocation(store) };
133        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
134    }
135
136    /// Gets the current internet proxy settings.
137    /// The returned proxy settings dictionary includes:
138    ///
139    /// <TABLE
140    /// BORDER>
141    /// <TR
142    /// >
143    /// <TH
144    /// >key
145    /// </TD
146    /// >
147    /// <TH
148    /// >type
149    /// </TD
150    /// >
151    /// <TH
152    /// >description
153    /// </TD
154    /// >
155    /// </TR
156    /// >
157    /// <TR
158    /// >
159    /// <TD
160    /// >kSCPropNetProxiesExceptionsList
161    /// </TD
162    /// >
163    /// <TD
164    /// >CFArray[CFString]
165    /// </TD
166    /// >
167    /// <TD
168    /// >Host name patterns which should bypass the proxy
169    /// </TD
170    /// >
171    /// </TR
172    /// >
173    /// <TR
174    /// >
175    /// <TD
176    /// >kSCPropNetProxiesHTTPEnable
177    /// </TD
178    /// >
179    /// <TD
180    /// >CFNumber (0 or 1)
181    /// </TD
182    /// >
183    /// <TD
184    /// >Enables/disables the use of an HTTP proxy
185    /// </TD
186    /// >
187    /// </TR
188    /// >
189    /// <TR
190    /// >
191    /// <TD
192    /// >kSCPropNetProxiesHTTPProxy
193    /// </TD
194    /// >
195    /// <TD
196    /// >CFString
197    /// </TD
198    /// >
199    /// <TD
200    /// >The proxy host
201    /// </TD
202    /// >
203    /// </TR
204    /// >
205    /// <TR
206    /// >
207    /// <TD
208    /// >kSCPropNetProxiesHTTPPort
209    /// </TD
210    /// >
211    /// <TD
212    /// >CFNumber
213    /// </TD
214    /// >
215    /// <TD
216    /// >The proxy port number
217    /// </TD
218    /// >
219    /// </TR
220    /// >
221    /// <TR
222    /// >
223    /// <TD
224    /// >kSCPropNetProxiesHTTPSEnable
225    /// </TD
226    /// >
227    /// <TD
228    /// >CFNumber (0 or 1)
229    /// </TD
230    /// >
231    /// <TD
232    /// >Enables/disables the use of an HTTPS proxy
233    /// </TD
234    /// >
235    /// </TR
236    /// >
237    /// <TR
238    /// >
239    /// <TD
240    /// >kSCPropNetProxiesHTTPSProxy
241    /// </TD
242    /// >
243    /// <TD
244    /// >CFString
245    /// </TD
246    /// >
247    /// <TD
248    /// >The proxy host
249    /// </TD
250    /// >
251    /// </TR
252    /// >
253    /// <TR
254    /// >
255    /// <TD
256    /// >kSCPropNetProxiesHTTPSPort
257    /// </TD
258    /// >
259    /// <TD
260    /// >CFNumber
261    /// </TD
262    /// >
263    /// <TD
264    /// >The proxy port number
265    /// </TD
266    /// >
267    /// </TR
268    /// >
269    /// <TR
270    /// >
271    /// <TD
272    /// >kSCPropNetProxiesFTPEnable
273    /// </TD
274    /// >
275    /// <TD
276    /// >CFNumber (0 or 1)
277    /// </TD
278    /// >
279    /// <TD
280    /// >Enables/disables the use of an FTP proxy
281    /// </TD
282    /// >
283    /// </TR
284    /// >
285    /// <TR
286    /// >
287    /// <TD
288    /// >kSCPropNetProxiesFTPProxy
289    /// </TD
290    /// >
291    /// <TD
292    /// >CFString
293    /// </TD
294    /// >
295    /// <TD
296    /// >The proxy host
297    /// </TD
298    /// >
299    /// </TR
300    /// >
301    /// <TR
302    /// >
303    /// <TD
304    /// >kSCPropNetProxiesFTPPort
305    /// </TD
306    /// >
307    /// <TD
308    /// >CFNumber
309    /// </TD
310    /// >
311    /// <TD
312    /// >The proxy port number
313    /// </TD
314    /// >
315    /// </TR
316    /// >
317    /// <TR
318    /// >
319    /// <TD
320    /// >kSCPropNetProxiesFTPPassive
321    /// </TD
322    /// >
323    /// <TD
324    /// >CFNumber (0 or 1)
325    /// </TD
326    /// >
327    /// <TD
328    /// >Enable passive mode operation for use behind connection
329    /// filter-ing firewalls.
330    /// </TD
331    /// >
332    /// </TR
333    /// >
334    /// </TABLE
335    /// >
336    ///
337    /// Other key-value pairs are defined in the SCSchemaDefinitions.h
338    /// header file.
339    ///
340    /// Parameter `store`: An SCDynamicStoreRef representing the dynamic store
341    /// session that should be used for communication with the server.
342    /// If NULL, a temporary session will be used.
343    ///
344    /// Returns: Returns a dictionary containing key-value pairs that represent
345    /// the current internet proxy settings;
346    /// NULL if no proxy settings have been defined or if an error
347    /// was encountered.
348    /// You must release the returned value.
349    #[doc(alias = "SCDynamicStoreCopyProxies")]
350    #[cfg(feature = "SCDynamicStore")]
351    #[inline]
352    pub fn proxies(store: Option<&SCDynamicStore>) -> Option<CFRetained<CFDictionary>> {
353        extern "C-unwind" {
354            fn SCDynamicStoreCopyProxies(
355                store: Option<&SCDynamicStore>,
356            ) -> Option<NonNull<CFDictionary>>;
357        }
358        let ret = unsafe { SCDynamicStoreCopyProxies(store) };
359        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
360    }
361}
362
363#[cfg(feature = "SCDynamicStore")]
364#[deprecated = "renamed to `SCDynamicStore::computer_name`"]
365#[inline]
366pub unsafe extern "C-unwind" fn SCDynamicStoreCopyComputerName(
367    store: Option<&SCDynamicStore>,
368    name_encoding: *mut CFStringEncoding,
369) -> Option<CFRetained<CFString>> {
370    extern "C-unwind" {
371        fn SCDynamicStoreCopyComputerName(
372            store: Option<&SCDynamicStore>,
373            name_encoding: *mut CFStringEncoding,
374        ) -> Option<NonNull<CFString>>;
375    }
376    let ret = unsafe { SCDynamicStoreCopyComputerName(store, name_encoding) };
377    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
378}
379
380#[cfg(all(feature = "SCDynamicStore", feature = "libc"))]
381#[deprecated = "renamed to `SCDynamicStore::console_user`"]
382#[inline]
383pub unsafe extern "C-unwind" fn SCDynamicStoreCopyConsoleUser(
384    store: Option<&SCDynamicStore>,
385    uid: *mut libc::uid_t,
386    gid: *mut libc::gid_t,
387) -> Option<CFRetained<CFString>> {
388    extern "C-unwind" {
389        fn SCDynamicStoreCopyConsoleUser(
390            store: Option<&SCDynamicStore>,
391            uid: *mut libc::uid_t,
392            gid: *mut libc::gid_t,
393        ) -> Option<NonNull<CFString>>;
394    }
395    let ret = unsafe { SCDynamicStoreCopyConsoleUser(store, uid, gid) };
396    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
397}
398
399#[cfg(feature = "SCDynamicStore")]
400#[deprecated = "renamed to `SCDynamicStore::local_host_name`"]
401#[inline]
402pub extern "C-unwind" fn SCDynamicStoreCopyLocalHostName(
403    store: Option<&SCDynamicStore>,
404) -> Option<CFRetained<CFString>> {
405    extern "C-unwind" {
406        fn SCDynamicStoreCopyLocalHostName(
407            store: Option<&SCDynamicStore>,
408        ) -> Option<NonNull<CFString>>;
409    }
410    let ret = unsafe { SCDynamicStoreCopyLocalHostName(store) };
411    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
412}
413
414#[cfg(feature = "SCDynamicStore")]
415#[deprecated = "renamed to `SCDynamicStore::location`"]
416#[inline]
417pub extern "C-unwind" fn SCDynamicStoreCopyLocation(
418    store: Option<&SCDynamicStore>,
419) -> Option<CFRetained<CFString>> {
420    extern "C-unwind" {
421        fn SCDynamicStoreCopyLocation(store: Option<&SCDynamicStore>) -> Option<NonNull<CFString>>;
422    }
423    let ret = unsafe { SCDynamicStoreCopyLocation(store) };
424    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
425}
426
427#[cfg(feature = "SCDynamicStore")]
428#[deprecated = "renamed to `SCDynamicStore::proxies`"]
429#[inline]
430pub extern "C-unwind" fn SCDynamicStoreCopyProxies(
431    store: Option<&SCDynamicStore>,
432) -> Option<CFRetained<CFDictionary>> {
433    extern "C-unwind" {
434        fn SCDynamicStoreCopyProxies(
435            store: Option<&SCDynamicStore>,
436        ) -> Option<NonNull<CFDictionary>>;
437    }
438    let ret = unsafe { SCDynamicStoreCopyProxies(store) };
439    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
440}