h`N{      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk l m n o p q r s t u v w x y z None I think that this function can be improved. Right now, it always allocates enough space for a fifteen-character text rendering of an IP address. I think that it should be possible to do more of the math upfront and allocate less space.^This does not do an endOfInput check because it is reused in the range parser implementation.This is sort of a misnomer. It takes Word32 to make dotDecimalParser probably perform better. This is mostly for internal use.Given the size of the mask, return the total number of ips in the subnet. This only works for IPv4 addresses because an IPv6 subnet can have up to 2^128 addresses.2  !"#$%&'()*+,-./012  !"#$%&'()*+,-./012  "%'$!&(#)*+,-./012  !"#$%&'()*+,-./01None )07>CLN7ASCII value of the separator9A 48-bit MAC address.=The length should be between 0 and 32. These bounds are inclusive. This expectation is not in any way enforced by this library because it does not cause errors. A mask length greater than 32 will be treated as if it were 32.A#A 32-bit Internet Protocol address.123456789:;<=>?@ABC{|}~23456789:;<=>?@ABCABC=>?@9:;<567823423456789:;<=>?@ABC{|}~NoneD Create an A~ address from four octets. The first argument is the most significant octet. The last argument is the least significant. Since the  and  instances for AN are not generally usefully, this function is the recommened way to create A addresses. For example:fromOctets 192 168 1 1IPv4 {getIPv4 = 3232235777}E Convert an A address into a quadruple of octets. The first element in the quadruple is the most significant octet. The last element is the least significant octet.F&The IP address representing any host: 0.0.0.0GThe loopback IP address:  127.0.0.1HThe broadcast IP address: 255.255.255.255IChecks to see if the AY address belongs to a private network. The three private networks that are checked are  10.0.0.0/8,  172.16.0.0/12, and 192.168.0.0/16.JChecks to see if the AW address belongs to a reserved network. This includes the three private networks that IS checks along with several other ranges that are not used on the public Internet.KChecks to see if the A address is publicly routable.public x == not (reserved x)DEFGHIJKDEFGHIJKDEFGHIJKDEFGHIJKNone LChecks to see if an A address belongs in the =.let ip = fromOctets 10 10 1 92/contains (IPv4Range (fromOctets 10 0 0 0) 8) ipTrue1contains (IPv4Range (fromOctets 10 11 0 0) 16) ipFalse/Typically, element-testing functions are written to take the element as the first argument and the set as the second argument. This is intentionally written the other way for better performance when iterating over a collection. For example, you might test elements in a list for membership like this:,let r = IPv4Range (fromOctets 10 10 10 6) 31JmapM_ (print . contains r) (take 5 $ iterate succ $ fromOctets 10 10 10 5)FalseTrueTrueFalseFalseThe implementation of L ensures that (with GHC), the bitmask creation and range normalization only occur once in the above example. They are reused as the list is iterated.M5This is provided to mirror the interface provided by Data.Set. It behaves just like L but with flipped arguments.member ip r == contains r ipN The inclusive lower bound of an =\. This is conventionally understood to be the broadcast address of a subnet. For example:@I.print $ lowerInclusive $ IPv4Range (fromOctets 10 10 1 160) 25 10.10.1.128*Note that the lower bound of a normalized =( is simply the ip address of the range:/lowerInclusive r == ipv4RangeBase (normalize r)P Convert an = into a list of the A addresses that are in it. >>> let r = IPv4Range (fromOctets 192 168 1 8) 30 >>> mapM_ I.print (toList r) 192.168.1.8 192.168.1.9 192.168.1.10 192.168.1.11R'The RFC1918 24-bit block. Subnet mask:  10.0.0.0/8S'The RFC1918 20-bit block. Subnet mask:  172.16.0.0/12T'The RFC1918 16-bit block. Subnet mask: 192.168.0.0/16U Normalize an =(. The first result of this is that the A inside the =H is changed so that the insignificant bits are zeroed out. For example:<prRange $ normalize $ IPv4Range (fromOctets 192 168 1 19) 24192.168.1.0/24=prRange $ normalize $ IPv4Range (fromOctets 192 168 1 163) 28192.168.1.160/28`The second effect of this is that the mask length is lowered to be 32 or smaller. Working with =s that have not been normalized does not cause any issues for this library, although other applications may reject such ranges (especially those with a mask length above 32). Note that U is idempotent, that is:(normalize r == (normalize . normalize) rV-This only exists for doctests. Do not use it. LMNOPQRSTUV LMNOPQRSTUV ULMNOPQRSTV LMNOPQRSTUVNone\(This exists mostly for testing purposes.WXYZ[\WXYZ[\WYXZ[\WXYZ[\Nonec(This exists mostly for testing purposes.]^_`abc]^_`abc]_^`abc]^_`abcNonedefdefdefdefNoneg'This should be rewritten to not create Text as an intermediate step.hThis should also be rewrittenghijghijghijghij None0Cklklklkl None mnopqrstu mnopqrstu mupqonrst mnopqrstu Nonev>This is a mediocre implementation that should be rewritten.w>This is a mediocre implementation that should be rewritten.x!Make a bytestring builder from a 9+ address using a colon as the separator.y Parser for a 96 address using with a colon as the separator (i.e. FA:43:B2:C0:0F:99).z Parser for a 9+ address using to the provided settings.vwxyzvwxyzvwxyzvwxyz   !"#$%&'()*+,-./0123456789:;<=>>?@@ABCCDEFFGHIIJKLMNOPQRSTUVWXYZ[\]^_`abc^_`adbc^`_^`ab K e ^ f _ ` g a b h i ^ ` a b hjklmnopqrstuvwxyz{|}~q:; ip_9c0zceSbQAUBsyo9uXLIn0 Net.Internal Net.TypesNet.IPv4Net.IPv4.RangeNet.IPv4.Range.Text Net.IPv4.TextNet.IPv4.StringNet.IPv4.ByteString.Char8Net.Mac Net.Mac.TextNet.Mac.ByteString.Char8eitherToAesonParserattoparsecParseJSON stripDecimaldecodeIPv4TextReaderdecodeIPv4TextEitheripOctetSizeErrorMsg rightToMaybetoDotDecimalTexttoDotDecimalBuilderrangeToDotDecimalTextrangeToDotDecimalBuildertoTextPreAllocated putAndCountputMacmacToTextPreAllocatedzeroi2wfromDotDecimalText'fromDotDecimalTextrangeFromDotDecimalText'rangeFromDotDecimalTextdotDecimalRangeParserdotDecimalParser fromOctets' countAddrswordSuccessorswordSuccessorsMmaskp24p20p16mask4mask8mask10mask12mask15mask16mask20mask24mask28mask32 macTextParser macToTextmacToTextBuilder macFromText macFromText' twoDigits threeDigits twoHexDigitstwoHexDigitsLower MacDecodingmacDecodingSeparator MacEncodingmacEncodingSeparatormacEncodingUpperCaseMacmacAmacB IPv4Range ipv4RangeBaseipv4RangeLengthIPv4getIPv4 fromOctetstoOctetsanyloopback broadcastprivatereservedpubliccontainsmemberlowerInclusiveupperInclusivetoList toGenerator private24 private20 private16 normalizeprRangeencode decodeEitherdecodebuilderparserprintreaderfromOctetsNoCastdecodeEitherWith decodeWith parserWith encodeWithV_MacMV_Mac V_IPv4Range MV_IPv4RangeV_IPv4MV_IPv4macFromOctets' mkIPv4Range$fVectorVectorMac$fMVectorMVectorMac $fUnboxMacTFCo:R:VectorMacTFCo:R:MVectorsMac$fVectorVectorIPv4Range$fMVectorMVectorIPv4Range$fUnboxIPv4RangeTFCo:R:VectorIPv4RangeTFCo:R:MVectorsIPv4Range$fVectorVectorIPv4$fMVectorMVectorIPv4 $fUnboxIPv4TFCo:R:VectorIPv4TFCo:R:MVectorsIPv4$fFromJSONIPv4Range$fToJSONIPv4Range$fFromJSONIPv4 $fToJSONIPv4$fHashableIPv4Range $fFromJSONMac $fToJSONMac $fHashableMacbaseGHC.ShowShowGHC.ReadReadtoBSPreAllocated defDecodingw8ToChar parseTwoHex parseWord8Hex