# tahr v0.1.0 - Table of Contents

> ONC RPC and NFSv3 server as a standalone Elixir library.

## Pages

- [README](readme.md)
- [Change Log](changelog.md)
- [LICENSE](license.md)

- Tutorials
  - [Serving a read-only filesystem](read-only-server.md)
  - [A read-write server](read-write-server.md)

## Modules

- [Tahr](Tahr.md): A standalone Elixir library for building NFSv3 file servers natively
on the BEAM — no kernel NFS server, no NIFs.
- [Tahr.InMemory](Tahr.InMemory.md): An in-memory read-write filesystem backing the reference
`Tahr.InMemory.NFSBackend` and
`Tahr.InMemory.MountBackend` implementations.
- [Tahr.InMemory.MountBackend](Tahr.InMemory.MountBackend.md): Export resolution for `Tahr.InMemory`: publishes `/export`
backed by the agent's root directory and refuses everything else
with `MOUNT3ERR_NOENT`.

- [Tahr.InMemory.NFSBackend](Tahr.InMemory.NFSBackend.md): Reference `Tahr.NFSv3.Backend` implementation over
`Tahr.InMemory`.
- [Tahr.Mount.Backend](Tahr.Mount.Backend.md): Behaviour for the export resolution layer the MOUNT v3 handler
delegates to. Keeps Tahr decoupled from any particular
backing store (a static config file, an in-memory test fixture, a
database of exports, …).
- [Tahr.Mount.Handler](Tahr.Mount.Handler.md): ONC RPC handler for MOUNT v3 (program 100005, version 3) — see
[RFC 1813 appendix I](https://www.rfc-editor.org/rfc/rfc1813#appendix-I).
- [Tahr.Mount.Types](Tahr.Mount.Types.md): XDR types for the MOUNT v3 protocol — [RFC 1813 appendix I](https://www.rfc-editor.org/rfc/rfc1813#appendix-I).
- [Tahr.Mount.Types.ExportNode](Tahr.Mount.Types.ExportNode.md): One entry in `MOUNTPROC3_EXPORT`'s reply: a directory and the groups allowed to mount it.
- [Tahr.Mount.Types.MountList](Tahr.Mount.Types.MountList.md): One entry in `MOUNTPROC3_DUMP`'s reply.
- [Tahr.NFSv3.Backend](Tahr.NFSv3.Backend.md): Behaviour for the filesystem layer the NFSv3 handler delegates to.
- [Tahr.NFSv3.Filehandle](Tahr.NFSv3.Filehandle.md): Default opaque file-handle scheme for NFSv3 backends.
- [Tahr.NFSv3.Handler](Tahr.NFSv3.Handler.md): ONC RPC handler for NFS v3 (program 100003, version 3) — see
[RFC 1813 §3](https://www.rfc-editor.org/rfc/rfc1813#section-3).
- [Tahr.NFSv3.Types](Tahr.NFSv3.Types.md): XDR types for NFS v3 — [RFC 1813 §2.5](https://www.rfc-editor.org/rfc/rfc1813#section-2.5).
- [Tahr.NFSv3.Types.Fattr3](Tahr.NFSv3.Types.Fattr3.md): Full file attributes. RFC 1813 §2.5.
- [Tahr.NFSv3.Types.Nfstime3](Tahr.NFSv3.Types.Nfstime3.md): Wall-clock time (seconds + nanoseconds). RFC 1813 §2.5.
- [Tahr.NFSv3.Types.Sattr3](Tahr.NFSv3.Types.Sattr3.md): Settable attributes for SETATTR / CREATE / MKDIR. RFC 1813 §2.5.
- [Tahr.NFSv3.Types.Specdata3](Tahr.NFSv3.Types.Specdata3.md): Major / minor device numbers. RFC 1813 §2.5.
- [Tahr.NFSv3.Types.WccAttr](Tahr.NFSv3.Types.WccAttr.md): Subset of attributes used by the weak cache consistency check. RFC 1813 §2.6.
- [Tahr.NFSv3.Types.WccData](Tahr.NFSv3.Types.WccData.md): Pre+post op attributes for a directory/file modified by the operation. RFC 1813 §2.6.
- [Tahr.RPC.Auth](Tahr.RPC.Auth.md): ONC RPC authentication flavors — [RFC 5531 §8](https://www.rfc-editor.org/rfc/rfc5531#section-8).
- [Tahr.RPC.Auth.None](Tahr.RPC.Auth.None.md): Marker for AUTH_NONE — no credential body.
- [Tahr.RPC.Auth.Sys](Tahr.RPC.Auth.Sys.md): Decoded `AUTH_SYS` credentials. Field names mirror the kernel's
`authsys_parms` struct so handlers reading the auth context map
1:1 to POSIX semantics.

- [Tahr.RPC.Dispatcher](Tahr.RPC.Dispatcher.md): Map an incoming `Tahr.RPC.Message.Call` to the registered
handler for its `{program, version}` pair, then wrap the result in
the appropriate `Tahr.RPC.Message.AcceptedReply` /
`DeniedReply`.
- [Tahr.RPC.Handler](Tahr.RPC.Handler.md): Behaviour for ONC RPC program handlers.
- [Tahr.RPC.Message](Tahr.RPC.Message.md): ONC RPC v2 call and reply envelopes — [RFC 5531 §9](https://www.rfc-editor.org/rfc/rfc5531#section-9).
- [Tahr.RPC.Message.AcceptedReply](Tahr.RPC.Message.AcceptedReply.md): Successful or per-procedure-error reply. `body` is the
procedure's encoded result for `:success`, or the relevant
payload (e.g. `{:prog_mismatch, low, high}`) for the error
cases.
- [Tahr.RPC.Message.Call](Tahr.RPC.Message.Call.md): Decoded RPC call. `args` is the unparsed payload — pass it to
the program handler verbatim.

- [Tahr.RPC.Message.DeniedReply](Tahr.RPC.Message.DeniedReply.md): Reply rejected at the RPC layer (RPC version mismatch or auth
failure). `body` carries the relevant tuple.

- [Tahr.RPC.Portmapper](Tahr.RPC.Portmapper.md): Minimal portmap v2 (program 100000) handler — enough to satisfy
`mount -t nfs` clients that go through `rpcbind` before they
contact the NFS server directly.
- [Tahr.RPC.RecordMarking](Tahr.RPC.RecordMarking.md): ONC RPC record-marking framing — [RFC 5531 §11](https://www.rfc-editor.org/rfc/rfc5531#section-11).
- [Tahr.RPC.Server](Tahr.RPC.Server.md): ONC RPC v2 TCP listener.
- [Tahr.XDR](Tahr.XDR.md): Pure-Elixir encoder / decoder for the XDR (External Data
Representation) standard — [RFC 4506](https://www.rfc-editor.org/rfc/rfc4506).

## Mix Tasks

- [mix tahr.serve](Mix.Tasks.Tahr.Serve.md): Starts a `Tahr.RPC.Server` serving `Tahr.InMemory` and
blocks until the process is terminated.

