1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-security-foundation")]
use objc2_security_foundation::*;
use crate::*;
extern "C" {
/// the address to connect to via proxy, used when making the options dictionary
///
/// the address to connect to via proxy, used when making the options dictionary
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyaddress?language=objc)
pub static ODSessionProxyAddress: Option<&'static NSString>;
}
extern "C" {
/// the port to connect to via proxy, used when making the options dictionary
///
/// the port to connect to via proxy, used when making the options dictionary. This parameter
/// is optional and should not be passed normally.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyport?language=objc)
pub static ODSessionProxyPort: Option<&'static NSString>;
}
extern "C" {
/// the username to connect with via proxy, used when making the options dictionary
///
/// the username to connect with via proxy, used when making the options dictionary
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxyusername?language=objc)
pub static ODSessionProxyUsername: Option<&'static NSString>;
}
extern "C" {
/// the password to connect with via proxy, used when making the options dictionary
///
/// the password to connect with via proxy, used when making the options dictionary
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsessionproxypassword?language=objc)
pub static ODSessionProxyPassword: Option<&'static NSString>;
}
extern_class!(
/// Class for working with OpenDirectory sessions.
///
/// Class for working with OpenDirectory sessions.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/odsession?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ODSession;
);
extern_conformance!(
unsafe impl NSObjectProtocol for ODSession {}
);
impl ODSession {
extern_methods!(
/// Returns a shared instance of a local ODSession
///
/// Returns a shared instance of a local ODSession. This can be used for most situations unless
/// more control is needed over the session.
#[unsafe(method(defaultSession))]
#[unsafe(method_family = none)]
pub unsafe fn defaultSession() -> Option<Retained<ODSession>>;
/// Creates an autoreleased instance of ODSession directed over Proxy to another host
///
/// Creates an autoreleased instance of ODSession directed over Proxy to another host. nil
/// can be passed for no options. outError is optional parameter, nil can be passed if error
/// details are not needed. Options include:
///
/// If proxy is required then a dictionary with keys should be:
/// Key Value
/// ODSessionProxyAddress NSString(hostname or IP)
/// ODSessionProxyPort NSNumber(IP port, should not be set as it will default)
/// ODSessionProxyUsername NSString(username)
/// ODSessionProxyPassword NSString(password)
///
/// # Safety
///
/// - `in_options` generic should be of the correct type.
/// - `in_options` might not allow `None`.
/// - `out_error` might not allow `None`.
#[unsafe(method(sessionWithOptions:error:))]
#[unsafe(method_family = none)]
pub unsafe fn sessionWithOptions_error(
in_options: Option<&NSDictionary>,
out_error: Option<&mut Option<Retained<NSError>>>,
) -> Option<Retained<Self>>;
/// Creates an instance of ODSession directed over Proxy to another host
///
/// Creates an instance of ODSession directed over Proxy to another host. nil can be
/// passed for no options. outError is optional parameter, nil can be passed if error
/// details are not needed. Options include:
///
/// If proxy is required then a dictionary with keys should be:
/// Key Value
/// ODSessionProxyAddress NSString(hostname or IP)
/// ODSessionProxyPort NSNumber(IP port, should not be set as it will default)
/// ODSessionProxyUsername NSString(username)
/// ODSessionProxyPassword NSString(password)
///
/// # Safety
///
/// - `in_options` generic should be of the correct type.
/// - `in_options` might not allow `None`.
/// - `out_error` might not allow `None`.
#[unsafe(method(initWithOptions:error:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithOptions_error(
this: Allocated<Self>,
in_options: Option<&NSDictionary>,
out_error: Option<&mut Option<Retained<NSError>>>,
) -> Option<Retained<Self>>;
/// Returns the node names that are registered on this ODSession
///
/// Returns the node names that are registered on this ODSession. outError can be nil if
/// error details are not needed.
///
/// # Safety
///
/// `out_error` might not allow `None`.
#[unsafe(method(nodeNamesAndReturnError:))]
#[unsafe(method_family = none)]
pub unsafe fn nodeNamesAndReturnError(
&self,
out_error: Option<&mut Option<Retained<NSError>>>,
) -> Option<Retained<NSArray>>;
/// Returns a list of names as NSStrings for all available configuration templates.
///
///
/// Returns a list of names as NSStrings for all available configuration templates. Configuration templates
/// have pre-configured modules and/or mappings. Useful for re-using existing configurations
/// that may change with operating system without changing the actual configuration.
#[unsafe(method(configurationTemplateNames))]
#[unsafe(method_family = none)]
pub unsafe fn configurationTemplateNames(&self) -> Retained<NSArray>;
/// Returns a list names as NSStrings for all available mapping templates.
///
///
/// Returns a list names as NSStrings for all available mapping templates. Mapping templates have pre-configured
/// record/attribute mappings. Useful if a configuration uses a common layout of mappings for a type of server.
#[unsafe(method(mappingTemplateNames))]
#[unsafe(method_family = none)]
pub unsafe fn mappingTemplateNames(&self) -> Retained<NSArray>;
#[cfg(feature = "objc2-security-foundation")]
/// Returns an authorization appropriate for managing configurations.
///
///
/// Returns an authorization appropriate for managing configurations. If a proxy session is in use this method will return
/// nil and no error.
///
/// # Safety
///
/// `error` might not allow `None`.
#[unsafe(method(configurationAuthorizationAllowingUserInteraction:error:))]
#[unsafe(method_family = none)]
pub unsafe fn configurationAuthorizationAllowingUserInteraction_error(
&self,
allow_interaction: bool,
error: Option<&mut Option<Retained<NSError>>>,
) -> Option<Retained<SFAuthorization>>;
#[cfg(feature = "ODConfiguration")]
/// Reads the configuration for a given nodename.
///
///
/// Reads the configuration for a given nodename.
///
/// # Safety
///
/// `nodename` might not allow `None`.
#[unsafe(method(configurationForNodename:))]
#[unsafe(method_family = none)]
pub unsafe fn configurationForNodename(
&self,
nodename: Option<&NSString>,
) -> Option<Retained<ODConfiguration>>;
#[cfg(all(feature = "ODConfiguration", feature = "objc2-security-foundation"))]
/// Adds a new configuration to the existing ODSession.
///
///
/// Adds a new configuration to the existing ODSession. An SFAuthorization can be provided if necessary.
///
/// # Safety
///
/// - `configuration` might not allow `None`.
/// - `authorization` might not allow `None`.
/// - `error` might not allow `None`.
#[unsafe(method(addConfiguration:authorization:error:))]
#[unsafe(method_family = none)]
pub unsafe fn addConfiguration_authorization_error(
&self,
configuration: Option<&ODConfiguration>,
authorization: Option<&SFAuthorization>,
error: Option<&mut Option<Retained<NSError>>>,
) -> bool;
#[cfg(all(feature = "ODConfiguration", feature = "objc2-security-foundation"))]
/// Deletes an existing configuration from the ODSession.
///
///
/// Deletes an existing configuration from the ODSession. An authorization can be provided if necessary.
///
/// # Safety
///
/// - `configuration` might not allow `None`.
/// - `authorization` might not allow `None`.
/// - `error` might not allow `None`.
#[unsafe(method(deleteConfiguration:authorization:error:))]
#[unsafe(method_family = none)]
pub unsafe fn deleteConfiguration_authorization_error(
&self,
configuration: Option<&ODConfiguration>,
authorization: Option<&SFAuthorization>,
error: Option<&mut Option<Retained<NSError>>>,
) -> bool;
#[cfg(feature = "objc2-security-foundation")]
/// Deletes an existing configuration from the ODSession.
///
///
/// Deletes an existing configuration from the ODSession. An authorization can be provided if necessary.
///
/// # Safety
///
/// - `nodename` might not allow `None`.
/// - `authorization` might not allow `None`.
/// - `error` might not allow `None`.
#[unsafe(method(deleteConfigurationWithNodename:authorization:error:))]
#[unsafe(method_family = none)]
pub unsafe fn deleteConfigurationWithNodename_authorization_error(
&self,
nodename: Option<&NSString>,
authorization: Option<&SFAuthorization>,
error: Option<&mut Option<Retained<NSError>>>,
) -> bool;
);
}
/// Methods declared on superclass `NSObject`.
impl ODSession {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}