hans-pcap 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+13/−40 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +1/−1
- README.md +0/−28
- example/test.hs +6/−5
- hans-pcap.cabal +6/−6
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2014, tolysz+Copyright (c) 2014-15, Marcin Tolysz All rights reserved. Redistribution and use in source and binary forms, with or without
− README.md
@@ -1,28 +0,0 @@-hans-pcap-========---Network ethernet device for HaNS [hans-2.4](https://github.com/GaloisInc/HaNS), 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.
example/test.hs view
@@ -2,14 +2,15 @@ module Main where import Hans.NetworkStack+import qualified Hans.Layer.Ethernet as Eth import Hans.Device.Pcap main :: IO () main = do- let mac = Mac 1 2 3 4 5 6 ns <- newNetworkStack-- dev <- pcapOpen "eth0".- addDevice ns mac (pcapSend dev) (pcapReceiveLoop dev)- deviceUp ns mac+ Just (dev,nd) <- openPcap "eth0" $ Just $ Mac 1 2 3 4 5 6+ print nd+ let Just mac = (ndMAC nd)+ Eth.addEthernetDevice (nsEthernet ns) mac (pcapSend dev) (pcapReceiveLoop dev)+ Eth.startEthernetDevice (nsEthernet ns) mac -- and we can do whatever we could earlier
hans-pcap.cabal view
@@ -2,8 +2,8 @@ -- see http://haskell.org/cabal/users-guide/ cabal-version: >=1.10 name: hans-pcap-version: 0.1.0.0-synopsis: PCAP driver for HaNS+version: 0.1.0.1+synopsis: Driver for real ethernet devices for HaNS description: 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. @@ -12,21 +12,21 @@ license-file: LICENSE author: Marcin Tolysz maintainer: tolysz@gmail.com--- copyright: +copyright: ©2014-2015 Marcin Tolysz category: Network build-type: Simple extra-source-files: example/test.hs, example/gal.hs- CHANGES, README.md+ CHANGES Stability: experimental Source-Repository head type: git location: https://github.com/tolysz/hans-pcap--- tested-with: + library exposed-modules: Hans.Device.Pcap build-depends : base >=4 && <4.8 , hans >=2.4 , pcap , bytestring- default-language: Haskell98+ default-language: Haskell2010