Source file srt_generated_stubs.ml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
module CI = Cstubs_internals
external ocaml_srt_1_srt_startup : unit -> unit = "ocaml_srt_1_srt_startup"
external ocaml_srt_2_srt_cleanup : unit -> unit = "ocaml_srt_2_srt_cleanup"
external ocaml_srt_3_srt_getlasterror : _ CI.fatptr -> int32
= "ocaml_srt_3_srt_getlasterror"
external ocaml_srt_4_srt_getlasterror_str : unit -> CI.voidp
= "ocaml_srt_4_srt_getlasterror_str"
external ocaml_srt_5_srt_clearlasterror : unit -> unit
= "ocaml_srt_5_srt_clearlasterror"
external ocaml_srt_6_srt_create_socket : unit -> int
= "ocaml_srt_6_srt_create_socket"
external ocaml_srt_7_srt_bind : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_7_srt_bind"
external ocaml_srt_8_strlen : _ CI.fatptr -> int = "ocaml_srt_8_strlen"
external ocaml_srt_9_srt_listen : int -> int -> int
= "ocaml_srt_9_srt_listen"
external ocaml_srt_10_srt_listen_callback
: int -> _ CI.fatfunptr -> _ CI.fatptr -> int
= "ocaml_srt_10_srt_listen_callback"
external ocaml_srt_11_srt_accept : int -> _ CI.fatptr -> _ CI.fatptr -> int
= "ocaml_srt_11_srt_accept"
external ocaml_srt_12_srt_connect : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_12_srt_connect"
external ocaml_srt_13_srt_rendezvous
: int -> _ CI.fatptr -> int -> _ CI.fatptr -> int -> int
= "ocaml_srt_13_srt_rendezvous"
external ocaml_srt_14_srt_send : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_14_srt_send"
external ocaml_srt_15_srt_recv : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_15_srt_recv"
external ocaml_srt_16_srt_recvmsg : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_16_srt_recvmsg"
external ocaml_srt_17_srt_sendmsg
: int -> _ CI.fatptr -> int -> int -> bool -> int
= "ocaml_srt_17_srt_sendmsg"
external ocaml_srt_18_srt_setsockflag
: int -> Unsigned.uint32 -> _ CI.fatptr -> int -> int
= "ocaml_srt_18_srt_setsockflag"
external ocaml_srt_19_srt_getsockflag
: int -> Unsigned.uint32 -> _ CI.fatptr -> _ CI.fatptr -> int
= "ocaml_srt_19_srt_getsockflag"
external ocaml_srt_20_srt_getsockstate : int -> Unsigned.uint32
= "ocaml_srt_20_srt_getsockstate"
external ocaml_srt_21_srt_setloglevel : int -> unit
= "ocaml_srt_21_srt_setloglevel"
external ocaml_srt_22_srt_close : int -> int = "ocaml_srt_22_srt_close"
external ocaml_srt_23_srt_epoll_create : unit -> int
= "ocaml_srt_23_srt_epoll_create"
external ocaml_srt_24_srt_epoll_add_usock : int -> int -> _ CI.fatptr -> int
= "ocaml_srt_24_srt_epoll_add_usock"
external ocaml_srt_25_srt_epoll_remove_usock : int -> int -> int
= "ocaml_srt_25_srt_epoll_remove_usock"
external ocaml_srt_26_srt_epoll_update_usock
: int -> int -> _ CI.fatptr -> int = "ocaml_srt_26_srt_epoll_update_usock"
external ocaml_srt_27_srt_epoll_uwait
: int -> _ CI.fatptr -> int -> int64 -> int
= "ocaml_srt_27_srt_epoll_uwait"
external ocaml_srt_28_srt_epoll_wait
: int -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr ->
int64 -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> _ CI.fatptr -> int
= "ocaml_srt_28_srt_epoll_wait_byte10" "ocaml_srt_28_srt_epoll_wait"
external ocaml_srt_29_srt_epoll_release : int -> int
= "ocaml_srt_29_srt_epoll_release"
external ocaml_srt_30_srt_bstats : int -> _ CI.fatptr -> int -> int
= "ocaml_srt_30_srt_bstats"
external ocaml_srt_31_srt_bistats : int -> _ CI.fatptr -> int -> int -> int
= "ocaml_srt_31_srt_bistats"
type 'a result = 'a
type 'a return = 'a
type 'a fn =
| Returns : 'a CI.typ -> 'a return fn
| Function : 'a CI.typ * 'b fn -> ('a -> 'b) fn
let map_result f x = f x
let returning t = Returns t
let (@->) f p = Function (f, p)
let foreign : type a b. string -> (a -> b) fn -> (a -> b) =
fun name t -> match t, name with
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Int,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))))),
"srt_bistats" ->
(fun x1 x2 x4 x5 ->
let CI.CPointer x3 = x2 in ocaml_srt_31_srt_bistats x1 x3 x4 x5)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_bstats" ->
(fun x6 x7 x9 ->
let CI.CPointer x8 = x7 in ocaml_srt_30_srt_bstats x6 x8 x9)
| Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)),
"srt_epoll_release" -> ocaml_srt_29_srt_epoll_release
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Int64_t,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Pointer _,
Function
(CI.Pointer _, Returns (CI.Primitive CI.Int))))))))))),
"srt_epoll_wait" ->
(fun x11 x12 x14 x16 x18 x20 x21 x23 x25 x27 ->
let CI.CPointer x28 = x27 in
let CI.CPointer x26 = x25 in
let CI.CPointer x24 = x23 in
let CI.CPointer x22 = x21 in
let CI.CPointer x19 = x18 in
let CI.CPointer x17 = x16 in
let CI.CPointer x15 = x14 in
let CI.CPointer x13 = x12 in
ocaml_srt_28_srt_epoll_wait x11 x13 x15 x17 x19 x20 x22 x24 x26 x28)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Int,
Function (CI.Primitive CI.Int64_t, Returns (CI.Primitive CI.Int))))),
"srt_epoll_uwait" ->
(fun x29 x30 x32 x33 ->
let CI.CPointer x31 = x30 in ocaml_srt_27_srt_epoll_uwait x29 x31 x32 x33)
| Function
(CI.Primitive CI.Int,
Function
(CI.Primitive CI.Int,
Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))),
"srt_epoll_update_usock" ->
(fun x34 x35 x36 ->
let CI.CPointer x37 = x36 in
ocaml_srt_26_srt_epoll_update_usock x34 x35 x37)
| Function
(CI.Primitive CI.Int,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))),
"srt_epoll_remove_usock" -> ocaml_srt_25_srt_epoll_remove_usock
| Function
(CI.Primitive CI.Int,
Function
(CI.Primitive CI.Int,
Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))),
"srt_epoll_add_usock" ->
(fun x40 x41 x42 ->
let CI.CPointer x43 = x42 in ocaml_srt_24_srt_epoll_add_usock x40 x41 x43)
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "srt_epoll_create" ->
ocaml_srt_23_srt_epoll_create
| Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)), "srt_close" ->
ocaml_srt_22_srt_close
| Function (CI.Primitive CI.Int, Returns CI.Void), "srt_setloglevel" ->
ocaml_srt_21_srt_setloglevel
| Function
(CI.Primitive CI.Int,
Returns (CI.View {CI.ty = CI.Primitive CI.Uint32_t; read = x48; _})),
"srt_getsockstate" -> (fun x47 -> x48 (ocaml_srt_20_srt_getsockstate x47))
| Function
(CI.Primitive CI.Int,
Function
(CI.View {CI.ty = CI.Primitive CI.Uint32_t; write = x51; _},
Function
(CI.Pointer _,
Function (CI.Pointer _, Returns (CI.Primitive CI.Int))))),
"srt_getsockflag" ->
(fun x49 x50 x53 x55 ->
let CI.CPointer x56 = x55 in
let CI.CPointer x54 = x53 in
let x52 = x51 x50 in ocaml_srt_19_srt_getsockflag x49 x52 x54 x56)
| Function
(CI.Primitive CI.Int,
Function
(CI.View {CI.ty = CI.Primitive CI.Uint32_t; write = x59; _},
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))))),
"srt_setsockflag" ->
(fun x57 x58 x61 x63 ->
let CI.CPointer x62 = x61 in
let x60 = x59 x58 in ocaml_srt_18_srt_setsockflag x57 x60 x62 x63)
| Function
(CI.Primitive CI.Int,
Function
(CI.View {CI.ty = CI.Pointer _; write = x66; _},
Function
(CI.Primitive CI.Int,
Function
(CI.Primitive CI.Int,
Function (CI.Primitive CI.Bool, Returns (CI.Primitive CI.Int)))))),
"srt_sendmsg" ->
(fun x64 x65 x69 x70 x71 ->
let CI.CPointer x68 = x66 x65 in
let x67 = x68 in ocaml_srt_17_srt_sendmsg x64 x67 x69 x70 x71)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_recvmsg" ->
(fun x72 x73 x75 ->
let CI.CPointer x74 = x73 in ocaml_srt_16_srt_recvmsg x72 x74 x75)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_recv" ->
(fun x76 x77 x79 ->
let CI.CPointer x78 = x77 in ocaml_srt_15_srt_recv x76 x78 x79)
| Function
(CI.Primitive CI.Int,
Function
(CI.View {CI.ty = CI.Pointer _; write = x82; _},
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_send" ->
(fun x80 x81 x85 ->
let CI.CPointer x84 = x82 x81 in
let x83 = x84 in ocaml_srt_14_srt_send x80 x83 x85)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))))),
"srt_rendezvous" ->
(fun x86 x87 x89 x90 x92 ->
let CI.CPointer x91 = x90 in
let CI.CPointer x88 = x87 in
ocaml_srt_13_srt_rendezvous x86 x88 x89 x91 x92)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_connect" ->
(fun x93 x94 x96 ->
let CI.CPointer x95 = x94 in ocaml_srt_12_srt_connect x93 x95 x96)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _, Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))),
"srt_accept" ->
(fun x97 x98 x100 ->
let CI.CPointer x101 = x100 in
let CI.CPointer x99 = x98 in ocaml_srt_11_srt_accept x97 x99 x101)
| Function
(CI.Primitive CI.Int,
Function
(CI.View {CI.ty = CI.Funptr _; write = x104; _},
Function (CI.Pointer _, Returns (CI.Primitive CI.Int)))),
"srt_listen_callback" ->
(fun x102 x103 x107 ->
let CI.CPointer x108 = x107 in
let CI.Static_funptr x106 = x104 x103 in
let x105 = x106 in ocaml_srt_10_srt_listen_callback x102 x105 x108)
| Function
(CI.Primitive CI.Int,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int))),
"srt_listen" -> ocaml_srt_9_srt_listen
| Function (CI.Pointer _, Returns (CI.Primitive CI.Int)), "strlen" ->
(fun x111 -> let CI.CPointer x112 = x111 in ocaml_srt_8_strlen x112)
| Function
(CI.Primitive CI.Int,
Function
(CI.Pointer _,
Function (CI.Primitive CI.Int, Returns (CI.Primitive CI.Int)))),
"srt_bind" ->
(fun x113 x114 x116 ->
let CI.CPointer x115 = x114 in ocaml_srt_7_srt_bind x113 x115 x116)
| Function (CI.Void, Returns (CI.Primitive CI.Int)), "srt_create_socket" ->
ocaml_srt_6_srt_create_socket
| Function (CI.Void, Returns CI.Void), "srt_clearlasterror" ->
ocaml_srt_5_srt_clearlasterror
| Function
(CI.Void,
Returns
(CI.View
{CI.ty = CI.View {CI.ty = CI.Pointer x120; read = x121; _};
read = x122; _})),
"srt_getlasterror_str" ->
(fun x119 ->
x122 (x121 (CI.make_ptr x120 (ocaml_srt_4_srt_getlasterror_str x119))))
| Function
(CI.Pointer _,
Returns (CI.View {CI.ty = CI.Primitive CI.Int32_t; read = x125; _})),
"srt_getlasterror" ->
(fun x123 ->
let CI.CPointer x124 = x123 in x125 (ocaml_srt_3_srt_getlasterror x124))
| Function (CI.Void, Returns CI.Void), "srt_cleanup" ->
ocaml_srt_2_srt_cleanup
| Function (CI.Void, Returns CI.Void), "srt_startup" ->
ocaml_srt_1_srt_startup
| _, s -> Printf.ksprintf failwith "No match for %s" s
let foreign_value : type a. string -> a Ctypes.typ -> a Ctypes.ptr =
fun name t -> match t, name with
| _, s -> Printf.ksprintf failwith "No match for %s" s