diff --git a/ethcore/src/light/net/event.rs b/ethcore/src/light/net/event.rs new file mode 100644 index 000000000..f7dee217a --- /dev/null +++ b/ethcore/src/light/net/event.rs @@ -0,0 +1,40 @@ +// Copyright 2015, 2016 Ethcore (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +//! Network events and event listeners. + +use network::PeerId; + +use super::{Status, Capabilities, Announcement}; + +use transaction::SignedTransaction; + +/// Peer connected +pub struct Connect(PeerId, Status, Capabilities); + +/// Peer disconnected +pub struct Disconnect(PeerId); + +/// Peer announces new capabilities. +pub struct Announcement(PeerId, Announcement); + +/// Transactions to be relayed. +pub struct RelayTransactions(Vec); + +/// An LES event handler. +pub trait Handler { + fn on_connect(&self, _event: Connect); +} \ No newline at end of file diff --git a/ethcore/src/light/net/mod.rs b/ethcore/src/light/net/mod.rs index 1d7fc8f2d..fc9ecbd18 100644 --- a/ethcore/src/light/net/mod.rs +++ b/ethcore/src/light/net/mod.rs @@ -39,7 +39,8 @@ mod buffer_flow; mod error; mod status; -pub use self::status::Announcement; +pub mod event; +pub use self::status::{Status, Capabilities, Announcement}; const TIMEOUT: TimerToken = 0; const TIMEOUT_INTERVAL_MS: u64 = 1000;