/usr/share/doc/libghc-iproute-doc/html/src/Data-IP-Mask.html is in libghc-iproute-doc 1.2.11-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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>Data/IP/Mask.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>IP</span><span class='hs-varop'>.</span><span class='hs-conid'>Mask</span> <span class='hs-keyword'>where</span>
<a name="line-2"></a>
<a name="line-3"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Bits</span>
<a name="line-4"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>IP</span><span class='hs-varop'>.</span><span class='hs-conid'>Addr</span>
<a name="line-5"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span>
<a name="line-6"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>IntMap</span> <span class='hs-varid'>hiding</span> <span class='hs-layout'>(</span><span class='hs-varid'>map</span><span class='hs-layout'>)</span>
<a name="line-7"></a>
<a name="line-8"></a><span class='hs-comment'>----------------------------------------------------------------</span>
<a name="line-9"></a>
<a name="line-10"></a><a name="maskIPv4"></a><span class='hs-definition'>maskIPv4</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Int</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IPv4</span>
<a name="line-11"></a><span class='hs-definition'>maskIPv4</span> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>IP4</span> <span class='hs-layout'>(</span><span class='hs-varid'>masksIPv4</span> <span class='hs-varop'>!</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-12"></a>
<a name="line-13"></a><a name="maskIPv6"></a><span class='hs-definition'>maskIPv6</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Int</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IPv6</span>
<a name="line-14"></a><span class='hs-definition'>maskIPv6</span> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>IP6</span> <span class='hs-layout'>(</span><span class='hs-varid'>masksIPv6</span> <span class='hs-varop'>!</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-15"></a>
<a name="line-16"></a><a name="masksWord32"></a><span class='hs-definition'>masksWord32</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word32</span><span class='hs-keyglyph'>]</span>
<a name="line-17"></a><span class='hs-definition'>masksWord32</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>take</span> <span class='hs-num'>33</span> <span class='hs-varop'>$</span> <span class='hs-varid'>iterate</span> <span class='hs-layout'>(</span><span class='hs-varop'>`shift`</span> <span class='hs-num'>1</span><span class='hs-layout'>)</span> <span class='hs-num'>0xffffffff</span>
<a name="line-18"></a>
<a name="line-19"></a><a name="masksIPv4"></a><span class='hs-definition'>masksIPv4</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IntMap</span> <span class='hs-conid'>IPv4Addr</span>
<a name="line-20"></a><span class='hs-definition'>masksIPv4</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromList</span> <span class='hs-varop'>$</span> <span class='hs-varid'>zip</span> <span class='hs-keyglyph'>[</span><span class='hs-num'>32</span><span class='hs-layout'>,</span><span class='hs-num'>31</span><span class='hs-keyglyph'>..</span><span class='hs-num'>0</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>masksWord32</span>
<a name="line-21"></a>
<a name="line-22"></a><a name="masksIPv6"></a><span class='hs-definition'>masksIPv6</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IntMap</span> <span class='hs-conid'>IPv6Addr</span>
<a name="line-23"></a><span class='hs-definition'>masksIPv6</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fromList</span> <span class='hs-varop'>$</span> <span class='hs-varid'>zip</span> <span class='hs-keyglyph'>[</span><span class='hs-num'>128</span><span class='hs-layout'>,</span><span class='hs-num'>127</span><span class='hs-keyglyph'>..</span><span class='hs-num'>0</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>ms</span>
<a name="line-24"></a> <span class='hs-keyword'>where</span>
<a name="line-25"></a> <span class='hs-varid'>ms</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>m0</span> <span class='hs-varop'>++</span> <span class='hs-varid'>m1</span> <span class='hs-varop'>++</span> <span class='hs-varid'>m2</span> <span class='hs-varop'>++</span> <span class='hs-varid'>m3</span> <span class='hs-varop'>++</span> <span class='hs-varid'>m4</span>
<a name="line-26"></a> <span class='hs-varid'>m0</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span>
<a name="line-27"></a> <span class='hs-varid'>m1</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>vmsk</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>vmsk</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>masks</span>
<a name="line-28"></a> <span class='hs-varid'>m2</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>vmsk</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>vmsk</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>masks</span>
<a name="line-29"></a> <span class='hs-varid'>m3</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>vmsk</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>all1</span><span class='hs-layout'>,</span><span class='hs-varid'>vmsk</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>masks</span>
<a name="line-30"></a> <span class='hs-varid'>m4</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>map</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>vmsk</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>vmsk</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>,</span><span class='hs-varid'>all0</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>masks</span>
<a name="line-31"></a> <span class='hs-varid'>masks</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>tail</span> <span class='hs-varid'>masksWord32</span>
<a name="line-32"></a> <span class='hs-varid'>all1</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>0xffffffff</span>
<a name="line-33"></a> <span class='hs-varid'>all0</span> <span class='hs-keyglyph'>=</span> <span class='hs-num'>0x00000000</span>
</pre></body>
</html>
|