# Module Rpc_program

    module Rpc_program: sig .. end

RPC programs

An RPC server offers its procedures as parts of a "program". Here, the notion of programs is introduced. A program is identified by a program number and a version number. The service of a program is a set of procedures that are described by procedure numbers and signatures. The signature of a procedure is a pair (s,u) of XDR types that should be interpreted as function s -> u. To make work easier, programs are encapsulated as an opaque type t. This data structure can store procedure names in addition to the plain numbers, so you can refer to procedures by their names. But note that these names are only local identifiers that are not transferred in the RPC protocol. The signature can be formulated upon a type system (a set of definitions of type names).

    type t

Type of RPC programs

    val create : Rtypes.uint4 ->
           Rtypes.uint4 ->
           Xdr.xdr_type_system ->
           (string * (Rtypes.uint4 * Xdr.xdr_type_term * Xdr.xdr_type_term)) list ->
           t

`create program_nr version_nr type_system procedures`

    val id : t -> int

The ID identifies the program (used in `Rpc_client`)

    val update : ?program_number:Rtypes.uint4 ->
           ?version_number:Rtypes.uint4 -> t -> t

Modifies program and/or version number. The modified program is returned. The program keeps its identity, i.e. the `id` function returns the same number.

    val program_number : t -> Rtypes.uint4

Return the program number

    val version_number : t -> Rtypes.uint4

Return the version number

    val null_proc_name : t -> string option

Returns the name of procedure 0 (or `None` if not found)

    val signature : t -> string -> Rtypes.uint4 * Xdr.xdr_type * Xdr.xdr_type

`signature p name` returns the triple `(proc_nr, in_t, out_t)` for the procedure `name`. `proc_nr` is the procedure number, `in_t` the argument type and `out_t` the result type.

    val procedure_number : t -> string -> Rtypes.uint4

`procedure_number p name` returns only the procedure number of the procedure called `name`.