aboutsummaryrefslogtreecommitdiff
path: root/src/expr/reject.rs
diff options
context:
space:
mode:
authorSimon THOBY <git@nightmared.fr>2022-12-03 22:47:53 +0100
committerSimon THOBY <git@nightmared.fr>2022-12-03 22:50:09 +0100
commit4b60b3cd41f5198c47a260ce69abf4c15b60ca92 (patch)
treeef3b7df96306820fc35db909762ac3c4227de87f /src/expr/reject.rs
parent3b11070076f0509f9423d6c4f582f6cf636df65a (diff)
convert the expressions to the new macros
Diffstat (limited to 'src/expr/reject.rs')
-rw-r--r--src/expr/reject.rs34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/expr/reject.rs b/src/expr/reject.rs
index e15f905..10b95ea 100644
--- a/src/expr/reject.rs
+++ b/src/expr/reject.rs
@@ -1,5 +1,6 @@
+use rustables_macros::nfnetlink_struct;
+
use crate::{
- create_wrapper_type,
nlmsg::{NfNetlinkAttribute, NfNetlinkDeserializable},
parser::DecodeError,
sys,
@@ -13,28 +14,15 @@ impl Expression for Reject {
}
}
-// A reject expression that defines the type of rejection message sent when discarding a packet.
-create_wrapper_type!(
- inline: Reject,
- [
- (
- get_type,
- set_type,
- with_type,
- sys::NFTA_REJECT_TYPE,
- reject_type,
- RejectType
- ),
- (
- get_icmp_code,
- set_icmp_code,
- with_icmp_code,
- sys::NFTA_REJECT_ICMP_CODE,
- icmp_code,
- IcmpCode
- )
- ]
-);
+#[derive(Clone, PartialEq, Eq, Default, Debug)]
+#[nfnetlink_struct]
+/// A reject expression that defines the type of rejection message sent when discarding a packet.
+pub struct Reject {
+ #[field(sys::NFTA_REJECT_TYPE, name_in_functions = "type")]
+ reject_type: RejectType,
+ #[field(sys::NFTA_REJECT_ICMP_CODE)]
+ icmp_code: IcmpCode,
+}
/// An ICMP reject code.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]