Module Odb_comm


module Odb_comm: sig .. end
Communications.


Commands


type command_option = string * string 
A command option is of the form (key, value).

type command = {
   com_tool : string;
   com_options : command_option list;
   com_phrase : string;
}
A command refers to a tool name, optional command options, and the phrase to execute.
val mk_command : tool:string ->
?options:command_option list -> string -> command
Convenient function to create a Odb_comm.command structure.
exception Error of string
This exception is raised when an error occurs when sending or receiving data. Syntax errors in command or response raise a Failure exception.
val input_command : Pervasives.in_channel -> command
Read a command from channel.
val output_command : Pervasives.out_channel -> command -> unit
Write a command to a channel.

Responses



type response = {
   resp_tool : string;
   resp_code : int;
   resp_contents : string;
}
A response refers to a tool name in field resp_tool. The resp_contents field contains the error message if the resp_code <> 0 or else the contents of the response.
val mk_response : tool:string -> ?code:int -> string -> response
Convenient function to create a Odb_comm.response structure. Default code is 0.
val input_response : Pervasives.in_channel -> response
Read a response from a channel.
val output_response : Pervasives.out_channel -> response -> unit
Write a response to a channel.
val check_response : response -> string
check_response r raises Failure r.resp_contents if r.resp_code <> 0, else return r.resp_contents.