1#![allow(clashing_extern_declarations)]
3
4use fastly_shared::FastlyStatus;
19
20pub mod fastly_cache;
21pub mod fastly_config_store;
22pub mod fastly_http_cache;
23
24pub 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 RequestPromiseHandle = u32;
40pub type ResponseHandle = u32;
41pub type SecretHandle = u32;
42pub type SecretStoreHandle = u32;
43
44#[repr(C)]
45pub struct DynamicBackendConfig {
46 pub host_override: *const u8,
47 pub host_override_len: u32,
48 pub connect_timeout_ms: u32,
49 pub first_byte_timeout_ms: u32,
50 pub between_bytes_timeout_ms: u32,
51 pub ssl_min_version: u32,
52 pub ssl_max_version: u32,
53 pub cert_hostname: *const u8,
54 pub cert_hostname_len: u32,
55 pub ca_cert: *const u8,
56 pub ca_cert_len: u32,
57 pub ciphers: *const u8,
58 pub ciphers_len: u32,
59 pub sni_hostname: *const u8,
60 pub sni_hostname_len: u32,
61 pub client_certificate: *const u8,
62 pub client_certificate_len: u32,
63 pub client_key: SecretHandle,
64 pub http_keepalive_time_ms: u32,
65 pub tcp_keepalive_enable: u32,
66 pub tcp_keepalive_interval_secs: u32,
67 pub tcp_keepalive_probes: u32,
68 pub tcp_keepalive_time_secs: u32,
69 pub max_connections: u32,
70 pub max_use: u32,
71 pub max_lifetime_ms: u32,
72}
73
74impl Default for DynamicBackendConfig {
75 fn default() -> Self {
76 DynamicBackendConfig {
77 host_override: std::ptr::null(),
78 host_override_len: 0,
79 connect_timeout_ms: 0,
80 first_byte_timeout_ms: 0,
81 between_bytes_timeout_ms: 0,
82 ssl_min_version: 0,
83 ssl_max_version: 0,
84 cert_hostname: std::ptr::null(),
85 cert_hostname_len: 0,
86 ca_cert: std::ptr::null(),
87 ca_cert_len: 0,
88 ciphers: std::ptr::null(),
89 ciphers_len: 0,
90 sni_hostname: std::ptr::null(),
91 sni_hostname_len: 0,
92 client_certificate: std::ptr::null(),
93 client_certificate_len: 0,
94 client_key: 0,
95 http_keepalive_time_ms: 0,
96 tcp_keepalive_enable: 0,
97 tcp_keepalive_interval_secs: 0,
98 tcp_keepalive_probes: 0,
99 tcp_keepalive_time_secs: 0,
100 max_connections: 0,
101 max_use: 0,
102 max_lifetime_ms: 0,
103 }
104 }
105}
106
107#[repr(C)]
115#[derive(Default, Clone, Copy)]
116pub enum InsertMode {
117 #[default]
121 Overwrite,
122
123 Add,
129
130 Append,
132
133 Prepend,
135}
136
137#[repr(C)]
138pub struct InsertConfig {
139 pub mode: InsertMode,
140 pub unused: u32,
141 pub metadata: *const u8,
142 pub metadata_len: u32,
143 pub time_to_live_sec: u32,
144 pub if_generation_match: u64,
145}
146
147impl Default for InsertConfig {
148 fn default() -> Self {
149 InsertConfig {
150 mode: InsertMode::Overwrite,
151 unused: 0,
152 metadata: std::ptr::null(),
153 metadata_len: 0,
154 time_to_live_sec: 0,
155 if_generation_match: 0,
156 }
157 }
158}
159
160#[repr(C)]
164#[derive(Default, Clone)]
165pub enum ListMode {
166 #[default]
168 Strong,
169 Eventual,
175 Other(String),
179}
180
181#[repr(C)]
182#[derive(Default, Clone)]
183pub enum ListModeInternal {
184 #[default]
185 Strong,
186 Eventual,
187}
188
189#[repr(C)]
190pub struct ListConfig {
191 pub mode: ListModeInternal,
192 pub cursor: *const u8,
193 pub cursor_len: u32,
194 pub limit: u32,
195 pub prefix: *const u8,
196 pub prefix_len: u32,
197}
198
199impl Default for ListConfig {
200 fn default() -> Self {
201 ListConfig {
202 mode: ListModeInternal::Strong,
203 cursor: std::ptr::null(),
204 cursor_len: 0,
205 limit: 0,
206 prefix: std::ptr::null(),
207 prefix_len: 0,
208 }
209 }
210}
211
212#[repr(C)]
213#[derive(Default)]
214pub struct LookupConfig {
215 reserved: u32,
218}
219
220#[repr(C)]
221#[derive(Default)]
222pub struct DeleteConfig {
223 reserved: u32,
226}
227
228bitflags::bitflags! {
229 #[derive(Default)]
231 #[repr(transparent)]
232 pub struct ContentEncodings: u32 {
233 const GZIP = 1 << 0;
234 }
235}
236
237bitflags::bitflags! {
238 #[derive(Default)]
240 #[repr(transparent)]
241 pub struct BackendConfigOptions: u32 {
242 const RESERVED = 1 << 0;
243 const HOST_OVERRIDE = 1 << 1;
244 const CONNECT_TIMEOUT = 1 << 2;
245 const FIRST_BYTE_TIMEOUT = 1 << 3;
246 const BETWEEN_BYTES_TIMEOUT = 1 << 4;
247 const USE_SSL = 1 << 5;
248 const SSL_MIN_VERSION = 1 << 6;
249 const SSL_MAX_VERSION = 1 << 7;
250 const CERT_HOSTNAME = 1 << 8;
251 const CA_CERT = 1 << 9;
252 const CIPHERS = 1 << 10;
253 const SNI_HOSTNAME = 1 << 11;
254 const DONT_POOL = 1 << 12;
255 const CLIENT_CERT = 1 << 13;
256 const GRPC = 1 << 14;
257 const KEEPALIVE = 1 << 15;
258 const POOLING_LIMITS = 1 << 16;
259 const PREFER_IPV4 = 1 << 17;
260 }
261 #[derive(Default)]
263 #[repr(transparent)]
264 pub struct InsertConfigOptions: u32 {
265 const RESERVED = 1 << 0;
266 const BACKGROUND_FETCH = 1 << 1;
267 const RESERVED_2 = 1 << 2;
268 const METADATA = 1 << 3;
269 const TIME_TO_LIVE_SEC = 1 << 4;
270 const IF_GENERATION_MATCH = 1 << 5;
271 }
272 #[derive(Default)]
274 #[repr(transparent)]
275 pub struct ListConfigOptions: u32 {
276 const RESERVED = 1 << 0;
277 const CURSOR = 1 << 1;
278 const LIMIT = 1 << 2;
279 const PREFIX = 1 << 3;
280 }
281 #[derive(Default)]
283 #[repr(transparent)]
284 pub struct LookupConfigOptions: u32 {
285 const RESERVED = 1 << 0;
286 }
287 #[derive(Default)]
289 #[repr(transparent)]
290 pub struct DeleteConfigOptions: u32 {
291 const RESERVED = 1 << 0;
292 }
293}
294
295pub mod fastly_abi {
296 use super::*;
297
298 #[link(wasm_import_module = "fastly_abi")]
299 extern "C" {
300 #[link_name = "init"]
301 pub fn init(abi_version: u64) -> FastlyStatus;
303 }
304}
305
306#[deprecated(since = "0.11.6")]
307pub mod fastly_uap {
308 use super::*;
309
310 #[link(wasm_import_module = "fastly_uap")]
311 extern "C" {
312 #[link_name = "parse"]
313 pub fn parse(
314 user_agent: *const u8,
315 user_agent_max_len: usize,
316 family: *mut u8,
317 family_max_len: usize,
318 family_written: *mut usize,
319 major: *mut u8,
320 major_max_len: usize,
321 major_written: *mut usize,
322 minor: *mut u8,
323 minor_max_len: usize,
324 minor_written: *mut usize,
325 patch: *mut u8,
326 patch_max_len: usize,
327 patch_written: *mut usize,
328 ) -> FastlyStatus;
329 }
330}
331
332pub mod fastly_http_body {
333 use super::*;
334
335 #[link(wasm_import_module = "fastly_http_body")]
336 extern "C" {
337 #[link_name = "append"]
338 pub fn append(dst_handle: BodyHandle, src_handle: BodyHandle) -> FastlyStatus;
339
340 #[link_name = "new"]
341 pub fn new(handle_out: *mut BodyHandle) -> FastlyStatus;
342
343 #[link_name = "read"]
344 pub fn read(
345 body_handle: BodyHandle,
346 buf: *mut u8,
347 buf_len: usize,
348 nread_out: *mut usize,
349 ) -> FastlyStatus;
350
351 #[allow(clashing_extern_declarations)]
353 #[link_name = "write"]
354 pub fn write(
355 body_handle: BodyHandle,
356 buf: *const u8,
357 buf_len: usize,
358 end: fastly_shared::BodyWriteEnd,
359 nwritten_out: *mut usize,
360 ) -> FastlyStatus;
361
362 #[link_name = "close"]
364 pub fn close(body_handle: BodyHandle) -> FastlyStatus;
365
366 #[link_name = "trailer_append"]
367 pub fn trailer_append(
368 body_handle: BodyHandle,
369 name: *const u8,
370 name_len: usize,
371 value: *const u8,
372 value_len: usize,
373 ) -> FastlyStatus;
374
375 #[link_name = "trailer_names_get"]
376 pub fn trailer_names_get(
377 body_handle: BodyHandle,
378 buf: *mut u8,
379 buf_len: usize,
380 cursor: u32,
381 ending_cursor: *mut i64,
382 nwritten: *mut usize,
383 ) -> FastlyStatus;
384
385 #[link_name = "trailer_value_get"]
386 pub fn trailer_value_get(
387 body_handle: BodyHandle,
388 name: *const u8,
389 name_len: usize,
390 value: *mut u8,
391 value_max_len: usize,
392 nwritten: *mut usize,
393 ) -> FastlyStatus;
394
395 #[link_name = "trailer_values_get"]
396 pub fn trailer_values_get(
397 body_handle: BodyHandle,
398 name: *const u8,
399 name_len: usize,
400 buf: *mut u8,
401 buf_len: usize,
402 cursor: u32,
403 ending_cursor: *mut i64,
404 nwritten: *mut usize,
405 ) -> FastlyStatus;
406
407 #[link_name = "known_length"]
408 pub fn known_length(body_handle: BodyHandle, length_out: *mut u64) -> FastlyStatus;
409 }
410}
411
412pub mod fastly_log {
413 use super::*;
414
415 #[link(wasm_import_module = "fastly_log")]
416 extern "C" {
417 #[link_name = "endpoint_get"]
418 pub fn endpoint_get(
419 name: *const u8,
420 name_len: usize,
421 endpoint_handle_out: *mut u32,
422 ) -> FastlyStatus;
423
424 #[allow(clashing_extern_declarations)]
426 #[link_name = "write"]
427 pub fn write(
428 endpoint_handle: u32,
429 msg: *const u8,
430 msg_len: usize,
431 nwritten_out: *mut usize,
432 ) -> FastlyStatus;
433
434 }
435}
436
437pub mod fastly_http_downstream {
438 use super::*;
439
440 #[derive(Default)]
441 #[repr(C)]
442 pub struct NextRequestOptions {
443 pub timeout_ms: u64,
444 }
445
446 bitflags::bitflags! {
447 #[derive(Default)]
449 #[repr(transparent)]
450 pub struct NextRequestOptionsMask: u32 {
451 const RESERVED = 1 << 0;
452 const TIMEOUT = 1 << 1;
453 }
454 }
455
456 #[link(wasm_import_module = "fastly_http_downstream")]
457 extern "C" {
458 #[link_name = "next_request"]
459 pub fn next_request(
460 options_mask: NextRequestOptionsMask,
461 options: *const NextRequestOptions,
462 handle_out: *mut RequestPromiseHandle,
463 ) -> FastlyStatus;
464
465 #[link_name = "next_request_wait"]
466 pub fn next_request_wait(
467 handle: RequestPromiseHandle,
468 req_handle_out: *mut RequestHandle,
469 body_handle_out: *mut BodyHandle,
470 ) -> FastlyStatus;
471
472 #[link_name = "next_request_abandon"]
473 pub fn next_request_abandon(handle: RequestPromiseHandle) -> FastlyStatus;
474
475 #[link_name = "downstream_original_header_names"]
476 pub fn downstream_original_header_names(
477 req_handle: RequestHandle,
478 buf: *mut u8,
479 buf_len: usize,
480 cursor: u32,
481 ending_cursor: *mut i64,
482 nwritten: *mut usize,
483 ) -> FastlyStatus;
484
485 #[link_name = "downstream_original_header_count"]
486 pub fn downstream_original_header_count(
487 req_handle: RequestHandle,
488 count_out: *mut u32,
489 ) -> FastlyStatus;
490
491 #[link_name = "downstream_client_ip_addr"]
492 pub fn downstream_client_ip_addr(
493 req_handle: RequestHandle,
494 addr_octets_out: *mut u8,
495 nwritten_out: *mut usize,
496 ) -> FastlyStatus;
497
498 #[link_name = "downstream_server_ip_addr"]
499 pub fn downstream_server_ip_addr(
500 req_handle: RequestHandle,
501 addr_octets_out: *mut u8,
502 nwritten_out: *mut usize,
503 ) -> FastlyStatus;
504
505 #[link_name = "downstream_client_h2_fingerprint"]
506 pub fn downstream_client_h2_fingerprint(
507 req_handle: RequestHandle,
508 h2fp_out: *mut u8,
509 h2fp_max_len: usize,
510 nwritten: *mut usize,
511 ) -> FastlyStatus;
512
513 #[link_name = "downstream_client_request_id"]
514 pub fn downstream_client_request_id(
515 req_handle: RequestHandle,
516 reqid_out: *mut u8,
517 reqid_max_len: usize,
518 nwritten: *mut usize,
519 ) -> FastlyStatus;
520
521 #[link_name = "downstream_client_oh_fingerprint"]
522 pub fn downstream_client_oh_fingerprint(
523 req_handle: RequestHandle,
524 ohfp_out: *mut u8,
525 ohfp_max_len: usize,
526 nwritten: *mut usize,
527 ) -> FastlyStatus;
528
529 #[link_name = "downstream_client_ddos_detected"]
530 pub fn downstream_client_ddos_detected(
531 req_handle: RequestHandle,
532 ddos_detected_out: *mut u32,
533 ) -> FastlyStatus;
534
535 #[link_name = "downstream_tls_cipher_openssl_name"]
536 pub fn downstream_tls_cipher_openssl_name(
537 req_handle: RequestHandle,
538 cipher_out: *mut u8,
539 cipher_max_len: usize,
540 nwritten: *mut usize,
541 ) -> FastlyStatus;
542
543 #[link_name = "downstream_tls_protocol"]
544 pub fn downstream_tls_protocol(
545 req_handle: RequestHandle,
546 protocol_out: *mut u8,
547 protocol_max_len: usize,
548 nwritten: *mut usize,
549 ) -> FastlyStatus;
550
551 #[link_name = "downstream_tls_client_hello"]
552 pub fn downstream_tls_client_hello(
553 req_handle: RequestHandle,
554 client_hello_out: *mut u8,
555 client_hello_max_len: usize,
556 nwritten: *mut usize,
557 ) -> FastlyStatus;
558
559 #[link_name = "downstream_tls_client_servername"]
560 pub fn downstream_tls_client_servername(
561 req_handle: RequestHandle,
562 sni_out: *mut u8,
563 sni_max_len: usize,
564 nwritten: *mut usize,
565 ) -> FastlyStatus;
566
567 #[link_name = "downstream_tls_ja3_md5"]
568 pub fn downstream_tls_ja3_md5(
569 req_handle: RequestHandle,
570 ja3_md5_out: *mut u8,
571 nwritten_out: *mut usize,
572 ) -> FastlyStatus;
573
574 #[link_name = "downstream_tls_ja4"]
575 pub fn downstream_tls_ja4(
576 req_handle: RequestHandle,
577 ja4_out: *mut u8,
578 ja4_max_len: usize,
579 nwritten: *mut usize,
580 ) -> FastlyStatus;
581
582 #[link_name = "downstream_compliance_region"]
583 pub fn downstream_compliance_region(
584 req_handle: RequestHandle,
585 region_out: *mut u8,
586 region_max_len: usize,
587 nwritten: *mut usize,
588 ) -> FastlyStatus;
589
590 #[link_name = "downstream_tls_raw_client_certificate"]
591 pub fn downstream_tls_raw_client_certificate(
592 req_handle: RequestHandle,
593 client_hello_out: *mut u8,
594 client_hello_max_len: usize,
595 nwritten: *mut usize,
596 ) -> FastlyStatus;
597
598 #[link_name = "downstream_tls_client_cert_verify_result"]
599 pub fn downstream_tls_client_cert_verify_result(
600 req_handle: RequestHandle,
601 verify_result_out: *mut u32,
602 ) -> FastlyStatus;
603
604 #[link_name = "fastly_key_is_valid"]
605 pub fn fastly_key_is_valid(
606 req_handle: RequestHandle,
607 is_valid_out: *mut u32,
608 ) -> FastlyStatus;
609 }
610}
611
612pub mod fastly_http_req {
613 use super::*;
614
615 bitflags::bitflags! {
616 #[derive(Default)]
617 #[repr(transparent)]
618 pub struct SendErrorDetailMask: u32 {
619 const RESERVED = 1 << 0;
620 const DNS_ERROR_RCODE = 1 << 1;
621 const DNS_ERROR_INFO_CODE = 1 << 2;
622 const TLS_ALERT_ID = 1 << 3;
623 }
624 }
625
626 #[repr(u32)]
627 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
628 pub enum SendErrorDetailTag {
629 Uninitialized,
630 Ok,
631 DnsTimeout,
632 DnsError,
633 DestinationNotFound,
634 DestinationUnavailable,
635 DestinationIpUnroutable,
636 ConnectionRefused,
637 ConnectionTerminated,
638 ConnectionTimeout,
639 ConnectionLimitReached,
640 TlsCertificateError,
641 TlsConfigurationError,
642 HttpIncompleteResponse,
643 HttpResponseHeaderSectionTooLarge,
644 HttpResponseBodyTooLarge,
645 HttpResponseTimeout,
646 HttpResponseStatusInvalid,
647 HttpUpgradeFailed,
648 HttpProtocolError,
649 HttpRequestCacheKeyInvalid,
650 HttpRequestUriInvalid,
651 InternalError,
652 TlsAlertReceived,
653 TlsProtocolError,
654 }
655
656 #[repr(C)]
657 #[derive(Clone, Debug, PartialEq, Eq)]
658 pub struct SendErrorDetail {
659 pub tag: SendErrorDetailTag,
660 pub mask: SendErrorDetailMask,
661 pub dns_error_rcode: u16,
662 pub dns_error_info_code: u16,
663 pub tls_alert_id: u8,
664 }
665
666 impl SendErrorDetail {
667 pub fn uninitialized_all() -> Self {
668 Self {
669 tag: SendErrorDetailTag::Uninitialized,
670 mask: SendErrorDetailMask::all(),
671 dns_error_rcode: Default::default(),
672 dns_error_info_code: Default::default(),
673 tls_alert_id: Default::default(),
674 }
675 }
676 }
677
678 bitflags::bitflags! {
679 #[repr(transparent)]
680 pub struct InspectInfoMask: u32 {
681 const RESERVED = 1 << 0;
682 const CORP = 1 << 1;
683 const WORKSPACE = 1 << 2;
684 const OVERRIDE_CLIENT_IP = 1 << 3;
685 }
686 }
687
688 #[repr(C)]
689 pub struct InspectInfo {
690 pub corp: *const u8,
691 pub corp_len: u32,
692 pub workspace: *const u8,
693 pub workspace_len: u32,
694 pub override_client_ip_ptr: *const u8,
695 pub override_client_ip_len: u32,
696 }
697
698 impl Default for InspectInfo {
699 fn default() -> Self {
700 InspectInfo {
701 corp: std::ptr::null(),
702 corp_len: 0,
703 workspace: std::ptr::null(),
704 workspace_len: 0,
705 override_client_ip_ptr: std::ptr::null(),
706 override_client_ip_len: 0,
707 }
708 }
709 }
710
711 #[link(wasm_import_module = "fastly_http_req")]
712 extern "C" {
713 #[link_name = "body_downstream_get"]
714 pub fn body_downstream_get(
715 req_handle_out: *mut RequestHandle,
716 body_handle_out: *mut BodyHandle,
717 ) -> FastlyStatus;
718
719 #[link_name = "cache_override_set"]
720 pub fn cache_override_set(
721 req_handle: RequestHandle,
722 tag: u32,
723 ttl: u32,
724 swr: u32,
725 ) -> FastlyStatus;
726
727 #[link_name = "cache_override_v2_set"]
728 pub fn cache_override_v2_set(
729 req_handle: RequestHandle,
730 tag: u32,
731 ttl: u32,
732 swr: u32,
733 sk: *const u8,
734 sk_len: usize,
735 ) -> FastlyStatus;
736
737 #[link_name = "framing_headers_mode_set"]
738 pub fn framing_headers_mode_set(
739 req_handle: RequestHandle,
740 mode: fastly_shared::FramingHeadersMode,
741 ) -> FastlyStatus;
742
743 #[link_name = "downstream_client_ip_addr"]
744 pub fn downstream_client_ip_addr(
745 addr_octets_out: *mut u8,
746 nwritten_out: *mut usize,
747 ) -> FastlyStatus;
748
749 #[link_name = "downstream_server_ip_addr"]
750 pub fn downstream_server_ip_addr(
751 addr_octets_out: *mut u8,
752 nwritten_out: *mut usize,
753 ) -> FastlyStatus;
754
755 #[link_name = "downstream_client_h2_fingerprint"]
756 pub fn downstream_client_h2_fingerprint(
757 h2fp_out: *mut u8,
758 h2fp_max_len: usize,
759 nwritten: *mut usize,
760 ) -> FastlyStatus;
761
762 #[link_name = "downstream_client_request_id"]
763 pub fn downstream_client_request_id(
764 reqid_out: *mut u8,
765 reqid_max_len: usize,
766 nwritten: *mut usize,
767 ) -> FastlyStatus;
768
769 #[link_name = "downstream_client_oh_fingerprint"]
770 pub fn downstream_client_oh_fingerprint(
771 ohfp_out: *mut u8,
772 ohfp_max_len: usize,
773 nwritten: *mut usize,
774 ) -> FastlyStatus;
775
776 #[link_name = "downstream_client_ddos_detected"]
777 pub fn downstream_client_ddos_detected(ddos_detected_out: *mut u32) -> FastlyStatus;
778
779 #[link_name = "downstream_tls_cipher_openssl_name"]
780 pub fn downstream_tls_cipher_openssl_name(
781 cipher_out: *mut u8,
782 cipher_max_len: usize,
783 nwritten: *mut usize,
784 ) -> FastlyStatus;
785
786 #[link_name = "downstream_tls_protocol"]
787 pub fn downstream_tls_protocol(
788 protocol_out: *mut u8,
789 protocol_max_len: usize,
790 nwritten: *mut usize,
791 ) -> FastlyStatus;
792
793 #[link_name = "downstream_tls_client_hello"]
794 pub fn downstream_tls_client_hello(
795 client_hello_out: *mut u8,
796 client_hello_max_len: usize,
797 nwritten: *mut usize,
798 ) -> FastlyStatus;
799
800 #[link_name = "downstream_tls_ja3_md5"]
801 pub fn downstream_tls_ja3_md5(
802 ja3_md5_out: *mut u8,
803 nwritten_out: *mut usize,
804 ) -> FastlyStatus;
805
806 #[link_name = "downstream_tls_ja4"]
807 pub fn downstream_tls_ja4(
808 ja4_out: *mut u8,
809 ja4_max_len: usize,
810 nwritten: *mut usize,
811 ) -> FastlyStatus;
812
813 #[link_name = "downstream_compliance_region"]
814 pub fn downstream_compliance_region(
815 region_out: *mut u8,
816 region_max_len: usize,
817 nwritten: *mut usize,
818 ) -> FastlyStatus;
819
820 #[link_name = "downstream_tls_raw_client_certificate"]
821 pub fn downstream_tls_raw_client_certificate(
822 client_hello_out: *mut u8,
823 client_hello_max_len: usize,
824 nwritten: *mut usize,
825 ) -> FastlyStatus;
826
827 #[link_name = "downstream_tls_client_cert_verify_result"]
828 pub fn downstream_tls_client_cert_verify_result(
829 verify_result_out: *mut u32,
830 ) -> FastlyStatus;
831
832 #[link_name = "header_append"]
833 pub fn header_append(
834 req_handle: RequestHandle,
835 name: *const u8,
836 name_len: usize,
837 value: *const u8,
838 value_len: usize,
839 ) -> FastlyStatus;
840
841 #[link_name = "header_insert"]
842 pub fn header_insert(
843 req_handle: RequestHandle,
844 name: *const u8,
845 name_len: usize,
846 value: *const u8,
847 value_len: usize,
848 ) -> FastlyStatus;
849
850 #[link_name = "original_header_names_get"]
851 pub fn original_header_names_get(
852 buf: *mut u8,
853 buf_len: usize,
854 cursor: u32,
855 ending_cursor: *mut i64,
856 nwritten: *mut usize,
857 ) -> FastlyStatus;
858
859 #[link_name = "original_header_count"]
860 pub fn original_header_count(count_out: *mut u32) -> FastlyStatus;
861
862 #[link_name = "header_names_get"]
863 pub fn header_names_get(
864 req_handle: RequestHandle,
865 buf: *mut u8,
866 buf_len: usize,
867 cursor: u32,
868 ending_cursor: *mut i64,
869 nwritten: *mut usize,
870 ) -> FastlyStatus;
871
872 #[link_name = "header_values_get"]
873 pub fn header_values_get(
874 req_handle: RequestHandle,
875 name: *const u8,
876 name_len: usize,
877 buf: *mut u8,
878 buf_len: usize,
879 cursor: u32,
880 ending_cursor: *mut i64,
881 nwritten: *mut usize,
882 ) -> FastlyStatus;
883
884 #[link_name = "header_values_set"]
885 pub fn header_values_set(
886 req_handle: RequestHandle,
887 name: *const u8,
888 name_len: usize,
889 values: *const u8,
890 values_len: usize,
891 ) -> FastlyStatus;
892
893 #[link_name = "header_value_get"]
894 pub fn header_value_get(
895 req_handle: RequestHandle,
896 name: *const u8,
897 name_len: usize,
898 value: *mut u8,
899 value_max_len: usize,
900 nwritten: *mut usize,
901 ) -> FastlyStatus;
902
903 #[link_name = "header_remove"]
904 pub fn header_remove(
905 req_handle: RequestHandle,
906 name: *const u8,
907 name_len: usize,
908 ) -> FastlyStatus;
909
910 #[link_name = "method_get"]
911 pub fn method_get(
912 req_handle: RequestHandle,
913 method: *mut u8,
914 method_max_len: usize,
915 nwritten: *mut usize,
916 ) -> FastlyStatus;
917
918 #[link_name = "method_set"]
919 pub fn method_set(
920 req_handle: RequestHandle,
921 method: *const u8,
922 method_len: usize,
923 ) -> FastlyStatus;
924
925 #[link_name = "new"]
926 pub fn new(req_handle_out: *mut RequestHandle) -> FastlyStatus;
927
928 #[link_name = "send_v2"]
929 pub fn send_v2(
930 req_handle: RequestHandle,
931 body_handle: BodyHandle,
932 backend: *const u8,
933 backend_len: usize,
934 error_detail: *mut SendErrorDetail,
935 resp_handle_out: *mut ResponseHandle,
936 resp_body_handle_out: *mut BodyHandle,
937 ) -> FastlyStatus;
938
939 #[link_name = "send_v3"]
940 pub fn send_v3(
941 req_handle: RequestHandle,
942 body_handle: BodyHandle,
943 backend: *const u8,
944 backend_len: usize,
945 error_detail: *mut SendErrorDetail,
946 resp_handle_out: *mut ResponseHandle,
947 resp_body_handle_out: *mut BodyHandle,
948 ) -> FastlyStatus;
949
950 #[link_name = "send_async"]
951 pub fn send_async(
952 req_handle: RequestHandle,
953 body_handle: BodyHandle,
954 backend: *const u8,
955 backend_len: usize,
956 pending_req_handle_out: *mut PendingRequestHandle,
957 ) -> FastlyStatus;
958
959 #[link_name = "send_async_streaming"]
960 pub fn send_async_streaming(
961 req_handle: RequestHandle,
962 body_handle: BodyHandle,
963 backend: *const u8,
964 backend_len: usize,
965 pending_req_handle_out: *mut PendingRequestHandle,
966 ) -> FastlyStatus;
967
968 #[link_name = "send_async_v2"]
969 pub fn send_async_v2(
970 req_handle: RequestHandle,
971 body_handle: BodyHandle,
972 backend: *const u8,
973 backend_len: usize,
974 streaming: u32,
975 pending_req_handle_out: *mut PendingRequestHandle,
976 ) -> FastlyStatus;
977
978 #[link_name = "upgrade_websocket"]
979 pub fn upgrade_websocket(backend: *const u8, backend_len: usize) -> FastlyStatus;
980
981 #[link_name = "redirect_to_websocket_proxy_v2"]
982 pub fn redirect_to_websocket_proxy_v2(
983 req: RequestHandle,
984 backend: *const u8,
985 backend_len: usize,
986 ) -> FastlyStatus;
987
988 #[link_name = "redirect_to_grip_proxy_v2"]
989 pub fn redirect_to_grip_proxy_v2(
990 req: RequestHandle,
991 backend: *const u8,
992 backend_len: usize,
993 ) -> FastlyStatus;
994
995 #[link_name = "register_dynamic_backend"]
996 pub fn register_dynamic_backend(
997 name_prefix: *const u8,
998 name_prefix_len: usize,
999 target: *const u8,
1000 target_len: usize,
1001 config_mask: BackendConfigOptions,
1002 config: *const DynamicBackendConfig,
1003 ) -> FastlyStatus;
1004
1005 #[link_name = "uri_get"]
1006 pub fn uri_get(
1007 req_handle: RequestHandle,
1008 uri: *mut u8,
1009 uri_max_len: usize,
1010 nwritten: *mut usize,
1011 ) -> FastlyStatus;
1012
1013 #[link_name = "uri_set"]
1014 pub fn uri_set(req_handle: RequestHandle, uri: *const u8, uri_len: usize) -> FastlyStatus;
1015
1016 #[link_name = "version_get"]
1017 pub fn version_get(req_handle: RequestHandle, version: *mut u32) -> FastlyStatus;
1018
1019 #[link_name = "version_set"]
1020 pub fn version_set(req_handle: RequestHandle, version: u32) -> FastlyStatus;
1021
1022 #[link_name = "pending_req_poll_v2"]
1023 pub fn pending_req_poll_v2(
1024 pending_req_handle: PendingRequestHandle,
1025 error_detail: *mut SendErrorDetail,
1026 is_done_out: *mut i32,
1027 resp_handle_out: *mut ResponseHandle,
1028 resp_body_handle_out: *mut BodyHandle,
1029 ) -> FastlyStatus;
1030
1031 #[link_name = "pending_req_select_v2"]
1032 pub fn pending_req_select_v2(
1033 pending_req_handles: *const PendingRequestHandle,
1034 pending_req_handles_len: usize,
1035 error_detail: *mut SendErrorDetail,
1036 done_index_out: *mut i32,
1037 resp_handle_out: *mut ResponseHandle,
1038 resp_body_handle_out: *mut BodyHandle,
1039 ) -> FastlyStatus;
1040
1041 #[link_name = "pending_req_wait_v2"]
1042 pub fn pending_req_wait_v2(
1043 pending_req_handle: PendingRequestHandle,
1044 error_detail: *mut SendErrorDetail,
1045 resp_handle_out: *mut ResponseHandle,
1046 resp_body_handle_out: *mut BodyHandle,
1047 ) -> FastlyStatus;
1048
1049 #[link_name = "fastly_key_is_valid"]
1050 pub fn fastly_key_is_valid(is_valid_out: *mut u32) -> FastlyStatus;
1051
1052 #[link_name = "close"]
1053 pub fn close(req_handle: RequestHandle) -> FastlyStatus;
1054
1055 #[link_name = "auto_decompress_response_set"]
1056 pub fn auto_decompress_response_set(
1057 req_handle: RequestHandle,
1058 encodings: ContentEncodings,
1059 ) -> FastlyStatus;
1060
1061 #[link_name = "inspect"]
1062 pub fn inspect(
1063 request_handle: RequestHandle,
1064 body_handle: BodyHandle,
1065 add_info_mask: InspectInfoMask,
1066 add_info: *const InspectInfo,
1067 buf: *mut u8,
1068 buf_len: usize,
1069 nwritten: *mut usize,
1070 ) -> FastlyStatus;
1071
1072 #[link_name = "on_behalf_of"]
1073 pub fn on_behalf_of(
1074 request_handle: RequestHandle,
1075 service: *const u8,
1076 service_len: usize,
1077 ) -> FastlyStatus;
1078 }
1079}
1080
1081pub mod fastly_http_resp {
1082 use super::*;
1083
1084 #[link(wasm_import_module = "fastly_http_resp")]
1085 extern "C" {
1086 #[link_name = "header_append"]
1087 pub fn header_append(
1088 resp_handle: ResponseHandle,
1089 name: *const u8,
1090 name_len: usize,
1091 value: *const u8,
1092 value_len: usize,
1093 ) -> FastlyStatus;
1094
1095 #[link_name = "header_insert"]
1096 pub fn header_insert(
1097 resp_handle: ResponseHandle,
1098 name: *const u8,
1099 name_len: usize,
1100 value: *const u8,
1101 value_len: usize,
1102 ) -> FastlyStatus;
1103
1104 #[link_name = "header_names_get"]
1105 pub fn header_names_get(
1106 resp_handle: ResponseHandle,
1107 buf: *mut u8,
1108 buf_len: usize,
1109 cursor: u32,
1110 ending_cursor: *mut i64,
1111 nwritten: *mut usize,
1112 ) -> FastlyStatus;
1113
1114 #[link_name = "header_value_get"]
1115 pub fn header_value_get(
1116 resp_handle: ResponseHandle,
1117 name: *const u8,
1118 name_len: usize,
1119 value: *mut u8,
1120 value_max_len: usize,
1121 nwritten: *mut usize,
1122 ) -> FastlyStatus;
1123
1124 #[link_name = "header_values_get"]
1125 pub fn header_values_get(
1126 resp_handle: ResponseHandle,
1127 name: *const u8,
1128 name_len: usize,
1129 buf: *mut u8,
1130 buf_len: usize,
1131 cursor: u32,
1132 ending_cursor: *mut i64,
1133 nwritten: *mut usize,
1134 ) -> FastlyStatus;
1135
1136 #[link_name = "header_values_set"]
1137 pub fn header_values_set(
1138 resp_handle: ResponseHandle,
1139 name: *const u8,
1140 name_len: usize,
1141 values: *const u8,
1142 values_len: usize,
1143 ) -> FastlyStatus;
1144
1145 #[link_name = "header_remove"]
1146 pub fn header_remove(
1147 resp_handle: ResponseHandle,
1148 name: *const u8,
1149 name_len: usize,
1150 ) -> FastlyStatus;
1151
1152 #[link_name = "new"]
1153 pub fn new(resp_handle_out: *mut ResponseHandle) -> FastlyStatus;
1154
1155 #[link_name = "send_downstream"]
1156 pub fn send_downstream(
1157 resp_handle: ResponseHandle,
1158 body_handle: BodyHandle,
1159 streaming: u32,
1160 ) -> FastlyStatus;
1161
1162 #[link_name = "status_get"]
1163 pub fn status_get(resp_handle: ResponseHandle, status: *mut u16) -> FastlyStatus;
1164
1165 #[link_name = "status_set"]
1166 pub fn status_set(resp_handle: ResponseHandle, status: u16) -> FastlyStatus;
1167
1168 #[link_name = "version_get"]
1169 pub fn version_get(resp_handle: ResponseHandle, version: *mut u32) -> FastlyStatus;
1170
1171 #[link_name = "version_set"]
1172 pub fn version_set(resp_handle: ResponseHandle, version: u32) -> FastlyStatus;
1173
1174 #[link_name = "framing_headers_mode_set"]
1175 pub fn framing_headers_mode_set(
1176 resp_handle: ResponseHandle,
1177 mode: fastly_shared::FramingHeadersMode,
1178 ) -> FastlyStatus;
1179
1180 #[doc(hidden)]
1181 #[link_name = "http_keepalive_mode_set"]
1182 pub fn http_keepalive_mode_set(
1183 resp_handle: ResponseHandle,
1184 mode: fastly_shared::HttpKeepaliveMode,
1185 ) -> FastlyStatus;
1186
1187 #[link_name = "close"]
1188 pub fn close(resp_handle: ResponseHandle) -> FastlyStatus;
1189
1190 #[link_name = "get_addr_dest_ip"]
1191 pub fn get_addr_dest_ip(
1192 resp_handle: ResponseHandle,
1193 addr_octets_out: *mut u8,
1194 nwritten_out: *mut usize,
1195 ) -> FastlyStatus;
1196
1197 #[link_name = "get_addr_dest_port"]
1198 pub fn get_addr_dest_port(resp_handle: ResponseHandle, port_out: *mut u16) -> FastlyStatus;
1199 }
1200}
1201
1202pub mod fastly_dictionary {
1203 use super::*;
1204
1205 #[link(wasm_import_module = "fastly_dictionary")]
1206 extern "C" {
1207 #[link_name = "open"]
1208 pub fn open(
1209 name: *const u8,
1210 name_len: usize,
1211 dict_handle_out: *mut DictionaryHandle,
1212 ) -> FastlyStatus;
1213
1214 #[link_name = "get"]
1215 pub fn get(
1216 dict_handle: DictionaryHandle,
1217 key: *const u8,
1218 key_len: usize,
1219 value: *mut u8,
1220 value_max_len: usize,
1221 nwritten: *mut usize,
1222 ) -> FastlyStatus;
1223 }
1224}
1225
1226pub mod fastly_geo {
1227 use super::*;
1228
1229 #[link(wasm_import_module = "fastly_geo")]
1230 extern "C" {
1231 #[link_name = "lookup"]
1232 pub fn lookup(
1233 addr_octets: *const u8,
1234 addr_len: usize,
1235 buf: *mut u8,
1236 buf_len: usize,
1237 nwritten_out: *mut usize,
1238 ) -> FastlyStatus;
1239 }
1240}
1241
1242pub mod fastly_device_detection {
1243 use super::*;
1244
1245 #[link(wasm_import_module = "fastly_device_detection")]
1246 extern "C" {
1247 #[link_name = "lookup"]
1248 pub fn lookup(
1249 user_agent: *const u8,
1250 user_agent_max_len: usize,
1251 buf: *mut u8,
1252 buf_len: usize,
1253 nwritten_out: *mut usize,
1254 ) -> FastlyStatus;
1255 }
1256}
1257
1258pub mod fastly_erl {
1259 use super::*;
1260
1261 #[link(wasm_import_module = "fastly_erl")]
1262 extern "C" {
1263 #[link_name = "check_rate"]
1264 pub fn check_rate(
1265 rc: *const u8,
1266 rc_max_len: usize,
1267 entry: *const u8,
1268 entry_max_len: usize,
1269 delta: u32,
1270 window: u32,
1271 limit: u32,
1272 pb: *const u8,
1273 pb_max_len: usize,
1274 ttl: u32,
1275 value: *mut u32,
1276 ) -> FastlyStatus;
1277
1278 #[link_name = "ratecounter_increment"]
1279 pub fn ratecounter_increment(
1280 rc: *const u8,
1281 rc_max_len: usize,
1282 entry: *const u8,
1283 entry_max_len: usize,
1284 delta: u32,
1285 ) -> FastlyStatus;
1286
1287 #[link_name = "ratecounter_lookup_rate"]
1288 pub fn ratecounter_lookup_rate(
1289 rc: *const u8,
1290 rc_max_len: usize,
1291 entry: *const u8,
1292 entry_max_len: usize,
1293 window: u32,
1294 value: *mut u32,
1295 ) -> FastlyStatus;
1296
1297 #[link_name = "ratecounter_lookup_count"]
1298 pub fn ratecounter_lookup_count(
1299 rc: *const u8,
1300 rc_max_len: usize,
1301 entry: *const u8,
1302 entry_max_len: usize,
1303 duration: u32,
1304 value: *mut u32,
1305 ) -> FastlyStatus;
1306
1307 #[link_name = "penaltybox_add"]
1308 pub fn penaltybox_add(
1309 pb: *const u8,
1310 pb_max_len: usize,
1311 entry: *const u8,
1312 entry_max_len: usize,
1313 ttl: u32,
1314 ) -> FastlyStatus;
1315
1316 #[link_name = "penaltybox_has"]
1317 pub fn penaltybox_has(
1318 pb: *const u8,
1319 pb_max_len: usize,
1320 entry: *const u8,
1321 entry_max_len: usize,
1322 value: *mut u32,
1323 ) -> FastlyStatus;
1324 }
1325}
1326
1327pub mod fastly_kv_store {
1328 use super::*;
1329
1330 #[repr(u32)]
1331 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1332 pub enum KvError {
1333 Uninitialized,
1334 Ok,
1335 BadRequest,
1336 NotFound,
1337 PreconditionFailed,
1338 PayloadTooLarge,
1339 InternalError,
1340 }
1341
1342 #[link(wasm_import_module = "fastly_object_store")]
1344 extern "C" {
1345 #[link_name = "open"]
1346 pub fn open(
1347 name_ptr: *const u8,
1348 name_len: usize,
1349 kv_store_handle_out: *mut KVStoreHandle,
1350 ) -> FastlyStatus;
1351
1352 #[deprecated(note = "kept for backward compatibility")]
1353 #[link_name = "lookup"]
1354 pub fn lookup(
1355 kv_store_handle: KVStoreHandle,
1356 key_ptr: *const u8,
1357 key_len: usize,
1358 body_handle_out: *mut BodyHandle,
1359 ) -> FastlyStatus;
1360
1361 #[deprecated(note = "kept for backward compatibility")]
1362 #[link_name = "lookup_async"]
1363 pub fn lookup_async(
1364 kv_store_handle: KVStoreHandle,
1365 key_ptr: *const u8,
1366 key_len: usize,
1367 pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1368 ) -> FastlyStatus;
1369
1370 #[deprecated(note = "kept for backward compatibility")]
1371 #[link_name = "pending_lookup_wait"]
1372 pub fn pending_lookup_wait(
1373 pending_handle: PendingObjectStoreLookupHandle,
1374 body_handle_out: *mut BodyHandle,
1375 ) -> FastlyStatus;
1376
1377 #[deprecated(note = "kept for backward compatibility")]
1378 #[link_name = "insert"]
1379 pub fn insert(
1380 kv_store_handle: KVStoreHandle,
1381 key_ptr: *const u8,
1382 key_len: usize,
1383 body_handle: BodyHandle,
1384 ) -> FastlyStatus;
1385
1386 #[deprecated(note = "kept for backward compatibility")]
1387 #[link_name = "insert_async"]
1388 pub fn insert_async(
1389 kv_store_handle: KVStoreHandle,
1390 key_ptr: *const u8,
1391 key_len: usize,
1392 body_handle: BodyHandle,
1393 pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1394 ) -> FastlyStatus;
1395
1396 #[deprecated(note = "kept for backward compatibility")]
1397 #[link_name = "pending_insert_wait"]
1398 pub fn pending_insert_wait(
1399 pending_body_handle: PendingObjectStoreInsertHandle,
1400 kv_error_out: *mut KvError,
1401 ) -> FastlyStatus;
1402
1403 #[deprecated(note = "kept for backward compatibility")]
1404 #[link_name = "delete_async"]
1405 pub fn delete_async(
1406 kv_store_handle: KVStoreHandle,
1407 key_ptr: *const u8,
1408 key_len: usize,
1409 pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1410 ) -> FastlyStatus;
1411
1412 #[deprecated(note = "kept for backward compatibility")]
1413 #[link_name = "pending_delete_wait"]
1414 pub fn pending_delete_wait(
1415 pending_body_handle: PendingObjectStoreDeleteHandle,
1416 ) -> FastlyStatus;
1417 }
1418
1419 #[link(wasm_import_module = "fastly_kv_store")]
1420 extern "C" {
1421 #[link_name = "open"]
1422 pub fn open_v2(
1423 name_ptr: *const u8,
1424 name_len: usize,
1425 kv_store_handle_out: *mut KVStoreHandle,
1426 ) -> FastlyStatus;
1427
1428 #[link_name = "lookup"]
1429 pub fn lookup_v2(
1430 kv_store_handle: KVStoreHandle,
1431 key_ptr: *const u8,
1432 key_len: usize,
1433 lookup_config_mask: LookupConfigOptions,
1434 lookup_config: *const LookupConfig,
1435 pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1436 ) -> FastlyStatus;
1437
1438 #[link_name = "lookup_wait"]
1439 pub fn pending_lookup_wait_v2(
1440 pending_handle: PendingObjectStoreLookupHandle,
1441 body_handle_out: *mut BodyHandle,
1442 metadata_buf: *mut u8,
1443 metadata_buf_len: usize,
1444 nwritten_out: *mut usize,
1445 generation_out: *mut u32,
1446 kv_error_out: *mut KvError,
1447 ) -> FastlyStatus;
1448
1449 #[link_name = "lookup_wait_v2"]
1450 pub fn lookup_wait_v2(
1451 pending_handle: PendingObjectStoreLookupHandle,
1452 body_handle_out: *mut BodyHandle,
1453 metadata_buf: *mut u8,
1454 metadata_buf_len: usize,
1455 nwritten_out: *mut usize,
1456 generation_out: *mut u64,
1457 kv_error_out: *mut KvError,
1458 ) -> FastlyStatus;
1459
1460 #[link_name = "insert"]
1461 pub fn insert_v2(
1462 kv_store_handle: KVStoreHandle,
1463 key_ptr: *const u8,
1464 key_len: usize,
1465 body_handle: BodyHandle,
1466 insert_config_mask: InsertConfigOptions,
1467 insert_config: *const InsertConfig,
1468 pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1469 ) -> FastlyStatus;
1470
1471 #[link_name = "insert_wait"]
1472 pub fn pending_insert_wait_v2(
1473 pending_body_handle: PendingObjectStoreInsertHandle,
1474 kv_error_out: *mut KvError,
1475 ) -> FastlyStatus;
1476
1477 #[link_name = "delete"]
1478 pub fn delete_v2(
1479 kv_store_handle: KVStoreHandle,
1480 key_ptr: *const u8,
1481 key_len: usize,
1482 delete_config_mask: DeleteConfigOptions,
1483 delete_config: *const DeleteConfig,
1484 pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1485 ) -> FastlyStatus;
1486
1487 #[link_name = "delete_wait"]
1488 pub fn pending_delete_wait_v2(
1489 pending_body_handle: PendingObjectStoreDeleteHandle,
1490 kv_error_out: *mut KvError,
1491 ) -> FastlyStatus;
1492
1493 #[link_name = "list"]
1494 pub fn list_v2(
1495 kv_store_handle: KVStoreHandle,
1496 list_config_mask: ListConfigOptions,
1497 list_config: *const ListConfig,
1498 pending_body_handle_out: *mut PendingObjectStoreListHandle,
1499 ) -> FastlyStatus;
1500
1501 #[link_name = "list_wait"]
1502 pub fn pending_list_wait_v2(
1503 pending_body_handle: PendingObjectStoreListHandle,
1504 body_handle_out: *mut BodyHandle,
1505 kv_error_out: *mut KvError,
1506 ) -> FastlyStatus;
1507 }
1508}
1509
1510pub mod fastly_secret_store {
1511 use super::*;
1512
1513 #[link(wasm_import_module = "fastly_secret_store")]
1514 extern "C" {
1515 #[link_name = "open"]
1516 pub fn open(
1517 secret_store_name_ptr: *const u8,
1518 secret_store_name_len: usize,
1519 secret_store_handle_out: *mut SecretStoreHandle,
1520 ) -> FastlyStatus;
1521
1522 #[link_name = "get"]
1523 pub fn get(
1524 secret_store_handle: SecretStoreHandle,
1525 secret_name_ptr: *const u8,
1526 secret_name_len: usize,
1527 secret_handle_out: *mut SecretHandle,
1528 ) -> FastlyStatus;
1529
1530 #[link_name = "plaintext"]
1531 pub fn plaintext(
1532 secret_handle: SecretHandle,
1533 plaintext_buf: *mut u8,
1534 plaintext_max_len: usize,
1535 nwritten_out: *mut usize,
1536 ) -> FastlyStatus;
1537
1538 #[link_name = "from_bytes"]
1539 pub fn from_bytes(
1540 plaintext_buf: *const u8,
1541 plaintext_len: usize,
1542 secret_handle_out: *mut SecretHandle,
1543 ) -> FastlyStatus;
1544 }
1545}
1546
1547pub mod fastly_backend {
1548 use super::*;
1549
1550 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1551 #[repr(u32)]
1552 pub enum BackendHealth {
1553 Unknown,
1554 Healthy,
1555 Unhealthy,
1556 }
1557
1558 #[link(wasm_import_module = "fastly_backend")]
1559 extern "C" {
1560 #[link_name = "exists"]
1561 pub fn exists(
1562 backend_ptr: *const u8,
1563 backend_len: usize,
1564 backend_exists_out: *mut u32,
1565 ) -> FastlyStatus;
1566
1567 #[link_name = "is_healthy"]
1568 pub fn is_healthy(
1569 backend_ptr: *const u8,
1570 backend_len: usize,
1571 backend_health_out: *mut BackendHealth,
1572 ) -> FastlyStatus;
1573
1574 #[link_name = "is_dynamic"]
1575 pub fn is_dynamic(
1576 backend_ptr: *const u8,
1577 backend_len: usize,
1578 value: *mut u32,
1579 ) -> FastlyStatus;
1580
1581 #[link_name = "get_host"]
1582 pub fn get_host(
1583 backend_ptr: *const u8,
1584 backend_len: usize,
1585 value: *mut u8,
1586 value_max_len: usize,
1587 nwritten: *mut usize,
1588 ) -> FastlyStatus;
1589
1590 #[link_name = "get_override_host"]
1591 pub fn get_override_host(
1592 backend_ptr: *const u8,
1593 backend_len: usize,
1594 value: *mut u8,
1595 value_max_len: usize,
1596 nwritten: *mut usize,
1597 ) -> FastlyStatus;
1598
1599 #[link_name = "get_port"]
1600 pub fn get_port(
1601 backend_ptr: *const u8,
1602 backend_len: usize,
1603 value: *mut u16,
1604 ) -> FastlyStatus;
1605
1606 #[link_name = "get_connect_timeout_ms"]
1607 pub fn get_connect_timeout_ms(
1608 backend_ptr: *const u8,
1609 backend_len: usize,
1610 value: *mut u32,
1611 ) -> FastlyStatus;
1612
1613 #[link_name = "get_first_byte_timeout_ms"]
1614 pub fn get_first_byte_timeout_ms(
1615 backend_ptr: *const u8,
1616 backend_len: usize,
1617 value: *mut u32,
1618 ) -> FastlyStatus;
1619
1620 #[link_name = "get_between_bytes_timeout_ms"]
1621 pub fn get_between_bytes_timeout_ms(
1622 backend_ptr: *const u8,
1623 backend_len: usize,
1624 value: *mut u32,
1625 ) -> FastlyStatus;
1626
1627 #[link_name = "get_http_keepalive_time"]
1628 pub fn get_http_keepalive_time(
1629 backend_ptr: *const u8,
1630 backend_len: usize,
1631 value: *mut u32,
1632 ) -> FastlyStatus;
1633
1634 #[link_name = "get_tcp_keepalive_enable"]
1635 pub fn get_tcp_keepalive_enable(
1636 backend_ptr: *const u8,
1637 backend_len: usize,
1638 value: *mut u32,
1639 ) -> FastlyStatus;
1640
1641 #[link_name = "get_tcp_keepalive_interval"]
1642 pub fn get_tcp_keepalive_interval(
1643 backend_ptr: *const u8,
1644 backend_len: usize,
1645 value: *mut u32,
1646 ) -> FastlyStatus;
1647
1648 #[link_name = "get_tcp_keepalive_probes"]
1649 pub fn get_tcp_keepalive_probes(
1650 backend_ptr: *const u8,
1651 backend_len: usize,
1652 value: *mut u32,
1653 ) -> FastlyStatus;
1654
1655 #[link_name = "get_tcp_keepalive_time"]
1656 pub fn get_tcp_keepalive_time(
1657 backend_ptr: *const u8,
1658 backend_len: usize,
1659 value: *mut u32,
1660 ) -> FastlyStatus;
1661
1662 #[link_name = "is_ssl"]
1663 pub fn is_ssl(backend_ptr: *const u8, backend_len: usize, value: *mut u32) -> FastlyStatus;
1664
1665 #[link_name = "get_ssl_min_version"]
1666 pub fn get_ssl_min_version(
1667 backend_ptr: *const u8,
1668 backend_len: usize,
1669 value: *mut u32,
1670 ) -> FastlyStatus;
1671
1672 #[link_name = "get_ssl_max_version"]
1673 pub fn get_ssl_max_version(
1674 backend_ptr: *const u8,
1675 backend_len: usize,
1676 value: *mut u32,
1677 ) -> FastlyStatus;
1678 }
1679}
1680
1681pub mod fastly_async_io {
1682 use super::*;
1683
1684 #[link(wasm_import_module = "fastly_async_io")]
1685 extern "C" {
1686 #[link_name = "select"]
1687 pub fn select(
1688 async_item_handles: *const AsyncItemHandle,
1689 async_item_handles_len: usize,
1690 timeout_ms: u32,
1691 done_index_out: *mut u32,
1692 ) -> FastlyStatus;
1693
1694 #[link_name = "is_ready"]
1695 pub fn is_ready(async_item_handle: AsyncItemHandle, ready_out: *mut u32) -> FastlyStatus;
1696 }
1697}
1698
1699pub mod fastly_image_optimizer {
1700 use super::*;
1701
1702 bitflags::bitflags! {
1703 #[repr(transparent)]
1704 pub struct ImageOptimizerTransformConfigOptions: u32 {
1705 const RESERVED = 1 << 0;
1706 const SDK_CLAIMS_OPTS = 1 << 1;
1707 }
1708 }
1709
1710 #[repr(C, align(8))]
1711 pub struct ImageOptimizerTransformConfig {
1712 pub sdk_claims_opts: *const u8,
1713 pub sdk_claims_opts_len: u32,
1714 }
1715
1716 impl Default for ImageOptimizerTransformConfig {
1717 fn default() -> Self {
1718 ImageOptimizerTransformConfig {
1719 sdk_claims_opts: std::ptr::null(),
1720 sdk_claims_opts_len: 0,
1721 }
1722 }
1723 }
1724
1725 #[repr(u32)]
1726 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1727 pub enum ImageOptimizerErrorTag {
1728 Uninitialized,
1729 Ok,
1730 Error,
1731 Warning,
1732 }
1733
1734 #[repr(C, align(8))]
1735 #[derive(Clone, Debug, PartialEq, Eq)]
1736 pub struct ImageOptimizerErrorDetail {
1737 pub tag: ImageOptimizerErrorTag,
1738 pub message: *const u8,
1739 pub message_len: usize,
1740 }
1741
1742 impl ImageOptimizerErrorDetail {
1743 pub fn uninitialized() -> Self {
1744 Self {
1745 tag: ImageOptimizerErrorTag::Uninitialized,
1746 message: std::ptr::null(),
1747 message_len: 0,
1748 }
1749 }
1750 }
1751
1752 #[link(wasm_import_module = "fastly_image_optimizer")]
1753 extern "C" {
1754 #[link_name = "transform_image_optimizer_request"]
1755 pub fn transform_image_optimizer_request(
1756 origin_image_request: RequestHandle,
1757 origin_image_request_body: BodyHandle,
1758 origin_image_backend: *const u8,
1759 origin_image_backend_len: usize,
1760 io_transform_config_options: ImageOptimizerTransformConfigOptions,
1761 io_transform_config: *const ImageOptimizerTransformConfig,
1762 io_error_detail: *mut ImageOptimizerErrorDetail,
1763 resp_handle_out: *mut ResponseHandle,
1764 resp_body_handle_out: *mut BodyHandle,
1765 ) -> FastlyStatus;
1766 }
1767}
1768
1769pub mod fastly_purge {
1770 use super::*;
1771
1772 bitflags::bitflags! {
1773 #[derive(Default)]
1774 #[repr(transparent)]
1775 pub struct PurgeOptionsMask: u32 {
1776 const SOFT_PURGE = 1 << 0;
1777 const RET_BUF = 1 << 1;
1778 }
1779 }
1780
1781 #[derive(Debug)]
1782 #[repr(C)]
1783 pub struct PurgeOptions {
1784 pub ret_buf_ptr: *mut u8,
1785 pub ret_buf_len: usize,
1786 pub ret_buf_nwritten_out: *mut usize,
1787 }
1788
1789 #[link(wasm_import_module = "fastly_purge")]
1790 extern "C" {
1791 #[link_name = "purge_surrogate_key"]
1792 pub fn purge_surrogate_key(
1793 surrogate_key_ptr: *const u8,
1794 surrogate_key_len: usize,
1795 options_mask: PurgeOptionsMask,
1796 options: *mut PurgeOptions,
1797 ) -> FastlyStatus;
1798 }
1799}
1800
1801pub mod fastly_compute_runtime {
1802 use super::*;
1803
1804 #[link(wasm_import_module = "fastly_compute_runtime")]
1805 extern "C" {
1806 #[link_name = "get_vcpu_ms"]
1807 pub fn get_vcpu_ms(ms_out: *mut u64) -> FastlyStatus;
1808 }
1809}
1810
1811pub mod fastly_acl {
1812 use super::*;
1813
1814 #[repr(u32)]
1815 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1816 pub enum AclError {
1817 Uninitialized,
1818 Ok,
1819 NoContent,
1820 TooManyRequests,
1821 }
1822
1823 #[link(wasm_import_module = "fastly_acl")]
1824 extern "C" {
1825 #[link_name = "open"]
1826 pub fn open(
1827 acl_name_ptr: *const u8,
1828 acl_name_len: usize,
1829 acl_handle_out: *mut AclHandle,
1830 ) -> FastlyStatus;
1831
1832 #[link_name = "lookup"]
1833 pub fn lookup(
1834 acl_handle: AclHandle,
1835 ip_octets: *const u8,
1836 ip_len: usize,
1837 body_handle_out: *mut BodyHandle,
1838 acl_error_out: *mut AclError,
1839 ) -> FastlyStatus;
1840 }
1841}
1842
1843pub mod fastly_shielding {
1844 use super::*;
1845
1846 bitflags::bitflags! {
1847 #[derive(Default)]
1848 #[repr(transparent)]
1849 pub struct ShieldBackendOptions: u32 {
1850 const RESERVED = 1 << 0;
1851 const CACHE_KEY = 1 << 1;
1852 const FIRST_BYTE_TIMEOUT = 1 << 2;
1853 }
1854 }
1855
1856 #[repr(C)]
1857 pub struct ShieldBackendConfig {
1858 pub cache_key: *const u8,
1859 pub cache_key_len: u32,
1860 pub first_byte_timeout_ms: u32,
1861 }
1862
1863 impl Default for ShieldBackendConfig {
1864 fn default() -> Self {
1865 ShieldBackendConfig {
1866 cache_key: std::ptr::null(),
1867 cache_key_len: 0,
1868 first_byte_timeout_ms: 0,
1869 }
1870 }
1871 }
1872
1873 #[link(wasm_import_module = "fastly_shielding")]
1881 extern "C" {
1882
1883 #[link_name = "shield_info"]
1885 pub fn shield_info(
1886 name: *const u8,
1887 name_len: usize,
1888 info_block: *mut u8,
1889 info_block_len: usize,
1890 nwritten_out: *mut u32,
1891 ) -> FastlyStatus;
1892
1893 #[link_name = "backend_for_shield"]
1895 pub fn backend_for_shield(
1896 name: *const u8,
1897 name_len: usize,
1898 options_mask: ShieldBackendOptions,
1899 options: *const ShieldBackendConfig,
1900 backend_name: *mut u8,
1901 backend_name_len: usize,
1902 nwritten_out: *mut u32,
1903 ) -> FastlyStatus;
1904 }
1905}
1906
1907#[cfg(not(target_env = "p1"))]
1912pub mod experimental {
1913 include!("service.rs");
1915
1916 pub mod wasi {
1919 extern crate wasip2 as wasi_crate;
1920
1921 pub mod cli {
1922 pub use super::wasi_crate::cli::environment;
1923 pub use super::wasi_crate::cli::exit;
1924 pub use super::wasi_crate::cli::stderr;
1925 pub use super::wasi_crate::cli::stdin;
1926 pub use super::wasi_crate::cli::stdout;
1927 }
1928 pub mod clocks {
1929 pub use super::wasi_crate::clocks::monotonic_clock;
1930 pub use super::wasi_crate::clocks::wall_clock;
1931 }
1932 pub mod io {
1933 pub use super::wasi_crate::io::error;
1934 pub use super::wasi_crate::io::poll;
1935 pub use super::wasi_crate::io::streams;
1936 }
1937 pub mod random {
1938 pub use super::wasi_crate::random::random;
1939 }
1940 }
1941}