1#![allow(clippy::too_many_arguments)]
7
8#[allow(unused_imports)]
11use crate::support::{BorrowedSlice, Bytes};
12
13#[repr(i32)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
16pub enum RootFormat {
17 Unknown = 0,
19 Wow = 1,
21 WowTvfs = 2,
23 Diablo3 = 3,
25 Diablo4 = 4,
27 Tvfs = 5,
29 Mndx = 6,
31 Overwatch = 7,
33 Agent = 8,
35}
36
37impl TryFrom<i32> for RootFormat {
38 type Error = crate::Error;
39 fn try_from(v: i32) -> Result<Self, crate::Error> {
40 match v {
41 0 => Ok(RootFormat::Unknown),
42 1 => Ok(RootFormat::Wow),
43 2 => Ok(RootFormat::WowTvfs),
44 3 => Ok(RootFormat::Diablo3),
45 4 => Ok(RootFormat::Diablo4),
46 5 => Ok(RootFormat::Tvfs),
47 6 => Ok(RootFormat::Mndx),
48 7 => Ok(RootFormat::Overwatch),
49 8 => Ok(RootFormat::Agent),
50 other => Err(crate::Error::UnknownEnum {
51 name: "RootFormat",
52 value: other,
53 }),
54 }
55 }
56}
57
58#[repr(i32)]
60#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
61pub enum FileIdHint {
62 None = 0,
64 Meta = 1,
66 Payload = 2,
68 Paylow = 3,
70 Paymed = 4,
72}
73
74impl TryFrom<i32> for FileIdHint {
75 type Error = crate::Error;
76 fn try_from(v: i32) -> Result<Self, crate::Error> {
77 match v {
78 0 => Ok(FileIdHint::None),
79 1 => Ok(FileIdHint::Meta),
80 2 => Ok(FileIdHint::Payload),
81 3 => Ok(FileIdHint::Paylow),
82 4 => Ok(FileIdHint::Paymed),
83 other => Err(crate::Error::UnknownEnum {
84 name: "FileIdHint",
85 value: other,
86 }),
87 }
88 }
89}
90
91#[derive(Clone, Debug, PartialEq)]
93pub struct FindEntry {
94 pub c_key: Vec<u8>,
95 pub file_size: u64,
96 pub locale_flags: u32,
97 pub content_flags: u32,
98 pub file_data_id: i32,
99 pub path: String,
100}
101
102pub struct CreateOptions {
104 pub(crate) raw: core::ptr::NonNull<ffi::whiteout_CascCreateOptions>,
105}
106
107impl Drop for CreateOptions {
108 fn drop(&mut self) {
109 unsafe { ffi::whiteout_casc_CascCreateOptions_delete(self.raw.as_ptr()) }
111 }
112}
113
114impl CreateOptions {
115 #[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_CascCreateOptions) -> Option<Self> {
119 core::ptr::NonNull::new(raw).map(|raw| CreateOptions { raw })
120 }
121}
122
123unsafe impl Send for CreateOptions {}
128
129impl core::fmt::Debug for CreateOptions {
130 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
131 f.debug_struct("CreateOptions").finish_non_exhaustive()
132 }
133}
134
135impl CreateOptions {
136 pub fn new() -> Self {
139 unsafe {
142 let raw = ffi::whiteout_casc_CascCreateOptions_new();
143 Self::from_raw(raw).expect("native CreateOptions allocation failed")
144 }
145 }
146
147 pub fn product(&self) -> String {
148 unsafe {
150 crate::support::take_string(ffi::whiteout_casc_CascCreateOptions_get_product(
151 self.raw.as_ptr(),
152 ))
153 }
154 }
155
156 pub fn set_product(&mut self, value: &str) {
157 let value = std::ffi::CString::new(value).unwrap_or_default();
158 unsafe {
160 ffi::whiteout_casc_CascCreateOptions_set_product(self.raw.as_ptr(), value.as_ptr())
161 }
162 }
163
164 pub fn version(&self) -> String {
165 unsafe {
167 crate::support::take_string(ffi::whiteout_casc_CascCreateOptions_get_version(
168 self.raw.as_ptr(),
169 ))
170 }
171 }
172
173 pub fn set_version(&mut self, value: &str) {
174 let value = std::ffi::CString::new(value).unwrap_or_default();
175 unsafe {
177 ffi::whiteout_casc_CascCreateOptions_set_version(self.raw.as_ptr(), value.as_ptr())
178 }
179 }
180
181 pub fn archive_max_size(&self) -> u32 {
183 unsafe { ffi::whiteout_casc_CascCreateOptions_get_archiveMaxSize(self.raw.as_ptr()) }
185 }
186
187 pub fn set_archive_max_size(&mut self, value: u32) {
188 unsafe { ffi::whiteout_casc_CascCreateOptions_set_archiveMaxSize(self.raw.as_ptr(), value) }
190 }
191
192 pub fn blte_frame_size(&self) -> u32 {
194 unsafe { ffi::whiteout_casc_CascCreateOptions_get_blteFrameSize(self.raw.as_ptr()) }
196 }
197
198 pub fn set_blte_frame_size(&mut self, value: u32) {
199 unsafe { ffi::whiteout_casc_CascCreateOptions_set_blteFrameSize(self.raw.as_ptr(), value) }
201 }
202
203 pub fn root_format(&self) -> RootFormat {
204 unsafe { ffi::whiteout_casc_CascCreateOptions_get_rootFormat(self.raw.as_ptr()) }
206 .try_into()
207 .expect("unknown enum discriminant from the native library")
208 }
209
210 pub fn set_root_format(&mut self, value: RootFormat) {
211 unsafe {
213 ffi::whiteout_casc_CascCreateOptions_set_rootFormat(self.raw.as_ptr(), value as i32)
214 }
215 }
216}
217
218impl Default for CreateOptions {
219 fn default() -> Self {
220 Self::new()
221 }
222}
223
224#[derive(Clone, Debug, PartialEq)]
226pub struct WriteOptions {
227 pub locale_flags: u32,
228 pub content_flags: u32,
229 pub compress: bool,
230}
231
232impl Default for WriteOptions {
233 fn default() -> Self {
234 unsafe {
236 let h = ffi::whiteout_casc_CascWriteOptions_new();
237 let out = WriteOptions {
238 locale_flags: ffi::whiteout_casc_CascWriteOptions_get_localeFlags(h),
239 content_flags: ffi::whiteout_casc_CascWriteOptions_get_contentFlags(h),
240 compress: ffi::whiteout_casc_CascWriteOptions_get_compress(h) != 0,
241 };
242 ffi::whiteout_casc_CascWriteOptions_delete(h);
243 out
244 }
245 }
246}
247
248impl WriteOptions {
249 #[allow(dead_code)] pub(crate) unsafe fn to_native(&self) -> *mut ffi::whiteout_CascWriteOptions {
252 unsafe {
253 let h = ffi::whiteout_casc_CascWriteOptions_new();
254 ffi::whiteout_casc_CascWriteOptions_set_localeFlags(h, self.locale_flags);
255 ffi::whiteout_casc_CascWriteOptions_set_contentFlags(h, self.content_flags);
256 ffi::whiteout_casc_CascWriteOptions_set_compress(h, if self.compress { 1 } else { 0 });
257 h
258 }
259 }
260
261 #[allow(dead_code)]
266 pub(crate) unsafe fn free_native(h: *mut ffi::whiteout_CascWriteOptions) {
267 unsafe { ffi::whiteout_casc_CascWriteOptions_delete(h) }
268 }
269}
270
271pub struct Storage {
281 pub(crate) raw: core::ptr::NonNull<ffi::whiteout_CascStorage>,
282}
283
284impl Drop for Storage {
285 fn drop(&mut self) {
286 unsafe { ffi::whiteout_casc_CascStorage_delete(self.raw.as_ptr()) }
288 }
289}
290
291impl Storage {
292 #[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_CascStorage) -> Option<Self> {
296 core::ptr::NonNull::new(raw).map(|raw| Storage { raw })
297 }
298}
299
300unsafe impl Send for Storage {}
305
306impl core::fmt::Debug for Storage {
307 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
308 f.debug_struct("Storage").finish_non_exhaustive()
309 }
310}
311
312impl Storage {
313 pub fn open(path: &str, pool: Option<&crate::interfaces::HostWorkerPool>) -> Option<Storage> {
315 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
316 unsafe {
318 Storage::from_raw(ffi::whiteout_casc_CascStorage_open(
319 path_cstr.as_ptr(),
320 pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
321 ))
322 }
323 }
324
325 pub fn open_path_locale_mask_pool(
327 path: &str,
328 locale_mask: u32,
329 pool: Option<&crate::interfaces::HostWorkerPool>,
330 ) -> Option<Storage> {
331 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
332 unsafe {
334 Storage::from_raw(ffi::whiteout_casc_CascStorage_open_path_localeMask_pool(
335 path_cstr.as_ptr(),
336 locale_mask,
337 pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
338 ))
339 }
340 }
341
342 pub fn open_path_product_pool(
344 path: &str,
345 product: &str,
346 pool: Option<&crate::interfaces::HostWorkerPool>,
347 ) -> Option<Storage> {
348 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
349 let product_cstr = std::ffi::CString::new(product).unwrap_or_default();
350 unsafe {
352 Storage::from_raw(ffi::whiteout_casc_CascStorage_open_path_product_pool(
353 path_cstr.as_ptr(),
354 product_cstr.as_ptr(),
355 pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
356 ))
357 }
358 }
359
360 pub fn close(&mut self) {
362 unsafe {
364 ffi::whiteout_casc_CascStorage_close(self.raw.as_ptr());
365 }
366 }
367
368 pub fn is_local(&self) -> bool {
370 unsafe { ffi::whiteout_casc_CascStorage_isLocal(self.raw.as_ptr()) != 0 }
372 }
373
374 pub fn is_online(&self) -> bool {
376 unsafe { ffi::whiteout_casc_CascStorage_isOnline(self.raw.as_ptr()) != 0 }
378 }
379
380 pub fn is_writable(&self) -> bool {
382 unsafe { ffi::whiteout_casc_CascStorage_isWritable(self.raw.as_ptr()) != 0 }
384 }
385
386 pub fn root_format(&self) -> RootFormat {
388 unsafe {
390 RootFormat::try_from(ffi::whiteout_casc_CascStorage_rootFormat(self.raw.as_ptr()))
391 .expect("unknown enum discriminant from the native library (ABI version skew)")
392 }
393 }
394
395 pub fn read_file(&self, casc_path: &str) -> Option<Bytes> {
397 let casc_path_cstr = std::ffi::CString::new(casc_path).unwrap_or_default();
398 unsafe {
400 Bytes::from_raw(ffi::whiteout_casc_CascStorage_readFile(
401 self.raw.as_ptr(),
402 casc_path_cstr.as_ptr(),
403 ))
404 }
405 }
406
407 pub fn read_file_casc_path_locale_flags_open_flags(
409 &self,
410 casc_path: &str,
411 locale_flags: u32,
412 open_flags: u32,
413 ) -> Option<Bytes> {
414 let casc_path_cstr = std::ffi::CString::new(casc_path).unwrap_or_default();
415 unsafe {
417 Bytes::from_raw(
418 ffi::whiteout_casc_CascStorage_readFile_cascPath_localeFlags_openFlags(
419 self.raw.as_ptr(),
420 casc_path_cstr.as_ptr(),
421 locale_flags,
422 open_flags,
423 ),
424 )
425 }
426 }
427
428 pub fn read_file_file_id_hint(&self, file_id: i32, hint: FileIdHint) -> Option<Bytes> {
430 unsafe {
432 Bytes::from_raw(ffi::whiteout_casc_CascStorage_readFile_fileId_hint(
433 self.raw.as_ptr(),
434 file_id,
435 hint as i32,
436 ))
437 }
438 }
439
440 pub fn read_file_file_id_locale_flags_open_flags_hint(
442 &self,
443 file_id: i32,
444 locale_flags: u32,
445 open_flags: u32,
446 hint: FileIdHint,
447 ) -> Option<Bytes> {
448 unsafe {
450 Bytes::from_raw(
451 ffi::whiteout_casc_CascStorage_readFile_fileId_localeFlags_openFlags_hint(
452 self.raw.as_ptr(),
453 file_id,
454 locale_flags,
455 open_flags,
456 hint as i32,
457 ),
458 )
459 }
460 }
461
462 pub fn file_exists(&self, casc_path: &str) -> bool {
464 let casc_path_cstr = std::ffi::CString::new(casc_path).unwrap_or_default();
465 unsafe {
467 ffi::whiteout_casc_CascStorage_fileExists(self.raw.as_ptr(), casc_path_cstr.as_ptr())
468 != 0
469 }
470 }
471
472 pub fn file_exists_file_id_hint(&self, file_id: i32, hint: FileIdHint) -> bool {
474 unsafe {
476 ffi::whiteout_casc_CascStorage_fileExists_fileId_hint(
477 self.raw.as_ptr(),
478 file_id,
479 hint as i32,
480 ) != 0
481 }
482 }
483
484 pub fn file_size(&self, casc_path: &str) -> Option<u64> {
486 let casc_path_cstr = std::ffi::CString::new(casc_path).unwrap_or_default();
487 let mut __v: u64 = 0;
488 let __has = unsafe {
491 ffi::whiteout_casc_CascStorage_fileSize(
492 self.raw.as_ptr(),
493 casc_path_cstr.as_ptr(),
494 &mut __v,
495 )
496 };
497 (__has != 0).then_some(__v)
498 }
499
500 pub fn file_size_file_id_hint(&self, file_id: i32, hint: FileIdHint) -> Option<u64> {
502 let mut __v: u64 = 0;
503 let __has = unsafe {
506 ffi::whiteout_casc_CascStorage_fileSize_fileId_hint(
507 self.raw.as_ptr(),
508 file_id,
509 hint as i32,
510 &mut __v,
511 )
512 };
513 (__has != 0).then_some(__v)
514 }
515
516 pub fn list_files(&self) -> Vec<String> {
518 unsafe {
522 let list = ffi::whiteout_casc_CascStorage_listFiles(self.raw.as_ptr());
523 if list.is_null() {
524 return Vec::new();
525 }
526 let n = ffi::whiteout_casc_StringList_size(list);
527 let out = (0..n)
528 .map(|i| crate::support::take_string(ffi::whiteout_casc_StringList_at(list, i)))
529 .collect();
530 ffi::whiteout_casc_StringList_delete(list);
531 out
532 }
533 }
534
535 pub fn list_entries(&self) -> Vec<FindEntry> {
537 unsafe {
541 let snap = ffi::whiteout_casc_CascStorage_listEntries_snapshot(self.raw.as_ptr());
542 if snap.is_null() {
543 return Vec::new();
544 }
545 let n = ffi::whiteout_casc_CascStorage_listEntries_count(snap);
546 let mut out = Vec::with_capacity(n);
547 for i in 0..n {
548 out.push(FindEntry {
549 c_key: crate::support::Bytes::from_raw(
550 ffi::whiteout_casc_CascStorage_listEntries_cKey_at(snap, i),
551 )
552 .map(|b| b.to_vec())
553 .unwrap_or_default(),
554 file_size: ffi::whiteout_casc_CascStorage_listEntries_fileSize_at(snap, i),
555 locale_flags: ffi::whiteout_casc_CascStorage_listEntries_localeFlags_at(
556 snap, i,
557 ),
558 content_flags: ffi::whiteout_casc_CascStorage_listEntries_contentFlags_at(
559 snap, i,
560 ),
561 file_data_id: ffi::whiteout_casc_CascStorage_listEntries_fileDataId_at(snap, i),
562 path: crate::support::take_string(
563 ffi::whiteout_casc_CascStorage_listEntries_path_at(snap, i),
564 ),
565 });
566 }
567 ffi::whiteout_casc_CascStorage_listEntries_free(snap);
568 out
569 }
570 }
571
572 pub fn total_file_count(&self) -> Option<u32> {
574 let mut __v: u32 = 0;
575 let __has =
578 unsafe { ffi::whiteout_casc_CascStorage_totalFileCount(self.raw.as_ptr(), &mut __v) };
579 (__has != 0).then_some(__v)
580 }
581
582 pub fn import_keys_from_string(&mut self, key_list: &str) -> bool {
584 let key_list_cstr = std::ffi::CString::new(key_list).unwrap_or_default();
585 unsafe {
587 ffi::whiteout_casc_CascStorage_importKeysFromString(
588 self.raw.as_ptr(),
589 key_list_cstr.as_ptr(),
590 ) != 0
591 }
592 }
593
594 pub fn import_keys_from_file(&mut self, key_file_path: &str) -> bool {
596 let key_file_path_cstr = std::ffi::CString::new(key_file_path).unwrap_or_default();
597 unsafe {
599 ffi::whiteout_casc_CascStorage_importKeysFromFile(
600 self.raw.as_ptr(),
601 key_file_path_cstr.as_ptr(),
602 ) != 0
603 }
604 }
605
606 pub fn find_encryption_key(&self, key_name: u64) -> Option<[u8; 16]> {
608 let mut __v: [u8; 16] = Default::default();
609 let __has = unsafe {
612 ffi::whiteout_casc_CascStorage_findEncryptionKey(
613 self.raw.as_ptr(),
614 key_name,
615 __v.as_mut_ptr(),
616 )
617 };
618 (__has != 0).then_some(__v)
619 }
620
621 pub fn flush_cache(&mut self) {
623 unsafe {
625 ffi::whiteout_casc_CascStorage_flushCache(self.raw.as_ptr());
626 }
627 }
628
629 pub fn prefetch(&mut self) -> bool {
631 unsafe { ffi::whiteout_casc_CascStorage_prefetch(self.raw.as_ptr()) != 0 }
633 }
634
635 pub fn last_error() -> u32 {
637 unsafe { ffi::whiteout_casc_CascStorage_lastError() }
639 }
640}
641
642pub struct StorageWritable {
650 pub(crate) raw: core::ptr::NonNull<ffi::whiteout_CascStorageWritable>,
651}
652
653impl Drop for StorageWritable {
654 fn drop(&mut self) {
655 unsafe { ffi::whiteout_casc_CascStorageWritable_delete(self.raw.as_ptr()) }
657 }
658}
659
660impl StorageWritable {
661 #[allow(dead_code)] pub(crate) unsafe fn from_raw(raw: *mut ffi::whiteout_CascStorageWritable) -> Option<Self> {
665 core::ptr::NonNull::new(raw).map(|raw| StorageWritable { raw })
666 }
667}
668
669unsafe impl Send for StorageWritable {}
674
675impl core::fmt::Debug for StorageWritable {
676 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
677 f.debug_struct("StorageWritable").finish_non_exhaustive()
678 }
679}
680
681impl StorageWritable {
682 pub fn create(
688 opts: &CreateOptions,
689 pool: Option<&crate::interfaces::HostWorkerPool>,
690 ) -> Option<StorageWritable> {
691 unsafe {
693 StorageWritable::from_raw(ffi::whiteout_casc_CascStorageWritable_create(
694 opts.raw.as_ptr(),
695 pool.map_or(core::ptr::null_mut(), |v| v.as_ptr()),
696 ))
697 }
698 }
699
700 pub fn reserve_file_id(&mut self, name: &str) -> Option<u32> {
710 let name_cstr = std::ffi::CString::new(name).unwrap_or_default();
711 let mut __v: u32 = 0;
712 let __has = unsafe {
715 ffi::whiteout_casc_CascStorageWritable_reserveFileId(
716 self.raw.as_ptr(),
717 name_cstr.as_ptr(),
718 &mut __v,
719 )
720 };
721 (__has != 0).then_some(__v)
722 }
723
724 pub fn write_file(&mut self, path: &str, data: &[u8], opts: &WriteOptions) -> bool {
730 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
731 let opts_native = unsafe { opts.to_native() };
732 unsafe {
735 let __r = ffi::whiteout_casc_CascStorageWritable_writeFile(
736 self.raw.as_ptr(),
737 path_cstr.as_ptr(),
738 data.as_ptr(),
739 data.len(),
740 opts_native,
741 ) != 0;
742 WriteOptions::free_native(opts_native);
743 __r
744 }
745 }
746
747 pub fn write_file_file_id_data_opts_hint(
749 &mut self,
750 file_id: i32,
751 data: &[u8],
752 opts: &WriteOptions,
753 hint: FileIdHint,
754 ) -> bool {
755 let opts_native = unsafe { opts.to_native() };
756 unsafe {
759 let __r = ffi::whiteout_casc_CascStorageWritable_writeFile_fileId_data_opts_hint(
760 self.raw.as_ptr(),
761 file_id,
762 data.as_ptr(),
763 data.len(),
764 opts_native,
765 hint as i32,
766 ) != 0;
767 WriteOptions::free_native(opts_native);
768 __r
769 }
770 }
771
772 pub fn delete_file(&mut self, path: &str) -> bool {
774 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
775 unsafe {
777 ffi::whiteout_casc_CascStorageWritable_deleteFile(self.raw.as_ptr(), path_cstr.as_ptr())
778 != 0
779 }
780 }
781
782 pub fn delete_file_file_id_hint(&mut self, file_id: i32, hint: FileIdHint) -> bool {
784 unsafe {
786 ffi::whiteout_casc_CascStorageWritable_deleteFile_fileId_hint(
787 self.raw.as_ptr(),
788 file_id,
789 hint as i32,
790 ) != 0
791 }
792 }
793
794 pub fn save(&mut self) -> bool {
796 unsafe { ffi::whiteout_casc_CascStorageWritable_save(self.raw.as_ptr()) != 0 }
798 }
799
800 pub fn save_path(&mut self, path: &str) -> bool {
802 let path_cstr = std::ffi::CString::new(path).unwrap_or_default();
803 unsafe {
805 ffi::whiteout_casc_CascStorageWritable_save_path(self.raw.as_ptr(), path_cstr.as_ptr())
806 != 0
807 }
808 }
809}
810
811#[doc(hidden)]
815pub mod ffi {
816 #![allow(missing_debug_implementations)]
817
818 #[allow(unused_imports)]
819 use crate::support::{RawBytes, RawCString};
820
821 #[repr(C)]
822 pub struct whiteout_CascCreateOptions {
823 _private: [u8; 0],
824 }
825 #[repr(C)]
826 pub struct whiteout_CascWriteOptions {
827 _private: [u8; 0],
828 }
829 #[repr(C)]
830 pub struct whiteout_CascStorage {
831 _private: [u8; 0],
832 }
833 #[repr(C)]
834 pub struct whiteout_CascStorageWritable {
835 _private: [u8; 0],
836 }
837 #[repr(C)]
838 pub struct whiteout_StringList {
839 _private: [u8; 0],
840 }
841
842 extern "C" {
843 pub fn whiteout_casc_StringList_size(self_: *mut whiteout_StringList) -> usize;
844 pub fn whiteout_casc_StringList_at(
845 self_: *mut whiteout_StringList,
846 index: usize,
847 ) -> RawCString;
848 pub fn whiteout_casc_StringList_delete(self_: *mut whiteout_StringList);
849 pub fn whiteout_casc_CascCreateOptions_new() -> *mut whiteout_CascCreateOptions;
851 pub fn whiteout_casc_CascCreateOptions_delete(self_: *mut whiteout_CascCreateOptions);
852 pub fn whiteout_casc_CascCreateOptions_get_product(
853 self_: *mut whiteout_CascCreateOptions,
854 ) -> RawCString;
855 pub fn whiteout_casc_CascCreateOptions_set_product(
856 self_: *mut whiteout_CascCreateOptions,
857 value: *const core::ffi::c_char,
858 );
859 pub fn whiteout_casc_CascCreateOptions_get_version(
860 self_: *mut whiteout_CascCreateOptions,
861 ) -> RawCString;
862 pub fn whiteout_casc_CascCreateOptions_set_version(
863 self_: *mut whiteout_CascCreateOptions,
864 value: *const core::ffi::c_char,
865 );
866 pub fn whiteout_casc_CascCreateOptions_get_archiveMaxSize(
867 self_: *mut whiteout_CascCreateOptions,
868 ) -> u32;
869 pub fn whiteout_casc_CascCreateOptions_set_archiveMaxSize(
870 self_: *mut whiteout_CascCreateOptions,
871 value: u32,
872 );
873 pub fn whiteout_casc_CascCreateOptions_get_blteFrameSize(
874 self_: *mut whiteout_CascCreateOptions,
875 ) -> u32;
876 pub fn whiteout_casc_CascCreateOptions_set_blteFrameSize(
877 self_: *mut whiteout_CascCreateOptions,
878 value: u32,
879 );
880 pub fn whiteout_casc_CascCreateOptions_get_rootFormat(
881 self_: *mut whiteout_CascCreateOptions,
882 ) -> i32;
883 pub fn whiteout_casc_CascCreateOptions_set_rootFormat(
884 self_: *mut whiteout_CascCreateOptions,
885 value: i32,
886 );
887 pub fn whiteout_casc_CascWriteOptions_new() -> *mut whiteout_CascWriteOptions;
889 pub fn whiteout_casc_CascWriteOptions_delete(self_: *mut whiteout_CascWriteOptions);
890 pub fn whiteout_casc_CascWriteOptions_get_localeFlags(
891 self_: *mut whiteout_CascWriteOptions,
892 ) -> u32;
893 pub fn whiteout_casc_CascWriteOptions_set_localeFlags(
894 self_: *mut whiteout_CascWriteOptions,
895 value: u32,
896 );
897 pub fn whiteout_casc_CascWriteOptions_get_contentFlags(
898 self_: *mut whiteout_CascWriteOptions,
899 ) -> u32;
900 pub fn whiteout_casc_CascWriteOptions_set_contentFlags(
901 self_: *mut whiteout_CascWriteOptions,
902 value: u32,
903 );
904 pub fn whiteout_casc_CascWriteOptions_get_compress(
905 self_: *mut whiteout_CascWriteOptions,
906 ) -> i32;
907 pub fn whiteout_casc_CascWriteOptions_set_compress(
908 self_: *mut whiteout_CascWriteOptions,
909 value: i32,
910 );
911 pub fn whiteout_casc_CascStorage_delete(self_: *mut whiteout_CascStorage);
913 pub fn whiteout_casc_CascStorage_open(
914 path: *const core::ffi::c_char,
915 pool: *mut core::ffi::c_void,
916 ) -> *mut whiteout_CascStorage;
917 pub fn whiteout_casc_CascStorage_open_path_localeMask_pool(
918 path: *const core::ffi::c_char,
919 locale_mask: u32,
920 pool: *mut core::ffi::c_void,
921 ) -> *mut whiteout_CascStorage;
922 pub fn whiteout_casc_CascStorage_open_path_product_pool(
923 path: *const core::ffi::c_char,
924 product: *const core::ffi::c_char,
925 pool: *mut core::ffi::c_void,
926 ) -> *mut whiteout_CascStorage;
927 pub fn whiteout_casc_CascStorage_close(self_: *mut whiteout_CascStorage);
928 pub fn whiteout_casc_CascStorage_isLocal(self_: *mut whiteout_CascStorage) -> i32;
929 pub fn whiteout_casc_CascStorage_isOnline(self_: *mut whiteout_CascStorage) -> i32;
930 pub fn whiteout_casc_CascStorage_isWritable(self_: *mut whiteout_CascStorage) -> i32;
931 pub fn whiteout_casc_CascStorage_rootFormat(self_: *mut whiteout_CascStorage) -> i32;
932 pub fn whiteout_casc_CascStorage_readFile(
933 self_: *mut whiteout_CascStorage,
934 casc_path: *const core::ffi::c_char,
935 ) -> RawBytes;
936 pub fn whiteout_casc_CascStorage_readFile_cascPath_localeFlags_openFlags(
937 self_: *mut whiteout_CascStorage,
938 casc_path: *const core::ffi::c_char,
939 locale_flags: u32,
940 open_flags: u32,
941 ) -> RawBytes;
942 pub fn whiteout_casc_CascStorage_readFile_fileId_hint(
943 self_: *mut whiteout_CascStorage,
944 file_id: i32,
945 hint: i32,
946 ) -> RawBytes;
947 pub fn whiteout_casc_CascStorage_readFile_fileId_localeFlags_openFlags_hint(
948 self_: *mut whiteout_CascStorage,
949 file_id: i32,
950 locale_flags: u32,
951 open_flags: u32,
952 hint: i32,
953 ) -> RawBytes;
954 pub fn whiteout_casc_CascStorage_fileExists(
955 self_: *mut whiteout_CascStorage,
956 casc_path: *const core::ffi::c_char,
957 ) -> i32;
958 pub fn whiteout_casc_CascStorage_fileExists_fileId_hint(
959 self_: *mut whiteout_CascStorage,
960 file_id: i32,
961 hint: i32,
962 ) -> i32;
963 pub fn whiteout_casc_CascStorage_fileSize(
964 self_: *mut whiteout_CascStorage,
965 casc_path: *const core::ffi::c_char,
966 out_value: *mut u64,
967 ) -> i32;
968 pub fn whiteout_casc_CascStorage_fileSize_fileId_hint(
969 self_: *mut whiteout_CascStorage,
970 file_id: i32,
971 hint: i32,
972 out_value: *mut u64,
973 ) -> i32;
974 pub fn whiteout_casc_CascStorage_listFiles(
975 self_: *mut whiteout_CascStorage,
976 ) -> *mut whiteout_StringList;
977 pub fn whiteout_casc_CascStorage_listEntries_snapshot(
978 self_: *mut whiteout_CascStorage,
979 ) -> *mut core::ffi::c_void;
980 pub fn whiteout_casc_CascStorage_listEntries_count(
981 snapshot: *mut core::ffi::c_void,
982 ) -> usize;
983 pub fn whiteout_casc_CascStorage_listEntries_cKey_at(
984 snapshot: *mut core::ffi::c_void,
985 index: usize,
986 ) -> RawBytes;
987 pub fn whiteout_casc_CascStorage_listEntries_fileSize_at(
988 snapshot: *mut core::ffi::c_void,
989 index: usize,
990 ) -> u64;
991 pub fn whiteout_casc_CascStorage_listEntries_localeFlags_at(
992 snapshot: *mut core::ffi::c_void,
993 index: usize,
994 ) -> u32;
995 pub fn whiteout_casc_CascStorage_listEntries_contentFlags_at(
996 snapshot: *mut core::ffi::c_void,
997 index: usize,
998 ) -> u32;
999 pub fn whiteout_casc_CascStorage_listEntries_fileDataId_at(
1000 snapshot: *mut core::ffi::c_void,
1001 index: usize,
1002 ) -> i32;
1003 pub fn whiteout_casc_CascStorage_listEntries_path_at(
1004 snapshot: *mut core::ffi::c_void,
1005 index: usize,
1006 ) -> RawCString;
1007 pub fn whiteout_casc_CascStorage_listEntries_free(snapshot: *mut core::ffi::c_void);
1008 pub fn whiteout_casc_CascStorage_totalFileCount(
1009 self_: *mut whiteout_CascStorage,
1010 out_value: *mut u32,
1011 ) -> i32;
1012 pub fn whiteout_casc_CascStorage_importKeysFromString(
1013 self_: *mut whiteout_CascStorage,
1014 key_list: *const core::ffi::c_char,
1015 ) -> i32;
1016 pub fn whiteout_casc_CascStorage_importKeysFromFile(
1017 self_: *mut whiteout_CascStorage,
1018 key_file_path: *const core::ffi::c_char,
1019 ) -> i32;
1020 pub fn whiteout_casc_CascStorage_findEncryptionKey(
1021 self_: *mut whiteout_CascStorage,
1022 key_name: u64,
1023 out_value: *mut u8,
1024 ) -> i32;
1025 pub fn whiteout_casc_CascStorage_flushCache(self_: *mut whiteout_CascStorage);
1026 pub fn whiteout_casc_CascStorage_prefetch(self_: *mut whiteout_CascStorage) -> i32;
1027 pub fn whiteout_casc_CascStorage_lastError() -> u32;
1028 pub fn whiteout_casc_CascStorageWritable_delete(self_: *mut whiteout_CascStorageWritable);
1030 pub fn whiteout_casc_CascStorageWritable_create(
1031 opts: *mut whiteout_CascCreateOptions,
1032 pool: *mut core::ffi::c_void,
1033 ) -> *mut whiteout_CascStorageWritable;
1034 pub fn whiteout_casc_CascStorageWritable_reserveFileId(
1035 self_: *mut whiteout_CascStorageWritable,
1036 name: *const core::ffi::c_char,
1037 out_value: *mut u32,
1038 ) -> i32;
1039 pub fn whiteout_casc_CascStorageWritable_writeFile(
1040 self_: *mut whiteout_CascStorageWritable,
1041 path: *const core::ffi::c_char,
1042 data: *const u8,
1043 data_size: usize,
1044 opts: *mut whiteout_CascWriteOptions,
1045 ) -> i32;
1046 pub fn whiteout_casc_CascStorageWritable_writeFile_fileId_data_opts_hint(
1047 self_: *mut whiteout_CascStorageWritable,
1048 file_id: i32,
1049 data: *const u8,
1050 data_size: usize,
1051 opts: *mut whiteout_CascWriteOptions,
1052 hint: i32,
1053 ) -> i32;
1054 pub fn whiteout_casc_CascStorageWritable_deleteFile(
1055 self_: *mut whiteout_CascStorageWritable,
1056 path: *const core::ffi::c_char,
1057 ) -> i32;
1058 pub fn whiteout_casc_CascStorageWritable_deleteFile_fileId_hint(
1059 self_: *mut whiteout_CascStorageWritable,
1060 file_id: i32,
1061 hint: i32,
1062 ) -> i32;
1063 pub fn whiteout_casc_CascStorageWritable_save(
1064 self_: *mut whiteout_CascStorageWritable,
1065 ) -> i32;
1066 pub fn whiteout_casc_CascStorageWritable_save_path(
1067 self_: *mut whiteout_CascStorageWritable,
1068 path: *const core::ffi::c_char,
1069 ) -> i32;
1070 }
1071}