1use crate::{ffi,IPAddress,IPRoute,Object};
7use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
8use std::{boxed::Box as Box_};
9
10glib::wrapper! {
11 #[doc(alias = "NMIPConfig")]
94 pub struct IPConfig(Object<ffi::NMIPConfig, ffi::NMIPConfigClass>) @extends Object;
95
96 match fn {
97 type_ => || ffi::nm_ip_config_get_type(),
98 }
99}
100
101impl IPConfig {
102 #[doc(alias = "nm_ip_config_get_addresses")]
111 #[doc(alias = "get_addresses")]
112 pub fn addresses(&self) -> Vec<IPAddress> {
113 unsafe {
114 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_addresses(self.to_glib_none().0))
115 }
116 }
117
118 #[doc(alias = "nm_ip_config_get_domains")]
125 #[doc(alias = "get_domains")]
126 pub fn domains(&self) -> Vec<glib::GString> {
127 unsafe {
128 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_domains(self.to_glib_none().0))
129 }
130 }
131
132 #[doc(alias = "nm_ip_config_get_family")]
139 #[doc(alias = "get_family")]
140 pub fn family(&self) -> i32 {
141 unsafe {
142 ffi::nm_ip_config_get_family(self.to_glib_none().0)
143 }
144 }
145
146 #[doc(alias = "nm_ip_config_get_gateway")]
152 #[doc(alias = "get_gateway")]
153 pub fn gateway(&self) -> glib::GString {
154 unsafe {
155 from_glib_none(ffi::nm_ip_config_get_gateway(self.to_glib_none().0))
156 }
157 }
158
159 #[doc(alias = "nm_ip_config_get_nameservers")]
165 #[doc(alias = "get_nameservers")]
166 pub fn nameservers(&self) -> Vec<glib::GString> {
167 unsafe {
168 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_nameservers(self.to_glib_none().0))
169 }
170 }
171
172 #[doc(alias = "nm_ip_config_get_routes")]
181 #[doc(alias = "get_routes")]
182 pub fn routes(&self) -> Vec<IPRoute> {
183 unsafe {
184 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_routes(self.to_glib_none().0))
185 }
186 }
187
188 #[doc(alias = "nm_ip_config_get_searches")]
195 #[doc(alias = "get_searches")]
196 pub fn searches(&self) -> Vec<glib::GString> {
197 unsafe {
198 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_searches(self.to_glib_none().0))
199 }
200 }
201
202 #[doc(alias = "nm_ip_config_get_wins_servers")]
209 #[doc(alias = "get_wins_servers")]
210 #[doc(alias = "wins-servers")]
211 pub fn wins_servers(&self) -> Vec<glib::GString> {
212 unsafe {
213 FromGlibPtrContainer::from_glib_none(ffi::nm_ip_config_get_wins_servers(self.to_glib_none().0))
214 }
215 }
216
217 #[doc(alias = "addresses")]
218 pub fn connect_addresses_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
219 unsafe extern "C" fn notify_addresses_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
220 let f: &F = &*(f as *const F);
221 f(&from_glib_borrow(this))
222 }
223 unsafe {
224 let f: Box_<F> = Box_::new(f);
225 connect_raw(self.as_ptr() as *mut _, c"notify::addresses".as_ptr() as *const _,
226 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_addresses_trampoline::<F> as *const ())), Box_::into_raw(f))
227 }
228 }
229
230 #[doc(alias = "domains")]
231 pub fn connect_domains_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
232 unsafe extern "C" fn notify_domains_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
233 let f: &F = &*(f as *const F);
234 f(&from_glib_borrow(this))
235 }
236 unsafe {
237 let f: Box_<F> = Box_::new(f);
238 connect_raw(self.as_ptr() as *mut _, c"notify::domains".as_ptr() as *const _,
239 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_domains_trampoline::<F> as *const ())), Box_::into_raw(f))
240 }
241 }
242
243 #[doc(alias = "family")]
244 pub fn connect_family_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
245 unsafe extern "C" fn notify_family_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
246 let f: &F = &*(f as *const F);
247 f(&from_glib_borrow(this))
248 }
249 unsafe {
250 let f: Box_<F> = Box_::new(f);
251 connect_raw(self.as_ptr() as *mut _, c"notify::family".as_ptr() as *const _,
252 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_family_trampoline::<F> as *const ())), Box_::into_raw(f))
253 }
254 }
255
256 #[doc(alias = "gateway")]
257 pub fn connect_gateway_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
258 unsafe extern "C" fn notify_gateway_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
259 let f: &F = &*(f as *const F);
260 f(&from_glib_borrow(this))
261 }
262 unsafe {
263 let f: Box_<F> = Box_::new(f);
264 connect_raw(self.as_ptr() as *mut _, c"notify::gateway".as_ptr() as *const _,
265 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_gateway_trampoline::<F> as *const ())), Box_::into_raw(f))
266 }
267 }
268
269 #[doc(alias = "nameservers")]
270 pub fn connect_nameservers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
271 unsafe extern "C" fn notify_nameservers_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
272 let f: &F = &*(f as *const F);
273 f(&from_glib_borrow(this))
274 }
275 unsafe {
276 let f: Box_<F> = Box_::new(f);
277 connect_raw(self.as_ptr() as *mut _, c"notify::nameservers".as_ptr() as *const _,
278 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_nameservers_trampoline::<F> as *const ())), Box_::into_raw(f))
279 }
280 }
281
282 #[doc(alias = "routes")]
283 pub fn connect_routes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
284 unsafe extern "C" fn notify_routes_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
285 let f: &F = &*(f as *const F);
286 f(&from_glib_borrow(this))
287 }
288 unsafe {
289 let f: Box_<F> = Box_::new(f);
290 connect_raw(self.as_ptr() as *mut _, c"notify::routes".as_ptr() as *const _,
291 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_routes_trampoline::<F> as *const ())), Box_::into_raw(f))
292 }
293 }
294
295 #[doc(alias = "searches")]
296 pub fn connect_searches_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
297 unsafe extern "C" fn notify_searches_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
298 let f: &F = &*(f as *const F);
299 f(&from_glib_borrow(this))
300 }
301 unsafe {
302 let f: Box_<F> = Box_::new(f);
303 connect_raw(self.as_ptr() as *mut _, c"notify::searches".as_ptr() as *const _,
304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_searches_trampoline::<F> as *const ())), Box_::into_raw(f))
305 }
306 }
307
308 #[doc(alias = "wins-servers")]
309 pub fn connect_wins_servers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
310 unsafe extern "C" fn notify_wins_servers_trampoline<F: Fn(&IPConfig) + 'static>(this: *mut ffi::NMIPConfig, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
311 let f: &F = &*(f as *const F);
312 f(&from_glib_borrow(this))
313 }
314 unsafe {
315 let f: Box_<F> = Box_::new(f);
316 connect_raw(self.as_ptr() as *mut _, c"notify::wins-servers".as_ptr() as *const _,
317 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_wins_servers_trampoline::<F> as *const ())), Box_::into_raw(f))
318 }
319 }
320}