package dns-forward

  1. Overview
  2. Docs

Construct an RPC server given a Flow and a method of Framing messages over the flow.

Parameters

module Flow : Flow.Server with type address = Ipaddr.t * int
module Framing : Framing.S with type flow = Flow.flow

Signature

type server

A Remote Procedure Call server which will listen on an address, accept incoming connections and answer them

type request = Cstruct.t

A complete request

type response = Cstruct.t

A complete response

type address = Config.Address.t

The address of the server

val bind : address -> server Error.t

Bind to the given address. This will fail if the address does not exist or if another server is already bound there.

val listen : server -> (request -> response Error.t) -> unit Error.t

Listen and accept incoming connections, use the provided callback to answer requests.

val shutdown : server -> unit Lwt.t

Shutdown the server and free any allocated resources.