# Class type Rpc_client.auth_protocol

    class type auth_protocol = object .. end

An authentication protocol is used for creating an authentication session.

    method state : [ `Done of auth_session
           | `Emit
           | `Error
           | `Receive of Netnumber.uint4 ]

The state of the authentication protocol:

- ``Emit`: The client needs to emit another token
- ``Receive xid`: The client waits for another token (with session identifier `xid`)
- ``Done session`: The protocol is finished and `session` can be used for authenticating
- ``Error`: Something went wrong.

    method emit : Netnumber.uint4 ->
           Netnumber.uint4 -> Netnumber.uint4 -> Rpc_packer.packed_value

Emits a token for this `xid`, `prog_nr` and `vers_nr`. The returned packed value should have been created with `Rpc_packer.pack_value`. It is possible that `emit` is called several times with different xid values. In this case, the returned packed value should be identical except that the new xid is included in the message.

After emission, the state must change to ``Receive`.

    method receive : Rpc_packer.packed_value -> unit

Receive a token for the `xid` announced in `state`. The passed packed value is the full RPC message. The message may also contain a server error - which may be processed by the protocol, or which may cause the reaction that `receive` raises an `Rpc.Rpc_server` exception.

After `receive`, the state can change to ``Emit`, ``Done` or ``Error`. The latter is obligatory when `receive` raises an exception. It is also possible not to raise an exception but silently switch to ``Error`.

Design limitation: there is right now no way to indicate that the next authentication method should be used instead.

    method gssapi_props : Netsys_gssapi.client_props option

Properties of the GSSAPI session (if existing)

    method destroy : unit -> unit

Destroys the session (e.g. delete the GSSAPI context)

    method auth_method : auth_method