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")]
16 pub struct WebRTCDTLSTransport(Object<ffi::GstWebRTCDTLSTransport, ffi::GstWebRTCDTLSTransportClass>) @extends gst::Object;
17
18 match fn {
19 type_ => || ffi::gst_webrtc_dtls_transport_get_type(),
20 }
21}
22
23impl WebRTCDTLSTransport {
24 pub fn certificate(&self) -> Option<glib::GString> {
25 ObjectExt::property(self, "certificate")
26 }
27
28 pub fn set_certificate(&self, certificate: Option<&str>) {
29 ObjectExt::set_property(self, "certificate", certificate)
30 }
31
32 pub fn is_client(&self) -> bool {
33 ObjectExt::property(self, "client")
34 }
35
36 pub fn set_client(&self, client: bool) {
37 ObjectExt::set_property(self, "client", client)
38 }
39
40 #[doc(alias = "remote-certificate")]
41 pub fn remote_certificate(&self) -> Option<glib::GString> {
42 ObjectExt::property(self, "remote-certificate")
43 }
44
45 #[doc(alias = "session-id")]
46 pub fn session_id(&self) -> u32 {
47 ObjectExt::property(self, "session-id")
48 }
49
50 pub fn state(&self) -> WebRTCDTLSTransportState {
51 ObjectExt::property(self, "state")
52 }
53
54 pub fn transport(&self) -> Option<WebRTCICETransport> {
55 ObjectExt::property(self, "transport")
56 }
57
58 #[doc(alias = "certificate")]
59 pub fn connect_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
60 &self,
61 f: F,
62 ) -> SignalHandlerId {
63 unsafe extern "C" fn notify_certificate_trampoline<
64 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
65 >(
66 this: *mut ffi::GstWebRTCDTLSTransport,
67 _param_spec: glib::ffi::gpointer,
68 f: glib::ffi::gpointer,
69 ) {
70 unsafe {
71 let f: &F = &*(f as *const F);
72 f(&from_glib_borrow(this))
73 }
74 }
75 unsafe {
76 let f: Box_<F> = Box_::new(f);
77 connect_raw(
78 self.as_ptr() as *mut _,
79 c"notify::certificate".as_ptr(),
80 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
81 notify_certificate_trampoline::<F> as *const (),
82 )),
83 Box_::into_raw(f),
84 )
85 }
86 }
87
88 #[doc(alias = "client")]
89 pub fn connect_client_notify<F: Fn(&Self) + Send + Sync + 'static>(
90 &self,
91 f: F,
92 ) -> SignalHandlerId {
93 unsafe extern "C" fn notify_client_trampoline<
94 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
95 >(
96 this: *mut ffi::GstWebRTCDTLSTransport,
97 _param_spec: glib::ffi::gpointer,
98 f: glib::ffi::gpointer,
99 ) {
100 unsafe {
101 let f: &F = &*(f as *const F);
102 f(&from_glib_borrow(this))
103 }
104 }
105 unsafe {
106 let f: Box_<F> = Box_::new(f);
107 connect_raw(
108 self.as_ptr() as *mut _,
109 c"notify::client".as_ptr(),
110 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
111 notify_client_trampoline::<F> as *const (),
112 )),
113 Box_::into_raw(f),
114 )
115 }
116 }
117
118 #[doc(alias = "remote-certificate")]
119 pub fn connect_remote_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
120 &self,
121 f: F,
122 ) -> SignalHandlerId {
123 unsafe extern "C" fn notify_remote_certificate_trampoline<
124 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
125 >(
126 this: *mut ffi::GstWebRTCDTLSTransport,
127 _param_spec: glib::ffi::gpointer,
128 f: glib::ffi::gpointer,
129 ) {
130 unsafe {
131 let f: &F = &*(f as *const F);
132 f(&from_glib_borrow(this))
133 }
134 }
135 unsafe {
136 let f: Box_<F> = Box_::new(f);
137 connect_raw(
138 self.as_ptr() as *mut _,
139 c"notify::remote-certificate".as_ptr(),
140 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
141 notify_remote_certificate_trampoline::<F> as *const (),
142 )),
143 Box_::into_raw(f),
144 )
145 }
146 }
147
148 #[doc(alias = "state")]
149 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
150 &self,
151 f: F,
152 ) -> SignalHandlerId {
153 unsafe extern "C" fn notify_state_trampoline<
154 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
155 >(
156 this: *mut ffi::GstWebRTCDTLSTransport,
157 _param_spec: glib::ffi::gpointer,
158 f: glib::ffi::gpointer,
159 ) {
160 unsafe {
161 let f: &F = &*(f as *const F);
162 f(&from_glib_borrow(this))
163 }
164 }
165 unsafe {
166 let f: Box_<F> = Box_::new(f);
167 connect_raw(
168 self.as_ptr() as *mut _,
169 c"notify::state".as_ptr(),
170 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
171 notify_state_trampoline::<F> as *const (),
172 )),
173 Box_::into_raw(f),
174 )
175 }
176 }
177
178 #[doc(alias = "transport")]
179 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
180 &self,
181 f: F,
182 ) -> SignalHandlerId {
183 unsafe extern "C" fn notify_transport_trampoline<
184 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
185 >(
186 this: *mut ffi::GstWebRTCDTLSTransport,
187 _param_spec: glib::ffi::gpointer,
188 f: glib::ffi::gpointer,
189 ) {
190 unsafe {
191 let f: &F = &*(f as *const F);
192 f(&from_glib_borrow(this))
193 }
194 }
195 unsafe {
196 let f: Box_<F> = Box_::new(f);
197 connect_raw(
198 self.as_ptr() as *mut _,
199 c"notify::transport".as_ptr(),
200 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
201 notify_transport_trampoline::<F> as *const (),
202 )),
203 Box_::into_raw(f),
204 )
205 }
206 }
207}
208
209unsafe impl Send for WebRTCDTLSTransport {}
210unsafe impl Sync for WebRTCDTLSTransport {}