hszephyr-0.1: Simple libzephyr bindings



Simple bindings to libzephyr.

All functions in this module properly serialize access to the C libzephyr and behave correctly with regard to forkIO, so this module should behave properly in threaded Haskell program.

At present, however, we only support maintaining a single, global, set of Zephyr subscriptions. This may be extended to support multiple clients within the same Haskell program.



initialize :: IO ()Source

Initialize libzephyr.

getSender :: IO StringSource

Return the name of the current Zephyr sender.

getRealm :: IO StringSource

Return the realm of the current host.

receiveNotice :: IO ZNoticeSource

Receive a ZNotice from the zephyr servers. Blocks until a notice is available.

pendingNotices :: IO IntSource

Checks for new incoming packets and then returns the number of pending messages in the queue.

tryReceiveNotice :: IO (Maybe ZNotice)Source

Try to receive a ZNotice, returning Nothing if no notice is available.

cancelSubscriptions :: IO ()Source

Cancel all zephyr subscriptions.

subscribeTo :: [ZSubscription] -> IO ()Source

Subscribe to one or more Zephyr triples.

unsubscribeTo :: [ZSubscription] -> IO ()Source

Unsubscribe from one or more Zephyr triples.

defaultFmt :: ByteStringSource

Holds the default display format used by outgoing Zephyrs by zwrite.

emptyNotice :: ZNoticeSource

A default ZNotice suitable for use as a template when creating a new notice for sending via sendNotice.

data ZNotice Source

ZNotice represents a Zephyr notice. All fields of this record are filled-in for received notices. For outoing notices, only the following fields are relevant:

  • z_class
  • z_instance
  • z_opcode
  • z_sender
  • z_default_fmt
  • z_kind
  • z_auth
  • z_fields




z_version :: ByteString

The Zephyr version this notice was sent with.

z_class :: ByteString

The Zephyr class of this notice.

z_instance :: ByteString

The Zephyr instance of this notice.

z_recipient :: ByteString

The recipient of this notice.

z_opcode :: ByteString

The opcode of this notice.

z_sender :: Maybe ByteString

The sender of this Notice. This field is always a Just for received notices. Setting it to Nothing for sent notices will cause it to automatically be filled in.

z_default_fmt :: ByteString

The default format clients should use to render this notice.

z_kind :: ZNoticeKind

The kind of this notice (determines how it will be ACK'd).

z_auth :: ZAuth

Whether this notice is authenticated.

z_fields :: [ByteString]

A list of the fields in this notice.

z_time :: UTCTime

The time this notice was sent.

newtype ZNoticeKind Source

ZNoticeKind represent the kinds of ZNotices sent or received by the Zephyr system.




unZNoticeKind :: CInt

data ZAuth Source



The message was received with correct authentication, or should be authenticated for outgoing notices.


The message was or will be sent with no authentication.


The message was received with invalid authentication.

data ZSubscription Source

Represents a Zephyr triple for the purposes of subscribing or unsubscribing to zephyrs.

kind_clientack :: ZNoticeKindSource

ZAuth represents the authentication used when sending or receiving a Zephyr.