Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Oct 31 12:34:50 -0700 2009 | |
| |
Emakefile | Fri Oct 23 10:03:58 -0700 2009 | |
| |
LICENSE | Wed Oct 28 18:43:40 -0700 2009 | |
| |
Makefile | Sat Oct 31 12:27:15 -0700 2009 | |
| |
README.rst | Fri Nov 13 06:00:41 -0800 2009 | |
| |
c_src/ | Sat Oct 31 12:26:07 -0700 2009 | |
| |
include/ | Sun Nov 15 07:20:02 -0800 2009 | |
| |
src/ | Wed Dec 09 13:00:40 -0800 2009 |
ENet - A pure-Erlang network stack
ENet is a pure Erlang network stack that can be used to encode and decode a variety of common packet formats.
The project includes a port program that can be used to send and receive ethernet frames via the /dev/tap0 device.
Drivers
Use
You'll need to edit the Makefile to set the appropriate CFLAGS and LDFLAGS for your machine and erts (32 or 64 bit built, location of libevent headers and libraries, ...).
For ease of use, you should probably change the ownership of /dev/tapN to yourself, and allow passwordless sudo to the command /sbin/ifconfig tapN. You can do this in /etc/sudoers by:
Cmnd_Alias ENET = /sbin/ifconfig tap0 * yourusername ALL=(ALL) NOPASSWD: ENET
From an erlang shell (with -boot start_sasl):
1> {ok, Pid} = enet_iface:start("tap0", "192.168.2.1/24 up"),
enet_if_dump:attach(Pid),
enet_if_arp:attach(Pid),
enet_if_arp:add_entry(Pid, "4A:6E:01:1B:19:8F", "192.168.2.2"),
enet_if_icmp:attach(Pid).
You should now see decoded traffic in the erlang shell. If you ping the IP address of the erlang interface 192.168.2.2 in the example, you should see ping replies and an arp entry (arp -na):
? (192.168.2.2) at 4a:6e:1:1b:19:8f on tap0 ifscope [ethernet]







