ONC-RPC-0.1: ONC RPC (aka Sun RPC) and XDR library

Safe HaskellNone
LanguageHaskell2010

Network.ONCRPC.Client

Description

ONC RPC Client interface. Handles RPC client protocol layer. Clients are fully thread-safe, allowing multiple outstanding requests, and automatically reconnect on error. Currently error messages are just written to stdout.

Synopsis

Documentation

data ClientServer Source #

How to connect to an RPC server. Currently only TCP connections to pre-defined ports are supported (no portmap).

Constructors

ClientServerPort

a known service by host/port, currently only TCP

Fields

data Client Source #

An RPC Client.

openClient :: ClientServer -> IO Client Source #

Create a new RPC client to the given server. This client must be destroyed with closeClient when done.

closeClient :: Client -> IO () Source #

Destroy an RPC client and close its underlying network connection. Any outstanding requests return ReplyFail, any any further attempt to use the Client may hang indefinitely.

clientCall :: (XDR a, XDR r) => Client -> Call a r -> IO (Reply r) Source #

Send a call message using an open client, and wait for a reply, returning ReplyFail on protocol error. The request will be automatically retried until a response is received.

setClientAuth :: Auth -> Auth -> Client -> Client Source #

Set the credentials and verifier to use when calling rpcCall on a client. Note that you can safely use different sets of credentials with the same underlying connection this way. By default, both are set to AuthNone.

rpcCall :: (XDR a, XDR r) => Client -> Procedure a r -> a -> IO r Source #

Make an RPC request. It waits for a response, retrying as necessary, or throws the RPCException, ReplyException, on any failure. This uses the credentials set by setClientAuth. If you need to retrieve the auth verifier, use clientCall.