use crate::{MatchId, http1::parser::types::http1_action};
const HTTP1A_NONE: u8 = 0;
const HTTP1A_START_CAPTURE: u8 = 1;
const HTTP1A_END_CAPTURE: u8 = 2;
const HTTP1F_DONE: u8 = 1 << 0;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Action {
StartCapture(MatchId),
EndCapture(MatchId),
Done,
EndCaptureAndDone(MatchId),
}
impl From<Action> for http1_action {
fn from(value: Action) -> Self {
let (kind, flags, mid) = match value {
Action::Done => (HTTP1A_NONE, HTTP1F_DONE, 0),
Action::StartCapture(mid) => (HTTP1A_START_CAPTURE, 0, mid.0),
Action::EndCapture(mid) => (HTTP1A_END_CAPTURE, 0, mid.0),
Action::EndCaptureAndDone(mid) => (HTTP1A_END_CAPTURE, HTTP1F_DONE, mid.0),
};
http1_action { kind, flags, mid }
}
}