package srt

  1. Overview
  2. Docs

Source file srt_constants.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
module Def (S : Cstubs.Types.TYPE) = struct
  open S

  type socket_status =
    [ `Init
    | `Opened
    | `Listening
    | `Connecting
    | `Connected
    | `Broken
    | `Closing
    | `Closed
    | `Nonexist ]

  type socket_opt =
    [ `Messageapi
    | `Payloadsize
    | `Transtype
    | `Rcvsyn
    | `Sndsyn
    | `Conntimeo
    | `Rcvtimeo
    | `Sndtimeo
    | `Reuseaddr
    | `Rcvbuf
    | `Rcvdata
    | `Rcvlatency
    | `Sndbuf
    | `Udp_rcvbuf
    | `Udp_sndbuf
    | `Enforced_encryption
    | `Pbkeylen
    | `Passphrase
    | `Streamid
    | `Ipv6only
    | `Latency
    | `Peerlatency ]

  type transtype = [ `Live | `File | `Invalid ]
  type poll_flag = [ `Read | `Write | `Error ]

  type errno =
    [ `Easyncfail
    | `Easyncrcv
    | `Easyncsnd
    | `Eboundsock
    | `Econgest
    | `Econnfail
    | `Econnlost
    | `Econnrej
    | `Econnsetup
    | `Econnsock
    | `Eduplisten
    | `Efile
    | `Einvalbufferapi
    | `Einvalmsgapi
    | `Einvop
    | `Einvparam
    | `Einvpollid
    | `Einvrdoff
    | `Einvsock
    | `Einvwroff
    | `Elargemsg
    | `Enobuf
    | `Enoconn
    | `Enolisten
    | `Enoserver
    | `Epeererr
    | `Epollempty
    | `Erdperm
    | `Erdvnoserv
    | `Erdvunbound
    | `Eresource
    | `Esclosed
    | `Esecfail
    | `Esockfail
    | `Esysobj
    | `Ethread
    | `Etimeout
    | `Eunboundsock
    | `Eunknown
    | `Ewrperm
    | `Success ]

  let enable_lostbytecount = constant "SRT_ENABLE_LOSTBYTESCOUNT" bool

  let socket_status : socket_status typ =
    enum "SRT_SOCKSTATUS"
      [
        (`Init, constant "SRTS_INIT" int64_t);
        (`Opened, constant "SRTS_OPENED" int64_t);
        (`Listening, constant "SRTS_LISTENING" int64_t);
        (`Connecting, constant "SRTS_CONNECTING" int64_t);
        (`Connected, constant "SRTS_CONNECTED" int64_t);
        (`Broken, constant "SRTS_BROKEN" int64_t);
        (`Closing, constant "SRTS_CLOSING" int64_t);
        (`Closed, constant "SRTS_CLOSED" int64_t);
        (`Nonexist, constant "SRTS_NONEXIST" int64_t);
      ]

  let socket_opt : socket_opt typ =
    enum "SRT_SOCKOPT"
      [
        (`Messageapi, constant "SRTO_MESSAGEAPI" int64_t);
        (`Payloadsize, constant "SRTO_PAYLOADSIZE" int64_t);
        (`Transtype, constant "SRTO_TRANSTYPE" int64_t);
        (`Rcvsyn, constant "SRTO_RCVSYN" int64_t);
        (`Sndsyn, constant "SRTO_SNDSYN" int64_t);
        (`Conntimeo, constant "SRTO_CONNTIMEO" int64_t);
        (`Rcvtimeo, constant "SRTO_RCVTIMEO" int64_t);
        (`Sndtimeo, constant "SRTO_SNDTIMEO" int64_t);
        (`Reuseaddr, constant "SRTO_REUSEADDR" int64_t);
        (`Rcvbuf, constant "SRTO_RCVBUF" int64_t);
        (`Rcvdata, constant "SRTO_RCVDATA" int64_t);
        (`Rcvlatency, constant "SRTO_RCVLATENCY" int64_t);
        (`Sndbuf, constant "SRTO_SNDBUF" int64_t);
        (`Udp_rcvbuf, constant "SRTO_UDP_RCVBUF" int64_t);
        (`Udp_sndbuf, constant "SRTO_UDP_SNDBUF" int64_t);
        (`Enforced_encryption, constant "SRTO_ENFORCEDENCRYPTION" int64_t);
        (`Passphrase, constant "SRTO_PASSPHRASE" int64_t);
        (`Pbkeylen, constant "SRTO_PBKEYLEN" int64_t);
        (`Streamid, constant "SRTO_STREAMID" int64_t);
        (`Ipv6only, constant "SRTO_IPV6ONLY" int64_t);
        (`Latency, constant "SRTO_LATENCY" int64_t);
        (`Latency, constant "SRTO_PEERLATENCY" int64_t);
      ]

  let srtt_live = constant "SRTT_LIVE" int64_t
  let srtt_file = constant "SRTT_FILE" int64_t
  let srtt_invalid = constant "SRTT_INVALID" int64_t

  let transtype : transtype typ =
    enum "SRT_TRANSTYPE"
      [(`Live, srtt_live); (`File, srtt_file); (`Invalid, srtt_invalid)]

  let log_crit = constant "LOG_CRIT" int
  let log_err = constant "LOG_ERR" int
  let log_warning = constant "LOG_WARNING" int
  let log_notice = constant "LOG_NOTICE" int
  let log_debug = constant "LOG_DEBUG" int

  let errno : errno typ =
    enum "SRT_ERRNO"
      [
        (`Easyncfail, constant "SRT_EASYNCFAIL" int64_t);
        (`Easyncrcv, constant "SRT_EASYNCRCV" int64_t);
        (`Easyncsnd, constant "SRT_EASYNCSND" int64_t);
        (`Eboundsock, constant "SRT_EBOUNDSOCK" int64_t);
        (`Econgest, constant "SRT_ECONGEST" int64_t);
        (`Econnfail, constant "SRT_ECONNFAIL" int64_t);
        (`Econnlost, constant "SRT_ECONNLOST" int64_t);
        (`Econnrej, constant "SRT_ECONNREJ" int64_t);
        (`Econnsetup, constant "SRT_ECONNSETUP" int64_t);
        (`Econnsock, constant "SRT_ECONNSOCK" int64_t);
        (`Eduplisten, constant "SRT_EDUPLISTEN" int64_t);
        (`Efile, constant "SRT_EFILE" int64_t);
        (`Einvalbufferapi, constant "SRT_EINVALBUFFERAPI" int64_t);
        (`Einvalmsgapi, constant "SRT_EINVALMSGAPI" int64_t);
        (`Einvop, constant "SRT_EINVOP" int64_t);
        (`Einvparam, constant "SRT_EINVPARAM" int64_t);
        (`Einvpollid, constant "SRT_EINVPOLLID" int64_t);
        (`Einvrdoff, constant "SRT_EINVRDOFF" int64_t);
        (`Einvsock, constant "SRT_EINVSOCK" int64_t);
        (`Einvwroff, constant "SRT_EINVWROFF" int64_t);
        (`Elargemsg, constant "SRT_ELARGEMSG" int64_t);
        (`Enobuf, constant "SRT_ENOBUF" int64_t);
        (`Enoconn, constant "SRT_ENOCONN" int64_t);
        (`Enolisten, constant "SRT_ENOLISTEN" int64_t);
        (`Enoserver, constant "SRT_ENOSERVER" int64_t);
        (`Epeererr, constant "SRT_EPEERERR" int64_t);
        (`Epollempty, constant "SRT_EPOLLEMPTY" int64_t);
        (`Erdperm, constant "SRT_ERDPERM" int64_t);
        (`Erdvnoserv, constant "SRT_ERDVNOSERV" int64_t);
        (`Erdvunbound, constant "SRT_ERDVUNBOUND" int64_t);
        (`Eresource, constant "SRT_ERESOURCE" int64_t);
        (`Esclosed, constant "SRT_ESCLOSED" int64_t);
        (`Esecfail, constant "SRT_ESECFAIL" int64_t);
        (`Esockfail, constant "SRT_ESOCKFAIL" int64_t);
        (`Esysobj, constant "SRT_ESYSOBJ" int64_t);
        (`Ethread, constant "SRT_ETHREAD" int64_t);
        (`Etimeout, constant "SRT_ETIMEOUT" int64_t);
        (`Eunboundsock, constant "SRT_EUNBOUNDSOCK" int64_t);
        (`Eunknown, constant "SRT_EUNKNOWN" int64_t);
        (`Ewrperm, constant "SRT_EWRPERM" int64_t);
        (`Success, constant "SRT_SUCCESS" int64_t);
      ]

  let srt_epoll_in = constant "SRT_EPOLL_IN" int64_t
  let srt_epoll_out = constant "SRT_EPOLL_OUT" int64_t
  let srt_epoll_err = constant "SRT_EPOLL_ERR" int64_t

  let poll_flag_of_flag = function
    | `Read -> srt_epoll_in
    | `Write -> srt_epoll_out
    | `Error -> srt_epoll_err

  let poll_flag : poll_flag typ =
    enum "SRT_EPOLL_OPT"
      [
        (`Read, constant "SRT_EPOLL_IN" int64_t);
        (`Write, constant "SRT_EPOLL_OUT" int64_t);
        (`Error, constant "SRT_EPOLL_ERR" int64_t);
      ]
end
OCaml

Innovation. Community. Security.