1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
use crate::constants::*;
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
pub struct NetlinkFlags(u16);
impl From<u16> for NetlinkFlags {
fn from(flags: u16) -> Self {
NetlinkFlags(flags)
}
}
impl<'a> From<&'a NetlinkFlags> for u16 {
fn from(flags: &'a NetlinkFlags) -> u16 {
flags.0
}
}
impl From<NetlinkFlags> for u16 {
fn from(flags: NetlinkFlags) -> u16 {
flags.0
}
}
impl Default for NetlinkFlags {
fn default() -> Self {
NetlinkFlags::new()
}
}
impl NetlinkFlags {
pub fn new() -> Self {
NetlinkFlags(0)
}
pub fn set_request(&mut self) -> &mut Self {
self.0 |= NLM_F_REQUEST;
self
}
pub fn has_request(self) -> bool {
self.0 & NLM_F_REQUEST == NLM_F_REQUEST
}
pub fn set_multipart(&mut self) -> &mut Self {
self.0 |= NLM_F_MULTIPART;
self
}
pub fn has_multipart(self) -> bool {
self.0 & NLM_F_MULTIPART == NLM_F_MULTIPART
}
pub fn set_ack(&mut self) -> &mut Self {
self.0 |= NLM_F_ACK;
self
}
pub fn has_ack(self) -> bool {
self.0 & NLM_F_ACK == NLM_F_ACK
}
pub fn set_echo(&mut self) -> &mut Self {
self.0 |= NLM_F_ECHO;
self
}
pub fn has_echo(self) -> bool {
self.0 & NLM_F_ECHO == NLM_F_ECHO
}
pub fn set_dump_intr(&mut self) -> &mut Self {
self.0 |= NLM_F_DUMP_INTR;
self
}
pub fn has_dump_intr(self) -> bool {
self.0 & NLM_F_DUMP_INTR == NLM_F_DUMP_INTR
}
pub fn set_dump_filterd(&mut self) -> &mut Self {
self.0 |= NLM_F_DUMP_FILTERED;
self
}
pub fn has_dump_filterd(self) -> bool {
self.0 & NLM_F_DUMP_FILTERED == NLM_F_DUMP_FILTERED
}
pub fn set_root(&mut self) -> &mut Self {
self.0 |= NLM_F_ROOT;
self
}
pub fn has_root(self) -> bool {
self.0 & NLM_F_ROOT == NLM_F_ROOT
}
pub fn set_match(&mut self) -> &mut Self {
self.0 |= NLM_F_MATCH;
self
}
pub fn has_match(self) -> bool {
self.0 & NLM_F_MATCH == NLM_F_MATCH
}
pub fn set_atomic(&mut self) -> &mut Self {
self.0 |= NLM_F_ATOMIC;
self
}
pub fn has_atomic(self) -> bool {
self.0 & NLM_F_ATOMIC == NLM_F_ATOMIC
}
pub fn set_dump(&mut self) -> &mut Self {
self.0 |= NLM_F_DUMP;
self
}
pub fn has_dump(self) -> bool {
self.0 & NLM_F_DUMP == NLM_F_DUMP
}
pub fn set_replace(&mut self) -> &mut Self {
self.0 |= NLM_F_REPLACE;
self
}
pub fn has_replace(self) -> bool {
self.0 & NLM_F_REPLACE == NLM_F_REPLACE
}
pub fn set_excl(&mut self) -> &mut Self {
self.0 |= NLM_F_EXCL;
self
}
pub fn has_excl(self) -> bool {
self.0 & NLM_F_EXCL == NLM_F_EXCL
}
pub fn set_create(&mut self) -> &mut Self {
self.0 |= NLM_F_CREATE;
self
}
pub fn has_create(self) -> bool {
self.0 & NLM_F_CREATE == NLM_F_CREATE
}
pub fn set_append(&mut self) -> &mut Self {
self.0 |= NLM_F_APPEND;
self
}
pub fn has_append(self) -> bool {
self.0 & NLM_F_APPEND == NLM_F_APPEND
}
pub fn set_nonrec(&mut self) -> &mut Self {
self.0 |= NLM_F_NONREC;
self
}
pub fn has_nonrec(self) -> bool {
self.0 & NLM_F_NONREC == NLM_F_NONREC
}
pub fn set_ack_tvls(&mut self) -> &mut Self {
self.0 |= NLM_F_ACK_TLVS;
self
}
pub fn has_ack_tvls(self) -> bool {
self.0 & NLM_F_ACK_TLVS == NLM_F_ACK_TLVS
}
pub fn set_capped(&mut self) -> &mut Self {
self.0 |= NLM_F_CAPPED;
self
}
pub fn has_capped(self) -> bool {
self.0 & NLM_F_CAPPED == NLM_F_CAPPED
}
}