Copyright | (c) Dustin Sallings 2019 |
---|---|
License | BSD3 |
Maintainer | dustin@spy.net |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
MQTT Types.
Synopsis
- data LastWill = LastWill {
- _willRetain :: Bool
- _willQoS :: QoS
- _willTopic :: ByteString
- _willMsg :: ByteString
- _willProps :: [Property]
- data MQTTPkt
- = ConnPkt ConnectRequest
- | ConnACKPkt ConnACKFlags
- | PublishPkt PublishRequest
- | PubACKPkt PubACK
- | PubRECPkt PubREC
- | PubRELPkt PubREL
- | PubCOMPPkt PubCOMP
- | SubscribePkt SubscribeRequest
- | SubACKPkt SubscribeResponse
- | UnsubscribePkt UnsubscribeRequest
- | UnsubACKPkt UnsubscribeResponse
- | PingPkt
- | PongPkt
- | DisconnectPkt DisconnectRequest
- | AuthPkt AuthRequest
- data QoS
- data ConnectRequest = ConnectRequest {}
- connectRequest :: ConnectRequest
- data ConnACKFlags = ConnACKFlags Bool ConnACKRC [Property]
- data ConnACKRC
- = ConnAccepted
- | UnacceptableProtocol
- | IdentifierRejected
- | ServerUnavailable
- | BadCredentials
- | NotAuthorized
- | ConnUnspecifiedError
- | ConnMalformedPacket
- | ConnProtocolError
- | ConnImplementationSpecificError
- | ConnUnsupportedProtocolVersion
- | ConnClientIdentifierNotValid
- | ConnBadUserNameOrPassword
- | ConnNotAuthorized
- | ConnServerUnavailable
- | ConnServerBusy
- | ConnBanned
- | ConnBadAuthenticationMethod
- | ConnTopicNameInvalid
- | ConnPacketTooLarge
- | ConnQuotaExceeded
- | ConnPayloadFormatInvalid
- | ConnRetainNotSupported
- | ConnQosNotSupported
- | ConnUseAnotherServer
- | ConnServerMoved
- | ConnConnectionRateExceeded
- data PublishRequest = PublishRequest {
- _pubDup :: Bool
- _pubQoS :: QoS
- _pubRetain :: Bool
- _pubTopic :: ByteString
- _pubPktID :: Word16
- _pubBody :: ByteString
- _pubProps :: [Property]
- data PubACK = PubACK Word16 Word8 [Property]
- data PubREC = PubREC Word16 Word8 [Property]
- data PubREL = PubREL Word16 Word8 [Property]
- data PubCOMP = PubCOMP Word16 Word8 [Property]
- data ProtocolLevel
- data Property
- = PropPayloadFormatIndicator Word8
- | PropMessageExpiryInterval Word32
- | PropContentType ByteString
- | PropResponseTopic ByteString
- | PropCorrelationData ByteString
- | PropSubscriptionIdentifier Int
- | PropSessionExpiryInterval Word32
- | PropAssignedClientIdentifier ByteString
- | PropServerKeepAlive Word16
- | PropAuthenticationMethod ByteString
- | PropAuthenticationData ByteString
- | PropRequestProblemInformation Word8
- | PropWillDelayInterval Word32
- | PropRequestResponseInformation Word8
- | PropResponseInformation ByteString
- | PropServerReference ByteString
- | PropReasonString ByteString
- | PropReceiveMaximum Word16
- | PropTopicAliasMaximum Word16
- | PropTopicAlias Word16
- | PropMaximumQoS Word8
- | PropRetainAvailable Word8
- | PropUserProperty ByteString ByteString
- | PropMaximumPacketSize Word32
- | PropWildcardSubscriptionAvailable Word8
- | PropSubscriptionIdentifierAvailable Word8
- | PropSharedSubscriptionAvailable Word8
- data AuthRequest = AuthRequest Word8 [Property]
- data SubscribeRequest = SubscribeRequest Word16 [(ByteString, SubOptions)] [Property]
- data SubOptions = SubOptions {}
- subOptions :: SubOptions
- data SubscribeResponse = SubscribeResponse Word16 [Either SubErr QoS] [Property]
- data SubErr
- data RetainHandling
- data DisconnectRequest = DisconnectRequest DiscoReason [Property]
- data UnsubscribeRequest = UnsubscribeRequest Word16 [ByteString] [Property]
- data UnsubscribeResponse = UnsubscribeResponse Word16 [Property] [UnsubStatus]
- data UnsubStatus
- data DiscoReason
- = DiscoNormalDisconnection
- | DiscoDisconnectWithWill
- | DiscoUnspecifiedError
- | DiscoMalformedPacket
- | DiscoProtocolError
- | DiscoImplementationSpecificError
- | DiscoNotAuthorized
- | DiscoServerBusy
- | DiscoServershuttingDown
- | DiscoKeepAliveTimeout
- | DiscoSessiontakenOver
- | DiscoTopicFilterInvalid
- | DiscoTopicNameInvalid
- | DiscoReceiveMaximumExceeded
- | DiscoTopicAliasInvalid
- | DiscoPacketTooLarge
- | DiscoMessageRateTooHigh
- | DiscoQuotaExceeded
- | DiscoAdministrativeAction
- | DiscoPayloadFormatInvalid
- | DiscoRetainNotSupported
- | DiscoQoSNotSupported
- | DiscoUseAnotherServer
- | DiscoServerMoved
- | DiscoSharedSubscriptionsNotSupported
- | DiscoConnectionRateExceeded
- | DiscoMaximumConnectTime
- | DiscoSubscriptionIdentifiersNotSupported
- | DiscoWildcardSubscriptionsNotSupported
- parsePacket :: ProtocolLevel -> Parser MQTTPkt
- class ByteMe a where
- toByteString :: ProtocolLevel -> a -> ByteString
- encodeLength :: Int -> [Word8]
- parseHdrLen :: Parser Int
- parseProperty :: Parser Property
- parseProperties :: ProtocolLevel -> Parser [Property]
- bsProps :: ProtocolLevel -> [Property] -> ByteString
- parseSubOptions :: Parser SubOptions
- class ByteSize a where
Documentation
An MQTT Will message.
LastWill | |
|
QoS values for publishing and subscribing.
data ConnectRequest Source #
ConnectRequest | |
|
Instances
Eq ConnectRequest Source # | |
Defined in Network.MQTT.Types (==) :: ConnectRequest -> ConnectRequest -> Bool # (/=) :: ConnectRequest -> ConnectRequest -> Bool # | |
Show ConnectRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> ConnectRequest -> ShowS # show :: ConnectRequest -> String # showList :: [ConnectRequest] -> ShowS # | |
Arbitrary ConnectRequest Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen ConnectRequest # shrink :: ConnectRequest -> [ConnectRequest] # | |
ByteMe ConnectRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> ConnectRequest -> [Word8] toByteString :: ProtocolLevel -> ConnectRequest -> ByteString Source # |
data ConnACKFlags Source #
Instances
Eq ConnACKFlags Source # | |
Defined in Network.MQTT.Types (==) :: ConnACKFlags -> ConnACKFlags -> Bool # (/=) :: ConnACKFlags -> ConnACKFlags -> Bool # | |
Show ConnACKFlags Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> ConnACKFlags -> ShowS # show :: ConnACKFlags -> String # showList :: [ConnACKFlags] -> ShowS # | |
Arbitrary ConnACKFlags Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen ConnACKFlags # shrink :: ConnACKFlags -> [ConnACKFlags] # | |
ByteMe ConnACKFlags Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> ConnACKFlags -> [Word8] toByteString :: ProtocolLevel -> ConnACKFlags -> ByteString Source # |
Instances
Bounded ConnACKRC Source # | |
Enum ConnACKRC Source # | |
Defined in Network.MQTT.Types succ :: ConnACKRC -> ConnACKRC # pred :: ConnACKRC -> ConnACKRC # fromEnum :: ConnACKRC -> Int # enumFrom :: ConnACKRC -> [ConnACKRC] # enumFromThen :: ConnACKRC -> ConnACKRC -> [ConnACKRC] # enumFromTo :: ConnACKRC -> ConnACKRC -> [ConnACKRC] # enumFromThenTo :: ConnACKRC -> ConnACKRC -> ConnACKRC -> [ConnACKRC] # | |
Eq ConnACKRC Source # | |
Show ConnACKRC Source # | |
Arbitrary ConnACKRC Source # | |
ByteSize ConnACKRC Source # | |
data PublishRequest Source #
PublishRequest | |
|
Instances
Eq PublishRequest Source # | |
Defined in Network.MQTT.Types (==) :: PublishRequest -> PublishRequest -> Bool # (/=) :: PublishRequest -> PublishRequest -> Bool # | |
Show PublishRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> PublishRequest -> ShowS # show :: PublishRequest -> String # showList :: [PublishRequest] -> ShowS # | |
Arbitrary PublishRequest Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen PublishRequest # shrink :: PublishRequest -> [PublishRequest] # | |
ByteMe PublishRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> PublishRequest -> [Word8] toByteString :: ProtocolLevel -> PublishRequest -> ByteString Source # |
data ProtocolLevel Source #
MQTT Protocol Levels
Protocol311 | MQTT 3.1.1 |
Protocol50 | MQTT 5.0 |
Instances
Property represents the various MQTT Properties that may sent or received along with packets in MQTT 5. For detailed use on when and where to use them, consult with the MQTT 5.0 spec.
data AuthRequest Source #
Instances
Eq AuthRequest Source # | |
Defined in Network.MQTT.Types (==) :: AuthRequest -> AuthRequest -> Bool # (/=) :: AuthRequest -> AuthRequest -> Bool # | |
Show AuthRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> AuthRequest -> ShowS # show :: AuthRequest -> String # showList :: [AuthRequest] -> ShowS # | |
Arbitrary AuthRequest Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen AuthRequest # shrink :: AuthRequest -> [AuthRequest] # | |
ByteMe AuthRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> AuthRequest -> [Word8] toByteString :: ProtocolLevel -> AuthRequest -> ByteString Source # |
data SubscribeRequest Source #
Instances
Eq SubscribeRequest Source # | |
Defined in Network.MQTT.Types (==) :: SubscribeRequest -> SubscribeRequest -> Bool # (/=) :: SubscribeRequest -> SubscribeRequest -> Bool # | |
Show SubscribeRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> SubscribeRequest -> ShowS # show :: SubscribeRequest -> String # showList :: [SubscribeRequest] -> ShowS # | |
Arbitrary SubscribeRequest Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen SubscribeRequest # shrink :: SubscribeRequest -> [SubscribeRequest] # | |
ByteMe SubscribeRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> SubscribeRequest -> [Word8] toByteString :: ProtocolLevel -> SubscribeRequest -> ByteString Source # |
data SubOptions Source #
Options used at subscribe time to define how to handle incoming messages.
SubOptions | |
|
Instances
Eq SubOptions Source # | |
Defined in Network.MQTT.Types (==) :: SubOptions -> SubOptions -> Bool # (/=) :: SubOptions -> SubOptions -> Bool # | |
Show SubOptions Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> SubOptions -> ShowS # show :: SubOptions -> String # showList :: [SubOptions] -> ShowS # | |
Arbitrary SubOptions Source # | |
Defined in Network.MQTT.Arbitrary arbitrary :: Gen SubOptions # shrink :: SubOptions -> [SubOptions] # | |
ByteMe SubOptions Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> SubOptions -> [Word8] toByteString :: ProtocolLevel -> SubOptions -> ByteString Source # |
subOptions :: SubOptions Source #
Reasonable subscription option defaults at QoS0
.
data SubscribeResponse Source #
Instances
Eq SubscribeResponse Source # | |
Defined in Network.MQTT.Types (==) :: SubscribeResponse -> SubscribeResponse -> Bool # (/=) :: SubscribeResponse -> SubscribeResponse -> Bool # | |
Show SubscribeResponse Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> SubscribeResponse -> ShowS # show :: SubscribeResponse -> String # showList :: [SubscribeResponse] -> ShowS # | |
Arbitrary SubscribeResponse Source # | |
Defined in Network.MQTT.Arbitrary | |
ByteMe SubscribeResponse Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> SubscribeResponse -> [Word8] toByteString :: ProtocolLevel -> SubscribeResponse -> ByteString Source # |
data RetainHandling Source #
How to process retained messages on subscriptions.
SendOnSubscribe | Send existing retained messages to a new client. |
SendOnSubscribeNew | Send existing retained messages that have not yet been sent. |
DoNotSendOnSubscribe | Don't send existing retained messages. |
Instances
Bounded RetainHandling Source # | |
Defined in Network.MQTT.Types | |
Enum RetainHandling Source # | |
Defined in Network.MQTT.Types succ :: RetainHandling -> RetainHandling # pred :: RetainHandling -> RetainHandling # toEnum :: Int -> RetainHandling # fromEnum :: RetainHandling -> Int # enumFrom :: RetainHandling -> [RetainHandling] # enumFromThen :: RetainHandling -> RetainHandling -> [RetainHandling] # enumFromTo :: RetainHandling -> RetainHandling -> [RetainHandling] # enumFromThenTo :: RetainHandling -> RetainHandling -> RetainHandling -> [RetainHandling] # | |
Eq RetainHandling Source # | |
Defined in Network.MQTT.Types (==) :: RetainHandling -> RetainHandling -> Bool # (/=) :: RetainHandling -> RetainHandling -> Bool # | |
Show RetainHandling Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> RetainHandling -> ShowS # show :: RetainHandling -> String # showList :: [RetainHandling] -> ShowS # |
data DisconnectRequest Source #
Instances
Eq DisconnectRequest Source # | |
Defined in Network.MQTT.Types (==) :: DisconnectRequest -> DisconnectRequest -> Bool # (/=) :: DisconnectRequest -> DisconnectRequest -> Bool # | |
Show DisconnectRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> DisconnectRequest -> ShowS # show :: DisconnectRequest -> String # showList :: [DisconnectRequest] -> ShowS # | |
Arbitrary DisconnectRequest Source # | |
Defined in Network.MQTT.Arbitrary | |
ByteMe DisconnectRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> DisconnectRequest -> [Word8] toByteString :: ProtocolLevel -> DisconnectRequest -> ByteString Source # |
data UnsubscribeRequest Source #
Instances
Eq UnsubscribeRequest Source # | |
Defined in Network.MQTT.Types (==) :: UnsubscribeRequest -> UnsubscribeRequest -> Bool # (/=) :: UnsubscribeRequest -> UnsubscribeRequest -> Bool # | |
Show UnsubscribeRequest Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> UnsubscribeRequest -> ShowS # show :: UnsubscribeRequest -> String # showList :: [UnsubscribeRequest] -> ShowS # | |
Arbitrary UnsubscribeRequest Source # | |
Defined in Network.MQTT.Arbitrary | |
ByteMe UnsubscribeRequest Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> UnsubscribeRequest -> [Word8] toByteString :: ProtocolLevel -> UnsubscribeRequest -> ByteString Source # |
data UnsubscribeResponse Source #
Instances
Eq UnsubscribeResponse Source # | |
Defined in Network.MQTT.Types (==) :: UnsubscribeResponse -> UnsubscribeResponse -> Bool # (/=) :: UnsubscribeResponse -> UnsubscribeResponse -> Bool # | |
Show UnsubscribeResponse Source # | |
Defined in Network.MQTT.Types showsPrec :: Int -> UnsubscribeResponse -> ShowS # show :: UnsubscribeResponse -> String # showList :: [UnsubscribeResponse] -> ShowS # | |
Arbitrary UnsubscribeResponse Source # | |
Defined in Network.MQTT.Arbitrary | |
ByteMe UnsubscribeResponse Source # | |
Defined in Network.MQTT.Types toBytes :: ProtocolLevel -> UnsubscribeResponse -> [Word8] toByteString :: ProtocolLevel -> UnsubscribeResponse -> ByteString Source # |
data UnsubStatus Source #
UnsubSuccess | |
UnsubNoSubscriptionExisted | |
UnsubUnspecifiedError | |
UnsubImplementationSpecificError | |
UnsubNotAuthorized | |
UnsubTopicFilterInvalid | |
UnsubPacketIdentifierInUse |
Instances
data DiscoReason Source #
Instances
parsePacket :: ProtocolLevel -> Parser MQTTPkt Source #
Nothing
toByteString :: ProtocolLevel -> a -> ByteString Source #
Instances
encodeLength :: Int -> [Word8] Source #
parseHdrLen :: Parser Int Source #
parseProperties :: ProtocolLevel -> Parser [Property] Source #
bsProps :: ProtocolLevel -> [Property] -> ByteString Source #