Commit a1086253 authored by RILLING Louis's avatar RILLING Louis
Browse files

tansiv-client: Put vsg_address functions in a dedicated module

parent 0fcf2d4c
......@@ -12,7 +12,7 @@ pub(crate) struct Config {
pub actor_socket: std::path::PathBuf,
/// Name (address) of this application in the network
#[structopt(short = "n", long = "name", parse(try_from_str = "crate::vsg_address_from_str"))]
#[structopt(short = "n", long = "name", parse(try_from_str = "crate::vsg_address::from_str"))]
pub address: libc::in_addr_t,
/// Initial time in the VM, formatted as %Y-%m-%dT%H:%M:%S%.f (%.f part is optional)
......
......@@ -19,6 +19,7 @@ mod connector;
pub mod error;
mod output_msg_set;
mod timer;
mod vsg_address;
mod waitfree_array_queue;
impl From<buffer_pool::Error> for Error {
......@@ -42,12 +43,6 @@ pub type Result<T> = std::result::Result<T, Error>;
pub type RecvCallback = Box<dyn Fn() -> () + Send + Sync>;
fn vsg_address_from_str(ip: &str) -> std::result::Result<libc::in_addr_t , std::net::AddrParseError> {
use std::str::FromStr;
let ipv4 = std::net::Ipv4Addr::from_str(ip)?;
Ok(Into::<u32>::into(ipv4).to_be())
}
#[derive(Debug)]
struct Packet {
src: libc::in_addr_t,
......
use std::net::Ipv4Addr;
pub fn from_str(ip: &str) -> std::result::Result<libc::in_addr_t , std::net::AddrParseError> {
use std::str::FromStr;
let ipv4 = Ipv4Addr::from_str(ip)?;
Ok(Into::<u32>::into(ipv4).to_be())
}
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