net-concurrent-0.0.1: Concurrent over the network execution library

Control.Concurrent.Network.Protocol

Contents

Description

Protocol implementation. (Internal module).

A packet contains a 2 byte packet type identifier, and a possibly empty list of 2 byte length field and length byte ByteString pairs. The number of pairs in the list can be deduced from the packet identifier and the direction of the packet (slave to master - or master to slave).

Synopsis

Functions

readProtoId :: Handle -> IO ProtoIdSource

Reads a packet ID from h

writeProtoId :: Handle -> ProtoId -> IO ()Source

Writes a packet ID to h

readBinary :: Binary a => Handle -> IO aSource

Reads a Binary from h

writeBinary :: Binary a => Handle -> a -> IO ()Source

Writes a binary to h

readByteString :: Handle -> IO ByteStringSource

Reads a ByteString from h

Slave communications with master

slaveID :: NCContext -> IO IntSource

Returns the slave ID of the caller

numSlaves :: NCContext -> IO IntSource

Number of slaves

printMsg :: NCContext -> String -> IO ()Source

Prints a message on master

Protocol identifiers

data ProtoId Source

Constructors

NNV

New empty NVar

PNV

Put NVar

TNV

Take NVar

PWO

Poll with a condition

PMS

print a message on master

SID

get slave id

NSL

number of slaves

Poll operators

data Equality Source

Constructors

EQOP 
NEQOP