nettle-openflow-0.1: High level configuration and control of computer networks.

Nettle.Servers.MessengerServer

Description

This module receives messages from external network components, such as, authentication portals, intrusion detection systems, vulnerability scanners, etc. These components are not necessarily written in Haskell or depend on Nettle; thus, the module acts an interface to the outside world.

This module interacts with external components via a threaded TCP server. Users of this module are given a channel on which they can receive messages from external components.

This module also assists in writing messenger clients that send messages to the server. Note that these clients need not be written in Haskell; it would be trivial to write a messenger client in another language. We provide a messenger client here for your reference and for convenience of integrating external Haskell components with Nettle.

Messages are plain text; it is your responsibility to impose semantics for these strings and ensure that messages from different components don't clash. (For example, I recommend that all messages from a vulnerability scanner be prefixed with "Scanner", messages from a Web portal be prefixed with "Portal", etc.)

Synopsis

Documentation

messengerServer :: PortID -> IO (Chan (SockAddr, Message))Source

Run a server that listens for connections from external messenger components. The server is run in a separate thread; the current thread returns a channel to the user where he can receive messages from the external components. Messages are annotated with the client's address information.

messengerClient :: HostName -> PortID -> (Chan2 (Maybe Message) (Maybe Message) () -> IO ()) -> IO ()Source

Connect to a messenger server (i.e., a Nettle controller that runs messengerServer) and send messages. Note that although this function returns a bidirectional channel for both sending and receiving messages from the server, the server currently does not send any messages.