lio-0.11.6.0: Labeled IO Information Flow Control Library

LIO.Concurrent.LChan

Description

Unbounded FIFO channels in the LIO monad. As with other objects in LIO, a channel has an associated label that is used to impose restrictions on its operations. In fact, labeled channels (LChans) are simply labeled Chans with read and write access restricted according to the label. This module is analogous to Control.Concurrent.Chan, but the operations take place in the LIO monad.

Synopsis

# Documentation

type LChan l a = LObj l (Chan a) Source #

A LChan is a labeled channel, i.e., an unbounded FIFO channel.

# Basic Functions

## Create labeled IORefs

newLChan :: Label l => l -> LIO l (LChan l a) Source #

Create a new labeled channel. Note that the supplied label must be above the current label and below the current clearance. An exception will be thrown by the underlying guardAlloc if this is not the case.

newLChanP :: PrivDesc l p => Priv p -> l -> LIO l (LChan l a) Source #

Same as newLChan except it takes a set of privileges which are accounted for in comparing the label of the Chan to the current label.

## Read LChans

readLChan :: Label l => LChan l a -> LIO l a Source #

Read the next value from the channel. The current label is raised to join of the channel label and current label. Howerver, the label of the channel must be below the current clearance.

readLChanP :: PrivDesc l p => Priv p -> LChan l a -> LIO l a Source #

Same as readLChan, but takes a privilege object which is used when the current label is raised to avoid over-taining the context.

## Write LChans

writeLChan :: Label l => LChan l a -> a -> LIO l () Source #

Write value to the labeled channel. The label of the channel must be bounded by the current label and clearance.

writeLChanP :: PrivDesc l p => Priv p -> LChan l a -> a -> LIO l () Source #

Same as writeLChan, but uses privileges when comparing the current label to the label of the channel.

## Dupicate LChans

dupLChan :: Label l => LChan l a -> LIO l (LChan l a) Source #

Duplicate labeled channel. The label of the channel must be bounded by the current label and clearance.

dupLChanP :: PrivDesc l p => Priv p -> LChan l a -> LIO l (LChan l a) Source #

Same as dupLChan, but uses privileges when comparing the current label to the label of the channel.