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 = "abandon"]
369 pub fn abandon(body_handle: BodyHandle) -> FastlyStatus;
370
371 #[link_name = "trailer_append"]
372 pub fn trailer_append(
373 body_handle: BodyHandle,
374 name: *const u8,
375 name_len: usize,
376 value: *const u8,
377 value_len: usize,
378 ) -> FastlyStatus;
379
380 #[link_name = "trailer_names_get"]
381 pub fn trailer_names_get(
382 body_handle: BodyHandle,
383 buf: *mut u8,
384 buf_len: usize,
385 cursor: u32,
386 ending_cursor: *mut i64,
387 nwritten: *mut usize,
388 ) -> FastlyStatus;
389
390 #[link_name = "trailer_value_get"]
391 pub fn trailer_value_get(
392 body_handle: BodyHandle,
393 name: *const u8,
394 name_len: usize,
395 value: *mut u8,
396 value_max_len: usize,
397 nwritten: *mut usize,
398 ) -> FastlyStatus;
399
400 #[link_name = "trailer_values_get"]
401 pub fn trailer_values_get(
402 body_handle: BodyHandle,
403 name: *const u8,
404 name_len: usize,
405 buf: *mut u8,
406 buf_len: usize,
407 cursor: u32,
408 ending_cursor: *mut i64,
409 nwritten: *mut usize,
410 ) -> FastlyStatus;
411
412 #[link_name = "known_length"]
413 pub fn known_length(body_handle: BodyHandle, length_out: *mut u64) -> FastlyStatus;
414 }
415}
416
417pub mod fastly_log {
418 use super::*;
419
420 #[link(wasm_import_module = "fastly_log")]
421 extern "C" {
422 #[link_name = "endpoint_get"]
423 pub fn endpoint_get(
424 name: *const u8,
425 name_len: usize,
426 endpoint_handle_out: *mut u32,
427 ) -> FastlyStatus;
428
429 #[allow(clashing_extern_declarations)]
431 #[link_name = "write"]
432 pub fn write(
433 endpoint_handle: u32,
434 msg: *const u8,
435 msg_len: usize,
436 nwritten_out: *mut usize,
437 ) -> FastlyStatus;
438
439 }
440}
441
442pub mod fastly_http_downstream {
443 use super::*;
444
445 #[derive(Default)]
446 #[repr(C)]
447 pub struct NextRequestOptions {
448 pub timeout_ms: u64,
449 }
450
451 bitflags::bitflags! {
452 #[derive(Default)]
454 #[repr(transparent)]
455 pub struct NextRequestOptionsMask: u32 {
456 const RESERVED = 1 << 0;
457 const TIMEOUT = 1 << 1;
458 }
459 }
460
461 #[link(wasm_import_module = "fastly_http_downstream")]
462 extern "C" {
463 #[link_name = "next_request"]
464 pub fn next_request(
465 options_mask: NextRequestOptionsMask,
466 options: *const NextRequestOptions,
467 handle_out: *mut RequestPromiseHandle,
468 ) -> FastlyStatus;
469
470 #[link_name = "next_request_wait"]
471 pub fn next_request_wait(
472 handle: RequestPromiseHandle,
473 req_handle_out: *mut RequestHandle,
474 body_handle_out: *mut BodyHandle,
475 ) -> FastlyStatus;
476
477 #[link_name = "next_request_abandon"]
478 pub fn next_request_abandon(handle: RequestPromiseHandle) -> FastlyStatus;
479
480 #[link_name = "downstream_original_header_names"]
481 pub fn downstream_original_header_names(
482 req_handle: RequestHandle,
483 buf: *mut u8,
484 buf_len: usize,
485 cursor: u32,
486 ending_cursor: *mut i64,
487 nwritten: *mut usize,
488 ) -> FastlyStatus;
489
490 #[link_name = "downstream_original_header_count"]
491 pub fn downstream_original_header_count(
492 req_handle: RequestHandle,
493 count_out: *mut u32,
494 ) -> FastlyStatus;
495
496 #[link_name = "downstream_client_ip_addr"]
497 pub fn downstream_client_ip_addr(
498 req_handle: RequestHandle,
499 addr_octets_out: *mut u8,
500 nwritten_out: *mut usize,
501 ) -> FastlyStatus;
502
503 #[link_name = "downstream_server_ip_addr"]
504 pub fn downstream_server_ip_addr(
505 req_handle: RequestHandle,
506 addr_octets_out: *mut u8,
507 nwritten_out: *mut usize,
508 ) -> FastlyStatus;
509
510 #[link_name = "downstream_client_h2_fingerprint"]
511 pub fn downstream_client_h2_fingerprint(
512 req_handle: RequestHandle,
513 h2fp_out: *mut u8,
514 h2fp_max_len: usize,
515 nwritten: *mut usize,
516 ) -> FastlyStatus;
517
518 #[link_name = "downstream_client_request_id"]
519 pub fn downstream_client_request_id(
520 req_handle: RequestHandle,
521 reqid_out: *mut u8,
522 reqid_max_len: usize,
523 nwritten: *mut usize,
524 ) -> FastlyStatus;
525
526 #[link_name = "downstream_client_oh_fingerprint"]
527 pub fn downstream_client_oh_fingerprint(
528 req_handle: RequestHandle,
529 ohfp_out: *mut u8,
530 ohfp_max_len: usize,
531 nwritten: *mut usize,
532 ) -> FastlyStatus;
533
534 #[link_name = "downstream_client_ddos_detected"]
535 pub fn downstream_client_ddos_detected(
536 req_handle: RequestHandle,
537 ddos_detected_out: *mut u32,
538 ) -> FastlyStatus;
539
540 #[link_name = "downstream_tls_cipher_openssl_name"]
541 pub fn downstream_tls_cipher_openssl_name(
542 req_handle: RequestHandle,
543 cipher_out: *mut u8,
544 cipher_max_len: usize,
545 nwritten: *mut usize,
546 ) -> FastlyStatus;
547
548 #[link_name = "downstream_tls_protocol"]
549 pub fn downstream_tls_protocol(
550 req_handle: RequestHandle,
551 protocol_out: *mut u8,
552 protocol_max_len: usize,
553 nwritten: *mut usize,
554 ) -> FastlyStatus;
555
556 #[link_name = "downstream_tls_client_hello"]
557 pub fn downstream_tls_client_hello(
558 req_handle: RequestHandle,
559 client_hello_out: *mut u8,
560 client_hello_max_len: usize,
561 nwritten: *mut usize,
562 ) -> FastlyStatus;
563
564 #[link_name = "downstream_tls_client_servername"]
565 pub fn downstream_tls_client_servername(
566 req_handle: RequestHandle,
567 sni_out: *mut u8,
568 sni_max_len: usize,
569 nwritten: *mut usize,
570 ) -> FastlyStatus;
571
572 #[link_name = "downstream_tls_ja3_md5"]
573 pub fn downstream_tls_ja3_md5(
574 req_handle: RequestHandle,
575 ja3_md5_out: *mut u8,
576 nwritten_out: *mut usize,
577 ) -> FastlyStatus;
578
579 #[link_name = "downstream_tls_ja4"]
580 pub fn downstream_tls_ja4(
581 req_handle: RequestHandle,
582 ja4_out: *mut u8,
583 ja4_max_len: usize,
584 nwritten: *mut usize,
585 ) -> FastlyStatus;
586
587 #[link_name = "downstream_compliance_region"]
588 pub fn downstream_compliance_region(
589 req_handle: RequestHandle,
590 region_out: *mut u8,
591 region_max_len: usize,
592 nwritten: *mut usize,
593 ) -> FastlyStatus;
594
595 #[link_name = "downstream_tls_raw_client_certificate"]
596 pub fn downstream_tls_raw_client_certificate(
597 req_handle: RequestHandle,
598 client_hello_out: *mut u8,
599 client_hello_max_len: usize,
600 nwritten: *mut usize,
601 ) -> FastlyStatus;
602
603 #[link_name = "downstream_tls_client_cert_verify_result"]
604 pub fn downstream_tls_client_cert_verify_result(
605 req_handle: RequestHandle,
606 verify_result_out: *mut u32,
607 ) -> FastlyStatus;
608
609 #[link_name = "fastly_key_is_valid"]
610 pub fn fastly_key_is_valid(
611 req_handle: RequestHandle,
612 is_valid_out: *mut u32,
613 ) -> FastlyStatus;
614
615 #[link_name = "downstream_bot_analyzed"]
616 pub fn downstream_bot_analyzed(
617 req_handle: RequestHandle,
618 bot_analyzed_out: *mut u32,
619 ) -> FastlyStatus;
620
621 #[link_name = "downstream_bot_detected"]
622 pub fn downstream_bot_detected(
623 req_handle: RequestHandle,
624 bot_detected_out: *mut u32,
625 ) -> FastlyStatus;
626
627 #[link_name = "downstream_bot_name"]
628 pub fn downstream_bot_name(
629 req_handle: RequestHandle,
630 bot_name_out: *mut u8,
631 bot_name_max_len: usize,
632 nwritten: *mut usize,
633 ) -> FastlyStatus;
634
635 #[link_name = "downstream_bot_category"]
636 pub fn downstream_bot_category(
637 req_handle: RequestHandle,
638 bot_category_out: *mut u8,
639 bot_category_max_len: usize,
640 nwritten: *mut usize,
641 ) -> FastlyStatus;
642
643 #[link_name = "downstream_bot_category_kind"]
644 pub fn downstream_bot_category_kind(
645 req_handle: RequestHandle,
646 bot_category_kind_out: *mut u32,
647 ) -> FastlyStatus;
648
649 #[link_name = "downstream_bot_verified"]
650 pub fn downstream_bot_verified(
651 req_handle: RequestHandle,
652 bot_verified_out: *mut u32,
653 ) -> FastlyStatus;
654 }
655}
656
657pub mod fastly_http_req {
658 use super::*;
659
660 bitflags::bitflags! {
661 #[derive(Default)]
662 #[repr(transparent)]
663 pub struct SendErrorDetailMask: u32 {
664 const RESERVED = 1 << 0;
665 const DNS_ERROR_RCODE = 1 << 1;
666 const DNS_ERROR_INFO_CODE = 1 << 2;
667 const TLS_ALERT_ID = 1 << 3;
668 const H2_ERROR = 1 << 4;
669 }
670 }
671
672 #[repr(u32)]
675 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
676 pub enum PendingResponseKind {
677 #[default]
680 Any = 0,
681
682 Response = 1,
684
685 Error = 2,
687 }
688
689 #[repr(u32)]
690 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
691 #[non_exhaustive]
692 pub enum SendErrorDetailTag {
693 Uninitialized,
694 Ok,
695 DnsTimeout,
696 DnsError,
697 DestinationNotFound,
698 DestinationUnavailable,
699 DestinationIpUnroutable,
700 ConnectionRefused,
701 ConnectionTerminated,
702 ConnectionTimeout,
703 ConnectionLimitReached,
704 TlsCertificateError,
705 TlsConfigurationError,
706 HttpIncompleteResponse,
707 HttpResponseHeaderSectionTooLarge,
708 HttpResponseBodyTooLarge,
709 HttpResponseTimeout,
710 HttpResponseStatusInvalid,
711 HttpUpgradeFailed,
712 HttpProtocolError,
713 HttpRequestCacheKeyInvalid,
714 HttpRequestUriInvalid,
715 InternalError,
716 TlsAlertReceived,
717 TlsProtocolError,
718 H2Error,
719 }
720
721 #[repr(C)]
722 #[derive(Clone, Debug, PartialEq, Eq)]
723 #[non_exhaustive]
724 pub struct SendErrorDetail {
725 pub tag: SendErrorDetailTag,
726 pub mask: SendErrorDetailMask,
727 pub dns_error_rcode: u16,
728 pub dns_error_info_code: u16,
729 pub tls_alert_id: u8,
730 pub h2_error_frame: u8,
731 pub h2_error_code: u32,
732 }
733
734 impl SendErrorDetail {
735 pub fn uninitialized_all() -> Self {
736 Self {
737 tag: SendErrorDetailTag::Uninitialized,
738 mask: SendErrorDetailMask::all(),
739 dns_error_rcode: Default::default(),
740 dns_error_info_code: Default::default(),
741 tls_alert_id: Default::default(),
742 h2_error_frame: Default::default(),
743 h2_error_code: Default::default(),
744 }
745 }
746 }
747
748 bitflags::bitflags! {
749 #[repr(transparent)]
750 pub struct InspectInfoMask: u32 {
751 const RESERVED = 1 << 0;
752 const CORP = 1 << 1;
753 const WORKSPACE = 1 << 2;
754 const OVERRIDE_CLIENT_IP = 1 << 3;
755 }
756 }
757
758 #[repr(C)]
759 pub struct InspectInfo {
760 pub corp: *const u8,
761 pub corp_len: u32,
762 pub workspace: *const u8,
763 pub workspace_len: u32,
764 pub override_client_ip_ptr: *const u8,
765 pub override_client_ip_len: u32,
766 }
767
768 impl Default for InspectInfo {
769 fn default() -> Self {
770 InspectInfo {
771 corp: std::ptr::null(),
772 corp_len: 0,
773 workspace: std::ptr::null(),
774 workspace_len: 0,
775 override_client_ip_ptr: std::ptr::null(),
776 override_client_ip_len: 0,
777 }
778 }
779 }
780
781 #[link(wasm_import_module = "fastly_http_req")]
782 extern "C" {
783 #[link_name = "body_downstream_get"]
784 pub fn body_downstream_get(
785 req_handle_out: *mut RequestHandle,
786 body_handle_out: *mut BodyHandle,
787 ) -> FastlyStatus;
788
789 #[link_name = "cache_override_set"]
790 pub fn cache_override_set(
791 req_handle: RequestHandle,
792 tag: u32,
793 ttl: u32,
794 swr: u32,
795 ) -> FastlyStatus;
796
797 #[link_name = "cache_override_v2_set"]
798 pub fn cache_override_v2_set(
799 req_handle: RequestHandle,
800 tag: u32,
801 ttl: u32,
802 swr: u32,
803 sk: *const u8,
804 sk_len: usize,
805 ) -> FastlyStatus;
806
807 #[link_name = "framing_headers_mode_set"]
808 pub fn framing_headers_mode_set(
809 req_handle: RequestHandle,
810 mode: fastly_shared::FramingHeadersMode,
811 ) -> FastlyStatus;
812
813 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
814 #[link_name = "downstream_client_ip_addr"]
815 pub fn downstream_client_ip_addr(
816 addr_octets_out: *mut u8,
817 nwritten_out: *mut usize,
818 ) -> FastlyStatus;
819
820 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
821 #[link_name = "downstream_server_ip_addr"]
822 pub fn downstream_server_ip_addr(
823 addr_octets_out: *mut u8,
824 nwritten_out: *mut usize,
825 ) -> FastlyStatus;
826
827 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
828 #[link_name = "downstream_client_h2_fingerprint"]
829 pub fn downstream_client_h2_fingerprint(
830 h2fp_out: *mut u8,
831 h2fp_max_len: usize,
832 nwritten: *mut usize,
833 ) -> FastlyStatus;
834
835 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
836 #[link_name = "downstream_client_request_id"]
837 pub fn downstream_client_request_id(
838 reqid_out: *mut u8,
839 reqid_max_len: usize,
840 nwritten: *mut usize,
841 ) -> FastlyStatus;
842
843 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
844 #[link_name = "downstream_client_oh_fingerprint"]
845 pub fn downstream_client_oh_fingerprint(
846 ohfp_out: *mut u8,
847 ohfp_max_len: usize,
848 nwritten: *mut usize,
849 ) -> FastlyStatus;
850
851 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
852 #[link_name = "downstream_client_ddos_detected"]
853 pub fn downstream_client_ddos_detected(ddos_detected_out: *mut u32) -> FastlyStatus;
854
855 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
856 #[link_name = "downstream_tls_cipher_openssl_name"]
857 pub fn downstream_tls_cipher_openssl_name(
858 cipher_out: *mut u8,
859 cipher_max_len: usize,
860 nwritten: *mut usize,
861 ) -> FastlyStatus;
862
863 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
864 #[link_name = "downstream_tls_protocol"]
865 pub fn downstream_tls_protocol(
866 protocol_out: *mut u8,
867 protocol_max_len: usize,
868 nwritten: *mut usize,
869 ) -> FastlyStatus;
870
871 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
872 #[link_name = "downstream_tls_client_hello"]
873 pub fn downstream_tls_client_hello(
874 client_hello_out: *mut u8,
875 client_hello_max_len: usize,
876 nwritten: *mut usize,
877 ) -> FastlyStatus;
878
879 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
880 #[link_name = "downstream_tls_ja3_md5"]
881 pub fn downstream_tls_ja3_md5(
882 ja3_md5_out: *mut u8,
883 nwritten_out: *mut usize,
884 ) -> FastlyStatus;
885
886 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
887 #[link_name = "downstream_tls_ja4"]
888 pub fn downstream_tls_ja4(
889 ja4_out: *mut u8,
890 ja4_max_len: usize,
891 nwritten: *mut usize,
892 ) -> FastlyStatus;
893
894 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
895 #[link_name = "downstream_compliance_region"]
896 pub fn downstream_compliance_region(
897 region_out: *mut u8,
898 region_max_len: usize,
899 nwritten: *mut usize,
900 ) -> FastlyStatus;
901
902 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
903 #[link_name = "downstream_tls_raw_client_certificate"]
904 pub fn downstream_tls_raw_client_certificate(
905 client_hello_out: *mut u8,
906 client_hello_max_len: usize,
907 nwritten: *mut usize,
908 ) -> FastlyStatus;
909
910 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
911 #[link_name = "downstream_tls_client_cert_verify_result"]
912 pub fn downstream_tls_client_cert_verify_result(
913 verify_result_out: *mut u32,
914 ) -> FastlyStatus;
915
916 #[link_name = "header_append"]
917 pub fn header_append(
918 req_handle: RequestHandle,
919 name: *const u8,
920 name_len: usize,
921 value: *const u8,
922 value_len: usize,
923 ) -> FastlyStatus;
924
925 #[link_name = "header_insert"]
926 pub fn header_insert(
927 req_handle: RequestHandle,
928 name: *const u8,
929 name_len: usize,
930 value: *const u8,
931 value_len: usize,
932 ) -> FastlyStatus;
933
934 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
935 #[link_name = "original_header_names_get"]
936 pub fn original_header_names_get(
937 buf: *mut u8,
938 buf_len: usize,
939 cursor: u32,
940 ending_cursor: *mut i64,
941 nwritten: *mut usize,
942 ) -> FastlyStatus;
943
944 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
945 #[link_name = "original_header_count"]
946 pub fn original_header_count(count_out: *mut u32) -> FastlyStatus;
947
948 #[link_name = "header_names_get"]
949 pub fn header_names_get(
950 req_handle: RequestHandle,
951 buf: *mut u8,
952 buf_len: usize,
953 cursor: u32,
954 ending_cursor: *mut i64,
955 nwritten: *mut usize,
956 ) -> FastlyStatus;
957
958 #[link_name = "header_values_get"]
959 pub fn header_values_get(
960 req_handle: RequestHandle,
961 name: *const u8,
962 name_len: usize,
963 buf: *mut u8,
964 buf_len: usize,
965 cursor: u32,
966 ending_cursor: *mut i64,
967 nwritten: *mut usize,
968 ) -> FastlyStatus;
969
970 #[link_name = "header_values_set"]
971 pub fn header_values_set(
972 req_handle: RequestHandle,
973 name: *const u8,
974 name_len: usize,
975 values: *const u8,
976 values_len: usize,
977 ) -> FastlyStatus;
978
979 #[link_name = "header_value_get"]
980 pub fn header_value_get(
981 req_handle: RequestHandle,
982 name: *const u8,
983 name_len: usize,
984 value: *mut u8,
985 value_max_len: usize,
986 nwritten: *mut usize,
987 ) -> FastlyStatus;
988
989 #[link_name = "header_remove"]
990 pub fn header_remove(
991 req_handle: RequestHandle,
992 name: *const u8,
993 name_len: usize,
994 ) -> FastlyStatus;
995
996 #[link_name = "method_get"]
997 pub fn method_get(
998 req_handle: RequestHandle,
999 method: *mut u8,
1000 method_max_len: usize,
1001 nwritten: *mut usize,
1002 ) -> FastlyStatus;
1003
1004 #[link_name = "method_set"]
1005 pub fn method_set(
1006 req_handle: RequestHandle,
1007 method: *const u8,
1008 method_len: usize,
1009 ) -> FastlyStatus;
1010
1011 #[link_name = "new"]
1012 pub fn new(req_handle_out: *mut RequestHandle) -> FastlyStatus;
1013
1014 #[link_name = "send_v2"]
1015 pub fn send_v2(
1016 req_handle: RequestHandle,
1017 body_handle: BodyHandle,
1018 backend: *const u8,
1019 backend_len: usize,
1020 error_detail: *mut SendErrorDetail,
1021 resp_handle_out: *mut ResponseHandle,
1022 resp_body_handle_out: *mut BodyHandle,
1023 ) -> FastlyStatus;
1024
1025 #[link_name = "send_v3"]
1026 pub fn send_v3(
1027 req_handle: RequestHandle,
1028 body_handle: BodyHandle,
1029 backend: *const u8,
1030 backend_len: usize,
1031 error_detail: *mut SendErrorDetail,
1032 resp_handle_out: *mut ResponseHandle,
1033 resp_body_handle_out: *mut BodyHandle,
1034 ) -> FastlyStatus;
1035
1036 #[link_name = "send_async"]
1037 pub fn send_async(
1038 req_handle: RequestHandle,
1039 body_handle: BodyHandle,
1040 backend: *const u8,
1041 backend_len: usize,
1042 pending_req_handle_out: *mut PendingRequestHandle,
1043 ) -> FastlyStatus;
1044
1045 #[link_name = "send_async_streaming"]
1046 pub fn send_async_streaming(
1047 req_handle: RequestHandle,
1048 body_handle: BodyHandle,
1049 backend: *const u8,
1050 backend_len: usize,
1051 pending_req_handle_out: *mut PendingRequestHandle,
1052 ) -> FastlyStatus;
1053
1054 #[link_name = "send_async_v2"]
1055 pub fn send_async_v2(
1056 req_handle: RequestHandle,
1057 body_handle: BodyHandle,
1058 backend: *const u8,
1059 backend_len: usize,
1060 streaming: u32,
1061 pending_req_handle_out: *mut PendingRequestHandle,
1062 ) -> FastlyStatus;
1063
1064 #[link_name = "upgrade_websocket"]
1065 pub fn upgrade_websocket(backend: *const u8, backend_len: usize) -> FastlyStatus;
1066
1067 #[link_name = "redirect_to_websocket_proxy_v2"]
1068 pub fn redirect_to_websocket_proxy_v2(
1069 req: RequestHandle,
1070 backend: *const u8,
1071 backend_len: usize,
1072 ) -> FastlyStatus;
1073
1074 #[link_name = "redirect_to_grip_proxy_v2"]
1075 pub fn redirect_to_grip_proxy_v2(
1076 req: RequestHandle,
1077 backend: *const u8,
1078 backend_len: usize,
1079 ) -> FastlyStatus;
1080
1081 #[link_name = "register_dynamic_backend"]
1082 pub fn register_dynamic_backend(
1083 name_prefix: *const u8,
1084 name_prefix_len: usize,
1085 target: *const u8,
1086 target_len: usize,
1087 config_mask: BackendConfigOptions,
1088 config: *const DynamicBackendConfig,
1089 ) -> FastlyStatus;
1090
1091 #[link_name = "uri_get"]
1092 pub fn uri_get(
1093 req_handle: RequestHandle,
1094 uri: *mut u8,
1095 uri_max_len: usize,
1096 nwritten: *mut usize,
1097 ) -> FastlyStatus;
1098
1099 #[link_name = "uri_set"]
1100 pub fn uri_set(req_handle: RequestHandle, uri: *const u8, uri_len: usize) -> FastlyStatus;
1101
1102 #[link_name = "version_get"]
1103 pub fn version_get(req_handle: RequestHandle, version: *mut u32) -> FastlyStatus;
1104
1105 #[link_name = "version_set"]
1106 pub fn version_set(req_handle: RequestHandle, version: u32) -> FastlyStatus;
1107
1108 #[link_name = "pending_req_header_append"]
1109 pub fn pending_req_header_append(
1110 pending_req_handle: PendingRequestHandle,
1111 name: *const u8,
1112 name_len: usize,
1113 value: *const u8,
1114 value_len: usize,
1115 target: PendingResponseKind,
1116 ) -> FastlyStatus;
1117
1118 #[link_name = "pending_req_header_insert"]
1119 pub fn pending_req_header_insert(
1120 pending_req_handle: PendingRequestHandle,
1121 name: *const u8,
1122 name_len: usize,
1123 value: *const u8,
1124 value_len: usize,
1125 target: PendingResponseKind,
1126 ) -> FastlyStatus;
1127
1128 #[link_name = "pending_req_header_remove"]
1129 pub fn pending_req_header_remove(
1130 pending_req_handle: PendingRequestHandle,
1131 name: *const u8,
1132 name_len: usize,
1133 target: PendingResponseKind,
1134 ) -> FastlyStatus;
1135
1136 #[link_name = "pending_req_poll_v2"]
1137 pub fn pending_req_poll_v2(
1138 pending_req_handle: PendingRequestHandle,
1139 error_detail: *mut SendErrorDetail,
1140 is_done_out: *mut i32,
1141 resp_handle_out: *mut ResponseHandle,
1142 resp_body_handle_out: *mut BodyHandle,
1143 ) -> FastlyStatus;
1144
1145 #[link_name = "pending_req_select_v2"]
1146 pub fn pending_req_select_v2(
1147 pending_req_handles: *const PendingRequestHandle,
1148 pending_req_handles_len: usize,
1149 error_detail: *mut SendErrorDetail,
1150 done_index_out: *mut i32,
1151 resp_handle_out: *mut ResponseHandle,
1152 resp_body_handle_out: *mut BodyHandle,
1153 ) -> FastlyStatus;
1154
1155 #[link_name = "pending_req_wait_v2"]
1156 pub fn pending_req_wait_v2(
1157 pending_req_handle: PendingRequestHandle,
1158 error_detail: *mut SendErrorDetail,
1159 resp_handle_out: *mut ResponseHandle,
1160 resp_body_handle_out: *mut BodyHandle,
1161 ) -> FastlyStatus;
1162
1163 #[deprecated(since = "0.12.0", note = "kept for backward compatibility")]
1164 #[link_name = "fastly_key_is_valid"]
1165 pub fn fastly_key_is_valid(is_valid_out: *mut u32) -> FastlyStatus;
1166
1167 #[link_name = "close"]
1168 pub fn close(req_handle: RequestHandle) -> FastlyStatus;
1169
1170 #[link_name = "auto_decompress_response_set"]
1171 pub fn auto_decompress_response_set(
1172 req_handle: RequestHandle,
1173 encodings: ContentEncodings,
1174 ) -> FastlyStatus;
1175
1176 #[link_name = "inspect"]
1177 pub fn inspect(
1178 request_handle: RequestHandle,
1179 body_handle: BodyHandle,
1180 add_info_mask: InspectInfoMask,
1181 add_info: *const InspectInfo,
1182 buf: *mut u8,
1183 buf_len: usize,
1184 nwritten: *mut usize,
1185 ) -> FastlyStatus;
1186
1187 #[link_name = "on_behalf_of"]
1188 pub fn on_behalf_of(
1189 request_handle: RequestHandle,
1190 service: *const u8,
1191 service_len: usize,
1192 ) -> FastlyStatus;
1193 }
1194}
1195
1196pub mod fastly_http_resp {
1197 use super::*;
1198
1199 #[link(wasm_import_module = "fastly_http_resp")]
1200 extern "C" {
1201 #[link_name = "header_append"]
1202 pub fn header_append(
1203 resp_handle: ResponseHandle,
1204 name: *const u8,
1205 name_len: usize,
1206 value: *const u8,
1207 value_len: usize,
1208 ) -> FastlyStatus;
1209
1210 #[link_name = "header_insert"]
1211 pub fn header_insert(
1212 resp_handle: ResponseHandle,
1213 name: *const u8,
1214 name_len: usize,
1215 value: *const u8,
1216 value_len: usize,
1217 ) -> FastlyStatus;
1218
1219 #[link_name = "header_names_get"]
1220 pub fn header_names_get(
1221 resp_handle: ResponseHandle,
1222 buf: *mut u8,
1223 buf_len: usize,
1224 cursor: u32,
1225 ending_cursor: *mut i64,
1226 nwritten: *mut usize,
1227 ) -> FastlyStatus;
1228
1229 #[link_name = "header_value_get"]
1230 pub fn header_value_get(
1231 resp_handle: ResponseHandle,
1232 name: *const u8,
1233 name_len: usize,
1234 value: *mut u8,
1235 value_max_len: usize,
1236 nwritten: *mut usize,
1237 ) -> FastlyStatus;
1238
1239 #[link_name = "header_values_get"]
1240 pub fn header_values_get(
1241 resp_handle: ResponseHandle,
1242 name: *const u8,
1243 name_len: usize,
1244 buf: *mut u8,
1245 buf_len: usize,
1246 cursor: u32,
1247 ending_cursor: *mut i64,
1248 nwritten: *mut usize,
1249 ) -> FastlyStatus;
1250
1251 #[link_name = "header_values_set"]
1252 pub fn header_values_set(
1253 resp_handle: ResponseHandle,
1254 name: *const u8,
1255 name_len: usize,
1256 values: *const u8,
1257 values_len: usize,
1258 ) -> FastlyStatus;
1259
1260 #[link_name = "header_remove"]
1261 pub fn header_remove(
1262 resp_handle: ResponseHandle,
1263 name: *const u8,
1264 name_len: usize,
1265 ) -> FastlyStatus;
1266
1267 #[link_name = "new"]
1268 pub fn new(resp_handle_out: *mut ResponseHandle) -> FastlyStatus;
1269
1270 #[link_name = "send_downstream"]
1271 pub fn send_downstream(
1272 resp_handle: ResponseHandle,
1273 body_handle: BodyHandle,
1274 streaming: u32,
1275 ) -> FastlyStatus;
1276
1277 #[link_name = "send_downstream_pending"]
1278 pub fn send_downstream_pending(pending_req_handle: PendingRequestHandle) -> FastlyStatus;
1279
1280 #[link_name = "status_get"]
1281 pub fn status_get(resp_handle: ResponseHandle, status: *mut u16) -> FastlyStatus;
1282
1283 #[link_name = "status_set"]
1284 pub fn status_set(resp_handle: ResponseHandle, status: u16) -> FastlyStatus;
1285
1286 #[link_name = "version_get"]
1287 pub fn version_get(resp_handle: ResponseHandle, version: *mut u32) -> FastlyStatus;
1288
1289 #[link_name = "version_set"]
1290 pub fn version_set(resp_handle: ResponseHandle, version: u32) -> FastlyStatus;
1291
1292 #[link_name = "framing_headers_mode_set"]
1293 pub fn framing_headers_mode_set(
1294 resp_handle: ResponseHandle,
1295 mode: fastly_shared::FramingHeadersMode,
1296 ) -> FastlyStatus;
1297
1298 #[doc(hidden)]
1299 #[link_name = "http_keepalive_mode_set"]
1300 pub fn http_keepalive_mode_set(
1301 resp_handle: ResponseHandle,
1302 mode: fastly_shared::HttpKeepaliveMode,
1303 ) -> FastlyStatus;
1304
1305 #[link_name = "close"]
1306 pub fn close(resp_handle: ResponseHandle) -> FastlyStatus;
1307
1308 #[link_name = "get_addr_dest_ip"]
1309 pub fn get_addr_dest_ip(
1310 resp_handle: ResponseHandle,
1311 addr_octets_out: *mut u8,
1312 nwritten_out: *mut usize,
1313 ) -> FastlyStatus;
1314
1315 #[link_name = "get_addr_dest_port"]
1316 pub fn get_addr_dest_port(resp_handle: ResponseHandle, port_out: *mut u16) -> FastlyStatus;
1317 }
1318}
1319
1320pub mod fastly_dictionary {
1321 use super::*;
1322
1323 #[link(wasm_import_module = "fastly_dictionary")]
1324 extern "C" {
1325 #[link_name = "open"]
1326 pub fn open(
1327 name: *const u8,
1328 name_len: usize,
1329 dict_handle_out: *mut DictionaryHandle,
1330 ) -> FastlyStatus;
1331
1332 #[link_name = "get"]
1333 pub fn get(
1334 dict_handle: DictionaryHandle,
1335 key: *const u8,
1336 key_len: usize,
1337 value: *mut u8,
1338 value_max_len: usize,
1339 nwritten: *mut usize,
1340 ) -> FastlyStatus;
1341 }
1342}
1343
1344pub mod fastly_geo {
1345 use super::*;
1346
1347 #[link(wasm_import_module = "fastly_geo")]
1348 extern "C" {
1349 #[link_name = "lookup"]
1350 pub fn lookup(
1351 addr_octets: *const u8,
1352 addr_len: usize,
1353 buf: *mut u8,
1354 buf_len: usize,
1355 nwritten_out: *mut usize,
1356 ) -> FastlyStatus;
1357 }
1358}
1359
1360pub mod fastly_device_detection {
1361 use super::*;
1362
1363 #[link(wasm_import_module = "fastly_device_detection")]
1364 extern "C" {
1365 #[link_name = "lookup"]
1366 pub fn lookup(
1367 user_agent: *const u8,
1368 user_agent_max_len: usize,
1369 buf: *mut u8,
1370 buf_len: usize,
1371 nwritten_out: *mut usize,
1372 ) -> FastlyStatus;
1373 }
1374}
1375
1376pub mod fastly_erl {
1377 use super::*;
1378
1379 #[link(wasm_import_module = "fastly_erl")]
1380 extern "C" {
1381 #[link_name = "check_rate"]
1382 pub fn check_rate(
1383 rc: *const u8,
1384 rc_max_len: usize,
1385 entry: *const u8,
1386 entry_max_len: usize,
1387 delta: u32,
1388 window: u32,
1389 limit: u32,
1390 pb: *const u8,
1391 pb_max_len: usize,
1392 ttl: u32,
1393 value: *mut u32,
1394 ) -> FastlyStatus;
1395
1396 #[link_name = "ratecounter_increment"]
1397 pub fn ratecounter_increment(
1398 rc: *const u8,
1399 rc_max_len: usize,
1400 entry: *const u8,
1401 entry_max_len: usize,
1402 delta: u32,
1403 ) -> FastlyStatus;
1404
1405 #[link_name = "ratecounter_lookup_rate"]
1406 pub fn ratecounter_lookup_rate(
1407 rc: *const u8,
1408 rc_max_len: usize,
1409 entry: *const u8,
1410 entry_max_len: usize,
1411 window: u32,
1412 value: *mut u32,
1413 ) -> FastlyStatus;
1414
1415 #[link_name = "ratecounter_lookup_count"]
1416 pub fn ratecounter_lookup_count(
1417 rc: *const u8,
1418 rc_max_len: usize,
1419 entry: *const u8,
1420 entry_max_len: usize,
1421 duration: u32,
1422 value: *mut u32,
1423 ) -> FastlyStatus;
1424
1425 #[link_name = "penaltybox_add"]
1426 pub fn penaltybox_add(
1427 pb: *const u8,
1428 pb_max_len: usize,
1429 entry: *const u8,
1430 entry_max_len: usize,
1431 ttl: u32,
1432 ) -> FastlyStatus;
1433
1434 #[link_name = "penaltybox_has"]
1435 pub fn penaltybox_has(
1436 pb: *const u8,
1437 pb_max_len: usize,
1438 entry: *const u8,
1439 entry_max_len: usize,
1440 value: *mut u32,
1441 ) -> FastlyStatus;
1442 }
1443}
1444
1445pub mod fastly_kv_store {
1446 use super::*;
1447
1448 #[repr(u32)]
1449 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1450 pub enum KvError {
1451 Uninitialized,
1452 Ok,
1453 BadRequest,
1454 NotFound,
1455 PreconditionFailed,
1456 PayloadTooLarge,
1457 InternalError,
1458 }
1459
1460 #[link(wasm_import_module = "fastly_object_store")]
1462 extern "C" {
1463 #[link_name = "open"]
1464 pub fn open(
1465 name_ptr: *const u8,
1466 name_len: usize,
1467 kv_store_handle_out: *mut KVStoreHandle,
1468 ) -> FastlyStatus;
1469
1470 #[deprecated(note = "kept for backward compatibility")]
1471 #[link_name = "lookup"]
1472 pub fn lookup(
1473 kv_store_handle: KVStoreHandle,
1474 key_ptr: *const u8,
1475 key_len: usize,
1476 body_handle_out: *mut BodyHandle,
1477 ) -> FastlyStatus;
1478
1479 #[deprecated(note = "kept for backward compatibility")]
1480 #[link_name = "lookup_async"]
1481 pub fn lookup_async(
1482 kv_store_handle: KVStoreHandle,
1483 key_ptr: *const u8,
1484 key_len: usize,
1485 pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1486 ) -> FastlyStatus;
1487
1488 #[deprecated(note = "kept for backward compatibility")]
1489 #[link_name = "pending_lookup_wait"]
1490 pub fn pending_lookup_wait(
1491 pending_handle: PendingObjectStoreLookupHandle,
1492 body_handle_out: *mut BodyHandle,
1493 ) -> FastlyStatus;
1494
1495 #[deprecated(note = "kept for backward compatibility")]
1496 #[link_name = "insert"]
1497 pub fn insert(
1498 kv_store_handle: KVStoreHandle,
1499 key_ptr: *const u8,
1500 key_len: usize,
1501 body_handle: BodyHandle,
1502 ) -> FastlyStatus;
1503
1504 #[deprecated(note = "kept for backward compatibility")]
1505 #[link_name = "insert_async"]
1506 pub fn insert_async(
1507 kv_store_handle: KVStoreHandle,
1508 key_ptr: *const u8,
1509 key_len: usize,
1510 body_handle: BodyHandle,
1511 pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1512 ) -> FastlyStatus;
1513
1514 #[deprecated(note = "kept for backward compatibility")]
1515 #[link_name = "pending_insert_wait"]
1516 pub fn pending_insert_wait(
1517 pending_body_handle: PendingObjectStoreInsertHandle,
1518 kv_error_out: *mut KvError,
1519 ) -> FastlyStatus;
1520
1521 #[deprecated(note = "kept for backward compatibility")]
1522 #[link_name = "delete_async"]
1523 pub fn delete_async(
1524 kv_store_handle: KVStoreHandle,
1525 key_ptr: *const u8,
1526 key_len: usize,
1527 pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1528 ) -> FastlyStatus;
1529
1530 #[deprecated(note = "kept for backward compatibility")]
1531 #[link_name = "pending_delete_wait"]
1532 pub fn pending_delete_wait(
1533 pending_body_handle: PendingObjectStoreDeleteHandle,
1534 ) -> FastlyStatus;
1535 }
1536
1537 #[link(wasm_import_module = "fastly_kv_store")]
1538 extern "C" {
1539 #[link_name = "open"]
1540 pub fn open_v2(
1541 name_ptr: *const u8,
1542 name_len: usize,
1543 kv_store_handle_out: *mut KVStoreHandle,
1544 ) -> FastlyStatus;
1545
1546 #[link_name = "lookup"]
1547 pub fn lookup_v2(
1548 kv_store_handle: KVStoreHandle,
1549 key_ptr: *const u8,
1550 key_len: usize,
1551 lookup_config_mask: LookupConfigOptions,
1552 lookup_config: *const LookupConfig,
1553 pending_body_handle_out: *mut PendingObjectStoreLookupHandle,
1554 ) -> FastlyStatus;
1555
1556 #[link_name = "lookup_wait"]
1557 pub fn pending_lookup_wait_v2(
1558 pending_handle: PendingObjectStoreLookupHandle,
1559 body_handle_out: *mut BodyHandle,
1560 metadata_buf: *mut u8,
1561 metadata_buf_len: usize,
1562 nwritten_out: *mut usize,
1563 generation_out: *mut u32,
1564 kv_error_out: *mut KvError,
1565 ) -> FastlyStatus;
1566
1567 #[link_name = "lookup_wait_v2"]
1568 pub fn lookup_wait_v2(
1569 pending_handle: PendingObjectStoreLookupHandle,
1570 body_handle_out: *mut BodyHandle,
1571 metadata_buf: *mut u8,
1572 metadata_buf_len: usize,
1573 nwritten_out: *mut usize,
1574 generation_out: *mut u64,
1575 kv_error_out: *mut KvError,
1576 ) -> FastlyStatus;
1577
1578 #[link_name = "insert"]
1579 pub fn insert_v2(
1580 kv_store_handle: KVStoreHandle,
1581 key_ptr: *const u8,
1582 key_len: usize,
1583 body_handle: BodyHandle,
1584 insert_config_mask: InsertConfigOptions,
1585 insert_config: *const InsertConfig,
1586 pending_body_handle_out: *mut PendingObjectStoreInsertHandle,
1587 ) -> FastlyStatus;
1588
1589 #[link_name = "insert_wait"]
1590 pub fn pending_insert_wait_v2(
1591 pending_body_handle: PendingObjectStoreInsertHandle,
1592 kv_error_out: *mut KvError,
1593 ) -> FastlyStatus;
1594
1595 #[link_name = "delete"]
1596 pub fn delete_v2(
1597 kv_store_handle: KVStoreHandle,
1598 key_ptr: *const u8,
1599 key_len: usize,
1600 delete_config_mask: DeleteConfigOptions,
1601 delete_config: *const DeleteConfig,
1602 pending_body_handle_out: *mut PendingObjectStoreDeleteHandle,
1603 ) -> FastlyStatus;
1604
1605 #[link_name = "delete_wait"]
1606 pub fn pending_delete_wait_v2(
1607 pending_body_handle: PendingObjectStoreDeleteHandle,
1608 kv_error_out: *mut KvError,
1609 ) -> FastlyStatus;
1610
1611 #[link_name = "list"]
1612 pub fn list_v2(
1613 kv_store_handle: KVStoreHandle,
1614 list_config_mask: ListConfigOptions,
1615 list_config: *const ListConfig,
1616 pending_body_handle_out: *mut PendingObjectStoreListHandle,
1617 ) -> FastlyStatus;
1618
1619 #[link_name = "list_wait"]
1620 pub fn pending_list_wait_v2(
1621 pending_body_handle: PendingObjectStoreListHandle,
1622 body_handle_out: *mut BodyHandle,
1623 kv_error_out: *mut KvError,
1624 ) -> FastlyStatus;
1625 }
1626}
1627
1628pub mod fastly_secret_store {
1629 use super::*;
1630
1631 #[link(wasm_import_module = "fastly_secret_store")]
1632 extern "C" {
1633 #[link_name = "open"]
1634 pub fn open(
1635 secret_store_name_ptr: *const u8,
1636 secret_store_name_len: usize,
1637 secret_store_handle_out: *mut SecretStoreHandle,
1638 ) -> FastlyStatus;
1639
1640 #[link_name = "get"]
1641 pub fn get(
1642 secret_store_handle: SecretStoreHandle,
1643 secret_name_ptr: *const u8,
1644 secret_name_len: usize,
1645 secret_handle_out: *mut SecretHandle,
1646 ) -> FastlyStatus;
1647
1648 #[link_name = "plaintext"]
1649 pub fn plaintext(
1650 secret_handle: SecretHandle,
1651 plaintext_buf: *mut u8,
1652 plaintext_max_len: usize,
1653 nwritten_out: *mut usize,
1654 ) -> FastlyStatus;
1655
1656 #[link_name = "from_bytes"]
1657 pub fn from_bytes(
1658 plaintext_buf: *const u8,
1659 plaintext_len: usize,
1660 secret_handle_out: *mut SecretHandle,
1661 ) -> FastlyStatus;
1662 }
1663}
1664
1665pub mod fastly_backend {
1666 use super::*;
1667
1668 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1669 #[repr(u32)]
1670 pub enum BackendHealth {
1671 Unknown,
1672 Healthy,
1673 Unhealthy,
1674 }
1675
1676 #[link(wasm_import_module = "fastly_backend")]
1677 extern "C" {
1678 #[link_name = "exists"]
1679 pub fn exists(
1680 backend_ptr: *const u8,
1681 backend_len: usize,
1682 backend_exists_out: *mut u32,
1683 ) -> FastlyStatus;
1684
1685 #[link_name = "is_healthy"]
1686 pub fn is_healthy(
1687 backend_ptr: *const u8,
1688 backend_len: usize,
1689 backend_health_out: *mut BackendHealth,
1690 ) -> FastlyStatus;
1691
1692 #[link_name = "is_dynamic"]
1693 pub fn is_dynamic(
1694 backend_ptr: *const u8,
1695 backend_len: usize,
1696 value: *mut u32,
1697 ) -> FastlyStatus;
1698
1699 #[link_name = "get_host"]
1700 pub fn get_host(
1701 backend_ptr: *const u8,
1702 backend_len: usize,
1703 value: *mut u8,
1704 value_max_len: usize,
1705 nwritten: *mut usize,
1706 ) -> FastlyStatus;
1707
1708 #[link_name = "get_override_host"]
1709 pub fn get_override_host(
1710 backend_ptr: *const u8,
1711 backend_len: usize,
1712 value: *mut u8,
1713 value_max_len: usize,
1714 nwritten: *mut usize,
1715 ) -> FastlyStatus;
1716
1717 #[link_name = "get_port"]
1718 pub fn get_port(
1719 backend_ptr: *const u8,
1720 backend_len: usize,
1721 value: *mut u16,
1722 ) -> FastlyStatus;
1723
1724 #[link_name = "get_connect_timeout_ms"]
1725 pub fn get_connect_timeout_ms(
1726 backend_ptr: *const u8,
1727 backend_len: usize,
1728 value: *mut u32,
1729 ) -> FastlyStatus;
1730
1731 #[link_name = "get_first_byte_timeout_ms"]
1732 pub fn get_first_byte_timeout_ms(
1733 backend_ptr: *const u8,
1734 backend_len: usize,
1735 value: *mut u32,
1736 ) -> FastlyStatus;
1737
1738 #[link_name = "get_between_bytes_timeout_ms"]
1739 pub fn get_between_bytes_timeout_ms(
1740 backend_ptr: *const u8,
1741 backend_len: usize,
1742 value: *mut u32,
1743 ) -> FastlyStatus;
1744
1745 #[link_name = "get_http_keepalive_time"]
1746 pub fn get_http_keepalive_time(
1747 backend_ptr: *const u8,
1748 backend_len: usize,
1749 value: *mut u32,
1750 ) -> FastlyStatus;
1751
1752 #[link_name = "get_tcp_keepalive_enable"]
1753 pub fn get_tcp_keepalive_enable(
1754 backend_ptr: *const u8,
1755 backend_len: usize,
1756 value: *mut u32,
1757 ) -> FastlyStatus;
1758
1759 #[link_name = "get_tcp_keepalive_interval"]
1760 pub fn get_tcp_keepalive_interval(
1761 backend_ptr: *const u8,
1762 backend_len: usize,
1763 value: *mut u32,
1764 ) -> FastlyStatus;
1765
1766 #[link_name = "get_tcp_keepalive_probes"]
1767 pub fn get_tcp_keepalive_probes(
1768 backend_ptr: *const u8,
1769 backend_len: usize,
1770 value: *mut u32,
1771 ) -> FastlyStatus;
1772
1773 #[link_name = "get_tcp_keepalive_time"]
1774 pub fn get_tcp_keepalive_time(
1775 backend_ptr: *const u8,
1776 backend_len: usize,
1777 value: *mut u32,
1778 ) -> FastlyStatus;
1779
1780 #[link_name = "is_ssl"]
1781 pub fn is_ssl(backend_ptr: *const u8, backend_len: usize, value: *mut u32) -> FastlyStatus;
1782
1783 #[link_name = "get_ssl_min_version"]
1784 pub fn get_ssl_min_version(
1785 backend_ptr: *const u8,
1786 backend_len: usize,
1787 value: *mut u32,
1788 ) -> FastlyStatus;
1789
1790 #[link_name = "get_ssl_max_version"]
1791 pub fn get_ssl_max_version(
1792 backend_ptr: *const u8,
1793 backend_len: usize,
1794 value: *mut u32,
1795 ) -> FastlyStatus;
1796 }
1797}
1798
1799pub mod fastly_async_io {
1800 use super::*;
1801
1802 #[link(wasm_import_module = "fastly_async_io")]
1803 extern "C" {
1804 #[link_name = "select"]
1805 pub fn select(
1806 async_item_handles: *const AsyncItemHandle,
1807 async_item_handles_len: usize,
1808 timeout_ms: u32,
1809 done_index_out: *mut u32,
1810 ) -> FastlyStatus;
1811
1812 #[link_name = "is_ready"]
1813 pub fn is_ready(async_item_handle: AsyncItemHandle, ready_out: *mut u32) -> FastlyStatus;
1814 }
1815}
1816
1817pub mod fastly_image_optimizer {
1818 use super::*;
1819
1820 bitflags::bitflags! {
1821 #[repr(transparent)]
1822 pub struct ImageOptimizerTransformConfigOptions: u32 {
1823 const RESERVED = 1 << 0;
1824 const SDK_CLAIMS_OPTS = 1 << 1;
1825 }
1826 }
1827
1828 #[repr(C, align(8))]
1829 pub struct ImageOptimizerTransformConfig {
1830 pub sdk_claims_opts: *const u8,
1831 pub sdk_claims_opts_len: u32,
1832 }
1833
1834 impl Default for ImageOptimizerTransformConfig {
1835 fn default() -> Self {
1836 ImageOptimizerTransformConfig {
1837 sdk_claims_opts: std::ptr::null(),
1838 sdk_claims_opts_len: 0,
1839 }
1840 }
1841 }
1842
1843 #[repr(u32)]
1844 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1845 pub enum ImageOptimizerErrorTag {
1846 Uninitialized,
1847 Ok,
1848 Error,
1849 Warning,
1850 }
1851
1852 #[repr(C, align(8))]
1853 #[derive(Clone, Debug, PartialEq, Eq)]
1854 pub struct ImageOptimizerErrorDetail {
1855 pub tag: ImageOptimizerErrorTag,
1856 pub message: *const u8,
1857 pub message_len: usize,
1858 }
1859
1860 impl ImageOptimizerErrorDetail {
1861 pub fn uninitialized() -> Self {
1862 Self {
1863 tag: ImageOptimizerErrorTag::Uninitialized,
1864 message: std::ptr::null(),
1865 message_len: 0,
1866 }
1867 }
1868 }
1869
1870 #[link(wasm_import_module = "fastly_image_optimizer")]
1871 extern "C" {
1872 #[link_name = "transform_image_optimizer_request"]
1873 pub fn transform_image_optimizer_request(
1874 origin_image_request: RequestHandle,
1875 origin_image_request_body: BodyHandle,
1876 origin_image_backend: *const u8,
1877 origin_image_backend_len: usize,
1878 io_transform_config_options: ImageOptimizerTransformConfigOptions,
1879 io_transform_config: *const ImageOptimizerTransformConfig,
1880 io_error_detail: *mut ImageOptimizerErrorDetail,
1881 resp_handle_out: *mut ResponseHandle,
1882 resp_body_handle_out: *mut BodyHandle,
1883 ) -> FastlyStatus;
1884 }
1885}
1886
1887pub mod fastly_purge {
1888 use super::*;
1889
1890 bitflags::bitflags! {
1891 #[derive(Default)]
1892 #[repr(transparent)]
1893 pub struct PurgeOptionsMask: u32 {
1894 const SOFT_PURGE = 1 << 0;
1895 const RET_BUF = 1 << 1;
1896 }
1897 }
1898
1899 #[derive(Debug)]
1900 #[repr(C)]
1901 pub struct PurgeOptions {
1902 pub ret_buf_ptr: *mut u8,
1903 pub ret_buf_len: usize,
1904 pub ret_buf_nwritten_out: *mut usize,
1905 }
1906
1907 #[link(wasm_import_module = "fastly_purge")]
1908 extern "C" {
1909 #[link_name = "purge_surrogate_key"]
1910 pub fn purge_surrogate_key(
1911 surrogate_key_ptr: *const u8,
1912 surrogate_key_len: usize,
1913 options_mask: PurgeOptionsMask,
1914 options: *mut PurgeOptions,
1915 ) -> FastlyStatus;
1916 }
1917}
1918
1919pub mod fastly_compute_runtime {
1920 use super::*;
1921
1922 #[link(wasm_import_module = "fastly_compute_runtime")]
1923 extern "C" {
1924 #[link_name = "get_vcpu_ms"]
1925 pub fn get_vcpu_ms(ms_out: *mut u64) -> FastlyStatus;
1926 }
1927
1928 #[link(wasm_import_module = "fastly_compute_runtime")]
1929 extern "C" {
1930 #[link_name = "get_heap_mib"]
1931 pub fn get_heap_mib(mb_out: *mut u32) -> fastly_shared::FastlyStatus;
1932 }
1933}
1934
1935pub mod fastly_acl {
1936 use super::*;
1937
1938 #[repr(u32)]
1939 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1940 pub enum AclError {
1941 Uninitialized,
1942 Ok,
1943 NoContent,
1944 TooManyRequests,
1945 }
1946
1947 #[link(wasm_import_module = "fastly_acl")]
1948 extern "C" {
1949 #[link_name = "open"]
1950 pub fn open(
1951 acl_name_ptr: *const u8,
1952 acl_name_len: usize,
1953 acl_handle_out: *mut AclHandle,
1954 ) -> FastlyStatus;
1955
1956 #[link_name = "lookup"]
1957 pub fn lookup(
1958 acl_handle: AclHandle,
1959 ip_octets: *const u8,
1960 ip_len: usize,
1961 body_handle_out: *mut BodyHandle,
1962 acl_error_out: *mut AclError,
1963 ) -> FastlyStatus;
1964 }
1965}
1966
1967pub mod fastly_shielding {
1968 use super::*;
1969
1970 bitflags::bitflags! {
1971 #[derive(Default)]
1972 #[repr(transparent)]
1973 pub struct ShieldBackendOptions: u32 {
1974 const RESERVED = 1 << 0;
1975 const CACHE_KEY = 1 << 1;
1976 const FIRST_BYTE_TIMEOUT = 1 << 2;
1977 }
1978 }
1979
1980 #[repr(C)]
1981 pub struct ShieldBackendConfig {
1982 pub cache_key: *const u8,
1983 pub cache_key_len: u32,
1984 pub first_byte_timeout_ms: u32,
1985 }
1986
1987 impl Default for ShieldBackendConfig {
1988 fn default() -> Self {
1989 ShieldBackendConfig {
1990 cache_key: std::ptr::null(),
1991 cache_key_len: 0,
1992 first_byte_timeout_ms: 0,
1993 }
1994 }
1995 }
1996
1997 #[link(wasm_import_module = "fastly_shielding")]
2005 extern "C" {
2006
2007 #[link_name = "shield_info"]
2009 pub fn shield_info(
2010 name: *const u8,
2011 name_len: usize,
2012 info_block: *mut u8,
2013 info_block_len: usize,
2014 nwritten_out: *mut u32,
2015 ) -> FastlyStatus;
2016
2017 #[link_name = "backend_for_shield"]
2019 pub fn backend_for_shield(
2020 name: *const u8,
2021 name_len: usize,
2022 options_mask: ShieldBackendOptions,
2023 options: *const ShieldBackendConfig,
2024 backend_name: *mut u8,
2025 backend_name_len: usize,
2026 nwritten_out: *mut u32,
2027 ) -> FastlyStatus;
2028 }
2029}
2030
2031#[cfg(not(target_env = "p1"))]
2033pub mod service0_1_0;
2034
2035#[cfg(not(target_env = "p1"))]
2036impl From<service0_1_0::fastly::compute::types::Error> for fastly_shared::FastlyStatus {
2037 fn from(error: service0_1_0::fastly::compute::types::Error) -> Self {
2038 use service0_1_0::fastly::compute::types::Error;
2039 match error {
2040 Error::InvalidArgument => Self::INVAL,
2041 Error::Unsupported => Self::UNSUPPORTED,
2042 Error::LimitExceeded => Self::LIMITEXCEEDED,
2043 Error::GenericError => Self::ERROR,
2044 Error::BufferLen(_) => Self::BUFLEN,
2045 Error::CannotRead => Self::NONE,
2046 Error::AuxiliaryError => Self::BADF,
2047 Error::HttpInvalid => Self::HTTPINVALID,
2048 Error::HttpUser => Self::HTTPUSER,
2049 Error::HttpIncomplete => Self::HTTPINCOMPLETE,
2050 Error::HttpHeadTooLarge => Self::HTTPHEADTOOLARGE,
2051 Error::HttpInvalidStatus => Self::HTTPINVALIDSTATUS,
2052 }
2053 }
2054}
2055
2056#[cfg(not(target_env = "p1"))]
2057impl From<std::net::IpAddr> for service0_1_0::fastly::compute::types::IpAddress {
2058 fn from(addr: std::net::IpAddr) -> Self {
2059 use std::net::IpAddr;
2060 match addr {
2061 IpAddr::V4(v4) => Self::Ipv4(v4.octets().into()),
2062 IpAddr::V6(v6) => Self::Ipv6(v6.segments().into()),
2063 }
2064 }
2065}
2066
2067#[cfg(not(target_env = "p1"))]
2068impl From<service0_1_0::fastly::compute::types::IpAddress> for std::net::IpAddr {
2069 fn from(addr: service0_1_0::fastly::compute::types::IpAddress) -> Self {
2070 use service0_1_0::fastly::compute::types::IpAddress;
2071 match addr {
2072 IpAddress::Ipv4(v4) => Self::V4(<[u8; 4]>::from(v4).into()),
2073 IpAddress::Ipv6(v6) => Self::V6(<[u16; 8]>::from(v6).into()),
2074 }
2075 }
2076}
2077
2078#[cfg(not(target_env = "p1"))]
2079impl From<service0_1_0::fastly::compute::http_types::HttpVersion> for http::version::Version {
2080 fn from(version: service0_1_0::fastly::compute::http_types::HttpVersion) -> Self {
2081 use service0_1_0::fastly::compute::http_types::HttpVersion;
2082 match version {
2083 HttpVersion::Http09 => Self::HTTP_09,
2084 HttpVersion::Http10 => Self::HTTP_10,
2085 HttpVersion::Http11 => Self::HTTP_11,
2086 HttpVersion::H2 => Self::HTTP_2,
2087 HttpVersion::H3 => Self::HTTP_3,
2088 }
2089 }
2090}
2091
2092#[cfg(not(target_env = "p1"))]
2093impl TryFrom<http::version::Version> for service0_1_0::fastly::compute::http_types::HttpVersion {
2094 type Error = ();
2095
2096 fn try_from(version: http::version::Version) -> Result<Self, Self::Error> {
2097 use http::version::Version;
2098 Ok(match version {
2099 Version::HTTP_09 => Self::Http09,
2100 Version::HTTP_10 => Self::Http10,
2101 Version::HTTP_11 => Self::Http11,
2102 Version::HTTP_2 => Self::H2,
2103 Version::HTTP_3 => Self::H3,
2104 _ => return Err(()),
2105 })
2106 }
2107}
2108
2109#[cfg(not(target_env = "p1"))]
2110impl From<fastly_shared::FramingHeadersMode>
2111 for service0_1_0::fastly::compute::http_types::FramingHeadersMode
2112{
2113 fn from(mode: fastly_shared::FramingHeadersMode) -> Self {
2114 use fastly_shared::FramingHeadersMode;
2115 match mode {
2116 FramingHeadersMode::Automatic => Self::Automatic,
2117 FramingHeadersMode::ManuallyFromHeaders => Self::ManuallyFromHeaders,
2118 }
2119 }
2120}
2121
2122#[cfg(not(target_env = "p1"))]
2123impl From<service0_1_0::fastly::compute::http_types::FramingHeadersMode>
2124 for fastly_shared::FramingHeadersMode
2125{
2126 fn from(mode: service0_1_0::fastly::compute::http_types::FramingHeadersMode) -> Self {
2127 use service0_1_0::fastly::compute::http_types::FramingHeadersMode;
2128 match mode {
2129 FramingHeadersMode::Automatic => Self::Automatic,
2130 FramingHeadersMode::ManuallyFromHeaders => Self::ManuallyFromHeaders,
2131 }
2132 }
2133}
2134
2135#[cfg(not(target_env = "p1"))]
2136impl From<fastly_shared::HttpKeepaliveMode>
2137 for service0_1_0::fastly::compute::http_resp::KeepaliveMode
2138{
2139 fn from(mode: fastly_shared::HttpKeepaliveMode) -> Self {
2140 use fastly_shared::HttpKeepaliveMode;
2141 match mode {
2142 HttpKeepaliveMode::Automatic => Self::Automatic,
2143 HttpKeepaliveMode::NoKeepalive => Self::NoKeepalive,
2144 }
2145 }
2146}
2147
2148#[cfg(not(target_env = "p1"))]
2149impl From<service0_1_0::fastly::compute::http_resp::KeepaliveMode>
2150 for fastly_shared::HttpKeepaliveMode
2151{
2152 fn from(mode: service0_1_0::fastly::compute::http_resp::KeepaliveMode) -> Self {
2153 use service0_1_0::fastly::compute::http_resp::KeepaliveMode;
2154 match mode {
2155 KeepaliveMode::Automatic => Self::Automatic,
2156 KeepaliveMode::NoKeepalive => Self::NoKeepalive,
2157 }
2158 }
2159}