Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/hopfma/appsec
This commit is contained in:
commit
c399ca6aa3
@ -58,5 +58,36 @@ impl Message {
|
||||
}
|
||||
vec
|
||||
}
|
||||
|
||||
fn recive(input: Vec<u8>) -> Message {
|
||||
let byte1 = input.get(0).expect("Fail to Read Byte 1");
|
||||
let byte2 = input.get(1).expect("Fail to Read Byte 2");
|
||||
let byte3 = input.get(2).expect("Fail to Read Byte 3");
|
||||
let byte4 = input.get(3).expect("Fail to Read Byte 4");
|
||||
|
||||
let src_id: u32 =
|
||||
(byte1 << 24) as u32 | (byte2 << 16) as u32 | (byte3 << 8) as u32 | (byte4 << 0) as u32;
|
||||
|
||||
let byte5 = input.get(5).expect("Fail to Read Byte 5");
|
||||
let byte6 = input.get(6).expect("Fail to Read Byte 6");
|
||||
let byte7 = input.get(7).expect("Fail to Read Byte 7");
|
||||
let byte8 = input.get(8).expect("Fail to Read Byte 8");
|
||||
|
||||
let dest_id: u32 =
|
||||
(byte5 << 24) as u32 | (byte6 << 16) as u32 | (byte7 << 8) as u32 | (byte8 << 0) as u32;
|
||||
|
||||
let byte9 = input.get(9).expect("Fail to Read byte 9");
|
||||
let byte10 = input.get(10).expect("Fail to Read byte 10");
|
||||
|
||||
let size = (byte9 << 8) as u16 | (byte10 << 0) as u16;
|
||||
assert!(size > 0, "Ungültige size größe size = {}", size);
|
||||
|
||||
Message {
|
||||
src_id: src_id,
|
||||
dest_id: dest_id,
|
||||
size: size,
|
||||
payload: (&input[11..]).to_vec(),
|
||||
}
|
||||
}
|
||||
// Methoden der Klasse
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user