feat: added basic structure around packet transfer

This commit is contained in:
Andrew Rioux
2023-09-25 23:24:37 -04:00
parent 867464f673
commit 0bda72491c
3 changed files with 154 additions and 16 deletions

View File

@@ -600,7 +600,12 @@ impl TCPPacketBuilder {
let seqnumber = self.seqnumber.unwrap();
let window = self.window.unwrap();
let len: u8 = (self.options.len() / 4 + 5).try_into().unwrap();
let mut options = self.options;
while options.len() % 4 != 0 {
options.push(0);
}
let len: u8 = (options.len() / 4 + 5).try_into().unwrap();
let len = len << 4;
let mut bytes = [
@@ -617,7 +622,7 @@ impl TCPPacketBuilder {
&window.to_be_bytes(),
&[0, 0],
&self.urgent_ptr.to_be_bytes(),
&self.options,
&options,
&data,
]
.concat();