hszephyr-0.2: Simple libzephyr bindings

Safe HaskellNone
LanguageHaskell98

Network.Zephyr

Description

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.

Synopsis

Documentation

initialize :: IO () Source #

Initialize libzephyr.

getSender :: IO String Source #

Return the name of the current Zephyr sender.

getRealm :: IO String Source #

Return the realm of the current host.

receiveNotice :: IO ZNotice Source #

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

pendingNotices :: IO Int Source #

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 :: ByteString Source #

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

emptyNotice :: ZNotice Source #

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

Constructors

ZNotice 

Fields

data ZAuth Source #

Constructors

Authenticated

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

Unauthenticated

The message was or will be sent with no authentication.

AuthenticationFailed

The message was received with invalid authentication.

data ZSubscription Source #

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

kind_servnak :: ZNoticeKind Source #

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