packages feed

iproute 1.2.5 → 1.2.6

raw patch · 4 files changed

+49/−7 lines, 4 filesdep +byteorderdep +network

Dependencies added: byteorder, network

Files

Data/IP.hs view
@@ -5,8 +5,8 @@   -- * Documentation   -- ** IP data     IP (..)-  , IPv4, toIPv4, fromIPv4-  , IPv6, toIPv6, fromIPv6+  , IPv4, toIPv4, fromIPv4, fromHostAddress, toHostAddress+  , IPv6, toIPv6, fromIPv6, fromHostAddress6, toHostAddress6   -- ** IP range data   , IPRange (..)   , AddrRange (addr, mask, mlen)
Data/IP/Addr.hs view
@@ -6,6 +6,8 @@ import Data.List (foldl') import Data.String import Data.Word+import Network.Socket+import System.ByteOrder import Text.Appar.String import Text.Printf @@ -122,7 +124,7 @@ --  {-|-  The 'fromIPv4' function convert 'IPv4' to a list of 'Int'.+  The 'fromIPv4' function converts 'IPv4' to a list of 'Int'.  >>> fromIPv4 (toIPv4 [192,0,2,1]) [192,0,2,1]@@ -131,7 +133,7 @@ fromIPv4 (IP4 w) = map (\n -> fromEnum $ (w `shiftR` n) .&. 0xff) [0o30, 0o20, 0o10, 0o00]  {-|-  The 'toIPv6' function convert 'IPv6' to a list of 'Int'.+  The 'toIPv6' function converts 'IPv6' to a list of 'Int'.  >>> fromIPv6 (toIPv6 [0x2001,0xDB8,0,0,0,0,0,1]) [8193,3512,0,0,0,0,0,1]@@ -250,3 +252,36 @@                           let spring = replicate len 0                           return $ bs1 ++ spring ++ bs2       check bs = when (length bs /= 8) (fail "IPv6 address4")++----------------------------------------------------------------+--+-- HostAddress and HostAddress6+--++-- | The 'fromHostAddress' function converts 'HostAddress' to 'IPv4'.+fromHostAddress :: HostAddress -> IPv4+fromHostAddress addr4+  | byteOrder == LittleEndian = IP4 $ fixByteOrder addr4+  | otherwise                 = IP4 addr4++-- | The 'toHostAddress' function converts 'IPv4' to 'HostAddress'.+toHostAddress :: IPv4 -> HostAddress+toHostAddress (IP4 addr4)+  | byteOrder == LittleEndian = fixByteOrder addr4+  | otherwise                 = addr4++-- | The 'fromHostAddress6' function converts 'HostAddress6' to 'IPv6'.+fromHostAddress6 :: HostAddress6 -> IPv6+fromHostAddress6 addr6 = IP6 addr6++-- | The 'toHostAddress6' function converts 'IPv6' to 'HostAddress6'.+toHostAddress6 :: IPv6 -> HostAddress6+toHostAddress6 (IP6 addr6) = addr6++fixByteOrder :: Word32 -> Word32+fixByteOrder s = d1 .|. d2 .|. d3 .|. d4+  where+    d1 = shiftL s 24+    d2 = shiftL s  8 .&. 0x00ff0000+    d3 = shiftR s  8 .&. 0x0000ff00+    d4 = shiftR s 24 .&. 0x000000ff
Data/IP/RouteTable/Internal.hs view
@@ -89,6 +89,9 @@  {-|   The 'empty' function returns an empty IP routing table.++>>> (empty :: IPRTable IPv4 ()) == fromList []+True -} empty :: Routable k => IPRTable k a empty = Nil@@ -147,7 +150,7 @@   The 'delete' function deletes a value by a key of 'AddrRange' from 'IPRTable'   and returns a new 'IPRTable'. ->>> delete "127.0.0.1" (insert ("127.0.0.1" :: AddrRange IPv4) () empty) == empty+>>> delete "127.0.0.1" (insert "127.0.0.1" () empty) == (empty :: IPRTable IPv4 ()) True -} delete :: (Routable k) => AddrRange k -> IPRTable k a -> IPRTable k a
iproute.cabal view
@@ -1,5 +1,5 @@ Name:                   iproute-Version:                1.2.5+Version:                1.2.6 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3@@ -27,7 +27,11 @@                         Data.IP.Op                         Data.IP.Range                         Data.IP.RouteTable.Internal-  Build-Depends:        base >= 4 && < 5, appar, containers+  Build-Depends:        base >= 4 && < 5+                      , appar+                      , byteorder+                      , containers+                      , network Source-Repository head   Type:                 git   Location:             git://github.com/kazu-yamamoto/iproute.git