Module Versioned_typed_tcp.Client_msg.Control

module Control: sig .. end

type 'name t = 
| Connecting
| Connect of 'name
| Disconnect of 'name * Core.Std.Sexp.t
| Parse_error of 'name * string
| Protocol_error of string
val bin_size_t : ('a -> int) -> 'a t -> int
val bin_write_t_ : (Bin_prot.Unsafe_common.sptr ->
Bin_prot.Unsafe_common.eptr ->
'a -> Bin_prot.Unsafe_common.sptr) ->
Bin_prot.Unsafe_common.sptr ->
Bin_prot.Unsafe_common.eptr ->
'a t ->
val bin_write_t : (Bin_prot.Unsafe_common.sptr ->
Bin_prot.Unsafe_common.eptr ->
'a -> Bin_prot.Unsafe_common.sptr) ->
Bin_prot.Common.buf ->
pos:Bin_prot.Common.pos ->
'a t -> Bin_prot.Common.pos
val bin_writer_t : 'a Bin_prot.Type_class.writer ->
'a t
val bin_read_t__ : 'a -> 'b -> 'c -> 'd -> 'e
val bin_read_t_ : (Bin_prot.Unsafe_common.sptr_ptr ->
Bin_prot.Unsafe_common.eptr -> 'a) ->
Bin_prot.Unsafe_common.sptr_ptr ->
Bin_prot.Unsafe_common.eptr ->
'a t
val bin_read_t : (Bin_prot.Unsafe_common.sptr_ptr ->
Bin_prot.Unsafe_common.eptr -> 'name) ->
Bin_prot.Common.buf ->
pos_ref:Bin_prot.Common.pos Pervasives.ref ->
'name t
val bin_reader_t : 'a Bin_prot.Type_class.reader ->
'a t
val bin_t : 'a Bin_prot.Type_class.t ->
'a t Bin_prot.Type_class.t

This module describes the type of a given direction of message flow. For example it might describe the type of messages from the client to the server.

lookup_marshal_fun v This function takes a version v, and returns a function that will downgrade (if necessary) the current version to v and then write it to a bigsubstring. It is perfectly fine if one message becomes zero or more messages as a result of downgrading, this is why the marshal fun returns a list. The contents of these buffers will be copied immediatly, so it is safe to reuse the same bigstring for multiple marshals.

lookup_unmarshal_fun v This function takes a version v, and returns a function that unmarshals a message and upgrades it, returning zero or more messages as a result of the upgrade. The bigsubstring is only guaranteed to contain valid data until the unmarshal function returns, after which it may be overwritten immediatly.

This module may be used to implement modes for clients/servers. A common scheme is to have two modes, Test, and Production, and to want to maintain the invariant that clients in mode Test may not talk to servers in mode Production, and that clients in mode Production may not talk to servers in mode Test. Versioned connection will check that the mode of the client is the same as the mode of the server.

If you don't care about modes, just use Dont_care_about_mode.

val __t_of_sexp__ : 'name.
(Sexplib.Sexp.t -> 'name) ->
Sexplib.Sexp.t -> 'name t
val t_of_sexp : 'name.
(Sexplib.Sexp.t -> 'name) ->
Sexplib.Sexp.t -> 'name t
val sexp_of_t : 'name.
('name -> Sexplib.Sexp.t) ->
'name t -> Sexplib.Sexp.t