- install Rust
- make sure everything works by running
cargo test
In the chatproto/src/netproto directory, edit decode.rs and encode.rs. The network protocol
work in the following way:
- structs are encoded by encoding each field, in the order they appear in the definition
- enums are encoded by first inserting a byte designing the variant we are in (starting at 0), and then encoding the enum fields
- numbers are encoded in the following way:
- with
u < 251, encode it as a single byte with that value, - with
251 <= u < 2**16, encode it as251followed by a little-endianu16value, - with
2**16 <= u < 2**32, encode it as252followed by a little-endianu32value, - with
2**32 <= u < 2**64, encode it as253followed by a little-endianu64value, - with
2**64 <= u < 2**128, encode it as254followed by a little-endianu128value.
- with
- collections are encoded by first putting their sizes, and they the contents
You can test your implementation by running:
cargo test netprotoIt is suggested to implement the encoding/decoding pair of functions in the order they are presented.
Before starting, do the following:
- rename the
sample.rsfile using a name unique to your group; - in the renamed file, edit the
GROUP_NAMEconstant and put your names in it.
You will only have to edit the renamed file, do not edit any other file! You will be graded on that file, and you should only send this file to the course teacher.
You will have to find fill the Server structure with data structures that will allow you to write the
traits methods. You will most likely want to use RwLock (the one from async_std::sync::RwLock).
Run tests and executables with the -F federation flag.
$ RUST_LOG=debug cargo run --bin server
...$ RUST_LOG=debug cargo run --bin client -- --name my_name
...