Commit 9bf89928 authored by Michael Watzko's avatar Michael Watzko
Browse files

Add get-network-conf

parent 6c77aabc
......@@ -77,7 +77,6 @@ fn main() {
match &args[2] as &str {
"version" => {
error_code = 1;
for _ in 0..5 {
let request = Request::RetrieveVersionInformation(random.read::<u8>());
if let Ok((response, data)) = send_wait_response(&mut socket, address, &request) {
......@@ -94,6 +93,28 @@ fn main() {
}
}
},
"get-network-conf" => {
for _ in 0..5 {
let request = Request::RetrieveNetworkConfiguration(random.read::<u8>());
if let Ok((response, data)) = send_wait_response(&mut socket, address, &request) {
// 18 = 6 + 3*4
if let Response::Ok(_, Format::ValueOnly(Type::Bytes(18))) = response {
println!("MAC: {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", data[0], data[1], data[2], data[3], data[4], data[5]);
println!();
println!("IP: {:}.{:}.{:}.{:}", data[ 6], data[ 7], data[ 8], data[ 9]);
println!("Subnet: {:}.{:}.{:}.{:}", data[10], data[11], data[12], data[13]);
println!("Gateway: {:}.{:}.{:}.{:}", data[14], data[15], data[16], data[17]);
error_code = 0;
} else {
println!("Error: {:?}", response);
error_code = 2;
}
break;
}
}
},
_ => {
let mut devices = Vec::new();
for i in 2..std::env::args().len() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment