libc_extra/android_linux/net/if_/
ifreq.rs

1// This file is part of libc-extra. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/libc-extra/master/COPYRIGHT. No part of libc-extra, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2016-2018 The developers of libc-extra. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/libc-extra/master/COPYRIGHT.
3
4
5#[repr(C)]
6#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub struct ifreq
8{
9	pub ifr_ifrn: Union_Unnamed2,
10	pub ifr_ifru: Union_Unnamed3,
11}
12
13impl Default for ifreq
14{
15	fn default() -> Self
16	{
17		unsafe { zeroed() }
18	}
19}
20
21#[repr(C)]
22#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
23pub struct Union_Unnamed2
24{
25	pub _bindgen_data_: [u8; IF_NAMESIZE],
26}
27
28impl Union_Unnamed2
29{
30	pub unsafe fn ifrn_name(&mut self) -> *mut [c_char; IF_NAMESIZE]
31	{
32		let raw: *mut u8 = transmute(&self._bindgen_data_);
33		transmute(raw.offset(0))
34	}
35}
36
37impl Default for Union_Unnamed2
38{
39	fn default() -> Self
40	{
41		unsafe { zeroed() }
42	}
43}
44
45#[repr(C)]
46#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
47pub struct Union_Unnamed3
48{
49	pub _bindgen_data_: [u64; 3],
50}
51
52impl Union_Unnamed3
53{
54	pub unsafe fn ifru_addr(&mut self) -> *mut sockaddr
55	{
56		let raw: *mut u8 = transmute(&self._bindgen_data_);
57		transmute(raw.offset(0))
58	}
59	
60	pub unsafe fn ifru_dstaddr(&mut self) -> *mut sockaddr
61	{
62		let raw: *mut u8 = transmute(&self._bindgen_data_);
63		transmute(raw.offset(0))
64	}
65	
66	pub unsafe fn ifru_broadaddr(&mut self) -> *mut sockaddr
67	{
68		let raw: *mut u8 = transmute(&self._bindgen_data_);
69		transmute(raw.offset(0))
70	}
71	
72	pub unsafe fn ifru_netmask(&mut self) -> *mut sockaddr
73	{
74		let raw: *mut u8 = transmute(&self._bindgen_data_);
75		transmute(raw.offset(0))
76	}
77	
78	pub unsafe fn ifru_hwaddr(&mut self) -> *mut sockaddr
79	{
80		let raw: *mut u8 = transmute(&self._bindgen_data_);
81		transmute(raw.offset(0))
82	}
83	
84	pub unsafe fn ifru_flags(&mut self) -> *mut c_short
85	{
86		let raw: *mut u8 = transmute(&self._bindgen_data_);
87		transmute(raw.offset(0))
88	}
89	
90	pub unsafe fn ifru_ivalue(&mut self) -> *mut c_int
91	{
92		let raw: *mut u8 = transmute(&self._bindgen_data_);
93		transmute(raw.offset(0))
94	}
95	
96	pub unsafe fn ifru_mtu(&mut self) -> *mut c_int
97	{
98		let raw: *mut u8 = transmute(&self._bindgen_data_);
99		transmute(raw.offset(0))
100	}
101	
102	pub unsafe fn ifru_map(&mut self) -> *mut ifmap
103	{
104		let raw: *mut u8 = transmute(&self._bindgen_data_);
105		transmute(raw.offset(0))
106	}
107	
108	pub unsafe fn ifru_slave(&mut self)  -> *mut [c_char; IF_NAMESIZE]
109	{
110		let raw: *mut u8 = transmute(&self._bindgen_data_);
111		transmute(raw.offset(0))
112	}
113	
114	pub unsafe fn ifru_newname(&mut self) -> *mut [c_char; IF_NAMESIZE]
115	{
116		let raw: *mut u8 = transmute(&self._bindgen_data_);
117		transmute(raw.offset(0))
118	}
119	
120	pub unsafe fn ifru_data(&mut self) -> *mut *mut c_void
121	{
122		let raw: *mut u8 = transmute(&self._bindgen_data_);
123		transmute(raw.offset(0))
124	}
125}
126
127impl Default for Union_Unnamed3
128{
129	fn default() -> Self
130	{
131		unsafe { zeroed() }
132	}
133}