Copyright | (c) Formaltech Inc. 2017 |
---|---|
License | BSD3 |
Maintainer | [email protected] |
Stability | experimental |
Portability | Linux |
Safe Haskell | None |
Language | Haskell2010 |
System.Linux.RTNetlink.Packet
Description
- data NLMsgHdr = NLMsgHdr {
- nlMsgLength :: Word32
- nlMsgType :: Word16
- nlMsgFlags :: Word16
- nlMsgSeqNum :: Word32
- nlMsgPid :: Word32
- nlMsgHdrIsError :: ByteString -> Bool
- splitMessages :: ByteString -> [ByteString]
- data Attribute
- newtype AttributeList = AttributeList [Attribute]
- type AttributeType = Word16
- attributeType :: Attribute -> AttributeType
- attributeData :: Attribute -> Maybe ByteString
- findAttribute :: [AttributeType] -> AttributeList -> Maybe Attribute
- cStringAttr :: AttributeType -> ByteString -> Attribute
- word32Attr :: AttributeType -> Word32 -> Attribute
- word16Attr :: AttributeType -> Word16 -> Attribute
- class Sized s where
- putAligned :: Integral a => a -> Putter ByteString
Low-level headers
ADT corresponding to struct nlmsghdr
from linux/netlink.h
.
Constructors
NLMsgHdr | |
Fields
|
nlMsgHdrIsError :: ByteString -> Bool Source #
Return True
iff the message is an error, assuming the provided
ByteString
is headed by an NLMsgHdr
.
splitMessages :: ByteString -> [ByteString] Source #
Split a ByteString into multiple messages using their NLMsgHdr
s.
Attributes
ADT representing a possibly nested netlink attribute.
Constructors
Attribute AttributeType ByteString | Simple attribute. |
AttributeNest AttributeType [Attribute] | Nested attribute. |
newtype AttributeList Source #
A collection of netlink attributes.
Constructors
AttributeList [Attribute] |
type AttributeType = Word16 Source #
Type identifier for an Attribute
.
attributeType :: Attribute -> AttributeType Source #
Get the type of an Attribute
.
attributeData :: Attribute -> Maybe ByteString Source #
Get the data from a simple Attribute
.
findAttribute :: [AttributeType] -> AttributeList -> Maybe Attribute Source #
Search for an Attribute
in a possibly nested list using the
AttributeType
to look for at each level.
cStringAttr :: AttributeType -> ByteString -> Attribute Source #
Construct an Attribute
with a null-byte-terminated string as data.
word32Attr :: AttributeType -> Word32 -> Attribute Source #
Construct an Attribute
with a 32-bit word as data.
word16Attr :: AttributeType -> Word16 -> Attribute Source #
Construct an Attribute
with a 16-bit word as data.
Sized data
Typeclass for data with a defined size. This lets us get sizes to use for constructing headers.
Minimal complete definition
putAligned :: Integral a => a -> Putter ByteString Source #
Pad a ByteString
to a given alignment.