linx-gateway-0.1.0.2: Implementation of the Enea LINX gateway protocol.

Safe HaskellSafe-Inferred

Network.Linx.Gateway.Message

Description

Implementation of low level messages from the LINX Gateway protocol. Details about the protocol can be found at: http://linx.sourceforge.net/linxdoc/doc/linxprotocols/book-linx-protocols-html/index.html

Synopsis

Documentation

data Message Source

Message, carrying a Header and a ProtocolPayload.

Instances

Eq Message 
Show Message 
Binary Message

Binary instance for Message.

data Header Source

Message header.

Constructors

Header 

Instances

Eq Header 
Show Header 
Generic Header 
Binary Header

Generic binary instances.

data ProtocolPayload Source

Protocol payload.

Constructors

FailedRequest 
InterfaceRequest

This request has two puposes. The client sends this request to retrieve information about the gateway server, e.g. supported requests, protocol verions etc. It is also used as a ping-message to check that the server is alive.

Fields

version :: !Version
 
flags :: !Flags
 
InterfaceReply 
CreateRequest

This request it used to create a client instance on the server that the client communicated with.

Fields

user :: !User
 
myName :: !CString
 
CreateReply 

Fields

status :: !Status
 
pid :: !Pid
 
maxSigSize :: !Length
 
DestroyRequest

This request is used to remove a client instance on the server, i.e. end the session that was started with the create request.

Fields

pid :: !Pid
 
DestroyReply 

Fields

status :: !Status
 
HuntRequest

This request is to used to ask the gateway server to execute a hunt call.

HuntReply 

Fields

status :: !Status
 
pid :: !Pid
 
ReceiveRequest

This request is used to ask the server to execute a receive or receive_w_tmo call. It differs from other requests, because the client may send a second receive request or an interface request before it has received the reply from the previous receive request. The client may send a second receive request to cancel the first one. Beware that server may already have sent a receive reply before the cancel request was received, in this case the client must also wait for the cancel reply. The client may send an interface request to the server, which returns an interface reply. This is used by the client to detect if the server has died while waiting for a receive reply.

ReceiveReply 

Fields

status :: !Status
 
senderPid :: !Pid
 
addresseePid :: !Pid
 
signal :: !Signal
 
SendRequest

This request is used to ask the gateway server to execute a send or send_w_s call.

Fields

fromPid :: !Pid
 
destPid :: !Pid
 
signal :: !Signal
 
SendReply 

Fields

status :: !Status
 
AttachRequest

This request is used to ask the gateway server to execute an attach call.

Fields

pid :: !Pid
 
signal :: !Signal
 
AttachReply 

Fields

status :: !Status
 
attref :: !Attref
 
DetachRequest

This request is used to ask the gateway server to execute a detach call.

Fields

attref :: !Attref
 
DetachReply 

Fields

status :: !Status
 
NameRequest

This request is to retrieve the gateway server's mame.

Fields

reserved :: !Int32
 
NameReply 

Fields

status :: !Status
 
nameLen :: !Length
 
name :: !CString
 

encode :: Binary a => a -> ByteString

Encode a value using binary serialisation to a lazy ByteString.

mkHuntReply :: Pid -> MessageSource

Make a HuntReply message.

mkSendRequest :: Pid -> Pid -> Signal -> MessageSource

Make a SendRequest message.

headerSize :: LengthSource

Get the header size in bytes.

decodeHeader :: ByteString -> HeaderSource

Decode the header.