ip-1.0.0: Library for IP and MAC addresses

Safe HaskellNone
LanguageHaskell2010

Net.Mac

Contents

Synopsis

Convert

Textual Conversion

Text

UTF-8 ByteString

decodeUtf8 :: ByteString -> Maybe Mac Source #

Lenient decoding of MAC address that accepts lowercase, uppercase, and any kind separator.

builderUtf8 :: Mac -> Builder Source #

Make a bytestring builder from a Mac address using a colon as the separator.

parserUtf8 :: Parser Mac Source #

Parser for a Mac address using with a colon as the separator (i.e. FA:43:B2:C0:0F:99).

parserWithUtf8 :: MacCodec -> Parser Mac Source #

Parser for a Mac address using the provided settings.

Types

newtype Mac Source #

A 48-bit MAC address. Do not use the data constructor for this type. It is not considered part of the stable API, and it allows you to construct invalid MAC addresses.

Constructors

Mac 

Fields

Instances

data MacGrouping Source #

The format expected by the mac address parser. The Word8 taken by some of these constructors is the ascii value of the character to be used as the separator. This is typically a colon, a hyphen, or a space character. All decoding functions are case insensitive.

Constructors

MacGroupingPairs !Char

Two-character groups, FA:2B:40:09:8C:11

MacGroupingTriples !Char

Three-character groups, 24B-F0A-025-829

MacGroupingQuadruples !Char

Four-character groups, A220.0745.CAC7

MacGroupingNoSeparator

No separator, 24AF4B5B0780

Instances

Eq MacGrouping Source # 
Ord MacGrouping Source # 
Read MacGrouping Source # 
Show MacGrouping Source # 
Generic MacGrouping Source # 

Associated Types

type Rep MacGrouping :: * -> * #

type Rep MacGrouping Source # 
type Rep MacGrouping = D1 (MetaData "MacGrouping" "Net.Mac" "ip-1.0.0-BvwF1jq0xxp8gUnemprXVK" False) ((:+:) ((:+:) (C1 (MetaCons "MacGroupingPairs" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Char))) (C1 (MetaCons "MacGroupingTriples" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Char)))) ((:+:) (C1 (MetaCons "MacGroupingQuadruples" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Char))) (C1 (MetaCons "MacGroupingNoSeparator" PrefixI False) U1)))