impl: tcp fin

This commit is contained in:
Cain 2024-01-15 16:28:56 +00:00 committed by Douile
parent 61ecbab312
commit c30f28741f
No known key found for this signature in database
GPG key ID: E048586A5FF6585C
3 changed files with 77 additions and 5 deletions

View file

@ -14,7 +14,7 @@ lazy_static! {
pub(crate) trait Writer {
fn write(&mut self, packet: &CapturePacket, data: &[u8]) -> GDResult<()>;
fn new_connect(&mut self, packet: &CapturePacket) -> GDResult<()>;
//TODO: Close connection
fn close_connection(&mut self, packet: &CapturePacket) -> GDResult<()>;
}
impl<W: Write> Writer for Pcap<W> {
@ -36,4 +36,14 @@ impl<W: Write> Writer for Pcap<W> {
Ok(())
}
fn close_connection(&mut self, packet: &CapturePacket) -> GDResult<()> {
match packet.protocol {
Protocol::TCP => {
self.send_tcp_fin(packet);
}
Protocol::UDP => {}
}
Ok(())
}
}