rtnetlink-0.1.0.3: Manipulate network devices, addresses, and routes on Linux

Copyright(c) Formaltech Inc. 2017
LicenseBSD3
Maintainerprotob3n@gmail.com
Stabilityexperimental
PortabilityLinux
Safe HaskellNone
LanguageHaskell2010

System.Linux.RTNetlink.Packet

Contents

Description

 

Synopsis

Low-level headers

data NLMsgHdr Source #

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 NLMsgHdrs.

Attributes

data Attribute Source #

ADT representing a possibly nested netlink attribute.

Constructors

Attribute AttributeType ByteString

Simple attribute.

AttributeNest AttributeType [Attribute]

Nested attribute.

type AttributeType = Word16 Source #

Type identifier for 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

class Sized s where Source #

Typeclass for data with a defined size. This lets us get sizes to use for constructing headers.

Minimal complete definition

size

Methods

size :: Integral i => s -> i Source #

Size of data.

sizeAligned :: Integral a => a -> s -> a Source #

Size of data with alignment padding added.

Instances

Sized () Source # 

Methods

size :: Integral i => () -> i Source #

sizeAligned :: Integral a => a -> () -> a Source #

Sized ByteString Source # 

Methods

size :: Integral i => ByteString -> i Source #

sizeAligned :: Integral a => a -> ByteString -> a Source #

Sized AttributeList Source # 
Sized Attribute Source # 

Methods

size :: Integral i => Attribute -> i Source #

sizeAligned :: Integral a => a -> Attribute -> a Source #

Sized NLMsgHdr Source # 

Methods

size :: Integral i => NLMsgHdr -> i Source #

sizeAligned :: Integral a => a -> NLMsgHdr -> a Source #

Sized NLMsgErr Source # 

Methods

size :: Integral i => NLMsgErr -> i Source #

sizeAligned :: Integral a => a -> NLMsgErr -> a Source #

Sized IfAddrMsg Source # 

Methods

size :: Integral i => IfAddrMsg -> i Source #

sizeAligned :: Integral a => a -> IfAddrMsg -> a Source #

Sized IfInfoMsg Source # 

Methods

size :: Integral i => IfInfoMsg -> i Source #

sizeAligned :: Integral a => a -> IfInfoMsg -> a Source #

Sized header => Sized (NLMessage header) Source # 

Methods

size :: Integral i => NLMessage header -> i Source #

sizeAligned :: Integral a => a -> NLMessage header -> a Source #

putAligned :: Integral a => a -> Putter ByteString Source #

Pad a ByteString to a given alignment.