gstreamer_webrtc/auto/
web_rtcdtls_transport.rs1use crate::{WebRTCDTLSTransportState, WebRTCICETransport, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 #[doc(alias = "GstWebRTCDTLSTransport")]
63 pub struct WebRTCDTLSTransport(Object<ffi::GstWebRTCDTLSTransport, ffi::GstWebRTCDTLSTransportClass>) @extends gst::Object;
64
65 match fn {
66 type_ => || ffi::gst_webrtc_dtls_transport_get_type(),
67 }
68}
69
70impl WebRTCDTLSTransport {
71 pub fn certificate(&self) -> Option<glib::GString> {
72 ObjectExt::property(self, "certificate")
73 }
74
75 pub fn set_certificate(&self, certificate: Option<&str>) {
76 ObjectExt::set_property(self, "certificate", certificate)
77 }
78
79 pub fn is_client(&self) -> bool {
80 ObjectExt::property(self, "client")
81 }
82
83 pub fn set_client(&self, client: bool) {
84 ObjectExt::set_property(self, "client", client)
85 }
86
87 #[doc(alias = "remote-certificate")]
88 pub fn remote_certificate(&self) -> Option<glib::GString> {
89 ObjectExt::property(self, "remote-certificate")
90 }
91
92 #[doc(alias = "session-id")]
93 pub fn session_id(&self) -> u32 {
94 ObjectExt::property(self, "session-id")
95 }
96
97 pub fn state(&self) -> WebRTCDTLSTransportState {
98 ObjectExt::property(self, "state")
99 }
100
101 pub fn transport(&self) -> Option<WebRTCICETransport> {
102 ObjectExt::property(self, "transport")
103 }
104
105 #[doc(alias = "certificate")]
106 pub fn connect_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
107 &self,
108 f: F,
109 ) -> SignalHandlerId {
110 unsafe extern "C" fn notify_certificate_trampoline<
111 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
112 >(
113 this: *mut ffi::GstWebRTCDTLSTransport,
114 _param_spec: glib::ffi::gpointer,
115 f: glib::ffi::gpointer,
116 ) {
117 unsafe {
118 let f: &F = &*(f as *const F);
119 f(&from_glib_borrow(this))
120 }
121 }
122 unsafe {
123 let f: Box_<F> = Box_::new(f);
124 connect_raw(
125 self.as_ptr() as *mut _,
126 c"notify::certificate".as_ptr(),
127 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
128 notify_certificate_trampoline::<F> as *const (),
129 )),
130 Box_::into_raw(f),
131 )
132 }
133 }
134
135 #[doc(alias = "client")]
136 pub fn connect_client_notify<F: Fn(&Self) + Send + Sync + 'static>(
137 &self,
138 f: F,
139 ) -> SignalHandlerId {
140 unsafe extern "C" fn notify_client_trampoline<
141 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
142 >(
143 this: *mut ffi::GstWebRTCDTLSTransport,
144 _param_spec: glib::ffi::gpointer,
145 f: glib::ffi::gpointer,
146 ) {
147 unsafe {
148 let f: &F = &*(f as *const F);
149 f(&from_glib_borrow(this))
150 }
151 }
152 unsafe {
153 let f: Box_<F> = Box_::new(f);
154 connect_raw(
155 self.as_ptr() as *mut _,
156 c"notify::client".as_ptr(),
157 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
158 notify_client_trampoline::<F> as *const (),
159 )),
160 Box_::into_raw(f),
161 )
162 }
163 }
164
165 #[doc(alias = "remote-certificate")]
166 pub fn connect_remote_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
167 &self,
168 f: F,
169 ) -> SignalHandlerId {
170 unsafe extern "C" fn notify_remote_certificate_trampoline<
171 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
172 >(
173 this: *mut ffi::GstWebRTCDTLSTransport,
174 _param_spec: glib::ffi::gpointer,
175 f: glib::ffi::gpointer,
176 ) {
177 unsafe {
178 let f: &F = &*(f as *const F);
179 f(&from_glib_borrow(this))
180 }
181 }
182 unsafe {
183 let f: Box_<F> = Box_::new(f);
184 connect_raw(
185 self.as_ptr() as *mut _,
186 c"notify::remote-certificate".as_ptr(),
187 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
188 notify_remote_certificate_trampoline::<F> as *const (),
189 )),
190 Box_::into_raw(f),
191 )
192 }
193 }
194
195 #[doc(alias = "state")]
196 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
197 &self,
198 f: F,
199 ) -> SignalHandlerId {
200 unsafe extern "C" fn notify_state_trampoline<
201 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
202 >(
203 this: *mut ffi::GstWebRTCDTLSTransport,
204 _param_spec: glib::ffi::gpointer,
205 f: glib::ffi::gpointer,
206 ) {
207 unsafe {
208 let f: &F = &*(f as *const F);
209 f(&from_glib_borrow(this))
210 }
211 }
212 unsafe {
213 let f: Box_<F> = Box_::new(f);
214 connect_raw(
215 self.as_ptr() as *mut _,
216 c"notify::state".as_ptr(),
217 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
218 notify_state_trampoline::<F> as *const (),
219 )),
220 Box_::into_raw(f),
221 )
222 }
223 }
224
225 #[doc(alias = "transport")]
226 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
227 &self,
228 f: F,
229 ) -> SignalHandlerId {
230 unsafe extern "C" fn notify_transport_trampoline<
231 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
232 >(
233 this: *mut ffi::GstWebRTCDTLSTransport,
234 _param_spec: glib::ffi::gpointer,
235 f: glib::ffi::gpointer,
236 ) {
237 unsafe {
238 let f: &F = &*(f as *const F);
239 f(&from_glib_borrow(this))
240 }
241 }
242 unsafe {
243 let f: Box_<F> = Box_::new(f);
244 connect_raw(
245 self.as_ptr() as *mut _,
246 c"notify::transport".as_ptr(),
247 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
248 notify_transport_trampoline::<F> as *const (),
249 )),
250 Box_::into_raw(f),
251 )
252 }
253 }
254}
255
256unsafe impl Send for WebRTCDTLSTransport {}
257unsafe impl Sync for WebRTCDTLSTransport {}