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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use crate::*;
extern "C" {
/// is the default type of ODSessionRef used if there is no need to create a specific reference
///
/// is the default type of ODSessionRef used if there is no need to create a specific reference
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opendirectory/kodsessiondefault?language=objc)
pub static kODSessionDefault: Option<&'static ODSessionRef>;
}
#[cfg(feature = "objc2-core-foundation")]
unsafe impl ConcreteType for ODSessionRef {
/// Standard GetTypeID function support for CF-based objects
///
/// Returns the typeID for ODSession objects
///
/// Returns: a valid CFTypeID for the ODSession object
#[doc(alias = "ODSessionGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn ODSessionGetTypeID() -> CFTypeID;
}
unsafe { ODSessionGetTypeID() }
}
}
impl ODSessionRef {
/// Creates an ODSession object to be passed to ODNode functions
///
/// Creates an ODSession object to be passed to ODNode functions.
///
/// Parameter `allocator`: a memory allocator to use for this object
///
/// Parameter `options`: a CFDictionary of options associated with this ODSession. This is typically NULL
/// unless caller needs to proxy to another host.
///
/// If proxy is required then a dictionary with keys should be:
/// Key Value
/// kODSessionProxyAddress CFString(hostname or IP)
/// kODSessionProxyPort CFNumber(IP port, should not be set as it will default)
/// kODSessionProxyUsername CFString(username)
/// kODSessionProxyPassword CFString(password)
///
/// Parameter `error`: an optional CFErrorRef reference for error details
///
/// Returns: a valid ODSessionRef object or NULL if it cannot be created. Pass reference to CFErrorRef to
/// get error details
///
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `options` generics must be of the correct type.
/// - `options` might not allow `None`.
/// - `error` must be a valid pointer.
#[doc(alias = "ODSessionCreate")]
#[cfg(feature = "objc2-core-foundation")]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
options: Option<&CFDictionary>,
error: *mut *mut CFError,
) -> Option<CFRetained<ODSessionRef>> {
extern "C-unwind" {
fn ODSessionCreate(
allocator: Option<&CFAllocator>,
options: Option<&CFDictionary>,
error: *mut *mut CFError,
) -> Option<NonNull<ODSessionRef>>;
}
let ret = unsafe { ODSessionCreate(allocator, options, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
/// Returns the node names that are registered on this ODSession
///
/// Returns the node names that are registered on this ODSession
///
/// Parameter `allocator`: a memory allocator to use for this object
///
/// Parameter `session`: an ODSessionRef, either kODSessionDefault or a valid ODSessionRef can be passed
///
/// Parameter `error`: an optional CFErrorRef reference for error details
///
/// Returns: a valid CFArrayRef of node names that can be opened on the session reference
///
/// # Safety
///
/// - `allocator` might not allow `None`.
/// - `session` might not allow `None`.
/// - `error` must be a valid pointer.
#[doc(alias = "ODSessionCopyNodeNames")]
#[cfg(feature = "objc2-core-foundation")]
#[inline]
pub unsafe fn node_names(
allocator: Option<&CFAllocator>,
session: Option<&ODSessionRef>,
error: *mut *mut CFError,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn ODSessionCopyNodeNames(
allocator: Option<&CFAllocator>,
session: Option<&ODSessionRef>,
error: *mut *mut CFError,
) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { ODSessionCopyNodeNames(allocator, session, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[cfg(feature = "objc2-core-foundation")]
#[deprecated = "renamed to `ODSessionRef::new`"]
#[inline]
pub unsafe extern "C-unwind" fn ODSessionCreate(
allocator: Option<&CFAllocator>,
options: Option<&CFDictionary>,
error: *mut *mut CFError,
) -> Option<CFRetained<ODSessionRef>> {
extern "C-unwind" {
fn ODSessionCreate(
allocator: Option<&CFAllocator>,
options: Option<&CFDictionary>,
error: *mut *mut CFError,
) -> Option<NonNull<ODSessionRef>>;
}
let ret = unsafe { ODSessionCreate(allocator, options, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "objc2-core-foundation")]
#[deprecated = "renamed to `ODSessionRef::node_names`"]
#[inline]
pub unsafe extern "C-unwind" fn ODSessionCopyNodeNames(
allocator: Option<&CFAllocator>,
session: Option<&ODSessionRef>,
error: *mut *mut CFError,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn ODSessionCopyNodeNames(
allocator: Option<&CFAllocator>,
session: Option<&ODSessionRef>,
error: *mut *mut CFError,
) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { ODSessionCopyNodeNames(allocator, session, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}