gstreamer_webrtc/auto/
web_rtcdtls_transport.rs1use 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")]
16 pub struct WebRTCDTLSTransport(Object<ffi::GstWebRTCDTLSTransport, ffi::GstWebRTCDTLSTransportClass>);
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 let f: &F = &*(f as *const F);
71 f(&from_glib_borrow(this))
72 }
73 unsafe {
74 let f: Box_<F> = Box_::new(f);
75 connect_raw(
76 self.as_ptr() as *mut _,
77 b"notify::certificate\0".as_ptr() as *const _,
78 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
79 notify_certificate_trampoline::<F> as *const (),
80 )),
81 Box_::into_raw(f),
82 )
83 }
84 }
85
86 #[doc(alias = "client")]
87 pub fn connect_client_notify<F: Fn(&Self) + Send + Sync + 'static>(
88 &self,
89 f: F,
90 ) -> SignalHandlerId {
91 unsafe extern "C" fn notify_client_trampoline<
92 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
93 >(
94 this: *mut ffi::GstWebRTCDTLSTransport,
95 _param_spec: glib::ffi::gpointer,
96 f: glib::ffi::gpointer,
97 ) {
98 let f: &F = &*(f as *const F);
99 f(&from_glib_borrow(this))
100 }
101 unsafe {
102 let f: Box_<F> = Box_::new(f);
103 connect_raw(
104 self.as_ptr() as *mut _,
105 b"notify::client\0".as_ptr() as *const _,
106 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
107 notify_client_trampoline::<F> as *const (),
108 )),
109 Box_::into_raw(f),
110 )
111 }
112 }
113
114 #[doc(alias = "remote-certificate")]
115 pub fn connect_remote_certificate_notify<F: Fn(&Self) + Send + Sync + 'static>(
116 &self,
117 f: F,
118 ) -> SignalHandlerId {
119 unsafe extern "C" fn notify_remote_certificate_trampoline<
120 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
121 >(
122 this: *mut ffi::GstWebRTCDTLSTransport,
123 _param_spec: glib::ffi::gpointer,
124 f: glib::ffi::gpointer,
125 ) {
126 let f: &F = &*(f as *const F);
127 f(&from_glib_borrow(this))
128 }
129 unsafe {
130 let f: Box_<F> = Box_::new(f);
131 connect_raw(
132 self.as_ptr() as *mut _,
133 b"notify::remote-certificate\0".as_ptr() as *const _,
134 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
135 notify_remote_certificate_trampoline::<F> as *const (),
136 )),
137 Box_::into_raw(f),
138 )
139 }
140 }
141
142 #[doc(alias = "state")]
143 pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
144 &self,
145 f: F,
146 ) -> SignalHandlerId {
147 unsafe extern "C" fn notify_state_trampoline<
148 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
149 >(
150 this: *mut ffi::GstWebRTCDTLSTransport,
151 _param_spec: glib::ffi::gpointer,
152 f: glib::ffi::gpointer,
153 ) {
154 let f: &F = &*(f as *const F);
155 f(&from_glib_borrow(this))
156 }
157 unsafe {
158 let f: Box_<F> = Box_::new(f);
159 connect_raw(
160 self.as_ptr() as *mut _,
161 b"notify::state\0".as_ptr() as *const _,
162 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
163 notify_state_trampoline::<F> as *const (),
164 )),
165 Box_::into_raw(f),
166 )
167 }
168 }
169
170 #[doc(alias = "transport")]
171 pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
172 &self,
173 f: F,
174 ) -> SignalHandlerId {
175 unsafe extern "C" fn notify_transport_trampoline<
176 F: Fn(&WebRTCDTLSTransport) + Send + Sync + 'static,
177 >(
178 this: *mut ffi::GstWebRTCDTLSTransport,
179 _param_spec: glib::ffi::gpointer,
180 f: glib::ffi::gpointer,
181 ) {
182 let f: &F = &*(f as *const F);
183 f(&from_glib_borrow(this))
184 }
185 unsafe {
186 let f: Box_<F> = Box_::new(f);
187 connect_raw(
188 self.as_ptr() as *mut _,
189 b"notify::transport\0".as_ptr() as *const _,
190 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
191 notify_transport_trampoline::<F> as *const (),
192 )),
193 Box_::into_raw(f),
194 )
195 }
196 }
197}
198
199unsafe impl Send for WebRTCDTLSTransport {}
200unsafe impl Sync for WebRTCDTLSTransport {}