projects
/
crypto_lab1.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Begining of some test cases.
[crypto_lab1.git]
/
src
/
main.rs
diff --git
a/src/main.rs
b/src/main.rs
index
e64323f
..
5f2fdf9
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-1,12
+1,16
@@
+#![feature(macro_rules)]
+
extern crate openssl;
extern crate openssl;
+extern crate serialize;
use std::io;
use std::os;
use std::io;
use std::os;
+use end_point::{ Client, Server };
+
mod crypto;
mod crypto;
-mod command;
-mod client;
-mod server;
+mod packet;
+mod end_point;
/*
TODO
/*
TODO
@@
-17,7
+21,7
@@
TODO
const PORT: u16 = 4221;
fn print_usage() {
const PORT: u16 = 4221;
fn print_usage() {
- println!("{} <genkey> | ...", os::args()[0]);
+ println!("{} <genkey> |
<tests> |
...", os::args()[0]);
}
fn main() {
}
fn main() {
@@
-31,26
+35,17
@@
fn main() {
Err(e) => println!("Unable to generate a key. Error: {}", e)
}
} else {
Err(e) => println!("Unable to generate a key. Error: {}", e)
}
} else {
- match server::Server::new(PORT) {
+ println!("Starting server..., Press any key to quit");
+
+ match Server::new("::1", PORT) {
Ok(mut server) => {
println!("Server started");
Ok(mut server) => {
println!("Server started");
-
- match client::Client::new("127.0.0.1", PORT) {
- Ok(mut client) => {
- client.start_tests();
- client.close();
- },
- Err(e) => {
- println!("Unable to create a client. Error: {}", e);
- return
- }
- }
-
- println!("Press any key to quit");
+ Client::start_tests("::1", PORT);
io::stdin().read_line().ok().expect("Failed to read line");
server.close().ok().expect("Failed to close the server");
},
io::stdin().read_line().ok().expect("Failed to read line");
server.close().ok().expect("Failed to close the server");
},
- Err(e) => println!("Unable to create a new server. Error: {}", e)
+ Err(e) =>
+ println!("Unable to create a new server. Error: {}", e)
}
}
}
}
}
}