gstreamer_webrtc/auto/
web_rtcdtls_transport.rs
1use crate::{ffi, WebRTCDTLSTransportState, WebRTCICETransport};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
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>);
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 let f: &F = &*(f as *const F);
118 f(&from_glib_borrow(this))
119 }
120 unsafe {
121 let f: Box_<F> = Box_::new(f);
122 connect_raw(
123 self.as_ptr() as *mut _,
124 c"notify::certificate".as_ptr() as *const _,
125 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
126 notify_certificate_trampoline::<F> as *const (),
127 )),
128 Box_::into_raw(f),
129 )
130 }
131 }
132
133 #[doc(alias = "client")]
134 pub fn connect_client_notify<F: Fn(&Self) + Send + Sync + 'static>(
135 &self,
136 f: F,
137 ) -> SignalHandlerId {
138 unsafe extern "C" fn notify_client_trampoline<
139 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
140 >(
141 this: *mut ffi::GstWebRTCDTLSTransport,
142 _param_spec: glib::ffi::gpointer,
143 f: glib::ffi::gpointer,
144 ) {
145 let f: &F = &*(f as *const F);
146 f(&from_glib_borrow(this))
147 }
148 unsafe {
149 let f: Box_<F> = Box_::new(f);
150 connect_raw(
151 self.as_ptr() as *mut _,
152 c"notify::client".as_ptr() as *const _,
153 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
154 notify_client_trampoline::<F> as *const (),
155 )),
156 Box_::into_raw(f),
157 )
158 }
159 }
160
161 #[doc(alias = "remote-certificate")]
162 pub fn connect_remote_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
163 &self,
164 f: F,
165 ) -> SignalHandlerId {
166 unsafe extern "C" fn notify_remote_certificate_trampoline<
167 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
168 >(
169 this: *mut ffi::GstWebRTCDTLSTransport,
170 _param_spec: glib::ffi::gpointer,
171 f: glib::ffi::gpointer,
172 ) {
173 let f: &F = &*(f as *const F);
174 f(&from_glib_borrow(this))
175 }
176 unsafe {
177 let f: Box_<F> = Box_::new(f);
178 connect_raw(
179 self.as_ptr() as *mut _,
180 c"notify::remote-certificate".as_ptr() as *const _,
181 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
182 notify_remote_certificate_trampoline::<F> as *const (),
183 )),
184 Box_::into_raw(f),
185 )
186 }
187 }
188
189 #[doc(alias = "state")]
190 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
191 &self,
192 f: F,
193 ) -> SignalHandlerId {
194 unsafe extern "C" fn notify_state_trampoline<
195 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
196 >(
197 this: *mut ffi::GstWebRTCDTLSTransport,
198 _param_spec: glib::ffi::gpointer,
199 f: glib::ffi::gpointer,
200 ) {
201 let f: &F = &*(f as *const F);
202 f(&from_glib_borrow(this))
203 }
204 unsafe {
205 let f: Box_<F> = Box_::new(f);
206 connect_raw(
207 self.as_ptr() as *mut _,
208 c"notify::state".as_ptr() as *const _,
209 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
210 notify_state_trampoline::<F> as *const (),
211 )),
212 Box_::into_raw(f),
213 )
214 }
215 }
216
217 #[doc(alias = "transport")]
218 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
219 &self,
220 f: F,
221 ) -> SignalHandlerId {
222 unsafe extern "C" fn notify_transport_trampoline<
223 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
224 >(
225 this: *mut ffi::GstWebRTCDTLSTransport,
226 _param_spec: glib::ffi::gpointer,
227 f: glib::ffi::gpointer,
228 ) {
229 let f: &F = &*(f as *const F);
230 f(&from_glib_borrow(this))
231 }
232 unsafe {
233 let f: Box_<F> = Box_::new(f);
234 connect_raw(
235 self.as_ptr() as *mut _,
236 c"notify::transport".as_ptr() as *const _,
237 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
238 notify_transport_trampoline::<F> as *const (),
239 )),
240 Box_::into_raw(f),
241 )
242 }
243 }
244}
245
246unsafe impl Send for WebRTCDTLSTransport {}
247unsafe impl Sync for WebRTCDTLSTransport {}