fastly_sys/
lib.rs

1// TODO ACF 2020-12-01: remove once this is fixed: https://github.com/rust-lang/rust/issues/79581
2#![allow(clashing_extern_declarations)]
3
4//! FFI bindings to the Fastly Compute ABI.
5//!
6//! This is a low-level package; the [`fastly`](https://docs.rs/fastly) crate wraps these functions
7//! in a much friendlier, Rust-like interface. You should not have to depend on this crate
8//! explicitly in your `Cargo.toml`.
9//!
10//! # Versioning and compatibility
11//!
12//! The Cargo version of this package was previously set according to compatibility with the
13//! Compute platform. Since the [`v0.25.0` release of the Fastly
14//! CLI](https://github.com/fastly/cli/releases/tag/v0.25.0), the CLI is configured with the range
15//! of `fastly-sys` versions that are currently compatible with the Compute platform. The Cargo
16//! version of this package since `0.4.0` instead follows the [Cargo SemVer compatibility
17//! guidelines](https://doc.rust-lang.org/cargo/reference/semver.html).
18use fastly_shared::FastlyStatus;
19
20pub mod fastly_cache;
21pub mod fastly_config_store;
22pub mod fastly_http_cache;
23
24// The following type aliases are used for readability of definitions in this module. They should
25// not be confused with types of similar names in the `fastly` crate which are used to provide safe
26// wrappers around these definitions.
27
28pub type AclHandle = u32;
29pub type AsyncItemHandle = u32;
30pub type BodyHandle = u32;
31pub type DictionaryHandle = u32;
32pub type KVStoreHandle = u32;
33pub type PendingObjectStoreDeleteHandle = u32;
34pub type PendingObjectStoreInsertHandle = u32;
35pub type PendingObjectStoreListHandle = u32;
36pub type PendingObjectStoreLookupHandle = u32;
37pub type PendingRequestHandle = u32;
38pub type RequestHandle = u32;
39pub type ResponseHandle = u32;
40pub type SecretHandle = u32;
41pub type SecretStoreHandle = u32;
42
43#[repr(C)]
44pub struct DynamicBackendConfig {
45    pub host_override: *const u8,
46    pub host_override_len: u32,
47    pub connect_timeout_ms: u32,
48    pub first_byte_timeout_ms: u32,
49    pub between_bytes_timeout_ms: u32,
50    pub ssl_min_version: u32,
51    pub ssl_max_version: u32,
52    pub cert_hostname: *const u8,
53    pub cert_hostname_len: u32,
54    pub ca_cert: *const u8,
55    pub ca_cert_len: u32,
56    pub ciphers: *const u8,
57    pub ciphers_len: u32,
58    pub sni_hostname: *const u8,
59    pub sni_hostname_len: u32,
60    pub client_certificate: *const u8,
61    pub client_certificate_len: u32,
62    pub client_key: SecretHandle,
63    pub http_keepalive_time_ms: u32,
64    pub tcp_keepalive_enable: u32,
65    pub tcp_keepalive_interval_secs: u32,
66    pub tcp_keepalive_probes: u32,
67    pub tcp_keepalive_time_secs: u32,
68}
69
70impl Default for DynamicBackendConfig {
71    fn default() -> Self {
72        DynamicBackendConfig {
73            host_override: std::ptr::null(),
74            host_override_len: 0,
75            connect_timeout_ms: 0,
76            first_byte_timeout_ms: 0,
77            between_bytes_timeout_ms: 0,
78            ssl_min_version: 0,
79            ssl_max_version: 0,
80            cert_hostname: std::ptr::null(),
81            cert_hostname_len: 0,
82            ca_cert: std::ptr::null(),
83            ca_cert_len: 0,
84            ciphers: std::ptr::null(),
85            ciphers_len: 0,
86            sni_hostname: std::ptr::null(),
87            sni_hostname_len: 0,
88            client_certificate: std::ptr::null(),
89            client_certificate_len: 0,
90            client_key: 0,
91            http_keepalive_time_ms: 0,
92            tcp_keepalive_enable: 0,
93            tcp_keepalive_interval_secs: 0,
94            tcp_keepalive_probes: 0,
95            tcp_keepalive_time_secs: 0,
96        }
97    }
98}
99
100/// Modes of KV Store insertion.
101///
102/// This type serves to facilitate alternative methods of key insertion.
103#[repr(C)]
104#[derive(Default, Clone, Copy)]
105pub enum InsertMode {
106    /// The default method of insertion. Create a key, or overwrite an existing one
107    #[default]
108    Overwrite,
109    /// Ensures the request will only succeed if the key doesn't already exist.
110    Add,
111    /// Updates the contents of a key by appending the body of the request to the existing key's contents. If the specified key does not exist, a new key is created.
112    Append,
113    /// Updates the contents of a key by prepending the body of the request onto the existing key's contents. If the specified key does not exist, a new key is created.
114    Prepend,
115}
116
117#[repr(C)]
118pub struct InsertConfig {
119    pub mode: InsertMode,
120    pub unused: u32,
121    pub metadata: *const u8,
122    pub metadata_len: u32,
123    pub time_to_live_sec: u32,
124    pub if_generation_match: u64,
125}
126
127impl Default for InsertConfig {
128    fn default() -> Self {
129        InsertConfig {
130            mode: InsertMode::Overwrite,
131            unused: 0,
132            metadata: std::ptr::null(),
133            metadata_len: 0,
134            time_to_live_sec: 0,
135            if_generation_match: 0,
136        }
137    }
138}
139
140/// Modes of KV Store list operations.
141///
142/// This type serves to facilitate alternative methods of cache interactions with list operations.
143#[repr(C)]
144#[derive(Default, Clone)]
145pub enum ListMode {
146    /// The default method of listing. Performs an un-cached list on every invocation.
147    #[default]
148    Strong,
149    /// Eventual mode will permit use of a cached list response. While the data may be out of sync, response time is much faster on repeated lists.
150    Eventual,
151    /// Other is a catch-all for unexpected responses from the upstream API. This should not be constructed by consumers of the SDK.
152    Other(String),
153}
154
155#[repr(C)]
156#[derive(Default, Clone)]
157pub enum ListModeInternal {
158    #[default]
159    Strong,
160    Eventual,
161}
162
163#[repr(C)]
164pub struct ListConfig {
165    pub mode: ListModeInternal,
166    pub cursor: *const u8,
167    pub cursor_len: u32,
168    pub limit: u32,
169    pub prefix: *const u8,
170    pub prefix_len: u32,
171}
172
173impl Default for ListConfig {
174    fn default() -> Self {
175        ListConfig {
176            mode: ListModeInternal::Strong,
177            cursor: std::ptr::null(),
178            cursor_len: 0,
179            limit: 0,
180            prefix: std::ptr::null(),
181            prefix_len: 0,
182        }
183    }
184}
185
186#[repr(C)]
187pub struct LookupConfig {
188    // reserved is just a placeholder,
189    // can be removed when somethin real is added
190    reserved: u32,
191}
192
193impl Default for LookupConfig {
194    fn default() -> Self {
195        LookupConfig { reserved: 0 }
196    }
197}
198
199#[repr(C)]
200pub struct DeleteConfig {
201    // reserved is just a placeholder,
202    // can be removed when somethin real is added
203    reserved: u32,
204}
205
206impl Default for DeleteConfig {
207    fn default() -> Self {
208        DeleteConfig { reserved: 0 }
209    }
210}
211
212bitflags::bitflags! {
213    /// `Content-Encoding` codings.
214    #[derive(Default)]
215    #[repr(transparent)]
216    pub struct ContentEncodings: u32 {
217        const GZIP = 1 << 0;
218    }
219}
220
221bitflags::bitflags! {
222    /// `BackendConfigOptions` codings.
223    #[derive(Default)]
224    #[repr(transparent)]
225    pub struct BackendConfigOptions: u32 {
226        const RESERVED = 1 << 0;
227        const HOST_OVERRIDE = 1 << 1;
228        const CONNECT_TIMEOUT = 1 << 2;
229        const FIRST_BYTE_TIMEOUT = 1 << 3;
230        const BETWEEN_BYTES_TIMEOUT = 1 << 4;
231        const USE_SSL = 1 << 5;
232        const SSL_MIN_VERSION = 1 << 6;
233        const SSL_MAX_VERSION = 1 << 7;
234        const CERT_HOSTNAME = 1 << 8;
235        const CA_CERT = 1 << 9;
236        const CIPHERS = 1 << 10;
237        const SNI_HOSTNAME = 1 << 11;
238        const DONT_POOL = 1 << 12;
239        const CLIENT_CERT = 1 << 13;
240        const GRPC = 1 << 14;
241        const KEEPALIVE = 1 << 15;
242    }
243    /// `InsertConfigOptions` codings.
244    #[derive(Default)]
245    #[repr(transparent)]
246    pub struct InsertConfigOptions: u32 {
247        const RESERVED = 1 << 0;
248        const BACKGROUND_FETCH = 1 << 1;
249        const RESERVED_2 = 1 << 2;
250        const METADATA = 1 << 3;
251        const TIME_TO_LIVE_SEC = 1 << 4;
252        const IF_GENERATION_MATCH = 1 << 5;
253    }
254    /// `ListConfigOptions` codings.
255    #[derive(Default)]
256    #[repr(transparent)]
257    pub struct ListConfigOptions: u32 {
258        const RESERVED = 1 << 0;
259        const CURSOR = 1 << 1;
260        const LIMIT = 1 << 2;
261        const PREFIX = 1 << 3;
262    }
263    /// `LookupConfigOptions` codings.
264    #[derive(Default)]
265    #[repr(transparent)]
266    pub struct LookupConfigOptions: u32 {
267        const RESERVED = 1 << 0;
268    }
269    /// `DeleteConfigOptions` codings.
270    #[derive(Default)]
271    #[repr(transparent)]
272    pub struct DeleteConfigOptions: u32 {
273        const RESERVED = 1 << 0;
274    }
275}
276
277pub mod fastly_abi {
278    use super::*;
279
280    #[link(wasm_import_module = "fastly_abi")]
281    extern "C" {
282        #[link_name = "init"]
283        /// Tell the runtime what ABI version this program is using (FASTLY_ABI_VERSION)
284        pub fn init(abi_version: u64) -> FastlyStatus;
285    }
286}
287
288pub mod fastly_uap {
289    use super::*;
290
291    #[link(wasm_import_module = "fastly_uap")]
292    extern "C" {
293        #[link_name = "parse"]
294        pub fn parse(
295            user_agent: *const u8,
296            user_agent_max_len: usize,
297            family: *mut u8,
298            family_max_len: usize,
299            family_written: *mut usize,
300            major: *mut u8,
301            major_max_len: usize,
302            major_written: *mut usize,
303            minor: *mut u8,
304            minor_max_len: usize,
305            minor_written: *mut usize,
306            patch: *mut u8,
307            patch_max_len: usize,
308            patch_written: *mut usize,
309        ) -> FastlyStatus;
310    }
311}
312
313pub mod fastly_http_body {
314    use super::*;
315
316    #[link(wasm_import_module = "fastly_http_body")]
317    extern "C" {
318        #[link_name = "append"]
319        pub fn append(dst_handle: BodyHandle, src_handle: BodyHandle) -> FastlyStatus;
320
321        #[link_name = "new"]
322        pub fn new(handle_out: *mut BodyHandle) -> FastlyStatus;
323
324        #[link_name = "read"]
325        pub fn read(
326            body_handle: BodyHandle,
327            buf: *mut u8,
328            buf_len: usize,
329            nread_out: *mut usize,
330        ) -> FastlyStatus;
331
332        // overeager warning for extern declarations is a rustc bug: https://github.com/rust-lang/rust/issues/79581
333        #[allow(clashing_extern_declarations)]
334        #[link_name = "write"]
335        pub fn write(
336            body_handle: BodyHandle,
337            buf: *const u8,
338            buf_len: usize,
339            end: fastly_shared::BodyWriteEnd,
340            nwritten_out: *mut usize,
341        ) -> FastlyStatus;
342
343        /// Close a body, freeing its resources and causing any sends to finish.
344        #[link_name = "close"]
345        pub fn close(body_handle: BodyHandle) -> FastlyStatus;
346
347        #[link_name = "trailer_append"]
348        pub fn trailer_append(
349            body_handle: BodyHandle,
350            name: *const u8,
351            name_len: usize,
352            value: *const u8,
353            value_len: usize,
354        ) -> FastlyStatus;
355
356        #[link_name = "trailer_names_get"]
357        pub fn trailer_names_get(
358            body_handle: BodyHandle,
359            buf: *mut u8,
360            buf_len: usize,
361            cursor: u32,
362            ending_cursor: *mut i64,
363            nwritten: *mut usize,
364        ) -> FastlyStatus;
365
366        #[link_name = "trailer_value_get"]
367        pub fn trailer_value_get(
368            body_handle: BodyHandle,
369            name: *const u8,
370            name_len: usize,
371            value: *mut u8,
372            value_max_len: usize,
373            nwritten: *mut usize,
374        ) -> FastlyStatus;
375
376        #[link_name = "trailer_values_get"]
377        pub fn trailer_values_get(
378            body_handle: BodyHandle,
379            name: *const u8,
380            name_len: usize,
381            buf: *mut u8,
382            buf_len: usize,
383            cursor: u32,
384            ending_cursor: *mut i64,
385            nwritten: *mut usize,
386        ) -> FastlyStatus;
387
388        #[link_name = "known_length"]
389        pub fn known_length(body_handle: BodyHandle, length_out: *mut u64) -> FastlyStatus;
390    }
391}
392
393pub mod fastly_log {
394    use super::*;
395
396    #[link(wasm_import_module = "fastly_log")]
397    extern "C" {
398        #[link_name = "endpoint_get"]
399        pub fn endpoint_get(
400            name: *const u8,
401            name_len: usize,
402            endpoint_handle_out: *mut u32,
403        ) -> FastlyStatus;
404
405        // overeager warning for extern declarations is a rustc bug: https://github.com/rust-lang/rust/issues/79581
406        #[allow(clashing_extern_declarations)]
407        #[link_name = "write"]
408        pub fn write(
409            endpoint_handle: u32,
410            msg: *const u8,
411            msg_len: usize,
412            nwritten_out: *mut usize,
413        ) -> FastlyStatus;
414
415    }
416}
417
418pub mod fastly_http_req {
419    use super::*;
420
421    bitflags::bitflags! {
422        #[derive(Default)]
423        #[repr(transparent)]
424        pub struct SendErrorDetailMask: u32 {
425            const RESERVED = 1 << 0;
426            const DNS_ERROR_RCODE = 1 << 1;
427            const DNS_ERROR_INFO_CODE = 1 << 2;
428            const TLS_ALERT_ID = 1 << 3;
429        }
430    }
431
432    #[repr(u32)]
433    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
434    pub enum SendErrorDetailTag {
435        Uninitialized,
436        Ok,
437        DnsTimeout,
438        DnsError,
439        DestinationNotFound,
440        DestinationUnavailable,
441        DestinationIpUnroutable,
442        ConnectionRefused,
443        ConnectionTerminated,
444        ConnectionTimeout,
445        ConnectionLimitReached,
446        TlsCertificateError,
447        TlsConfigurationError,
448        HttpIncompleteResponse,
449        HttpResponseHeaderSectionTooLarge,
450        HttpResponseBodyTooLarge,
451        HttpResponseTimeout,
452        HttpResponseStatusInvalid,
453        HttpUpgradeFailed,
454        HttpProtocolError,
455        HttpRequestCacheKeyInvalid,
456        HttpRequestUriInvalid,
457        InternalError,
458        TlsAlertReceived,
459        TlsProtocolError,
460    }
461
462    #[repr(C)]
463    #[derive(Clone, Debug, PartialEq, Eq)]
464    pub struct SendErrorDetail {
465        pub tag: SendErrorDetailTag,
466        pub mask: SendErrorDetailMask,
467        pub dns_error_rcode: u16,
468        pub dns_error_info_code: u16,
469        pub tls_alert_id: u8,
470    }
471
472    impl SendErrorDetail {
473        pub fn uninitialized_all() -> Self {
474            Self {
475                tag: SendErrorDetailTag::Uninitialized,
476                mask: SendErrorDetailMask::all(),
477                dns_error_rcode: Default::default(),
478                dns_error_info_code: Default::default(),
479                tls_alert_id: Default::default(),
480            }
481        }
482    }
483
484    bitflags::bitflags! {
485        #[repr(transparent)]
486        pub struct InspectInfoMask: u32 {
487            const RESERVED = 1 << 0;
488            const CORP = 1 << 1;
489            const WORKSPACE = 1 << 2;
490        }
491    }
492
493    #[repr(C)]
494    pub struct InspectInfo {
495        pub corp: *const u8,
496        pub corp_len: u32,
497        pub workspace: *const u8,
498        pub workspace_len: u32,
499    }
500
501    impl Default for InspectInfo {
502        fn default() -> Self {
503            InspectInfo {
504                corp: std::ptr::null(),
505                corp_len: 0,
506                workspace: std::ptr::null(),
507                workspace_len: 0,
508            }
509        }
510    }
511
512    #[link(wasm_import_module = "fastly_http_req")]
513    extern "C" {
514        #[link_name = "body_downstream_get"]
515        pub fn body_downstream_get(
516            req_handle_out: *mut RequestHandle,
517            body_handle_out: *mut BodyHandle,
518        ) -> FastlyStatus;
519
520        #[link_name = "cache_override_set"]
521        pub fn cache_override_set(
522            req_handle: RequestHandle,
523            tag: u32,
524            ttl: u32,
525            swr: u32,
526        ) -> FastlyStatus;
527
528        #[link_name = "cache_override_v2_set"]
529        pub fn cache_override_v2_set(
530            req_handle: RequestHandle,
531            tag: u32,
532            ttl: u32,
533            swr: u32,
534            sk: *const u8,
535            sk_len: usize,
536        ) -> FastlyStatus;
537
538        #[link_name = "framing_headers_mode_set"]
539        pub fn framing_headers_mode_set(
540            req_handle: RequestHandle,
541            mode: fastly_shared::FramingHeadersMode,
542        ) -> FastlyStatus;
543
544        #[link_name = "downstream_client_ip_addr"]
545        pub fn downstream_client_ip_addr(
546            addr_octets_out: *mut u8,
547            nwritten_out: *mut usize,
548        ) -> FastlyStatus;
549
550        #[link_name = "downstream_server_ip_addr"]
551        pub fn downstream_server_ip_addr(
552            addr_octets_out: *mut u8,
553            nwritten_out: *mut usize,
554        ) -> FastlyStatus;
555
556        #[link_name = "downstream_client_h2_fingerprint"]
557        pub fn downstream_client_h2_fingerprint(
558            h2fp_out: *mut u8,
559            h2fp_max_len: usize,
560            nwritten: *mut usize,
561        ) -> FastlyStatus;
562
563        #[link_name = "downstream_client_request_id"]
564        pub fn downstream_client_request_id(
565            reqid_out: *mut u8,
566            reqid_max_len: usize,
567            nwritten: *mut usize,
568        ) -> FastlyStatus;
569
570        #[link_name = "downstream_client_oh_fingerprint"]
571        pub fn downstream_client_oh_fingerprint(
572            ohfp_out: *mut u8,
573            ohfp_max_len: usize,
574            nwritten: *mut usize,
575        ) -> FastlyStatus;
576
577        #[link_name = "downstream_tls_cipher_openssl_name"]
578        pub fn downstream_tls_cipher_openssl_name(
579            cipher_out: *mut u8,
580            cipher_max_len: usize,
581            nwritten: *mut usize,
582        ) -> FastlyStatus;
583
584        #[link_name = "downstream_tls_protocol"]
585        pub fn downstream_tls_protocol(
586            protocol_out: *mut u8,
587            protocol_max_len: usize,
588            nwritten: *mut usize,
589        ) -> FastlyStatus;
590
591        #[link_name = "downstream_tls_client_hello"]
592        pub fn downstream_tls_client_hello(
593            client_hello_out: *mut u8,
594            client_hello_max_len: usize,
595            nwritten: *mut usize,
596        ) -> FastlyStatus;
597
598        #[link_name = "downstream_tls_ja3_md5"]
599        pub fn downstream_tls_ja3_md5(
600            ja3_md5_out: *mut u8,
601            nwritten_out: *mut usize,
602        ) -> FastlyStatus;
603
604        #[link_name = "downstream_tls_ja4"]
605        pub fn downstream_tls_ja4(
606            ja4_out: *mut u8,
607            ja4_max_len: usize,
608            nwritten: *mut usize,
609        ) -> FastlyStatus;
610
611        #[link_name = "downstream_tls_raw_client_certificate"]
612        pub fn downstream_tls_raw_client_certificate(
613            client_hello_out: *mut u8,
614            client_hello_max_len: usize,
615            nwritten: *mut usize,
616        ) -> FastlyStatus;
617
618        #[link_name = "downstream_tls_client_cert_verify_result"]
619        pub fn downstream_tls_client_cert_verify_result(
620            verify_result_out: *mut u32,
621        ) -> FastlyStatus;
622
623        #[link_name = "header_append"]
624        pub fn header_append(
625            req_handle: RequestHandle,
626            name: *const u8,
627            name_len: usize,
628            value: *const u8,
629            value_len: usize,
630        ) -> FastlyStatus;
631
632        #[link_name = "header_insert"]
633        pub fn header_insert(
634            req_handle: RequestHandle,
635            name: *const u8,
636            name_len: usize,
637            value: *const u8,
638            value_len: usize,
639        ) -> FastlyStatus;
640
641        #[link_name = "original_header_names_get"]
642        pub fn original_header_names_get(
643            buf: *mut u8,
644            buf_len: usize,
645            cursor: u32,
646            ending_cursor: *mut i64,
647            nwritten: *mut usize,
648        ) -> FastlyStatus;
649
650        #[link_name = "original_header_count"]
651        pub fn original_header_count(count_out: *mut u32) -> FastlyStatus;
652
653        #[link_name = "header_names_get"]
654        pub fn header_names_get(
655            req_handle: RequestHandle,
656            buf: *mut u8,
657            buf_len: usize,
658            cursor: u32,
659            ending_cursor: *mut i64,
660            nwritten: *mut usize,
661        ) -> FastlyStatus;
662
663        #[link_name = "header_values_get"]
664        pub fn header_values_get(
665            req_handle: RequestHandle,
666            name: *const u8,
667            name_len: usize,
668            buf: *mut u8,
669            buf_len: usize,
670            cursor: u32,
671            ending_cursor: *mut i64,
672            nwritten: *mut usize,
673        ) -> FastlyStatus;
674
675        #[link_name = "header_values_set"]
676        pub fn header_values_set(
677            req_handle: RequestHandle,
678            name: *const u8,
679            name_len: usize,
680            values: *const u8,
681            values_len: usize,
682        ) -> FastlyStatus;
683
684        #[link_name = "header_value_get"]
685        pub fn header_value_get(
686            req_handle: RequestHandle,
687            name: *const u8,
688            name_len: usize,
689            value: *mut u8,
690            value_max_len: usize,
691            nwritten: *mut usize,
692        ) -> FastlyStatus;
693
694        #[link_name = "header_remove"]
695        pub fn header_remove(
696            req_handle: RequestHandle,
697            name: *const u8,
698            name_len: usize,
699        ) -> FastlyStatus;
700
701        #[link_name = "method_get"]
702        pub fn method_get(
703            req_handle: RequestHandle,
704            method: *mut u8,
705            method_max_len: usize,
706            nwritten: *mut usize,
707        ) -> FastlyStatus;
708
709        #[link_name = "method_set"]
710        pub fn method_set(
711            req_handle: RequestHandle,
712            method: *const u8,
713            method_len: usize,
714        ) -> FastlyStatus;
715
716        #[link_name = "new"]
717        pub fn new(req_handle_out: *mut RequestHandle) -> FastlyStatus;
718
719        #[link_name = "send_v2"]
720        pub fn send_v2(
721            req_handle: RequestHandle,
722            body_handle: BodyHandle,
723            backend: *const u8,
724            backend_len: usize,
725            error_detail: *mut SendErrorDetail,
726            resp_handle_out: *mut ResponseHandle,
727            resp_body_handle_out: *mut BodyHandle,
728        ) -> FastlyStatus;
729
730        #[link_name = "send_v3"]
731        pub fn send_v3(
732            req_handle: RequestHandle,
733            body_handle: BodyHandle,
734            backend: *const u8,
735            backend_len: usize,
736            error_detail: *mut SendErrorDetail,
737            resp_handle_out: *mut ResponseHandle,
738            resp_body_handle_out: *mut BodyHandle,
739        ) -> FastlyStatus;
740
741        #[link_name = "send_async"]
742        pub fn send_async(
743            req_handle: RequestHandle,
744            body_handle: BodyHandle,
745            backend: *const u8,
746            backend_len: usize,
747            pending_req_handle_out: *mut PendingRequestHandle,
748        ) -> FastlyStatus;
749
750        #[link_name = "send_async_streaming"]
751        pub fn send_async_streaming(
752            req_handle: RequestHandle,
753            body_handle: BodyHandle,
754            backend: *const u8,
755            backend_len: usize,
756            pending_req_handle_out: *mut PendingRequestHandle,
757        ) -> FastlyStatus;
758
759        #[link_name = "send_async_v2"]
760        pub fn send_async_v2(
761            req_handle: RequestHandle,
762            body_handle: BodyHandle,
763            backend: *const u8,
764            backend_len: usize,
765            streaming: u32,
766            pending_req_handle_out: *mut PendingRequestHandle,
767        ) -> FastlyStatus;
768
769        #[link_name = "upgrade_websocket"]
770        pub fn upgrade_websocket(backend: *const u8, backend_len: usize) -> FastlyStatus;
771
772        #[link_name = "redirect_to_websocket_proxy_v2"]
773        pub fn redirect_to_websocket_proxy_v2(
774            req: RequestHandle,
775            backend: *const u8,
776            backend_len: usize,
777        ) -> FastlyStatus;
778
779        #[link_name = "redirect_to_grip_proxy_v2"]
780        pub fn redirect_to_grip_proxy_v2(
781            req: RequestHandle,
782            backend: *const u8,
783            backend_len: usize,
784        ) -> FastlyStatus;
785
786        #[link_name = "register_dynamic_backend"]
787        pub fn register_dynamic_backend(
788            name_prefix: *const u8,
789            name_prefix_len: usize,
790            target: *const u8,
791            target_len: usize,
792            config_mask: BackendConfigOptions,
793            config: *const DynamicBackendConfig,
794        ) -> FastlyStatus;
795
796        #[link_name = "uri_get"]
797        pub fn uri_get(
798            req_handle: RequestHandle,
799            uri: *mut u8,
800            uri_max_len: usize,
801            nwritten: *mut usize,
802        ) -> FastlyStatus;
803
804        #[link_name = "uri_set"]
805        pub fn uri_set(req_handle: RequestHandle, uri: *const u8, uri_len: usize) -> FastlyStatus;
806
807        #[link_name = "version_get"]
808        pub fn version_get(req_handle: RequestHandle, version: *mut u32) -> FastlyStatus;
809
810        #[link_name = "version_set"]
811        pub fn version_set(req_handle: RequestHandle, version: u32) -> FastlyStatus;
812
813        #[link_name = "pending_req_poll_v2"]
814        pub fn pending_req_poll_v2(
815            pending_req_handle: PendingRequestHandle,
816            error_detail: *mut SendErrorDetail,
817            is_done_out: *mut i32,
818            resp_handle_out: *mut ResponseHandle,
819            resp_body_handle_out: *mut BodyHandle,
820        ) -> FastlyStatus;
821
822        #[link_name = "pending_req_select_v2"]
823        pub fn pending_req_select_v2(
824            pending_req_handles: *const PendingRequestHandle,
825            pending_req_handles_len: usize,
826            error_detail: *mut SendErrorDetail,
827            done_index_out: *mut i32,
828            resp_handle_out: *mut ResponseHandle,
829            resp_body_handle_out: *mut BodyHandle,
830        ) -> FastlyStatus;
831
832        #[link_name = "pending_req_wait_v2"]
833        pub fn pending_req_wait_v2(
834            pending_req_handle: PendingRequestHandle,
835            error_detail: *mut SendErrorDetail,
836            resp_handle_out: *mut ResponseHandle,
837            resp_body_handle_out: *mut BodyHandle,
838        ) -> FastlyStatus;
839
840        #[link_name = "fastly_key_is_valid"]
841        pub fn fastly_key_is_valid(is_valid_out: *mut u32) -> FastlyStatus;
842
843        #[link_name = "close"]
844        pub fn close(req_handle: RequestHandle) -> FastlyStatus;
845
846        #[link_name = "auto_decompress_response_set"]
847        pub fn auto_decompress_response_set(
848            req_handle: RequestHandle,
849            encodings: ContentEncodings,
850        ) -> FastlyStatus;
851
852        #[link_name = "inspect"]
853        pub fn inspect(
854            request_handle: RequestHandle,
855            body_handle: BodyHandle,
856            add_info_mask: InspectInfoMask,
857            add_info: *const InspectInfo,
858            buf: *mut u8,
859            buf_len: usize,
860            nwritten: *mut usize,
861        ) -> FastlyStatus;
862
863        #[link_name = "on_behalf_of"]
864        pub fn on_behalf_of(
865            request_handle: RequestHandle,
866            service: *const u8,
867            service_len: usize,
868        ) -> FastlyStatus;
869    }
870}
871
872pub mod fastly_http_resp {
873    use super::*;
874
875    #[link(wasm_import_module = "fastly_http_resp")]
876    extern "C" {
877        #[link_name = "header_append"]
878        pub fn header_append(
879            resp_handle: ResponseHandle,
880            name: *const u8,
881            name_len: usize,
882            value: *const u8,
883            value_len: usize,
884        ) -> FastlyStatus;
885
886        #[link_name = "header_insert"]
887        pub fn header_insert(
888            resp_handle: ResponseHandle,
889            name: *const u8,
890            name_len: usize,
891            value: *const u8,
892            value_len: usize,
893        ) -> FastlyStatus;
894
895        #[link_name = "header_names_get"]
896        pub fn header_names_get(
897            resp_handle: ResponseHandle,
898            buf: *mut u8,
899            buf_len: usize,
900            cursor: u32,
901            ending_cursor: *mut i64,
902            nwritten: *mut usize,
903        ) -> FastlyStatus;
904
905        #[link_name = "header_value_get"]
906        pub fn header_value_get(
907            resp_handle: ResponseHandle,
908            name: *const u8,
909            name_len: usize,
910            value: *mut u8,
911            value_max_len: usize,
912            nwritten: *mut usize,
913        ) -> FastlyStatus;
914
915        #[link_name = "header_values_get"]
916        pub fn header_values_get(
917            resp_handle: ResponseHandle,
918            name: *const u8,
919            name_len: usize,
920            buf: *mut u8,
921            buf_len: usize,
922            cursor: u32,
923            ending_cursor: *mut i64,
924            nwritten: *mut usize,
925        ) -> FastlyStatus;
926
927        #[link_name = "header_values_set"]
928        pub fn header_values_set(
929            resp_handle: ResponseHandle,
930            name: *const u8,
931            name_len: usize,
932            values: *const u8,
933            values_len: usize,
934        ) -> FastlyStatus;
935
936        #[link_name = "header_remove"]
937        pub fn header_remove(
938            resp_handle: ResponseHandle,
939            name: *const u8,
940            name_len: usize,
941        ) -> FastlyStatus;
942
943        #[link_name = "new"]
944        pub fn new(resp_handle_out: *mut ResponseHandle) -> FastlyStatus;
945
946        #[link_name = "send_downstream"]
947        pub fn send_downstream(
948            resp_handle: ResponseHandle,
949            body_handle: BodyHandle,
950            streaming: u32,
951        ) -> FastlyStatus;
952
953        #[link_name = "status_get"]
954        pub fn status_get(resp_handle: ResponseHandle, status: *mut u16) -> FastlyStatus;
955
956        #[link_name = "status_set"]
957        pub fn status_set(resp_handle: ResponseHandle, status: u16) -> FastlyStatus;
958
959        #[link_name = "version_get"]
960        pub fn version_get(resp_handle: ResponseHandle, version: *mut u32) -> FastlyStatus;
961
962        #[link_name = "version_set"]
963        pub fn version_set(resp_handle: ResponseHandle, version: u32) -> FastlyStatus;
964
965        #[link_name = "framing_headers_mode_set"]
966        pub fn framing_headers_mode_set(
967            resp_handle: ResponseHandle,
968            mode: fastly_shared::FramingHeadersMode,
969        ) -> FastlyStatus;
970
971        #[doc(hidden)]
972        #[link_name = "http_keepalive_mode_set"]
973        pub fn http_keepalive_mode_set(
974            resp_handle: ResponseHandle,
975            mode: fastly_shared::HttpKeepaliveMode,
976        ) -> FastlyStatus;
977
978        #[link_name = "close"]
979        pub fn close(resp_handle: ResponseHandle) -> FastlyStatus;
980
981        #[link_name = "get_addr_dest_ip"]
982        pub fn get_addr_dest_ip(
983            resp_handle: ResponseHandle,
984            addr_octets_out: *mut u8,
985            nwritten_out: *mut usize,
986        ) -> FastlyStatus;
987
988        #[link_name = "get_addr_dest_port"]
989        pub fn get_addr_dest_port(resp_handle: ResponseHandle, port_out: *mut u16) -> FastlyStatus;
990    }
991}
992
993pub mod fastly_dictionary {
994    use super::*;
995
996    #[link(wasm_import_module = "fastly_dictionary")]
997    extern "C" {
998        #[link_name = "open"]
999        pub fn open(
1000            name: *const u8,
1001            name_len: usize,
1002            dict_handle_out: *mut DictionaryHandle,
1003        ) -> FastlyStatus;
1004
1005        #[link_name = "get"]
1006        pub fn get(
1007            dict_handle: DictionaryHandle,
1008            key: *const u8,
1009            key_len: usize,
1010            value: *mut u8,
1011            value_max_len: usize,
1012            nwritten: *mut usize,
1013        ) -> FastlyStatus;
1014    }
1015}
1016
1017pub mod fastly_geo {
1018    use super::*;
1019
1020    #[link(wasm_import_module = "fastly_geo")]
1021    extern "C" {
1022        #[link_name = "lookup"]
1023        pub fn lookup(
1024            addr_octets: *const u8,
1025            addr_len: usize,
1026            buf: *mut u8,
1027            buf_len: usize,
1028            nwritten_out: *mut usize,
1029        ) -> FastlyStatus;
1030    }
1031}
1032
1033pub mod fastly_device_detection {
1034    use super::*;
1035
1036    #[link(wasm_import_module = "fastly_device_detection")]
1037    extern "C" {
1038        #[link_name = "lookup"]
1039        pub fn lookup(
1040            user_agent: *const u8,
1041            user_agent_max_len: usize,
1042            buf: *mut u8,
1043            buf_len: usize,
1044            nwritten_out: *mut usize,
1045        ) -> FastlyStatus;
1046    }
1047}
1048
1049pub mod fastly_erl {
1050    use super::*;
1051
1052    #[link(wasm_import_module = "fastly_erl")]
1053    extern "C" {
1054        #[link_name = "check_rate"]
1055        pub fn check_rate(
1056            rc: *const u8,
1057            rc_max_len: usize,
1058            entry: *const u8,
1059            entry_max_len: usize,
1060            delta: u32,
1061            window: u32,
1062            limit: u32,
1063            pb: *const u8,
1064            pb_max_len: usize,
1065            ttl: u32,
1066            value: *mut u32,
1067        ) -> FastlyStatus;
1068
1069        #[link_name = "ratecounter_increment"]
1070        pub fn ratecounter_increment(
1071            rc: *const u8,
1072            rc_max_len: usize,
1073            entry: *const u8,
1074            entry_max_len: usize,
1075            delta: u32,
1076        ) -> FastlyStatus;
1077
1078        #[link_name = "ratecounter_lookup_rate"]
1079        pub fn ratecounter_lookup_rate(
1080            rc: *const u8,
1081            rc_max_len: usize,
1082            entry: *const u8,
1083            entry_max_len: usize,
1084            window: u32,
1085            value: *mut u32,
1086        ) -> FastlyStatus;
1087
1088        #[link_name = "ratecounter_lookup_count"]
1089        pub fn ratecounter_lookup_count(
1090            rc: *const u8,
1091            rc_max_len: usize,
1092            entry: *const u8,
1093            entry_max_len: usize,
1094            duration: u32,
1095            value: *mut u32,
1096        ) -> FastlyStatus;
1097
1098        #[link_name = "penaltybox_add"]
1099        pub fn penaltybox_add(
1100            pb: *const u8,
1101            pb_max_len: usize,
1102            entry: *const u8,
1103            entry_max_len: usize,
1104            ttl: u32,
1105        ) -> FastlyStatus;
1106
1107        #[link_name = "penaltybox_has"]
1108        pub fn penaltybox_has(
1109            pb: *const u8,
1110            pb_max_len: usize,
1111            entry: *const u8,
1112            entry_max_len: usize,
1113            value: *mut u32,
1114        ) -> FastlyStatus;
1115    }
1116}
1117
1118pub mod fastly_kv_store {
1119    use super::*;
1120
1121    #[repr(u32)]
1122    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1123    pub enum KvError {
1124        Uninitialized,
1125        Ok,
1126        BadRequest,
1127        NotFound,
1128        PreconditionFailed,
1129        PayloadTooLarge,
1130        InternalError,
1131    }
1132
1133    // TODO ACF 2023-04-11: keep the object store name here until the ABI is updated
1134    #[link(wasm_import_module = "fastly_object_store")]
1135    extern "C" {
1136        #[link_name = "open"]
1137        pub fn open(
1138            name_ptr: *const u8,
1139            name_len: usize,
1140            kv_store_handle_out: *mut KVStoreHandle,
1141        ) -> FastlyStatus;
1142
1143        #[deprecated(note = "kept for backward compatibility")]
1144        #[link_name = "lookup"]
1145        pub fn lookup(
1146            kv_store_handle: KVStoreHandle,
1147            key_ptr: *const u8,
1148            key_len: usize,
1149            body_handle_out: *mut BodyHandle,
1150        ) -> FastlyStatus;
1151
1152        #[deprecated(note = "kept for backward compatibility")]
1153        #[link_name = "lookup_async"]
1154        pub fn lookup_async(
1155            kv_store_handle: KVStoreHandle,
1156            key_ptr: *const u8,
1157            key_len: usize,
1158            pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1159        ) -> FastlyStatus;
1160
1161        #[deprecated(note = "kept for backward compatibility")]
1162        #[link_name = "pending_lookup_wait"]
1163        pub fn pending_lookup_wait(
1164            pending_handle: PendingObjectStoreLookupHandle,
1165            body_handle_out: *mut BodyHandle,
1166        ) -> FastlyStatus;
1167
1168        #[deprecated(note = "kept for backward compatibility")]
1169        #[link_name = "insert"]
1170        pub fn insert(
1171            kv_store_handle: KVStoreHandle,
1172            key_ptr: *const u8,
1173            key_len: usize,
1174            body_handle: BodyHandle,
1175        ) -> FastlyStatus;
1176
1177        #[deprecated(note = "kept for backward compatibility")]
1178        #[link_name = "insert_async"]
1179        pub fn insert_async(
1180            kv_store_handle: KVStoreHandle,
1181            key_ptr: *const u8,
1182            key_len: usize,
1183            body_handle: BodyHandle,
1184            pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1185        ) -> FastlyStatus;
1186
1187        #[deprecated(note = "kept for backward compatibility")]
1188        #[link_name = "pending_insert_wait"]
1189        pub fn pending_insert_wait(
1190            pending_body_handle: PendingObjectStoreInsertHandle,
1191            kv_error_out: *mut KvError,
1192        ) -> FastlyStatus;
1193
1194        #[deprecated(note = "kept for backward compatibility")]
1195        #[link_name = "delete_async"]
1196        pub fn delete_async(
1197            kv_store_handle: KVStoreHandle,
1198            key_ptr: *const u8,
1199            key_len: usize,
1200            pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1201        ) -> FastlyStatus;
1202
1203        #[deprecated(note = "kept for backward compatibility")]
1204        #[link_name = "pending_delete_wait"]
1205        pub fn pending_delete_wait(
1206            pending_body_handle: PendingObjectStoreDeleteHandle,
1207        ) -> FastlyStatus;
1208    }
1209
1210    #[link(wasm_import_module = "fastly_kv_store")]
1211    extern "C" {
1212        #[link_name = "open"]
1213        pub fn open_v2(
1214            name_ptr: *const u8,
1215            name_len: usize,
1216            kv_store_handle_out: *mut KVStoreHandle,
1217        ) -> FastlyStatus;
1218
1219        #[link_name = "lookup"]
1220        pub fn lookup_v2(
1221            kv_store_handle: KVStoreHandle,
1222            key_ptr: *const u8,
1223            key_len: usize,
1224            lookup_config_mask: LookupConfigOptions,
1225            lookup_config: *const LookupConfig,
1226            pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1227        ) -> FastlyStatus;
1228
1229        #[link_name = "lookup_wait"]
1230        pub fn pending_lookup_wait_v2(
1231            pending_handle: PendingObjectStoreLookupHandle,
1232            body_handle_out: *mut BodyHandle,
1233            metadata_buf: *mut u8,
1234            metadata_buf_len: usize,
1235            nwritten_out: *mut usize,
1236            generation_out: *mut u32,
1237            kv_error_out: *mut KvError,
1238        ) -> FastlyStatus;
1239
1240        #[link_name = "lookup_wait_v2"]
1241        pub fn lookup_wait_v2(
1242            pending_handle: PendingObjectStoreLookupHandle,
1243            body_handle_out: *mut BodyHandle,
1244            metadata_buf: *mut u8,
1245            metadata_buf_len: usize,
1246            nwritten_out: *mut usize,
1247            generation_out: *mut u64,
1248            kv_error_out: *mut KvError,
1249        ) -> FastlyStatus;
1250
1251        #[link_name = "insert"]
1252        pub fn insert_v2(
1253            kv_store_handle: KVStoreHandle,
1254            key_ptr: *const u8,
1255            key_len: usize,
1256            body_handle: BodyHandle,
1257            insert_config_mask: InsertConfigOptions,
1258            insert_config: *const InsertConfig,
1259            pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1260        ) -> FastlyStatus;
1261
1262        #[link_name = "insert_wait"]
1263        pub fn pending_insert_wait_v2(
1264            pending_body_handle: PendingObjectStoreInsertHandle,
1265            kv_error_out: *mut KvError,
1266        ) -> FastlyStatus;
1267
1268        #[link_name = "delete"]
1269        pub fn delete_v2(
1270            kv_store_handle: KVStoreHandle,
1271            key_ptr: *const u8,
1272            key_len: usize,
1273            delete_config_mask: DeleteConfigOptions,
1274            delete_config: *const DeleteConfig,
1275            pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1276        ) -> FastlyStatus;
1277
1278        #[link_name = "delete_wait"]
1279        pub fn pending_delete_wait_v2(
1280            pending_body_handle: PendingObjectStoreDeleteHandle,
1281            kv_error_out: *mut KvError,
1282        ) -> FastlyStatus;
1283
1284        #[link_name = "list"]
1285        pub fn list_v2(
1286            kv_store_handle: KVStoreHandle,
1287            list_config_mask: ListConfigOptions,
1288            list_config: *const ListConfig,
1289            pending_body_handle_out: *mut PendingObjectStoreListHandle,
1290        ) -> FastlyStatus;
1291
1292        #[link_name = "list_wait"]
1293        pub fn pending_list_wait_v2(
1294            pending_body_handle: PendingObjectStoreListHandle,
1295            body_handle_out: *mut BodyHandle,
1296            kv_error_out: *mut KvError,
1297        ) -> FastlyStatus;
1298    }
1299}
1300
1301pub mod fastly_secret_store {
1302    use super::*;
1303
1304    #[link(wasm_import_module = "fastly_secret_store")]
1305    extern "C" {
1306        #[link_name = "open"]
1307        pub fn open(
1308            secret_store_name_ptr: *const u8,
1309            secret_store_name_len: usize,
1310            secret_store_handle_out: *mut SecretStoreHandle,
1311        ) -> FastlyStatus;
1312
1313        #[link_name = "get"]
1314        pub fn get(
1315            secret_store_handle: SecretStoreHandle,
1316            secret_name_ptr: *const u8,
1317            secret_name_len: usize,
1318            secret_handle_out: *mut SecretHandle,
1319        ) -> FastlyStatus;
1320
1321        #[link_name = "plaintext"]
1322        pub fn plaintext(
1323            secret_handle: SecretHandle,
1324            plaintext_buf: *mut u8,
1325            plaintext_max_len: usize,
1326            nwritten_out: *mut usize,
1327        ) -> FastlyStatus;
1328
1329        #[link_name = "from_bytes"]
1330        pub fn from_bytes(
1331            plaintext_buf: *const u8,
1332            plaintext_len: usize,
1333            secret_handle_out: *mut SecretHandle,
1334        ) -> FastlyStatus;
1335    }
1336}
1337
1338pub mod fastly_backend {
1339    use super::*;
1340
1341    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1342    #[repr(u32)]
1343    pub enum BackendHealth {
1344        Unknown,
1345        Healthy,
1346        Unhealthy,
1347    }
1348
1349    #[link(wasm_import_module = "fastly_backend")]
1350    extern "C" {
1351        #[link_name = "exists"]
1352        pub fn exists(
1353            backend_ptr: *const u8,
1354            backend_len: usize,
1355            backend_exists_out: *mut u32,
1356        ) -> FastlyStatus;
1357
1358        #[link_name = "is_healthy"]
1359        pub fn is_healthy(
1360            backend_ptr: *const u8,
1361            backend_len: usize,
1362            backend_health_out: *mut BackendHealth,
1363        ) -> FastlyStatus;
1364
1365        #[link_name = "is_dynamic"]
1366        pub fn is_dynamic(
1367            backend_ptr: *const u8,
1368            backend_len: usize,
1369            value: *mut u32,
1370        ) -> FastlyStatus;
1371
1372        #[link_name = "get_host"]
1373        pub fn get_host(
1374            backend_ptr: *const u8,
1375            backend_len: usize,
1376            value: *mut u8,
1377            value_max_len: usize,
1378            nwritten: *mut usize,
1379        ) -> FastlyStatus;
1380
1381        #[link_name = "get_override_host"]
1382        pub fn get_override_host(
1383            backend_ptr: *const u8,
1384            backend_len: usize,
1385            value: *mut u8,
1386            value_max_len: usize,
1387            nwritten: *mut usize,
1388        ) -> FastlyStatus;
1389
1390        #[link_name = "get_port"]
1391        pub fn get_port(
1392            backend_ptr: *const u8,
1393            backend_len: usize,
1394            value: *mut u16,
1395        ) -> FastlyStatus;
1396
1397        #[link_name = "get_connect_timeout_ms"]
1398        pub fn get_connect_timeout_ms(
1399            backend_ptr: *const u8,
1400            backend_len: usize,
1401            value: *mut u32,
1402        ) -> FastlyStatus;
1403
1404        #[link_name = "get_first_byte_timeout_ms"]
1405        pub fn get_first_byte_timeout_ms(
1406            backend_ptr: *const u8,
1407            backend_len: usize,
1408            value: *mut u32,
1409        ) -> FastlyStatus;
1410
1411        #[link_name = "get_between_bytes_timeout_ms"]
1412        pub fn get_between_bytes_timeout_ms(
1413            backend_ptr: *const u8,
1414            backend_len: usize,
1415            value: *mut u32,
1416        ) -> FastlyStatus;
1417
1418        #[link_name = "get_http_keepalive_time"]
1419        pub fn get_http_keepalive_time(
1420            backend_ptr: *const u8,
1421            backend_len: usize,
1422            value: *mut u32,
1423        ) -> FastlyStatus;
1424
1425        #[link_name = "get_tcp_keepalive_enable"]
1426        pub fn get_tcp_keepalive_enable(
1427            backend_ptr: *const u8,
1428            backend_len: usize,
1429            value: *mut u32,
1430        ) -> FastlyStatus;
1431
1432        #[link_name = "get_tcp_keepalive_interval"]
1433        pub fn get_tcp_keepalive_interval(
1434            backend_ptr: *const u8,
1435            backend_len: usize,
1436            value: *mut u32,
1437        ) -> FastlyStatus;
1438
1439        #[link_name = "get_tcp_keepalive_probes"]
1440        pub fn get_tcp_keepalive_probes(
1441            backend_ptr: *const u8,
1442            backend_len: usize,
1443            value: *mut u32,
1444        ) -> FastlyStatus;
1445
1446        #[link_name = "get_tcp_keepalive_time"]
1447        pub fn get_tcp_keepalive_time(
1448            backend_ptr: *const u8,
1449            backend_len: usize,
1450            value: *mut u32,
1451        ) -> FastlyStatus;
1452
1453        #[link_name = "is_ssl"]
1454        pub fn is_ssl(backend_ptr: *const u8, backend_len: usize, value: *mut u32) -> FastlyStatus;
1455
1456        #[link_name = "get_ssl_min_version"]
1457        pub fn get_ssl_min_version(
1458            backend_ptr: *const u8,
1459            backend_len: usize,
1460            value: *mut u32,
1461        ) -> FastlyStatus;
1462
1463        #[link_name = "get_ssl_max_version"]
1464        pub fn get_ssl_max_version(
1465            backend_ptr: *const u8,
1466            backend_len: usize,
1467            value: *mut u32,
1468        ) -> FastlyStatus;
1469    }
1470}
1471
1472pub mod fastly_async_io {
1473    use super::*;
1474
1475    #[link(wasm_import_module = "fastly_async_io")]
1476    extern "C" {
1477        #[link_name = "select"]
1478        pub fn select(
1479            async_item_handles: *const AsyncItemHandle,
1480            async_item_handles_len: usize,
1481            timeout_ms: u32,
1482            done_index_out: *mut u32,
1483        ) -> FastlyStatus;
1484
1485        #[link_name = "is_ready"]
1486        pub fn is_ready(async_item_handle: AsyncItemHandle, ready_out: *mut u32) -> FastlyStatus;
1487    }
1488}
1489
1490pub mod fastly_purge {
1491    use super::*;
1492
1493    bitflags::bitflags! {
1494        #[derive(Default)]
1495        #[repr(transparent)]
1496        pub struct PurgeOptionsMask: u32 {
1497            const SOFT_PURGE = 1 << 0;
1498            const RET_BUF = 1 << 1;
1499        }
1500    }
1501
1502    #[derive(Debug)]
1503    #[repr(C)]
1504    pub struct PurgeOptions {
1505        pub ret_buf_ptr: *mut u8,
1506        pub ret_buf_len: usize,
1507        pub ret_buf_nwritten_out: *mut usize,
1508    }
1509
1510    #[link(wasm_import_module = "fastly_purge")]
1511    extern "C" {
1512        #[link_name = "purge_surrogate_key"]
1513        pub fn purge_surrogate_key(
1514            surrogate_key_ptr: *const u8,
1515            surrogate_key_len: usize,
1516            options_mask: PurgeOptionsMask,
1517            options: *mut PurgeOptions,
1518        ) -> FastlyStatus;
1519    }
1520}
1521
1522pub mod fastly_compute_runtime {
1523    use super::*;
1524
1525    #[link(wasm_import_module = "fastly_compute_runtime")]
1526    extern "C" {
1527        #[link_name = "get_vcpu_ms"]
1528        pub fn get_vcpu_ms(ms_out: *mut u64) -> FastlyStatus;
1529    }
1530}
1531
1532pub mod fastly_acl {
1533    use super::*;
1534
1535    #[repr(u32)]
1536    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1537    pub enum AclError {
1538        Uninitialized,
1539        Ok,
1540        NoContent,
1541        TooManyRequests,
1542    }
1543
1544    #[link(wasm_import_module = "fastly_acl")]
1545    extern "C" {
1546        #[link_name = "open"]
1547        pub fn open(
1548            acl_name_ptr: *const u8,
1549            acl_name_len: usize,
1550            acl_handle_out: *mut AclHandle,
1551        ) -> FastlyStatus;
1552
1553        #[link_name = "lookup"]
1554        pub fn lookup(
1555            acl_handle: AclHandle,
1556            ip_octets: *const u8,
1557            ip_len: usize,
1558            body_handle_out: *mut BodyHandle,
1559            acl_error_out: *mut AclError,
1560        ) -> FastlyStatus;
1561    }
1562}