-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasync_conn.mli
56 lines (45 loc) · 1.75 KB
/
async_conn.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(*
* Copyright (C) 2009 Citrix Ltd.
* Author Prashanth Mundkur <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (version
* 2.1 only) as published by the Free Software Foundation, with the
* special exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
(* Convenience asynchronous connection, for use with the Eventloop
module.
This module provides a more convenient API for the IO callbacks.
*)
type t
val compare : t -> t -> int
val hash : t -> int
type callbacks = {
connect_callback : t -> unit;
recv_callback : t -> string -> (* offset *) int -> (* length *) int -> unit;
send_done_callback : t -> unit;
shutdown_callback : t -> unit;
error_callback : t -> Eventloop.error -> unit;
}
val attach : Eventloop.t -> Unix.file_descr -> ?enable_send_done:bool -> ?enable_recv:bool -> callbacks -> t
val detach : t -> unit
val close : t -> unit
val enable_send_done : t -> unit
val disable_send_done : t -> unit
val enable_recv : t -> unit
val disable_recv : t -> unit
val connect : t -> Unix.sockaddr -> unit
val send : t -> string -> unit
val send_substring : t -> string -> (* offset *) int -> (* length *) int -> unit
val send_buffer : t -> Buffer.t -> unit
val has_pending_send : t -> bool
val set_callbacks : t -> callbacks -> unit
val get_handle : t -> Eventloop.handle
val get_eventloop : t -> Eventloop.t
val get_fd : t -> Unix.file_descr
val get_send_buf : t -> Buffer.t