Pure ZeroMQ in Haskell
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ZMQHS More conduit centric Dec 30, 2012
blaster
docs
test Forgot the test updates Dec 30, 2012
.gitignore
.travis.yml Enabling travis Dec 27, 2012
LICENSE Initial commit Oct 11, 2011
README.md Travis swag Dec 27, 2012
Setup.hs Initial commit Oct 11, 2011
ZMQHS.hs HSpec work Dec 17, 2012
zmqhs.cabal

README.md

ZMQHS: Pure ZMQ

Build Status

Pure ZMQ. No FFI.

http://rfc.zeromq.org/spec:13

http://www.haskell.org/haskellwiki/DealingWithBinaryData

http://stackoverflow.com/questions/3120796/haskell-testing-workflow/3120826#3120826

http://hpaste.org/53004#a53006

ZMQ ABNF

zmtp        = *connection

connection  = greeting content
greeting    = anonymous / identity
anonymous   = %x01 final
identity    = length final (%x01-ff) *OCTET

message     = *more-frame final-frame
more-frame  = length more body
final-frame = length final body
length      = OCTET / (%xFF 8OCTET)
more        = %x01
final       = %x00
body        = *OCTET

content     = *broadcast / *addressed / *neutral

broadcast   = message

addressed   = envelope message
envelope    = *more-frame delimiter
delimiter   = %x01 more

neutral     = message

How to DOS libzmq

foldr (>>) (return ()) (repeat do_connect)

combinatorrent

getAPMsg :: Int -> Parser Message
getAPMsg l = do
    c <- A.anyWord8
    case c of
        0  -> return Choke
        1  -> return Unchoke
        2  -> return Interested
        3  -> return NotInterested
        4  -> (Have <$> apW32be)
        5  -> (BitField <$> (A.take (l-1)))
        6  -> (Request <$> apW32be <*> (Block <$> apW32be <*> apW32be))
        7  -> (Piece <$> apW32be <*> apW32be <*> A.take (l - 9))
        8  -> (Cancel <$> apW32be <*> (Block <$> apW32be <*> apW32be))
        9  -> (Port . fromIntegral <$> apW16be)
        0x0D -> (Suggest <$> apW32be)
        0x0E -> return HaveAll
        0x0F -> return HaveNone
        0x10 -> (RejectRequest <$> apW32be <*> (Block <$> apW32be <*> apW32be))
        0x11 -> (AllowedFast <$> apW32be)
        20 -> (ExtendedMsg <$> A.anyWord8 <*> A.take (l - 2))
        k  -> fail $ "Illegal parse, code: " ++ show k

Want Something That Works?

A kind soul has already created a working FFI binding: zeromq-haskell

http://hackage.haskell.org/package/zeromq-haskell

Contact

@tureus or xrlange [at] tureus.com