<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="next" href="Bproto.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Binary" rel="Chapter" href="Binary.html"> <link title="Bproto" rel="Chapter" href="Bproto.html"> <link title="Db" rel="Chapter" href="Db.html"> <link title="Graph" rel="Chapter" href="Graph.html"> <link title="Monitor_sig" rel="Chapter" href="Monitor_sig.html"> <link title="Ocamlviz" rel="Chapter" href="Ocamlviz.html"> <link title="Ocamlviz_threads" rel="Chapter" href="Ocamlviz_threads.html"> <link title="Protocol" rel="Chapter" href="Protocol.html"> <link title="Timemap" rel="Chapter" href="Timemap.html"><title>Binary</title> </head> <body> <div class="navbar"> <a href="index.html">Up</a> <a href="Bproto.html">Next</a> </div> <center><h1>Module <a href="type_Binary.html">Binary</a></h1></center> <br> <pre><span class="keyword">module</span> Binary: <code class="code">sig</code> <a href="Binary.html">..</a> <code class="code">end</code></pre>Low-level functions for the binary protocol.<br> <hr width="100%"> <br> Coding functions<br> <br> <br> <pre><span class="keyword">val</span> <a name="VALbuf_int8"></a>buf_int8 : <code class="type">Buffer.t -> int -> unit</code></pre><div class="info"> <code class="code">buf_int8 b i</code> encodes a 8-bits integer <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_int16"></a>buf_int16 : <code class="type">Buffer.t -> int -> unit</code></pre><div class="info"> <code class="code">buf_int16 b i</code> encodes a 16-bits integer <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_int31"></a>buf_int31 : <code class="type">Buffer.t -> int -> unit</code></pre><div class="info"> <code class="code">buf_int31 b i</code> encodes a native 31-bits integer <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_int63"></a>buf_int63 : <code class="type">Buffer.t -> int -> unit</code></pre><div class="info"> <code class="code">buf_int63 b i</code> encodes a native 63-bits integer <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_string31"></a>buf_string31 : <code class="type">Buffer.t -> string -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALbuf_bool"></a>buf_bool : <code class="type">Buffer.t -> bool -> unit</code></pre><div class="info"> <code class="code">buf_bool b i</code> encodes a boolean <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_float"></a>buf_float : <code class="type">Buffer.t -> float -> unit</code></pre><div class="info"> <code class="code">buf_float b f</code> encodes a floating-point number <code class="code">f</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_int64"></a>buf_int64 : <code class="type">Buffer.t -> Int64.t -> unit</code></pre><div class="info"> <code class="code">buf_int64 b i</code> encodes an int64 <code class="code">i</code> in the buffer <code class="code">b</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALbuf_list16"></a>buf_list16 : <code class="type">(Buffer.t -> 'a -> unit) -> Buffer.t -> 'a list -> unit</code></pre><div class="info"> <code class="code">buf_list16 f b l</code> encodes the list <code class="code">l</code> in the buffer <code class="code">b</code>, with the function <code class="code">f</code> specifying how to encode an item of <code class="code">l</code>.<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONIncompleteMessage"></a>IncompleteMessage</pre> <div class="info"> <br> </div> <br> Decoding functions<br> <br> <br> <pre><span class="keyword">val</span> <a name="VALget_uint8"></a>get_uint8 : <code class="type">string -> int -> int</code></pre><div class="info"> <code class="code">get_uint8 s pos</code> decodes a byte in <code class="code">s</code> at the position <code class="code">pos</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int16"></a>get_int16 : <code class="type">string -> int -> int * int</code></pre><div class="info"> <code class="code">get_int16 s pos</code> decodes two bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 16 bits integer along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int31"></a>get_int31 : <code class="type">string -> int -> int * int</code></pre><div class="info"> <code class="code">get_int31 s pos</code> decodes four bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 31 bits integer along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int63"></a>get_int63 : <code class="type">string -> int -> int * int</code></pre><div class="info"> <code class="code">get_int63 s pos</code> decodes eight bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 63 bits integer along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int64"></a>get_int64 : <code class="type">string -> int -> Int64.t * int</code></pre><div class="info"> <code class="code">get_int64 s pos</code> decodes eight bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 63 bits integer along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int63_of_31"></a>get_int63_of_31 : <code class="type">string -> int -> int * int</code></pre><div class="info"> <code class="code">get_int63_of_31 s pos</code> decodes four bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 63 bits integer along with the new position in <code class="code">s</code>, made from the 31 bits integer.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_int64_of_63"></a>get_int64_of_63 : <code class="type">string -> int -> Int64.t * int</code></pre><div class="info"> <code class="code">get_int64_of_63 s pos</code> decodes eight bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a 64 bits integer along with the new position in <code class="code">s</code>, made from the 63 bits integer.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_float"></a>get_float : <code class="type">string -> int -> float * int</code></pre><div class="info"> <code class="code">get_float s pos</code> decodes eight bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a floating-point number along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_string"></a>get_string : <code class="type">string -> int -> int -> string * int</code></pre><div class="info"> <code class="code">get_string s pos len</code> decodes <code class="code">len</code> bytes in <code class="code">s</code> at the position <code class="code">pos</code> and return a string along with the new position in <code class="code">s</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_list16"></a>get_list16 : <code class="type">(string -> int -> int -> 'a * int) -> string -> int -> int -> 'a list * int</code></pre><div class="info"> <code class="code">get_list16 f s pos last</code> decodes <code class="code">last</code>-<code class="code">pos</code> bytes in <code class="code">s</code>, at the position <code class="code">pos</code>, with the function <code class="code">f</code> that specifies how to get an item, and returns a 'b list.<br> </div> <pre><span class="keyword">val</span> <a name="VALget_bool"></a>get_bool : <code class="type">string -> int -> bool</code></pre><div class="info"> <code class="code">get_bool s pos</code> decodes a byte in <code class="code">s</code> at the position <code class="code">pos</code> and return a boolean along with the new position in <code class="code">s</code>.<br> </div> </body></html>