-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathiocaml_zmq.mli
111 lines (86 loc) · 3.73 KB
/
iocaml_zmq.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
(*
The ZMQ API has been taken from https://github.com/issuu/ocaml-zmq
Copyright (c) 2012 Hezekiah M. Carty
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*)
module ZMQ : sig
module Context : sig
type t
val create : unit -> t
val terminate : t -> unit
end
module Socket : sig
type 'a t
type 'a kind
val pair : [>`Pair] kind
val pub : [>`Pub] kind
val sub : [>`Sub] kind
val req : [>`Req] kind
val rep : [>`Rep] kind
val dealer : [>`Dealer] kind
val router : [>`Router] kind
val pull : [>`Pull] kind
val push : [>`Push] kind
val xsub : [>`Xsub] kind
val xpub : [>`Xpub] kind
val create : Context.t -> 'a kind -> 'a t
val close : 'a t -> unit
val bind : 'a t -> string -> unit
val connect : 'a t -> string -> unit
val has_more : 'a t -> bool
val get_fd : 'a t -> Unix.file_descr
val set_linger_period : 'a t -> int -> unit
val set_identity : 'a t -> string -> unit
val subscribe : [> `Sub] t -> string -> unit
val send : ?block:bool -> ?more:bool -> 'a t -> string -> unit
val send_all : ?block:bool -> 'a t -> string list -> unit
val recv : ?block:bool -> 'a t -> string
val recv_all : ?block:bool -> 'a t -> string list
type event = No_event | Poll_in | Poll_out | Poll_in_out | Poll_error
val events : 'a t -> event
end
end
(*
Taken from https://github.com/hcarty/lwt-zmq
Copyright (c) 2012 Hezekiah M. Carty
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*)
module Lwt_zmq : sig
module Socket : sig
type 'a t
val of_socket : 'a ZMQ.Socket.t -> 'a t
val to_socket : 'a t -> 'a ZMQ.Socket.t
val recv : 'a t -> string Lwt.t
val send : 'a t -> string -> unit Lwt.t
val recv_all : 'a t -> string list Lwt.t
val send_all : 'a t -> string list -> unit Lwt.t
end
end