A short (and mostly wrong) history of computer networking
When I launched my Patreon, I vowed to explain how computers work. But in 2019, computers rarely work in isolation. So let’s take the time to write a few articles about how...
Windows dynamic libraries, calling conventions, and transmute
So, how does
ping.exeactually send a ping? It seems unrealistic that
ping.exeitself implements all the protocols involved in sending a ping. So it must be calling some sort of...
FFI-safe types in Rust, newtypes and MaybeUninit
It’s time to make
sup, our own take on
ping, use the Win32 APIs to send an ICMP echo. Earlier we discovered that Windows’s
IcmpSendEcho2Ex. But for our...
Designing and implementing a safer API on top of LoadLibrary
It’s refactor time!
Our complete program is now about a hundred lines, counting blank lines (see the end of part 3 for a complete listing).
While this is pretty good for...
A simple ping library, parsing strings into IPv4 address
We’ve just spent a lot of time abstracting over LoadLibrary, but we still have all the gory details of the Win32 ICMP API straight in our main.rs file! That won’t do....
The builder pattern, and a macro that keeps FFI code DRY
Our ping API is simple, but it’s also very limited:
pub fn ping(dest: ipv4::Addr) -> Result<(), String> // called as: ping(ipv4::Addr([8, 8, 8, 8])).unwrap();...
Finding the default network interface through WMI
Let’s set aside our
supproject for a while.
Don’t get me wrong - it’s a perfectly fine project, and, were we simply rewriting “ping” for Windows...
Binding C APIs with variable-length structs and UTF-16
Okay, I lied.
I’m deciding - right this instant - that using wmic is cheating too. Oh, it was fair game when we were learning about Windows, but we’re past that now....
Consuming Ethernet frames with the nom crate
Now that we’ve found the best way to find the “default network interface”… what can we do with that interface?
Well, listen for network traffic of...
Improving error handling - panics vs. proper errors
Before we move on to parsing more of our raw packets, I want to take some time to improve our error handling strategy.
ersatzcodebase contains a mix of...
Parsing IPv4 packets, including numbers smaller than bytes
Hello and welcome to Part 11 of this series, wherein we finally use some of the code I prototyped way back when I was planning this series.
Where are we standing?