Skip to content
This repository
Newer
Older
100644 59 lines (38 sloc) 1.54 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (*
19 @author Adam Koprowski
20 *)
21
22 (* TODO hide implementation? *)
23 type protocol = string
24
25 type fd = Unix.file_descr
26
27 type addr = Unix.inet_addr
28
29 type connection_type = TCP | UDP | SSL | FILE
30
31 (** A complete network address *)
32 type t
33
34 (* FIXME, this function is identity for now but can be used to
35 ease possible futher transition to hiding implementation
36 of [protocol] *)
37 val mk_protocol : string -> protocol
38
39 val mk_tcp : protocol:protocol -> fd:fd -> addr:addr -> t
40
41 val mk_udp : protocol:protocol -> fd:fd -> addr:addr -> t
42
43 val mk_file : fd:fd -> t
44
45 val get_type : t -> connection_type
46
47 val get_addr : t -> addr
48
49 val get_fd : t -> fd
50
51 val get_protocol : t -> protocol
52
53 val get_type_and_fd : t -> [`Tcp of fd | `Udp of fd | `File of fd | `Ssl of Ssl.socket]
54
55 val secured_from_normal : Ssl.socket -> t -> t
56
57 val string_of_sockaddr : Unix.sockaddr -> string
58
59 val to_string : t -> string
Something went wrong with that request. Please try again.