Copyright | (c) Formaltech Inc. 2017 |
---|---|
License | BSD3 |
Maintainer | protob3n@gmail.com |
Stability | experimental |
Portability | Linux |
Safe Haskell | None |
Language | Haskell2010 |
System.Linux.RTNetlink.Address
Contents
Description
Synopsis
- data IfInetAddress = IfInetAddress {}
- data IfInet6Address = IfInet6Address {}
- newtype IfIndex = IfIndex {}
- newtype IfPrefix = IfPrefix Word8
- data IfScope
- newtype IfLabel = IfLabel ByteString
- data Precedence
- data DuplicateAddressDetection
- data DuplicateAddressDetectionFlags = DuplicateAddressDetectionFlags {
- dadOptimistic :: Bool
- dadTentative :: Bool
- dadFailed :: Bool
- data Mip6Homing
- data Preference
- data Permanence
- data PrefixRoute
- data MulticastAutoJoin
- data IfSeconds
- data IfLifetime = IfLifetime {}
- data AnyInterface = AnyInterface
- data IfAddrMsg = IfAddrMsg {
- addrFamily :: Word8
- addrPrefix :: Word8
- addrFlags :: Word8
- addrScope :: Word8
- addrIndex :: Word32
- data InetAddress
- inetAddressFromTuple :: (Word8, Word8, Word8, Word8) -> InetAddress
- inetAddressToTuple :: InetAddress -> (Word8, Word8, Word8, Word8)
- data Inet6Address
- inet6AddressFromTuple :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> Inet6Address
- inet6AddressToTuple :: Inet6Address -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16)
Documentation
data IfInetAddress Source #
An ipv4 address and netmask associated with an interface.
Constructors
IfInetAddress | |
Fields
|
Instances
data IfInet6Address Source #
An ipv6 address and netmask associated with an interface.
Constructors
IfInet6Address | |
Fields
|
Instances
The index of a layer-3 interface.
Instances
Enum IfIndex Source # | |
Eq IfIndex Source # | |
Integral IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address | |
Num IfIndex Source # | |
Ord IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address | |
Real IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address Methods toRational :: IfIndex -> Rational # | |
Show IfIndex Source # | |
Reply IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader IfIndex :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader IfIndex) -> Maybe IfIndex Source # | |
Message IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type MessageHeader IfIndex :: Type Source # Methods messageHeaderParts :: IfIndex -> [HeaderPart (MessageHeader IfIndex)] Source # messageAttrs :: IfIndex -> AttributeList Source # | |
type ReplyHeader IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address | |
type MessageHeader IfIndex Source # | |
Defined in System.Linux.RTNetlink.Address |
A netmask in CIDR notation.
Instances
Constructors
IfUniverse | Destination located anywhere (default). |
IfUserScope Word8 | User-defined scope; 0, 200, and 253-5 are reserved. |
IfSite | IPv6 address valid inside this site. Deprecated. |
IfLink | Destination on attached link. |
IfHost | Local address. |
IfNowhere | Destination doesn't exist. |
Instances
Eq IfScope Source # | |
Show IfScope Source # | |
Reply IfScope Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader IfScope :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader IfScope) -> Maybe IfScope Source # | |
Message IfScope Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type MessageHeader IfScope :: Type Source # Methods messageHeaderParts :: IfScope -> [HeaderPart (MessageHeader IfScope)] Source # messageAttrs :: IfScope -> AttributeList Source # | |
(Create c, MessageHeader c ~ IfAddrMsg) => Create (c, IfScope) Source # | |
Defined in System.Linux.RTNetlink.Address | |
(Create c, MessageHeader c ~ IfAddrMsg) => Create (IfScope, c) Source # | |
Defined in System.Linux.RTNetlink.Address | |
type ReplyHeader IfScope Source # | |
Defined in System.Linux.RTNetlink.Address | |
type MessageHeader IfScope Source # | |
Defined in System.Linux.RTNetlink.Address |
A textual label applied to an IPv4 address. Defaults to the LinkName
of
the parent link. Note that this is ignored/absent for IPv6 addresses.
Constructors
IfLabel ByteString |
Instances
Eq IfLabel Source # | |
Show IfLabel Source # | |
IsString IfLabel Source # | |
Defined in System.Linux.RTNetlink.Address Methods fromString :: String -> IfLabel # | |
Reply IfLabel Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader IfLabel :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader IfLabel) -> Maybe IfLabel Source # | |
Message IfLabel Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type MessageHeader IfLabel :: Type Source # Methods messageHeaderParts :: IfLabel -> [HeaderPart (MessageHeader IfLabel)] Source # messageAttrs :: IfLabel -> AttributeList Source # | |
(Create c, MessageHeader c ~ IfAddrMsg) => Create (c, IfLabel) Source # | |
Defined in System.Linux.RTNetlink.Address | |
(Create c, MessageHeader c ~ IfAddrMsg) => Create (IfLabel, c) Source # | |
Defined in System.Linux.RTNetlink.Address | |
type ReplyHeader IfLabel Source # | |
Defined in System.Linux.RTNetlink.Address | |
type MessageHeader IfLabel Source # | |
Defined in System.Linux.RTNetlink.Address |
data Precedence Source #
Precedence for address on its link. The first address created on a subnet
is Primary
, and each subsequent one is Secondary
. (This is similar to an
"alias" address in ifconfig
.) By default, linux has the (maybe
counterintuitive) behavior that, when the primary address on a subnet is
deleted, all secondary interfaces are deleted as well. To change this
behavior, you can set net.ipv{4|6}.conf.dev.promote_secondaries = 1
in
sysctl
.
Instances
Eq Precedence Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show Precedence Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> Precedence -> ShowS # show :: Precedence -> String # showList :: [Precedence] -> ShowS # | |
Reply Precedence Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader Precedence :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader Precedence) -> Maybe Precedence Source # | |
type ReplyHeader Precedence Source # | |
Defined in System.Linux.RTNetlink.Address |
data DuplicateAddressDetection Source #
Whether this IPv6 address should send duplicate address detection packets
(see RFC2462). Default is DadEnabled
. This flag only makes sense for IPv6
addresses, but the kernel is perfectly happy to let you set it on IPv4 ones,
with no effect.
Constructors
DadEnabled | |
DadDisabled |
Instances
data DuplicateAddressDetectionFlags Source #
Flags for IPv6 duplicate address detection. See RFC4862.
Constructors
DuplicateAddressDetectionFlags | |
Fields
|
Instances
Eq DuplicateAddressDetectionFlags Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show DuplicateAddressDetectionFlags Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> DuplicateAddressDetectionFlags -> ShowS # show :: DuplicateAddressDetectionFlags -> String # showList :: [DuplicateAddressDetectionFlags] -> ShowS # | |
Reply DuplicateAddressDetectionFlags Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader DuplicateAddressDetectionFlags :: Type Source # | |
type ReplyHeader DuplicateAddressDetectionFlags Source # | |
Defined in System.Linux.RTNetlink.Address |
data Mip6Homing Source #
Home address for IPv6. Used in Mobility for IPv6 (MIP6), which allows a device to use its home address on mobile networks. See RFC6275.
Instances
Eq Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> Mip6Homing -> ShowS # show :: Mip6Homing -> String # showList :: [Mip6Homing] -> ShowS # | |
Reply Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader Mip6Homing :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader Mip6Homing) -> Maybe Mip6Homing Source # | |
Message Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type MessageHeader Mip6Homing :: Type Source # Methods messageHeaderParts :: Mip6Homing -> [HeaderPart (MessageHeader Mip6Homing)] Source # | |
type ReplyHeader Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address | |
type MessageHeader Mip6Homing Source # | |
Defined in System.Linux.RTNetlink.Address |
data Preference Source #
Indicates an address that is past its preferred lifetime. A deprecated address will be dis-preferred for source address selection.
Constructors
Prefered | |
Deprecated |
Instances
Eq Preference Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show Preference Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> Preference -> ShowS # show :: Preference -> String # showList :: [Preference] -> ShowS # | |
Reply Preference Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader Preference :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader Preference) -> Maybe Preference Source # | |
type ReplyHeader Preference Source # | |
Defined in System.Linux.RTNetlink.Address |
data Permanence Source #
A Permanent
IPv6 address is one that was explicitly created. A Dynamic
address is one that was auto-generated, e.g. by SLAAC.
Instances
Eq Permanence Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show Permanence Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> Permanence -> ShowS # show :: Permanence -> String # showList :: [Permanence] -> ShowS # | |
Reply Permanence Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type ReplyHeader Permanence :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader Permanence) -> Maybe Permanence Source # | |
type ReplyHeader Permanence Source # | |
Defined in System.Linux.RTNetlink.Address |
data PrefixRoute Source #
Whether to automatically add a route based on the prefix when the address is added.
Constructors
PREnabled | |
PRDisabled |
Instances
data MulticastAutoJoin Source #
Enable joining multicast groups when connected to a switch that does IGMP snooping. Only sensible on multicast addresses.
Constructors
AutoJoin | |
NoAutoJoin |
Instances
Instances
Eq IfSeconds Source # | |
Ord IfSeconds Source # | |
Show IfSeconds Source # | |
Serialize IfSeconds Source # | |
data IfLifetime Source #
The lifetime of this address. The address will be in a Prefered
state for
ifPrefered
seconds, after which it will be Deprecated
. After ifValid
seconds, the address will be removed.
Constructors
IfLifetime | |
Fields
|
Instances
data AnyInterface Source #
Interface wildcard. Use this to get information about all layer-3 interfaces.
Constructors
AnyInterface |
Instances
Eq AnyInterface Source # | |
Defined in System.Linux.RTNetlink.Address | |
Show AnyInterface Source # | |
Defined in System.Linux.RTNetlink.Address Methods showsPrec :: Int -> AnyInterface -> ShowS # show :: AnyInterface -> String # showList :: [AnyInterface] -> ShowS # | |
Request AnyInterface Source # | |
Defined in System.Linux.RTNetlink.Address Methods requestNLFlags :: AnyInterface -> ChangeFlags NLFlags Source # | |
Message AnyInterface Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type MessageHeader AnyInterface :: Type Source # Methods messageHeaderParts :: AnyInterface -> [HeaderPart (MessageHeader AnyInterface)] Source # | |
type MessageHeader AnyInterface Source # | |
Defined in System.Linux.RTNetlink.Address |
The header corresponding to address messages, based on 'struct ifaddrmsg' from 'linux/if_addr.h'.
Constructors
IfAddrMsg | |
Fields
|
Instances
Eq IfAddrMsg Source # | |
Show IfAddrMsg Source # | |
Serialize IfAddrMsg Source # | |
Sized IfAddrMsg Source # | |
ReplyMessageHeader IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address Methods replyTypeNumbers :: IfAddrMsg -> [TypeNumber] Source # | |
RequestMessageHeader IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address Methods | |
DestroyMessageHeader IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address Methods | |
CreateMessageHeader IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address Methods | |
Header IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address Associated Types type HeaderPart IfAddrMsg :: Type Source # Methods fromHeaderParts :: [HeaderPart IfAddrMsg] -> IfAddrMsg Source # | |
type HeaderPart IfAddrMsg Source # | |
Defined in System.Linux.RTNetlink.Address |
Re-exports
data InetAddress #
To avoid errors with endianess it was decided to keep this type abstract.
Use inetAddressFromTuple
and inetAddressToTuple
for constructing and
deconstructing custom addresses.
Hint: Use the Storable
instance.
It exposes it exactly as found within an IP packet (big endian if you insist
on interpreting it as a number).
Another hint: Use getAddressInfo
for parsing and suppress
nameserver lookups:
> getAddressInfo (Just "127.0.0.1") Nothing aiNumericHost :: IO [AddressInfo Inet Stream TCP] [AddressInfo {addressInfoFlags = AddressInfoFlags 4, socketAddress = SocketAddressInet {inetAddress = InetAddress 127.0.0.1, inetPort = InetPort 0}, canonicalName = Nothing}]
Instances
inetAddressFromTuple :: (Word8, Word8, Word8, Word8) -> InetAddress #
Constructs a custom InetAddress
.
inetAddressFromTuple (127,0,0,1) == inetLoopback
inetAddressToTuple :: InetAddress -> (Word8, Word8, Word8, Word8) #
Deconstructs an InetAddress
.
data Inet6Address #
To avoid errors with endianess it was decided to keep this type abstract.
Use inet6AddressFromTuple
and inet6AddressToTuple
for constructing and
deconstructing custom addresses.
Hint: Use the Storable
instance. It exposes it
exactly as found within an IP packet (big endian if you insist
on interpreting it as a number).
Another hint: Use getAddressInfo
for parsing and suppress
nameserver lookups:
> getAddressInfo (Just "::1") Nothing aiNumericHost :: IO [AddressInfo SocketAddressInet6 Stream TCP] [AddressInfo { addressInfoFlags = AddressInfoFlags 4, socketAddress = SocketAddressInet6 {inet6Address = Inet6Address 0000:0000:0000:0000:0000:0000:0000:0001, inet6Port = Inet6Port 0, inet6FlowInfo = Inet6FlowInfo 0, inet6ScopeId = Inet6ScopeId 0}, canonicalName = Nothing }]
Instances
inet6AddressFromTuple :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> Inet6Address #
Constructs a custom Inet6Address
.
inet6AddressFromTuple (0,0,0,0,0,0,0,1) == inet6Loopback
inet6AddressToTuple :: Inet6Address -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) #
Deconstructs an Inet6Address
.
Orphan instances
Reply Inet6Address Source # | |
Associated Types type ReplyHeader Inet6Address :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader Inet6Address) -> Maybe Inet6Address Source # | |
Reply InetAddress Source # | |
Associated Types type ReplyHeader InetAddress :: Type Source # Methods fromNLMessage :: NLMessage (ReplyHeader InetAddress) -> Maybe InetAddress Source # | |
Message Inet6Address Source # | |
Associated Types type MessageHeader Inet6Address :: Type Source # Methods messageHeaderParts :: Inet6Address -> [HeaderPart (MessageHeader Inet6Address)] Source # | |
Message InetAddress Source # | |
Associated Types type MessageHeader InetAddress :: Type Source # Methods messageHeaderParts :: InetAddress -> [HeaderPart (MessageHeader InetAddress)] Source # |