objc2_open_directory/generated/
ODConfiguration.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-security-foundation")]
8use objc2_security_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningdisabled?language=objc)
13pub const ODPacketSigningDisabled: c_uint = 0;
14/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningallow?language=objc)
15pub const ODPacketSigningAllow: c_uint = 1;
16/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketsigningrequired?language=objc)
17pub const ODPacketSigningRequired: c_uint = 2;
18
19/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptiondisabled?language=objc)
20pub const ODPacketEncryptionDisabled: c_uint = 0;
21/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionallow?language=objc)
22pub const ODPacketEncryptionAllow: c_uint = 1;
23/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionrequired?language=objc)
24pub const ODPacketEncryptionRequired: c_uint = 2;
25/// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odpacketencryptionssl?language=objc)
26pub const ODPacketEncryptionSSL: c_uint = 3;
27
28extern "C" {
29    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypejoined?language=objc)
30    pub static ODTrustTypeJoined: Option<&'static NSString>;
31}
32
33extern "C" {
34    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypeusingcredentials?language=objc)
35    pub static ODTrustTypeUsingCredentials: Option<&'static NSString>;
36}
37
38extern "C" {
39    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odtrusttypeanonymous?language=objc)
40    pub static ODTrustTypeAnonymous: Option<&'static NSString>;
41}
42
43extern_class!(
44    /// [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odconfiguration?language=objc)
45    #[unsafe(super(NSObject))]
46    #[derive(Debug, PartialEq, Eq, Hash)]
47    pub struct ODConfiguration;
48);
49
50extern_conformance!(
51    unsafe impl NSObjectProtocol for ODConfiguration {}
52);
53
54impl ODConfiguration {
55    extern_methods!(
56        #[unsafe(method(nodeName))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn nodeName(&self) -> Retained<NSString>;
59
60        /// Setter for [`nodeName`][Self::nodeName].
61        ///
62        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
63        #[unsafe(method(setNodeName:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn setNodeName(&self, node_name: Option<&NSString>);
66
67        #[unsafe(method(comment))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn comment(&self) -> Retained<NSString>;
70
71        /// Setter for [`comment`][Self::comment].
72        ///
73        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
74        #[unsafe(method(setComment:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setComment(&self, comment: Option<&NSString>);
77
78        #[cfg(feature = "ODMappings")]
79        #[unsafe(method(defaultMappings))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn defaultMappings(&self) -> Option<Retained<ODMappings>>;
82
83        #[cfg(feature = "ODMappings")]
84        /// Setter for [`defaultMappings`][Self::defaultMappings].
85        ///
86        /// # Safety
87        ///
88        /// `default_mappings` might not allow `None`.
89        #[unsafe(method(setDefaultMappings:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn setDefaultMappings(&self, default_mappings: Option<&ODMappings>);
92
93        #[unsafe(method(templateName))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn templateName(&self) -> Retained<NSString>;
96
97        /// Setter for [`templateName`][Self::templateName].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        #[unsafe(method(setTemplateName:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setTemplateName(&self, template_name: Option<&NSString>);
103
104        #[unsafe(method(virtualSubnodes))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn virtualSubnodes(&self) -> Retained<NSArray>;
107
108        /// Setter for [`virtualSubnodes`][Self::virtualSubnodes].
109        ///
110        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
111        ///
112        /// # Safety
113        ///
114        /// `virtual_subnodes` generic should be of the correct type.
115        #[unsafe(method(setVirtualSubnodes:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setVirtualSubnodes(&self, virtual_subnodes: Option<&NSArray>);
118
119        #[unsafe(method(hideRegistration))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn hideRegistration(&self) -> bool;
122
123        /// Setter for [`hideRegistration`][Self::hideRegistration].
124        #[unsafe(method(setHideRegistration:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setHideRegistration(&self, hide_registration: bool);
127
128        #[unsafe(method(preferredDestinationHostName))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn preferredDestinationHostName(&self) -> Retained<NSString>;
131
132        /// Setter for [`preferredDestinationHostName`][Self::preferredDestinationHostName].
133        ///
134        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
135        #[unsafe(method(setPreferredDestinationHostName:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setPreferredDestinationHostName(
138            &self,
139            preferred_destination_host_name: Option<&NSString>,
140        );
141
142        #[unsafe(method(preferredDestinationHostPort))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn preferredDestinationHostPort(&self) -> u16;
145
146        /// Setter for [`preferredDestinationHostPort`][Self::preferredDestinationHostPort].
147        #[unsafe(method(setPreferredDestinationHostPort:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setPreferredDestinationHostPort(&self, preferred_destination_host_port: u16);
150
151        #[unsafe(method(trustAccount))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn trustAccount(&self) -> Retained<NSString>;
154
155        #[unsafe(method(trustMetaAccount))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn trustMetaAccount(&self) -> Retained<NSString>;
158
159        #[unsafe(method(trustKerberosPrincipal))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn trustKerberosPrincipal(&self) -> Retained<NSString>;
162
163        #[unsafe(method(trustType))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn trustType(&self) -> Retained<NSString>;
166
167        #[unsafe(method(trustUsesMutualAuthentication))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn trustUsesMutualAuthentication(&self) -> bool;
170
171        #[unsafe(method(trustUsesKerberosKeytab))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn trustUsesKerberosKeytab(&self) -> bool;
174
175        #[unsafe(method(trustUsesSystemKeychain))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn trustUsesSystemKeychain(&self) -> bool;
178
179        #[unsafe(method(packetSigning))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn packetSigning(&self) -> NSInteger;
182
183        /// Setter for [`packetSigning`][Self::packetSigning].
184        #[unsafe(method(setPacketSigning:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setPacketSigning(&self, packet_signing: NSInteger);
187
188        #[unsafe(method(packetEncryption))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn packetEncryption(&self) -> NSInteger;
191
192        /// Setter for [`packetEncryption`][Self::packetEncryption].
193        #[unsafe(method(setPacketEncryption:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setPacketEncryption(&self, packet_encryption: NSInteger);
196
197        #[unsafe(method(manInTheMiddleProtection))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn manInTheMiddleProtection(&self) -> bool;
200
201        /// Setter for [`manInTheMiddleProtection`][Self::manInTheMiddleProtection].
202        #[unsafe(method(setManInTheMiddleProtection:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn setManInTheMiddleProtection(&self, man_in_the_middle_protection: bool);
205
206        #[unsafe(method(queryTimeoutInSeconds))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn queryTimeoutInSeconds(&self) -> NSInteger;
209
210        /// Setter for [`queryTimeoutInSeconds`][Self::queryTimeoutInSeconds].
211        #[unsafe(method(setQueryTimeoutInSeconds:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setQueryTimeoutInSeconds(&self, query_timeout_in_seconds: NSInteger);
214
215        #[unsafe(method(connectionSetupTimeoutInSeconds))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn connectionSetupTimeoutInSeconds(&self) -> NSInteger;
218
219        /// Setter for [`connectionSetupTimeoutInSeconds`][Self::connectionSetupTimeoutInSeconds].
220        #[unsafe(method(setConnectionSetupTimeoutInSeconds:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setConnectionSetupTimeoutInSeconds(
223            &self,
224            connection_setup_timeout_in_seconds: NSInteger,
225        );
226
227        #[unsafe(method(connectionIdleTimeoutInSeconds))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn connectionIdleTimeoutInSeconds(&self) -> NSInteger;
230
231        /// Setter for [`connectionIdleTimeoutInSeconds`][Self::connectionIdleTimeoutInSeconds].
232        #[unsafe(method(setConnectionIdleTimeoutInSeconds:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setConnectionIdleTimeoutInSeconds(
235            &self,
236            connection_idle_timeout_in_seconds: NSInteger,
237        );
238
239        #[unsafe(method(defaultModuleEntries))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn defaultModuleEntries(&self) -> Retained<NSArray>;
242
243        /// Setter for [`defaultModuleEntries`][Self::defaultModuleEntries].
244        ///
245        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
246        ///
247        /// # Safety
248        ///
249        /// `default_module_entries` generic should be of the correct type.
250        #[unsafe(method(setDefaultModuleEntries:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setDefaultModuleEntries(&self, default_module_entries: Option<&NSArray>);
253
254        #[unsafe(method(authenticationModuleEntries))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn authenticationModuleEntries(&self) -> Retained<NSArray>;
257
258        /// Setter for [`authenticationModuleEntries`][Self::authenticationModuleEntries].
259        ///
260        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
261        ///
262        /// # Safety
263        ///
264        /// `authentication_module_entries` generic should be of the correct type.
265        #[unsafe(method(setAuthenticationModuleEntries:))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn setAuthenticationModuleEntries(
268            &self,
269            authentication_module_entries: Option<&NSArray>,
270        );
271
272        #[unsafe(method(discoveryModuleEntries))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn discoveryModuleEntries(&self) -> Retained<NSArray>;
275
276        /// Setter for [`discoveryModuleEntries`][Self::discoveryModuleEntries].
277        ///
278        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
279        ///
280        /// # Safety
281        ///
282        /// `discovery_module_entries` generic should be of the correct type.
283        #[unsafe(method(setDiscoveryModuleEntries:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn setDiscoveryModuleEntries(&self, discovery_module_entries: Option<&NSArray>);
286
287        #[unsafe(method(generalModuleEntries))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn generalModuleEntries(&self) -> Retained<NSArray>;
290
291        /// Setter for [`generalModuleEntries`][Self::generalModuleEntries].
292        ///
293        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
294        ///
295        /// # Safety
296        ///
297        /// `general_module_entries` generic should be of the correct type.
298        #[unsafe(method(setGeneralModuleEntries:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn setGeneralModuleEntries(&self, general_module_entries: Option<&NSArray>);
301
302        /// Returns an initialized and autoreleased ODConfiguration object.
303        ///
304        ///
305        /// Returns an initialized and autoreleased ODConfiguration object.
306        #[unsafe(method(configuration))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn configuration() -> Option<Retained<Self>>;
309
310        /// Returns a suggested name to use for the trust account.
311        ///
312        ///
313        /// Returns a suggested name to use for a trust account.  This name will be derived from the hostname
314        /// (if provided), otherwise it will be derived from the local hostname removing special characters
315        /// that may not be allowed by many systems.
316        ///
317        /// # Safety
318        ///
319        /// `hostname` might not allow `None`.
320        #[unsafe(method(suggestedTrustAccount:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn suggestedTrustAccount(
323            hostname: Option<&NSString>,
324        ) -> Option<Retained<NSString>>;
325
326        /// Returns a suggested password to be used for trust account with the requested length.
327        ///
328        ///
329        /// Returns a suggested password to be used for trust account with the requested length.
330        #[unsafe(method(suggestedTrustPassword:))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn suggestedTrustPassword(length: usize) -> Option<Retained<NSString>>;
333
334        #[cfg(feature = "objc2-security-foundation")]
335        /// Saves the configuration using the provided authorization.
336        ///
337        ///
338        /// Saves the configuration using the provided authorization.
339        ///
340        /// # Safety
341        ///
342        /// - `authorization` might not allow `None`.
343        /// - `error` might not allow `None`.
344        #[unsafe(method(saveUsingAuthorization:error:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn saveUsingAuthorization_error(
347            &self,
348            authorization: Option<&SFAuthorization>,
349            error: Option<&mut Option<Retained<NSError>>>,
350        ) -> bool;
351
352        /// Adds a trust account with the provided name and password using the credentials provided by the user.
353        ///
354        ///
355        /// Adds a trust account with the provided name and password using the credentials provided by the user.  User can
356        /// request that the trust be forcibly created (replacing existing trust if found in directory).  A trust should be
357        /// established only after enough configuration is available and the configuration been saved.  If the trust is
358        /// required, then the configuration can be deleted if necessary upon failure.
359        ///
360        /// # Safety
361        ///
362        /// - `trust_type` might not allow `None`.
363        /// - `account` might not allow `None`.
364        /// - `account_password` might not allow `None`.
365        /// - `username` might not allow `None`.
366        /// - `password` might not allow `None`.
367        /// - `error` might not allow `None`.
368        #[unsafe(method(addTrustType:trustAccount:trustPassword:username:password:joinExisting:error:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn addTrustType_trustAccount_trustPassword_username_password_joinExisting_error(
371            &self,
372            trust_type: Option<&NSString>,
373            account: Option<&NSString>,
374            account_password: Option<&NSString>,
375            username: Option<&NSString>,
376            password: Option<&NSString>,
377            join: bool,
378            error: Option<&mut Option<Retained<NSError>>>,
379        ) -> bool;
380
381        /// Removes trust using the provided username and password.
382        ///
383        ///
384        /// Removes trust using the provided username and password.  The trust account will be removed from the directory only if requested.
385        ///
386        /// # Safety
387        ///
388        /// - `username` might not allow `None`.
389        /// - `password` might not allow `None`.
390        /// - `error` might not allow `None`.
391        #[unsafe(method(removeTrustUsingUsername:password:deleteTrustAccount:error:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn removeTrustUsingUsername_password_deleteTrustAccount_error(
394            &self,
395            username: Option<&NSString>,
396            password: Option<&NSString>,
397            delete_account: bool,
398            error: Option<&mut Option<Retained<NSError>>>,
399        ) -> bool;
400    );
401}
402
403/// Methods declared on superclass `NSObject`.
404impl ODConfiguration {
405    extern_methods!(
406        #[unsafe(method(init))]
407        #[unsafe(method_family = init)]
408        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
409
410        #[unsafe(method(new))]
411        #[unsafe(method_family = new)]
412        pub unsafe fn new() -> Retained<Self>;
413    );
414}