-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Stomp Parser and Utilities -- @package stompl @version 0.3.0 -- | Stomp Frames and some useful operations on them module Network.Mom.Stompl.Frame -- | This is a frame data Frame -- | The frame type identifies, what the Stomp protocol calls -- command; -- -- data FrameType -- | Sent by the application to initiate a connection Connect :: FrameType -- | Same as Connect, but with STOMP instead of CONNECT Stomp :: FrameType -- | Sent by the broker to confirm the connection Connected :: FrameType -- | Sent by the application to end the connection Disconnect :: FrameType -- | Sent by the application to publish a message in a queue Send :: FrameType -- | Sent by the broker to forward a message published in a queue to which -- the application has subscribed Message :: FrameType -- | Sent by the application to subscribe to a queue Subscribe :: FrameType -- | Sent by the application to unsubscribe from a queue Unsubscribe :: FrameType -- | Sent by the application to start a transaction Begin :: FrameType -- | Sent by the application to commit a transaction Commit :: FrameType -- | Sent by the application to abort a transaction Abort :: FrameType -- | Sent by the application to acknowledge a message Ack :: FrameType -- | Sent by the application to negatively acknowledge a message Nack :: FrameType -- | Keep-alive message sent by both, application and broker HeartBeat :: FrameType -- | Sent by the broker to report an error Error :: FrameType -- | Sent by the broker to confirm the receipt of a frame Receipt :: FrameType -- | Tuple of (key, value) type Header = (String, String) -- | The Frame body is represented as strict ByteString. type Body = ByteString -- | Heart-beat configuration; the first Int of the pair represents -- the frequency in which the sender wants to send heart-beats; the -- second represents the highest frequency in which the sender can accept -- heart-beats. The frequency is expressed as the period in milliseconds -- between two heart-beats. For details on negotiating heart-beats, -- please refer to the Stomp specification. type Heart = (Int, Int) -- | The Stomp version used or accepted by the sender; the first Int -- is the major version number, the second is the minor. For details on -- version negotiation, please refer to the Stomp specification. type Version = (Int, Int) data AckMode -- | A successfully sent message is automatically considered ack'd Auto :: AckMode -- | The client is expected to explicitly confirm the receipt of a message -- by sending an Ack frame; all message older than the ack'd -- message since the last Ack (or the beginning of the session) -- are implicitly ack'd as well. This is called cumulative ack. Client :: AckMode -- | Non-cumulative ack: The client is expected to explicitly confirm the -- receipt of a message by sending an Ack frame; only the message -- with the msg-id in the Ack frame is actually ack'd ClientIndi :: AckMode -- | check if String represents a valid AckMode isValidAck :: String -> Bool -- | Description of a server consisting of name, version and comments type SrvDesc = (String, String, String) -- | get name from SrvDesc getSrvName :: SrvDesc -> String -- | get version from SrvDesc getSrvVer :: SrvDesc -> String -- | get comments from SrvDesc getSrvCmts :: SrvDesc -> String -- | make a Connect frame (Application -> Broker). The parameters -- are: -- -- mkConnect :: String -> String -> String -> Heart -> [Version] -> String -> [Header] -> Frame -- | Same as mkConnect, but the result is a "STOMP" frame rather -- than a "CONNECT" frame mkStomp :: String -> String -> String -> Heart -> [Version] -> String -> [Header] -> Frame -- | make a Connect frame (Broker -> Application). The parameters -- are: -- -- mkConnected :: String -> Heart -> Version -> SrvDesc -> [Header] -> Frame -- | make a Subscribe frame (Application -> Broker). The -- parameters are: -- -- mkSubscribe :: String -> AckMode -> String -> String -> String -> [Header] -> Frame -- | make an Unsubscribe frame (Application -> Broker). The -- parameters are: -- -- mkUnsubscribe :: String -> String -> String -> [Header] -> Frame -- | make a Send frame (Application -> Broker). The parameters -- are: -- -- mkSend :: String -> String -> String -> Type -> Int -> [Header] -> Body -> Frame -- | make a Message frame (Broker -> Application). The parameters -- are: -- -- mkMessage :: String -> String -> String -> String -> Type -> Int -> [Header] -> Body -> Frame -- | make a Receipt frame (Broker -> Application). The parameters -- are: -- -- mkErr :: String -> String -> Type -> Int -> [Header] -> Body -> Frame -- | make a Begin frame (Application -> Broker). The parameters -- are: -- -- mkBegin :: String -> String -> [Header] -> Frame -- | make a Commit frame (Application -> Broker). The parameters -- are: -- -- mkCommit :: String -> String -> [Header] -> Frame -- | make an Abort frame (Application -> Broker). The parameters -- are: -- -- mkAbort :: String -> String -> [Header] -> Frame -- | make an Ack frame (Application -> Broker). The parameters -- are: -- -- mkAck :: String -> String -> String -> String -> [Header] -> Frame -- | make a Nack frame (Application -> Broker). The parameters -- are: -- -- mkNack :: String -> String -> String -> String -> [Header] -> Frame -- | make a Disconnect frame (Application -> Broker). The -- parameter is: -- -- mkDisconnect :: String -> [Header] -> Frame -- | make a HeatBeat frame (Application -> Broker and Broker -- -> Application) mkBeat :: Frame -- | make a Receipt frame (Broker -> Application). The parameter -- is: -- -- mkReceipt :: String -> [Header] -> Frame -- | make Connect frame mkConFrame :: [Header] -> Either String Frame -- | make Stomp frame mkStmpFrame :: [Header] -> Either String Frame -- | make Connected frame mkCondFrame :: [Header] -> Either String Frame -- | make Disconnect frame mkDisFrame :: [Header] -> Either String Frame -- | make Subscribe frame mkSubFrame :: [Header] -> Either String Frame -- | make Unsubscribe frame mkUSubFrame :: [Header] -> Either String Frame -- | make Send frame mkSndFrame :: [Header] -> Int -> Body -> Either String Frame -- | make Message frame mkMsgFrame :: [Header] -> Int -> Body -> Either String Frame -- | make Error frame mkErrFrame :: [Header] -> Int -> Body -> Either String Frame -- | make Begin frame mkBgnFrame :: [Header] -> Either String Frame -- | make Commit frame mkCmtFrame :: [Header] -> Either String Frame -- | make Abort frame mkAbrtFrame :: [Header] -> Either String Frame -- | make Ack frame mkAckFrame :: [Header] -> Either String Frame -- | make Nack frame mkNackFrame :: [Header] -> Either String Frame -- | make Receipt frame mkRecFrame :: [Header] -> Either String Frame -- | make login header mkLogHdr :: String -> Header -- | make passcode header mkPassHdr :: String -> Header -- | make destination header mkDestHdr :: String -> Header -- | make content-length header mkLenHdr :: String -> Header -- | make transaction header mkTrnHdr :: String -> Header -- | make receipt header mkRecHdr :: String -> Header -- | make selector header mkSelHdr :: String -> Header -- | make id header (subscribe frame) mkIdHdr :: String -> Header -- | make ack header (subscribe frame) mkAckHdr :: String -> Header -- | make session header (connected frame) mkSesHdr :: String -> Header -- | make message header (error frame) mkMsgHdr :: String -> Header -- | make message-id header mkMIdHdr :: String -> Header -- | make accept-version header (connect frame) mkAcVerHdr :: String -> Header -- | make version header (connected frame) mkVerHdr :: String -> Header -- | make host header (connect frame) mkHostHdr :: String -> Header -- | make heart-beat header mkBeatHdr :: String -> Header -- | make content-type header mkMimeHdr :: String -> Header -- | make server header (connected frame) mkSrvHdr :: String -> Header -- | make subscription header mkSubHdr :: String -> Header -- | make client-id header mkCliIdHdr :: String -> Header -- | convert String to Version valToVer :: String -> Maybe Version -- | convert String to list of Version valToVers :: String -> Maybe [Version] -- | convert Version to String verToVal :: Version -> String -- | convert list of Version to String versToVal :: [Version] -> String -- | convert HeartBeat to String beatToVal :: Heart -> String -- | convert String to HeartBeat valToBeat :: String -> Maybe Heart -- | convert AckMode to String ackToVal :: AckMode -> String -- | convert String to AckMode valToAck :: String -> Maybe AckMode -- | convert String to SrvDesc strToSrv :: String -> SrvDesc -- | convert SrvDesc to String srvToStr :: SrvDesc -> String -- | negotiates version - if no common version is found, the function -- results in version 1.0! negoVersion :: [Version] -> [Version] -> Version -- | negotiates heart-beat negoBeat :: Heart -> Heart -> Heart -- | remove header (String) from list of Header rmHdr :: [Header] -> String -> [Header] -- | remove headers (list of String) from list of Header rmHdrs :: [Header] -> [String] -> [Header] getAck :: [Header] -> Either String AckMode getLen :: [Header] -> Either String Int -- | gets the FrameType of a Frame typeOf :: Frame -> FrameType -- | converts a Frame into a ByteString putFrame :: Frame -> ByteString -- | converts a Frame into a String toString :: Frame -> String -- | converts the FrameType into a ByteString putCommand :: Frame -> ByteString -- | converts a Send frame into a Message frame; parameters: -- -- sndToMsg :: String -> String -> String -> Frame -> Maybe Frame -- | converts a Connect frame into a Connected frame, -- negotiating heart-beats and version; parameters: -- -- conToCond :: String -> String -> Heart -> [Version] -> Frame -> Maybe Frame -- | sets the transaction header to an empty string; this is a useful -- function for brokers: when a transaction has been committed, the -- Send messages can be handled by the same function without, -- accidentally, iterating into a new transaction. resetTrans :: Frame -> Frame -- | Compliance with protocol version complies :: Version -> Frame -> Bool -- | get destination from Subscribe, Unsubscribe, -- Send or Message getDest :: Frame -> String -- | get transaction from Send, Ack, Nack, -- Begin, Commit or Abort getTrans :: Frame -> String -- | get receipt or receipt-id from any frame, but -- Connect, Connected, Message, Error getReceipt :: Frame -> String -- | get login from Connect getLogin :: Frame -> String -- | get passcode from Connect getPasscode :: Frame -> String -- | get client-id from Connect getCliId :: Frame -> String -- | get host from Connect getHost :: Frame -> String -- | get accept-version from Connect getVersions :: Frame -> [Version] -- | get version from Connected getVersion :: Frame -> Version -- | get heart-beat from Connect or Connected getBeat :: Frame -> Heart -- | get session from Connected getSession :: Frame -> String -- | get server from Connected getServer :: Frame -> SrvDesc -- | get subscription from Ack, Nack or Message getSub :: Frame -> String -- | get selector from Subscribe getSelector :: Frame -> String -- | get id from Subscribe or Unsubscribe getId :: Frame -> String -- | get ack from Subscribe getAcknow :: Frame -> AckMode -- | get ack or message-id from Message getMsgAck :: Frame -> String -- | get body from Send, Message, Error getBody :: Frame -> ByteString -- | get content-type from Send, Message, Error getMime :: Frame -> Type -- | get content-length from Send, Message, -- Error getLength :: Frame -> Int -- | get message from Error getMsg :: Frame -> String -- | get all additional headers from Send or Message getHeaders :: Frame -> [Header] -- | snoc (|>) :: ByteString -> Char -> ByteString -- | cons (<|) :: Char -> ByteString -> ByteString -- | append (>|<) :: ByteString -> ByteString -> ByteString upString :: String -> String numeric :: String -> Bool instance Show FrameType instance Read FrameType instance Eq FrameType instance Eq AckMode instance Show Frame instance Eq Frame instance Read AckMode instance Show AckMode -- | Stomp Parser based on Attoparsec module Network.Mom.Stompl.Parser -- | The Stomp Parser stompParser :: Parser Frame -- | Parses a ByteString at once with Attoparsec parseOnly. May fail -- or conclude. stompAtOnce :: ByteString -> Either String Frame