forked from fastly/compute-at-edge-abi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
typenames.witx
360 lines (339 loc) · 13.1 KB
/
typenames.witx
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
;;; Status codes returned from hostcalls.
(typename $fastly_status
(enum (@witx tag u32)
;;; Success value.
;;;
;;; This indicates that a hostcall finished successfully.
$ok
;;; Generic error value.
;;;
;;; This means that some unexpected error occurred during a hostcall.
$error
;;; Invalid argument.
$inval
;;; Invalid handle.
;;;
;;; Returned when a request, response, or body handle is not valid.
$badf
;;; Buffer length error.
;;;
;;; Returned when a buffer is too long.
$buflen
;;; Unsupported operation error.
;;;
;;; This error is returned when some operation cannot be performed, because it is not supported.
$unsupported
;;; Alignment error.
;;;
;;; This is returned when a pointer does not point to a properly aligned slice of memory.
$badalign
;;; Invalid HTTP error.
;;;
;;; This can be returned when a method, URI, header, or status is not valid. This can also
;;; be returned if a message head is too large.
$httpinvalid
;;; HTTP user error.
;;;
;;; This is returned in cases where user code caused an HTTP error. For example, attempt to send
;;; a 1xx response code, or a request with a non-absolute URI. This can also be caused by
;;; an unexpected header: both `content-length` and `transfer-encoding`, for example.
$httpuser
;;; HTTP incomplete message error.
;;;
;;; This can be returned when a stream ended unexpectedly.
$httpincomplete
;;; A `None` error.
;;;
;;; This status code is used to indicate when an optional value did not exist, as opposed to
;;; an empty value.
$none
;;; Message head too large.
$httpheadtoolarge
;;; Invalid HTTP status.
$httpinvalidstatus
;;; Limit exceeded
;;;
;;; This is returned when an attempt to allocate a resource has exceeded the maximum number of
;;; resources permitted. For example, creating too many response handles.
$limitexceeded
;;; Resource temporarily unavailable
;;;
;;; This is returned when an attempting to retrieve a resource that is not yet available.
;;; For example when attempting to read trailers from a Body that has not yet been consumed.
$again))
;;; A tag indicating HTTP protocol versions.
(typename $http_version
(enum (@witx tag u32)
$http_09
$http_10
$http_11
$h2
$h3))
;;; HTTP status codes.
(typename $http_status u16)
(typename $body_write_end
(enum (@witx tag u32)
$back
$front))
;;; A handle to an HTTP request or response body.
(typename $body_handle (handle))
;;; A handle to an HTTP request.
(typename $request_handle (handle))
;;; A handle to an HTTP response.
(typename $response_handle (handle))
;;; A handle to a currently-pending asynchronous HTTP request.
(typename $pending_request_handle (handle))
;;; A handle to a logging endpoint.
(typename $endpoint_handle (handle))
;;; A handle to an Edge Dictionary.
(typename $dictionary_handle (handle))
;;; A handle to an Object Store.
(typename $object_store_handle (handle))
;;; A handle to a pending Object Store lookup.
(typename $pending_object_store_lookup_handle (handle))
;;; A handle to a pending Object Store insert.
(typename $pending_object_store_insert_handle (handle))
;;; A handle to a pending Object Store delete.
(typename $pending_object_store_delete_handle (handle))
;;; A handle to a Secret Store.
(typename $secret_store_handle (handle))
;;; A handle to an individual secret.
(typename $secret_handle (handle))
;;; A handle to an object supporting generic async operations.
;;; Can be either a `body_handle` or a `pending_request_handle`.
;;;
;;; Each async item has an associated I/O action:
;;;
;;; * Pending requests: awaiting the response headers / `Response` object
;;; * Normal bodies: reading bytes from the body
;;; * Streaming bodies: writing bytes to the body
;;;
;;; For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written
;;; into, even before the origin itself consumes that data.
(typename $async_item_handle (handle))
;;; A "multi-value" cursor.
(typename $multi_value_cursor u32)
;;; -1 represents "finished", non-negative represents a $multi_value_cursor:
(typename $multi_value_cursor_result s64)
;;; An override for response caching behavior.
;;; A zero value indicates that the origin response's cache control headers should be used.
(typename $cache_override_tag
(flags (@witx repr u32)
;;; Do not cache the response to this request, regardless of the origin response's headers.
$pass
$ttl
$stale_while_revalidate
$pci))
(typename $num_bytes (@witx usize))
(typename $header_count u32)
(typename $is_done u32)
(typename $done_idx u32)
(typename $is_valid u32)
(typename $inserted u32)
(typename $ready_idx u32)
(typename $port u16)
(typename $timeout_ms u32)
(typename $backend_exists u32)
(typename $is_dynamic u32)
(typename $is_ssl u32)
(typename $backend_health
(enum (@witx tag u32)
$unknown
$healthy
$unhealthy))
(typename $content_encodings
(flags (@witx repr u32)
$gzip))
(typename $framing_headers_mode
(enum (@witx tag u32)
$automatic
$manually_from_headers))
(typename $http_keepalive_mode
(enum (@witx tag u32)
$automatic
$no_keepalive))
(typename $tls_version
(enum (@witx tag u32)
$tls_1
$tls_1_1
$tls_1_2
$tls_1_3))
(typename $backend_config_options
(flags (@witx repr u32)
$reserved
$host_override
$connect_timeout
$first_byte_timeout
$between_bytes_timeout
$use_ssl
$ssl_min_version
$ssl_max_version
$cert_hostname
$ca_cert
$ciphers
$sni_hostname
$dont_pool
$client_cert
$grpc
))
(typename $dynamic_backend_config
(record
(field $host_override (@witx pointer (@witx char8)))
(field $host_override_len u32)
(field $connect_timeout_ms u32)
(field $first_byte_timeout_ms u32)
(field $between_bytes_timeout_ms u32)
(field $ssl_min_version $tls_version)
(field $ssl_max_version $tls_version)
(field $cert_hostname (@witx pointer (@witx char8)))
(field $cert_hostname_len u32)
(field $ca_cert (@witx pointer (@witx char8)))
(field $ca_cert_len u32)
(field $ciphers (@witx pointer (@witx char8)))
(field $ciphers_len u32)
(field $sni_hostname (@witx pointer (@witx char8)))
(field $sni_hostname_len u32)
(field $client_certificate (@witx pointer (@witx char8)))
(field $client_certificate_len u32)
(field $client_key $secret_handle)
))
;;; TLS client certificate verified result from downstream.
(typename $client_cert_verify_result
(enum (@witx tag u32)
;;; Success value.
;;;
;;; This indicates that client certificate verified successfully.
$ok
;;; bad certificate error.
;;;
;;; This error means the certificate is corrupt
;;; (e.g., the certificate signatures do not verify correctly).
$bad_certificate
;;; certificate revoked error.
;;;
;;; This error means the client certificate is revoked by its signer.
$certificate_revoked
;;; certificate expired error.
;;;
;;; This error means the client certificate has expired or is not currently valid.
$certificate_expired
;;; unknown CA error.
;;;
;;; This error means the valid certificate chain or partial chain was received,
;;; but the certificate was not accepted because the CA certificate could not be
;;; located or could not be matched with a known trust anchor.
$unknown_ca
;;; certificate missing error.
;;;
;;; This error means the client does not provide a certificate
;;; during the handshake..
$certificate_missing
;;; certificate unknown error.
;;;
;;; This error means the client certificate was received, but some other (unspecified)
;;; issue arose in processing the certificate, rendering it unacceptable.
$certificate_unknown))
(typename $purge_options_mask
(flags (@witx repr u32)
$soft_purge
$ret_buf ;; all ret_buf fields must be populated
)
)
(typename $purge_options
(record
;; JSON purge response as in https://developer.fastly.com/reference/api/purging/#purge-tag
(field $ret_buf_ptr (@witx pointer u8))
(field $ret_buf_len (@witx usize))
(field $ret_buf_nwritten_out (@witx pointer (@witx usize)))
)
)
(typename $send_error_detail_tag
(enum (@witx tag u32)
;;; The $send_error_detail struct has not been populated.
$uninitialized
;;; There was no send error.
$ok
;;; The system encountered a timeout when trying to find an IP address for the backend
;;; hostname.
$dns_timeout
;;; The system encountered a DNS error when trying to find an IP address for the backend
;;; hostname. The fields $dns_error_rcode and $dns_error_info_code may be set in the
;;; $send_error_detail.
$dns_error
;;; The system cannot determine which backend to use, or the specified backend was invalid.
$destination_not_found
;;; The system considers the backend to be unavailable; e.g., recent attempts to communicate
;;; with it may have failed, or a health check may indicate that it is down.
$destination_unavailable
;;; The system cannot find a route to the next-hop IP address.
$destination_ip_unroutable
;;; The system's connection to the backend was refused.
$connection_refused
;;; The system's connection to the backend was closed before a complete response was
;;; received.
$connection_terminated
;;; The system's attempt to open a connection to the backend timed out.
$connection_timeout
;;; The system is configured to limit the number of connections it has to the backend, and
;;; that limit has been exceeded.
$connection_limit_reached
;;; The system encountered an error when verifying the certificate presented by the backend.
$tls_certificate_error
;;; The system encountered an error with the backend TLS configuration.
$tls_configuration_error
;;; The system received an incomplete response to the request from the backend.
$http_incomplete_response
;;; The system received a response to the request whose header section was considered too
;;; large.
$http_response_header_section_too_large
;;; The system received a response to the request whose body was considered too large.
$http_response_body_too_large
;;; The system reached a configured time limit waiting for the complete response.
$http_response_timeout
;;; The system received a response to the request whose status code or reason phrase was
;;; invalid.
$http_response_status_invalid
;;; The process of negotiating an upgrade of the HTTP version between the system and the
;;; backend failed.
$http_upgrade_failed
;;; The system encountered an HTTP protocol error when communicating with the backend. This
;;; error will only be used when a more specific one is not defined.
$http_protocol_error
;;; An invalid cache key was provided for the request.
$http_request_cache_key_invalid
;;; An invalid URI was provided for the request.
$http_request_uri_invalid
;;; The system encountered an unexpected internal error.
$internal_error
;;; The system received a TLS alert from the backend. The field $tls_alert_id may be set in
;;; the $send_error_detail.
$tls_alert_received
;;; The system encountered a TLS error when communicating with the backend, either during
;;; the handshake or afterwards.
$tls_protocol_error
))
;;; Mask representing which fields are understood by the guest, and which have been set by the host.
;;;
;;; When the guest calls hostcalls with a mask, it should set every bit in the mask that corresponds
;;; to a defined flag. This signals the host to write only to fields with a set bit, allowing
;;; forward compatibility for existing guest programs even after new fields are added to the struct.
(typename $send_error_detail_mask
(flags (@witx repr u32)
$reserved
$dns_error_rcode
$dns_error_info_code
$tls_alert_id
))
(typename $send_error_detail
(record
(field $tag $send_error_detail_tag)
(field $mask $send_error_detail_mask)
(field $dns_error_rcode u16)
(field $dns_error_info_code u16)
(field $tls_alert_id u8)
))
(typename $blocked u32)
(typename $rate u32)
(typename $count u32)
(typename $has u32)
(typename $body_length u64)