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

[ apache, library, network, program ] [ Propose Tags ]

Tools and library for writing ONC (Sun) RPC clients and servers. Provides equivalent functionality to rpcgen and librpcsvc, except in pure Haskell. The hsrpcgen tool (and Cabal preprocessor library) allows .x XDR files to generate Haskell protocol descriptors. The library provides a client interface to use these descriptions to make RPC calls.

[Skip to Readme]


Automatic Flags

Enable bindresvport option on client connections


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.1, 0.2
Dependencies base (>=4.8 && <5), base16-bytestring, bytestring, Cabal, cereal (>=0.5.4), containers, filepath, haskell-src-exts (>=1.18), network (>=3), ONC-RPC, parsec, random, time, unix, vector [details]
License Apache-2.0
Copyright 2017
Author Dylan Simon
Maintainer dylan@dylex.net
Category Network
Source repo head: git clone https://github.com/dylex/haskell-nfs
Uploaded by DylanSimon at 2022-11-11T17:41:49Z
Distributions NixOS:0.2
Executables hsrpcgen
Downloads 771 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-11-11 [all 1 reports]

Readme for ONC-RPC-0.2

[back to package description]

Haskell ONC (Sun) RPC and XDR tools and library

Haskell tools and library for interacting with ONC RPC (aka Sun RPC) protocols. The goal is a working NFS4 client, so TCP clients and efficient large data handling will be prioritized over servers, UDP, and portmaping. It includes the following complete components.

Primary Components


A code-generator for .x (XDR) files which you can call directly or use as a pre-processor from cabal (see Setup.hs for an example). The module Network.ONCRPC.Prot in this package is itself generated from the XDR description of the RPC protocol. While many .x files will work as-is, some depend on C-specific functionality that will require some minor tweaking.


A client library which allows you to use the generated module to make RPC calls to servers.


hsrpcgen -P nfs.x -o NFS.hs
import qualified Network.ONCRPC as RPC
import qualified NFS

client <- RPC.openClient $ RPC.ClientServerPort "nfs.server.example.com" "nfs"
reply <- RPC.rpcCall client $ RPC.Call (NFS.nFSPROC_NULL (NFS.nFS_VERSION NFS.nFS_PROGRAM)) RPC.AuthNone RPC.AuthNone ()
RPC.closeClient client


This package implements RFC5531 and RFC4506 as closely as possible.

xdrgen is a rpcgen replacement for other languages, written in Haskell. By contrast, this project targets full RPC support in Haskell.