All Projects → libpnet → Libpnet

libpnet / Libpnet

Licence: other
Cross-platform, low level networking using the Rust programming language.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Libpnet

Easyhttpcpp
A cross-platform HTTP client library with a focus on usability and speed
Stars: ✭ 110 (-91.68%)
Mutual labels:  networking, cross-platform
Cute headers
Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
Stars: ✭ 3,274 (+147.66%)
Mutual labels:  networking, cross-platform
Litenetlib
Lite reliable UDP library for Mono and .NET
Stars: ✭ 2,179 (+64.83%)
Mutual labels:  networking, cross-platform
Joynet
high performance network (tcp socket) library for lua, based on https://github.com/IronsDu/brynet and lua coroutine.
Stars: ✭ 101 (-92.36%)
Mutual labels:  networking, cross-platform
Poco
The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
Stars: ✭ 5,762 (+335.85%)
Mutual labels:  networking, cross-platform
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-87.59%)
Mutual labels:  networking, packets
Netlink
Socket and Networking Library using msgpack.org[C++11]
Stars: ✭ 197 (-85.1%)
Mutual labels:  networking, cross-platform
Hp Socket
High Performance TCP/UDP/HTTP Communication Component
Stars: ✭ 4,420 (+234.34%)
Mutual labels:  networking, cross-platform
Airshare
Cross-platform content sharing in a local network
Stars: ✭ 497 (-62.41%)
Mutual labels:  networking, cross-platform
Curlcpp
An object oriented C++ wrapper for CURL (libcurl)
Stars: ✭ 462 (-65.05%)
Mutual labels:  networking, cross-platform
Brynet
A Header-Only cross-platform C++ TCP network library . Can use vcpkg(https://github.com/Microsoft/vcpkg/tree/master/ports/brynet) install
Stars: ✭ 674 (-49.02%)
Mutual labels:  networking, cross-platform
Sharppcap
Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets
Stars: ✭ 665 (-49.7%)
Mutual labels:  packets, cross-platform
Xdp
Package xdp allows one to use XDP sockets from the Go programming language.
Stars: ✭ 36 (-97.28%)
Mutual labels:  networking, packets
Zlb
This is the repository of ZEVENET Load Balancer (next generation of Zen Load Balancer)
Stars: ✭ 90 (-93.19%)
Mutual labels:  networking
Roslynpad
A cross-platform C# editor based on Roslyn and AvalonEdit
Stars: ✭ 1,310 (-0.91%)
Mutual labels:  cross-platform
Cubicsdr
Cross-Platform Software-Defined Radio Application
Stars: ✭ 1,294 (-2.12%)
Mutual labels:  cross-platform
Xdg
Go implementation of the XDG Base Directory Specification and XDG user directories
Stars: ✭ 88 (-93.34%)
Mutual labels:  cross-platform
Webm.py
🎞 Cross-platform command-line WebM converter
Stars: ✭ 93 (-92.97%)
Mutual labels:  cross-platform
Gns3 Gui
GNS3 Graphical Network Simulator
Stars: ✭ 1,307 (-1.13%)
Mutual labels:  networking
Module Shop Mini Program
一个基于 .NET Core构建的简单、跨平台、模块化的商城系统
Stars: ✭ 89 (-93.27%)
Mutual labels:  cross-platform

libpnet Crates.io License Documentation

Linux ∪ OS X Build Status: Linux ∪ OS X Build Status

Windows Build Status: Windows Build Status

Discussion and support: #libpnet on freenode / #rust-networking on irc.mozilla.org / #rust on irc.mozilla.org.

libpnet provides a cross-platform API for low level networking using Rust.

There are four key components:

  • The packet module, allowing safe construction and manipulation of packets;
  • The pnet_macros crate, providing infrastructure for the packet module;
  • The transport module, which allows implementation of transport protocols;
  • The datalink module, which allows sending and receiving data link packets directly.

Why?

There are lots of reasons to use low level networking, and many more to do it using Rust. A few are outlined here:

Developing Transport Protocols

There are usually two ways to go about developing a new transport layer protocol:

  • Write it in a scripting language such as Python;
  • Write it using C.

The former is great for trying out new ideas and rapid prototyping, however not so great as a real-world implementation. While you can usually get reasonable performance out of these implementations, they're generally significantly slower than an implementation in C, and not suitable for any "heavy lifting".

The next option is to write it in C - this will give you great performance, but comes with a number of other issues:

  • Lack of memory safety - this is a huge source of security vulnerabilities and other bugs in C-based network stacks. It is far too easy to forget a bounds check or use a pointer after it is freed.
  • Lack of thread safety - you have to be very careful to make sure the correct locks are used, and used correctly.
  • Lack of high level abstractions - part of the appeal of scripting languages such as Python is the higher level of abstraction which enables simpler APIs and ease of programming.

Using libpnet and Rust, you get the best of both worlds. The higher level abstractions, memory and thread safety, alongside the performance of C.

Network Utilities

Many networking utilities such as ping and traceroute rely on being able to manipulate network and transport headers, which isn't possible with standard networking stacks such as those provided by std::io::net.

Data Link Layer

It can be useful to work directly at the data link layer, to see packets as they are "on the wire". There are lots of uses for this, including network diagnostics, packet capture and traffic shaping.

Documentation

API documentation for the latest build can be found here: https://docs.rs/pnet/

Usage

To use libpnet in your project, add the following to your Cargo.toml:

[dependencies.pnet]
version = "0.27.2"

libpnet should work on any Rust channel (stable, beta, or nightly), starting with Rust 1.34.2. When using a nightly version of Rust, you may wish to use pass --no-default-features --features nightly to Cargo, to enable faster build times.

When running the test suite, there are a number of networking tests which will likely fail - the easiest way to workaround this is to run cargo test as a root or administrative user. This can often be avoided, however it is more involved.

Windows

There are three requirements for building on Windows:

  • You must use a version of Rust which uses the MSVC toolchain
  • You must have WinPcap or npcap installed (tested with version WinPcap 4.1.3) (If using npcap, make sure to install with the "Install Npcap in WinPcap API-compatible Mode")
  • You must place Packet.lib from the WinPcap Developers pack in a directory named lib, in the root of this repository. Alternatively, you can use any of the locations listed in the %LIB%/$Env:LIB environment variables. For the 64 bit toolchain it is in WpdPack/Lib/x64/Packet.lib, for the 32 bit toolchain, it is in WpdPack/Lib/Packet.lib.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].