ipcconfig trait

This commit is contained in:
NikVolf
2016-04-07 23:18:48 +03:00
parent 54300b136c
commit c351bcd5a2
8 changed files with 35 additions and 2 deletions

View File

@@ -8,3 +8,4 @@ license = "GPL-3.0"
[dependencies]
ethcore-devtools = { path = "../../devtools" }
semver = "0.2.0"

View File

@@ -19,8 +19,24 @@
use std::io::{Read, Write};
use std::marker::Sync;
use std::sync::atomic::*;
use semver::Version;
pub trait IpcInterface<T> {
pub struct Handshake {
protocol_version: Version,
api_version: Version,
reserved: [u8; 64],
}
pub trait IpcConfig {
fn api_version() -> Version {
Version::parse("1.0.0").unwrap()
}
fn protocol_version() -> Version {
Version::parse("1.0.0").unwrap()
}
}
pub trait IpcInterface<T> where T: IpcConfig {
/// reads the message from io, dispatches the call and returns serialized result
fn dispatch<R>(&self, r: &mut R) -> Vec<u8> where R: Read;

View File

@@ -17,6 +17,7 @@
//! IPC RPC interface
extern crate ethcore_devtools as devtools;
extern crate semver;
pub mod interface;
pub use interface::{IpcInterface, IpcSocket, invoke};
pub use interface::{IpcInterface, IpcSocket, invoke, IpcConfig};