/usr/share/doc/libghc-iproute-doc/html/Data-IP-RouteTable.html is in libghc-iproute-doc 1.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.IP.RouteTable</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-IP-RouteTable.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-IP-RouteTable.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">iproute-1.7.0: IP Routing Table</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Data.IP.RouteTable</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Documentation</a><ul><li><a href="#g:2">Routable class</a></li><li><a href="#g:3">Type for IP routing table</a></li><li><a href="#g:4">Functions to manipulate an IP routing table</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>IP routing table is a tree of <code>IPRange</code>
to search one of them on the longest
match base. It is a kind of TRIE with one
way branching removed. Both IPv4 and IPv6
are supported.</p><p>For more information, see:
<a href="http://www.mew.org/~kazu/proj/iproute/">http://www.mew.org/~kazu/proj/iproute/</a></p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> <a href="Data-IP.html#t:Addr">Addr</a> a => <a href="#t:Routable">Routable</a> a <span class="keyword">where</span><ul class="subs"><li><a href="#v:intToTBit">intToTBit</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> a</li><li><a href="#v:isZero">isZero</a> :: a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:IPRTable">IPRTable</a> k a</li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a</li><li class="src short"><a href="#v:insert">insert</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a</li><li class="src short"><a href="#v:delete">delete</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a</li><li class="src short"><a href="#v:lookup">lookup</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a</li><li class="src short"><a href="#v:findMatch">findMatch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m => <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> m (<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a)</li><li class="src short"><a href="#v:fromList">fromList</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => [(<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a)] -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> [(<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a)]</li></ul></div><div id="interface"><h1 id="g:1">Documentation</h1><h2 id="g:2">Routable class</h2><div class="top"><p class="src"><span class="keyword">class</span> <a href="Data-IP.html#t:Addr">Addr</a> a => <a name="t:Routable" class="def">Routable</a> a <span class="keyword">where</span> <a href="src/Data-IP-RouteTable-Internal.html#Routable" class="link">Source</a></p><div class="doc"><p>A class to contain IPv4 and IPv6.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:intToTBit" class="def">intToTBit</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> -> a <a href="src/Data-IP-RouteTable-Internal.html#intToTBit" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:intToTBit">intToTBit</a></code> function takes <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> and returns an <code><a href="Data-IP-RouteTable.html#t:Routable">Routable</a></code> address
whose only n-th bit is set.</p></div><p class="src"><a name="v:isZero" class="def">isZero</a> :: a -> a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-IP-RouteTable-Internal.html#isZero" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:isZero">isZero</a></code> function takes an <code><a href="Data-IP-RouteTable.html#t:Routable">Routable</a></code> address and an test bit
<code><a href="Data-IP-RouteTable.html#t:Routable">Routable</a></code> address and returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:True">True</a></code> is the bit is unset,
otherwise returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:False">False</a></code>.</p></div></div><div class="subs instances"><p id="control.i:Routable" class="caption collapser" onclick="toggleSection('i:Routable')">Instances</p><div id="section.i:Routable" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Data-IP-RouteTable.html#t:Routable">Routable</a> <a href="Data-IP-Internal.html#t:IPv6">IPv6</a></span> <a href="src/Data-IP-RouteTable-Internal.html#line-50" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-IP-RouteTable.html#t:Routable">Routable</a> <a href="Data-IP-Internal.html#t:IPv4">IPv4</a></span> <a href="src/Data-IP-RouteTable-Internal.html#line-46" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h2 id="g:3">Type for IP routing table</h2><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:IPRTable" class="def">IPRTable</a> k a <a href="src/Data-IP-RouteTable-Internal.html#IPRTable" class="link">Source</a></p><div class="doc"><p>The Tree structure for IP routing table based on TRIE with
one way branching removed. This is an abstract data type,
so you cannot touch its inside. Please use <code><a href="Data-IP-RouteTable.html#v:insert">insert</a></code> or <code><a href="Data-IP-RouteTable.html#v:lookup">lookup</a></code>, instead.</p></div><div class="subs instances"><p id="control.i:IPRTable" class="caption collapser" onclick="toggleSection('i:IPRTable')">Instances</p><div id="section.i:IPRTable" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k)</span> <a href="src/Data-IP-RouteTable-Internal.html#line-106" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#t:Foldable">Foldable</a> (<a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k)</span> <a href="src/Data-IP-RouteTable-Internal.html#line-110" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#t:Traversable">Traversable</a> (<a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k)</span> <a href="src/Data-IP-RouteTable-Internal.html#line-114" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> k, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a)</span> <a href="src/Data-IP-RouteTable-Internal.html#line-93" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> k, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> a) => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> (<a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a)</span> <a href="src/Data-IP-RouteTable-Internal.html#line-93" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><h2 id="g:4">Functions to manipulate an IP routing table</h2><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a <a href="src/Data-IP-RouteTable-Internal.html#empty" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:empty">empty</a></code> function returns an empty IP routing table.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(empty :: IPRTable IPv4 ()) == fromList []
</code></strong>True
</pre></div></div><div class="top"><p class="src"><a name="v:insert" class="def">insert</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a <a href="src/Data-IP-RouteTable-Internal.html#insert" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:insert">insert</a></code> function inserts a value with a key of <code><a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a></code> to <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code>
and returns a new <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code>.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(insert ("127.0.0.1" :: AddrRange IPv4) () empty) == fromList [("127.0.0.1",())]
</code></strong>True
</pre></div></div><div class="top"><p class="src"><a name="v:delete" class="def">delete</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a <a href="src/Data-IP-RouteTable-Internal.html#delete" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:delete">delete</a></code> function deletes a value by a key of <code><a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a></code> from <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code>
and returns a new <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code>.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>delete "127.0.0.1" (insert "127.0.0.1" () empty) == (empty :: IPRTable IPv4 ())
</code></strong>True
</pre></div></div><div class="top"><p class="src"><a name="v:lookup" class="def">lookup</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> a <a href="src/Data-IP-RouteTable-Internal.html#lookup" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:lookup">lookup</a></code> function looks up <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code> with a key of <code><a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a></code>.
If a routing information in <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code> matches the key, its value
is returned.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let v4 = ["133.4.0.0/16","133.5.0.0/16","133.5.16.0/24","133.5.23.0/24"] :: [AddrRange IPv4]
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>let rt = fromList $ zip v4 v4
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>lookup "127.0.0.1" rt
</code></strong>Nothing
<code class="prompt">>>> </code><strong class="userinput"><code>lookup "133.3.0.1" rt
</code></strong>Nothing
<code class="prompt">>>> </code><strong class="userinput"><code>lookup "133.4.0.0" rt
</code></strong>Just 133.4.0.0/16
<code class="prompt">>>> </code><strong class="userinput"><code>lookup "133.4.0.1" rt
</code></strong>Just 133.4.0.0/16
<code class="prompt">>>> </code><strong class="userinput"><code>lookup "133.5.16.0" rt
</code></strong>Just 133.5.16.0/24
<code class="prompt">>>> </code><strong class="userinput"><code>lookup "133.5.16.1" rt
</code></strong>Just 133.5.16.0/24
</pre></div></div><div class="top"><p class="src"><a name="v:findMatch" class="def">findMatch</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m => <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> m (<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a) <a href="src/Data-IP-RouteTable-Internal.html#findMatch" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:findMatch">findMatch</a></code> function looks up <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code> with a key of <code><a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a></code>.
If the key matches routing informations in <code><a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a></code>, they are
returned.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>let v4 = ["133.4.0.0/16","133.5.0.0/16","133.5.16.0/24","133.5.23.0/24"] :: [AddrRange IPv4]
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>let rt = fromList $ zip v4 $ repeat ()
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>findMatch "133.4.0.0/15" rt :: [(AddrRange IPv4,())]
</code></strong>[(133.4.0.0/16,()),(133.5.0.0/16,()),(133.5.16.0/24,()),(133.5.23.0/24,())]
</pre></div></div><div class="top"><p class="src"><a name="v:fromList" class="def">fromList</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => [(<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a)] -> <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a <a href="src/Data-IP-RouteTable-Internal.html#fromList" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-IP-RouteTable.html#v:fromList">fromList</a></code> function creates a new IP routing table from
a list of a pair of <code>IPrange</code> and value.</p></div></div><div class="top"><p class="src"><a name="v:toList" class="def">toList</a> :: <a href="Data-IP-RouteTable.html#t:Routable">Routable</a> k => <a href="Data-IP-RouteTable.html#t:IPRTable">IPRTable</a> k a -> [(<a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a> k, a)] <a href="src/Data-IP-RouteTable-Internal.html#toList" class="link">Source</a></p><div class="doc"><p>The <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:toList">toList</a></code> function creates a list of a pair of <code><a href="Data-IP-Internal.html#t:AddrRange">AddrRange</a></code> and
value from an IP routing table.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|