Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From ethrecv-0.0.1 To trunk
2024-03-28
| ||
17:43 | Working on a simulator, using unix local datagram sockets, backend. Leaf check-in: d1bbde3fa5 user: jan tags: uds-simulator | |
2024-03-20
| ||
11:47 | Re-export pcap. Leaf check-in: 9c0f8028a4 user: jan tags: trunk | |
11:44 | Use pcap 1.3.0. check-in: 8528c5c473 user: jan tags: trunk | |
2024-03-12
| ||
16:30 | Update changelog. check-in: 01c7b31411 user: jan tags: trunk | |
16:20 | reinstate a debug output to detect unexpected errors when reading from control stream. check-in: c630a1781b user: jan tags: ethrecv-0.0.1, trunk | |
16:17 | Comment out debug outputs. check-in: 0dba4808e5 user: jan tags: trunk | |
Changes to Cargo.toml.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | - + + + + + + - + | [package] name = "ethrecv" |
︙ |
Changes to README.md.
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 | + + + + + + + + | # ethrecv The _ethrecv_ crate is designed to receive ethernet packets at a high rate. [![Crates.io][crates-badge]][crates-url] [![0BSD licensed][0bsd-badge]][0bsd-url] [crates-badge]: https://img.shields.io/crates/v/ethrecv.svg [crates-url]: https://crates.io/crates/ethrecv [0bsd-badge]: https://img.shields.io/badge/license-0BSD-blue.svg [0bsd-url]: https://opensource.org/license/0bsd |
Changes to examples/simple-demo.rs.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + + + - + + - + - + - + |
|
︙ |
Changes to src/lib.rs.
︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | + + + + | #[cfg(feature = "idle")] mod idlemon; mod cmdsig; mod err; use std::{ ops::ControlFlow, sync::{mpsc::Sender, Arc}, thread }; #[cfg(any(feature = "idle", feature = "inspect"))] use std::time::Duration; #[cfg(unix)] use parking_lot::Mutex; #[cfg(windows)] use std::sync::atomic::AtomicU32; pub use err::Error; use cmdsig::CmdSignal; pub use pcap; /// Messages that can be sent back to controller from recever thread. enum Msg { #[cfg(feature = "inspect")] Inspect(std::sync::mpsc::Sender<RecvInfo>) } |
︙ | |||
71 72 73 74 75 76 77 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | + + + - + - - + + + + + | /// Called on the receiver thread before the processing reading and /// processing loop has been entered. fn init(&mut self) -> Result<(), Self::Error> { Ok(()) } /// Called to process packets. fn proc( &mut self, pkt: pcap::Packet |
︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | + + + + + + + + + + | #[cfg(feature = "idle")] #[cfg_attr(docsrs, doc(cfg(feature = "idle")))] pub fn idle_duration_r(&mut self, dur: Duration) -> &mut Self { self.idle_dur = Some(dur); self } pub fn thread_name(mut self, name: impl ToString) -> Self { self.thread_name_r(name); self } pub fn thread_name_r(&mut self, name: impl ToString) -> &mut Self { self.thread_name = Some(name.to_string()); self } } impl RecvThread { pub fn run<E>( self, mut handler: impl PacketHandler<Error = E> + Send + 'static |
︙ | |||
186 187 188 189 190 191 192 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | + + + + + + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - + + - - + + - - - - - - + + + + + + - - + + + + + | // Channel used to send requests to receiver thread. let (ch_tx, ch_rx) = std::sync::mpsc::channel::<Msg>(); #[cfg(feature = "idle")] let cmdsig2 = cmdsig.clone(); let bldr = thread::Builder::new(); let bldr = if let Some(thread_name) = self.thread_name { bldr.name(thread_name) } else { bldr }; let jh = bldr |
︙ |
Changes to src/unix.rs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + | //! Unix packet receiver backend implementation. //! //! This backend uses `mio` to wait for either packets or intra-process //! commands. use std::{ io::{ErrorKind, Read}, ops::ControlFlow, os::fd::AsRawFd, sync::mpsc::Receiver }; #[cfg(feature = "inspect")] use std::time::Instant; |
︙ | |||
89 90 91 92 93 94 95 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - - + + | #[cfg(feature = "idle")] if let Some(ref idle_sh) = rp.idle_sh { idle_sh.touch(); } //println!("Got a packet!"); |
︙ | |||
156 157 158 159 160 161 162 | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - - + + + | raw_pkt_bytes, runtime: Instant::now() - start_time }; handler.inspect(&info); } #[cfg(feature = "idle")] b'd' => { |
︙ |
Changes to src/win.rs.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | - - - - + + + + + + + | //! Windows packet receiver backend implementation. //! //! This backend uses an event semaphore, provided by pcap, to unblock the //! blocking `pcap_next()` whenever the controller or idle thread requests some //! action to be taken. |
︙ | |||
84 85 86 87 88 89 90 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - - + + | #[cfg(feature = "idle")] if let Some(ref idle_sh) = rp.idle_sh { idle_sh.touch(); } //println!("Got a packet!"); |
︙ | |||
127 128 129 130 131 132 133 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - - + + | runtime: Instant::now() - start_time }; handler.inspect(&info); } #[cfg(feature = "idle")] if cmd & CmdFlags::IDLE.bits() != 0 { |
︙ |
Changes to www/changelog.md.
1 2 3 4 5 6 7 8 9 10 11 12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + + + + + + + + + + + + + + + + + | # Change Log - ⚠️ Breaking change ## [Unreleased] [Details](/vdiff?from=ethrecv-0.0.1&to=trunk) ### Added - `RecvThread::thread_name()` can be used to set the receiver's thread name. - Re-export `pcap` from crate root. ### Changed - ⚠️ Return `ControlFlow` from `PacketHandler::proc()` and `PacketHandler::idle()`, to more clearly state intention to continue or abort poll loop. This also opens up the ability to end the loop successfully, using `ControlFlow::Break(Ok(()))`. - Upgrade from `pcap` `1.2.0` to `1.3.0`. ### Removed --- ## [0.0.1] - 2024-03-12 Initial release. |
Changes to www/index.md.
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + + + + + + + + + + + + + + + + + + + + + + + | # ethrecv |
︙ |