summaryrefslogtreecommitdiff
path: root/src/protocol/pppoe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/pppoe.rs')
-rw-r--r--src/protocol/pppoe.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/protocol/pppoe.rs b/src/protocol/pppoe.rs
index e63dbb1..7f3e05e 100644
--- a/src/protocol/pppoe.rs
+++ b/src/protocol/pppoe.rs
@@ -25,7 +25,7 @@ use nom::IResult;
* https://info.support.huawei.com/info-finder/encyclopedia/zh/PPPoE.html
*/
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq)]
pub enum PPPoECode {
SessionData, // Session Data
PADI, // Active Discovery Initiation
@@ -36,7 +36,7 @@ pub enum PPPoECode {
Other(u8),
}
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq)]
pub enum PPPoETagType {
EndOfList,
ServiceName,
@@ -51,20 +51,20 @@ pub enum PPPoETagType {
Other(u16),
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq)]
pub struct PPPoETag {
pub tag_type: PPPoETagType,
pub tag_length: u16,
pub tag_value: Vec<u8>,
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq)]
pub enum PPPoEStage {
Discovery(Vec<PPPoETag>),
Session(PPPProtocol),
}
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Debug, PartialEq)]
pub struct PPPoEHeader {
pub version: u8, // 4 bits
pub type_: u8, // 4 bits
@@ -137,10 +137,10 @@ fn pppoe_tags_decode(input: &[u8]) -> IResult<&[u8], Vec<PPPoETag>> {
let mut remain = input;
loop {
let (input, tag) = pppoe_tag_decode(remain)?;
- let tag_type = tag.tag_type;
+ let is_end_of_list = tag.tag_type == PPPoETagType::EndOfList;
remain = input;
tags.push(tag);
- if remain.is_empty() || tag_type == PPPoETagType::EndOfList {
+ if remain.is_empty() || is_end_of_list {
break;
}
}