The hans-pcap package

[maintain]
Warnings:

Network ethernet device for HaNS(Currently requires hans-2.4 from the github), which can tap into a real ethernet interface, all using pcap library and preform raw packet reads & writes. This is a very simple. But requires: root - to be able to use PCAP.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0, 0.1.0.1, 0.1.0.2
Dependenciesbase (>=4 && <4.8), bytestring, hans (>=2.4), pcap [details]
LicenseBSD3
AuthorMarcin Tolysz
Maintainertolysz@gmail.com
Stabilityexperimental
CategoryNetwork
Home pagehttps://github.com/tolysz/hans-pcap
Source repositoryhead: git clone https://github.com/tolysz/hans-pcap
UploadedSat Sep 6 01:15:53 UTC 2014 by tolysz

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hans-pcap-0.1.0.0

hans-pcap

Network ethernet device for HaNS hans-2.4, which can tap into a real ethernet interface, all using pcap library and preform raw packet reads & writes. It is using ghc 7.8, thus the high dependencies. This is a very naive implementation, however not much more can be squeezed from PCAP. Top run requires: root - all because we need to use PCAP

example use:

import Hans.NetworkStack
import Hans.Device.Pcap

main :: IO ()
main = do
  ns  <- newNetworkStack
  -- MAC we want to have; make it unique
  let mac = Mac 1 2 3 4 5 6

  -- device we attach to
  dev <- pcapOpen "eth0" 
  addDevice ns mac (pcapSend dev) (pcapReceiveLoop dev)
  deviceUp ns mac

And we can continue using HaNS as normal. See example/gal.hs for a working example.