gpgme_sys/
types.rs

1use libc::{c_char, c_int, c_long, c_uint, c_ulong, c_ushort, c_void, size_t, ssize_t};
2
3use crate::consts::*;
4
5pub use libgpg_error_sys::{
6    gpg_err_code_t as gpgme_err_code_t, gpg_err_source_t as gpgme_err_source_t,
7    gpg_error_t as gpgme_error_t,
8};
9
10#[cfg(all(target_os = "windows", target_arch = "x86"))]
11pub type gpgme_off_t = i32;
12#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
13pub type gpgme_off_t = i64;
14#[cfg(not(target_os = "windows"))]
15pub type gpgme_off_t = libc::off_t;
16
17pub type gpgme_ssize_t = libc::ssize_t;
18
19// extern {
20//     pub type gpgme_context;
21//     pub type gpgme_data;
22// }
23#[repr(C)]
24pub struct gpgme_context {
25    _priv: [u8; 0],
26}
27
28#[repr(C)]
29pub struct gpgme_data {
30    _priv: [u8; 0],
31}
32
33pub type gpgme_ctx_t = *mut gpgme_context;
34pub type gpgme_data_t = *mut gpgme_data;
35
36#[repr(C)]
37#[derive(Copy, Clone)]
38pub struct _gpgme_sig_notation {
39    pub next: gpgme_sig_notation_t,
40    pub name: *mut c_char,
41    pub value: *mut c_char,
42    pub name_len: c_int,
43    pub value_len: c_int,
44    pub flags: gpgme_sig_notation_flags_t,
45    pub bitfield: u32,
46}
47pub type gpgme_sig_notation_t = *mut _gpgme_sig_notation;
48
49impl _gpgme_sig_notation {
50    #[inline]
51    pub fn human_readable(&self) -> bool {
52        (self.bitfield & 0b01) == 0b01
53    }
54
55    #[inline]
56    pub fn critical(&self) -> bool {
57        (self.bitfield & 0b10) == 0b10
58    }
59}
60
61#[repr(C)]
62#[derive(Copy, Clone)]
63pub struct _gpgme_engine_info {
64    pub next: gpgme_engine_info_t,
65    pub protocol: gpgme_protocol_t,
66    pub file_name: *mut c_char,
67    pub version: *mut c_char,
68    pub req_version: *const c_char,
69    pub home_dir: *mut c_char,
70}
71pub type gpgme_engine_info_t = *mut _gpgme_engine_info;
72
73#[repr(C)]
74#[derive(Copy, Clone)]
75pub struct _gpgme_tofu_info {
76    pub next: gpgme_tofu_info_t,
77    pub bitfield: u32,
78    pub signcount: c_ushort,
79    pub encrcount: c_ushort,
80    pub signfirst: c_ulong,
81    pub signlast: c_ulong,
82    pub encrfirst: c_ulong,
83    pub encrlast: c_ulong,
84    pub description: *mut c_char,
85}
86pub type gpgme_tofu_info_t = *mut _gpgme_tofu_info;
87
88impl _gpgme_tofu_info {
89    #[inline]
90    pub fn validity(&self) -> c_uint {
91        (self.bitfield & 0b0000_0111) as c_uint
92    }
93
94    #[inline]
95    pub fn policy(&self) -> gpgme_tofu_policy_t {
96        ((self.bitfield & 0b1111_0000) >> 4) as gpgme_tofu_policy_t
97    }
98}
99
100#[repr(C)]
101#[derive(Copy, Clone)]
102pub struct _gpgme_subkey {
103    pub next: gpgme_subkey_t,
104    pub bitfield: u32,
105    pub pubkey_algo: gpgme_pubkey_algo_t,
106    pub length: c_uint,
107    pub keyid: *mut c_char,
108    _keyid: [c_char; 17],
109    pub fpr: *mut c_char,
110    pub timestamp: c_long,
111    pub expires: c_long,
112    pub card_number: *mut c_char,
113    pub curve: *mut c_char,
114    pub keygrip: *mut c_char,
115}
116pub type gpgme_subkey_t = *mut _gpgme_subkey;
117
118impl _gpgme_subkey {
119    #[inline]
120    pub fn revoked(&self) -> bool {
121        (self.bitfield & 0b0000_00000001) == 0b0000_00000001
122    }
123    #[inline]
124    pub fn expired(&self) -> bool {
125        (self.bitfield & 0b0000_00000010) == 0b0000_00000010
126    }
127    #[inline]
128    pub fn disabled(&self) -> bool {
129        (self.bitfield & 0b0000_00000100) == 0b0000_00000100
130    }
131    #[inline]
132    pub fn invalid(&self) -> bool {
133        (self.bitfield & 0b0000_00001000) == 0b0000_00001000
134    }
135    #[inline]
136    pub fn can_encrypt(&self) -> bool {
137        (self.bitfield & 0b0000_00010000) == 0b0000_00010000
138    }
139    #[inline]
140    pub fn can_sign(&self) -> bool {
141        (self.bitfield & 0b0000_00100000) == 0b0000_00100000
142    }
143    #[inline]
144    pub fn can_certify(&self) -> bool {
145        (self.bitfield & 0b0000_01000000) == 0b0000_01000000
146    }
147    #[inline]
148    pub fn secret(&self) -> bool {
149        (self.bitfield & 0b0000_10000000) == 0b0000_10000000
150    }
151    #[inline]
152    pub fn can_authenticate(&self) -> bool {
153        (self.bitfield & 0b0001_00000000) == 0b0001_00000000
154    }
155    #[inline]
156    pub fn is_qualified(&self) -> bool {
157        (self.bitfield & 0b0010_00000000) == 0b0010_00000000
158    }
159    #[inline]
160    pub fn is_cardkey(&self) -> bool {
161        (self.bitfield & 0b0100_00000000) == 0b0100_00000000
162    }
163    #[inline]
164    pub fn is_de_vs(&self) -> bool {
165        (self.bitfield & 0b1000_00000000) == 0b1000_00000000
166    }
167}
168
169#[repr(C)]
170#[derive(Copy, Clone)]
171pub struct _gpgme_key_sig {
172    pub next: gpgme_key_sig_t,
173    pub bitfield: u32,
174    pub pubkey_algo: gpgme_pubkey_algo_t,
175    pub keyid: *mut c_char,
176    _keyid: [c_char; 17],
177    pub timestamp: c_long,
178    pub expires: c_long,
179    pub status: gpgme_error_t,
180    _class: c_uint,
181    pub uid: *mut c_char,
182    pub name: *mut c_char,
183    pub email: *mut c_char,
184    pub comment: *mut c_char,
185    pub sig_class: c_uint,
186    pub notations: gpgme_sig_notation_t,
187    _last_notation: gpgme_sig_notation_t,
188    pub trust_scope: *mut c_char,
189}
190pub type gpgme_key_sig_t = *mut _gpgme_key_sig;
191
192impl _gpgme_key_sig {
193    #[inline]
194    pub fn revoked(&self) -> bool {
195        (self.bitfield & 0b0001) == 0b0001
196    }
197    #[inline]
198    pub fn expired(&self) -> bool {
199        (self.bitfield & 0b0010) == 0b0010
200    }
201    #[inline]
202    pub fn invalid(&self) -> bool {
203        (self.bitfield & 0b0100) == 0b0100
204    }
205    #[inline]
206    pub fn exportable(&self) -> bool {
207        (self.bitfield & 0b1000) == 0b1000
208    }
209    #[inline]
210    pub fn trust_depth(&self) -> u8 {
211        ((self.bitfield >> 16) & 0xFF) as u8
212    }
213    #[inline]
214    pub fn trust_value(&self) -> u8 {
215        (self.bitfield >> 24) as u8
216    }
217}
218
219#[repr(C)]
220#[derive(Copy, Clone)]
221pub struct _gpgme_user_id {
222    pub next: gpgme_user_id_t,
223    pub bitfield: u32,
224    pub validity: gpgme_validity_t,
225    pub uid: *mut c_char,
226    pub name: *mut c_char,
227    pub email: *mut c_char,
228    pub comment: *mut c_char,
229    pub signatures: gpgme_key_sig_t,
230    _last_keysig: gpgme_key_sig_t,
231    pub address: *mut c_char,
232    pub tofu: gpgme_tofu_info_t,
233    pub last_update: c_ulong,
234    pub uidhash: *mut c_char,
235}
236pub type gpgme_user_id_t = *mut _gpgme_user_id;
237
238impl _gpgme_user_id {
239    #[inline]
240    pub fn revoked(&self) -> bool {
241        (self.bitfield & 0b0001) == 0b0001
242    }
243    #[inline]
244    pub fn invalid(&self) -> bool {
245        (self.bitfield & 0b0010) == 0b0010
246    }
247    #[inline]
248    pub fn origin(&self) -> u32 {
249        self.bitfield >> 27
250    }
251}
252
253#[repr(C)]
254#[derive(Copy, Clone)]
255pub struct _gpgme_key {
256    _refs: c_uint,
257    pub bitfield: u32,
258    pub protocol: gpgme_protocol_t,
259    pub issuer_serial: *mut c_char,
260    pub issuer_name: *mut c_char,
261    pub chain_id: *mut c_char,
262    pub owner_trust: gpgme_validity_t,
263    pub subkeys: gpgme_subkey_t,
264    pub uids: gpgme_user_id_t,
265    _last_subkey: gpgme_subkey_t,
266    _last_uid: gpgme_user_id_t,
267    pub keylist_mode: gpgme_keylist_mode_t,
268    pub fpr: *mut c_char,
269    pub last_update: c_ulong,
270}
271pub type gpgme_key_t = *mut _gpgme_key;
272
273impl _gpgme_key {
274    #[inline]
275    pub fn revoked(&self) -> bool {
276        (self.bitfield & 0b00_00000001) == 0b00_00000001
277    }
278    #[inline]
279    pub fn expired(&self) -> bool {
280        (self.bitfield & 0b00_00000010) == 0b00_00000010
281    }
282    #[inline]
283    pub fn disabled(&self) -> bool {
284        (self.bitfield & 0b00_00000100) == 0b00_00000100
285    }
286    #[inline]
287    pub fn invalid(&self) -> bool {
288        (self.bitfield & 0b00_00001000) == 0b00_00001000
289    }
290    #[inline]
291    pub fn can_encrypt(&self) -> bool {
292        (self.bitfield & 0b00_00010000) == 0b00_00010000
293    }
294    #[inline]
295    pub fn can_sign(&self) -> bool {
296        (self.bitfield & 0b00_00100000) == 0b00_00100000
297    }
298    #[inline]
299    pub fn can_certify(&self) -> bool {
300        (self.bitfield & 0b00_01000000) == 0b00_01000000
301    }
302    #[inline]
303    pub fn secret(&self) -> bool {
304        (self.bitfield & 0b00_10000000) == 0b00_10000000
305    }
306    #[inline]
307    pub fn can_authenticate(&self) -> bool {
308        (self.bitfield & 0b01_00000000) == 0b01_00000000
309    }
310    #[inline]
311    pub fn is_qualified(&self) -> bool {
312        (self.bitfield & 0b10_00000000) == 0b10_00000000
313    }
314    #[inline]
315    pub fn origin(&self) -> u32 {
316        self.bitfield >> 27
317    }
318}
319
320pub type gpgme_passphrase_cb_t = Option<
321    unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char, c_int, c_int) -> gpgme_error_t,
322>;
323pub type gpgme_progress_cb_t =
324    Option<unsafe extern "C" fn(*mut c_void, *const c_char, c_int, c_int, c_int)>;
325pub type gpgme_status_cb_t =
326    Option<unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char) -> gpgme_error_t>;
327pub type gpgme_interact_cb_t =
328    Option<unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char, c_int) -> gpgme_error_t>;
329pub type gpgme_edit_cb_t = Option<
330    unsafe extern "C" fn(*mut c_void, gpgme_status_code_t, *const c_char, c_int) -> gpgme_error_t,
331>;
332
333pub type gpgme_io_cb_t = Option<unsafe extern "C" fn(*mut c_void, c_int) -> gpgme_error_t>;
334pub type gpgme_register_io_cb_t = Option<
335    unsafe extern "C" fn(
336        *mut c_void,
337        c_int,
338        c_int,
339        gpgme_io_cb_t,
340        *mut c_void,
341        *mut *mut c_void,
342    ) -> gpgme_error_t,
343>;
344pub type gpgme_remove_io_cb_t = Option<unsafe extern "C" fn(*mut c_void)>;
345
346#[repr(C)]
347#[derive(Copy, Clone)]
348pub struct gpgme_io_event_done_data {
349    pub err: gpgme_error_t,
350    pub op_err: gpgme_error_t,
351}
352pub type gpgme_io_event_done_data_t = *mut gpgme_io_event_done_data;
353
354pub type gpgme_event_io_cb_t =
355    Option<unsafe extern "C" fn(*mut c_void, gpgme_event_io_t, *mut c_void)>;
356
357#[repr(C)]
358#[derive(Copy, Clone)]
359pub struct gpgme_io_cbs {
360    pub add: gpgme_register_io_cb_t,
361    pub add_priv: *mut c_void,
362    pub remove: gpgme_remove_io_cb_t,
363    pub event: gpgme_event_io_cb_t,
364    pub event_priv: *mut c_void,
365}
366pub type gpgme_io_cbs_t = *mut gpgme_io_cbs;
367
368pub type gpgme_data_read_cb_t =
369    Option<unsafe extern "C" fn(*mut c_void, *mut c_void, size_t) -> ssize_t>;
370pub type gpgme_data_write_cb_t =
371    Option<unsafe extern "C" fn(*mut c_void, *const c_void, size_t) -> ssize_t>;
372pub type gpgme_data_seek_cb_t =
373    Option<unsafe extern "C" fn(*mut c_void, libc::off_t, c_int) -> libc::off_t>;
374pub type gpgme_data_release_cb_t = Option<unsafe extern "C" fn(*mut c_void)>;
375
376#[repr(C)]
377#[derive(Copy, Clone)]
378pub struct gpgme_data_cbs {
379    pub read: gpgme_data_read_cb_t,
380    pub write: gpgme_data_write_cb_t,
381    pub seek: gpgme_data_seek_cb_t,
382    pub release: gpgme_data_release_cb_t,
383}
384pub type gpgme_data_cbs_t = *mut gpgme_data_cbs;
385
386#[repr(C)]
387#[non_exhaustive]
388#[derive(Copy, Clone)]
389pub struct _gpgme_invalid_key {
390    pub next: gpgme_invalid_key_t,
391    pub fpr: *mut c_char,
392    pub reason: gpgme_error_t,
393}
394pub type gpgme_invalid_key_t = *mut _gpgme_invalid_key;
395
396#[repr(C)]
397#[non_exhaustive]
398#[derive(Copy, Clone)]
399pub struct _gpgme_op_encrypt_result {
400    pub invalid_recipients: gpgme_invalid_key_t,
401}
402pub type gpgme_encrypt_result_t = *mut _gpgme_op_encrypt_result;
403
404#[repr(C)]
405#[non_exhaustive]
406#[derive(Copy, Clone)]
407pub struct _gpgme_recipient {
408    pub next: gpgme_recipient_t,
409    pub keyid: *mut c_char,
410    _keyid: [c_char; 17],
411    pub pubkey_algo: gpgme_pubkey_algo_t,
412    pub status: gpgme_error_t,
413}
414pub type gpgme_recipient_t = *mut _gpgme_recipient;
415
416#[repr(C)]
417#[non_exhaustive]
418#[derive(Copy, Clone)]
419pub struct _gpgme_op_decrypt_result {
420    pub unsupported_algorithm: *mut c_char,
421    pub bitfield: u32,
422    pub recipients: gpgme_recipient_t,
423    pub file_name: *mut c_char,
424    pub session_key: *mut c_char,
425    pub symkey_algo: *mut c_char,
426}
427pub type gpgme_decrypt_result_t = *mut _gpgme_op_decrypt_result;
428
429impl _gpgme_op_decrypt_result {
430    #[inline]
431    pub fn wrong_key_usage(&self) -> bool {
432        (self.bitfield & 0b0001) == 0b0001
433    }
434
435    #[inline]
436    pub fn is_de_vs(&self) -> bool {
437        (self.bitfield & 0b0010) == 0b0010
438    }
439
440    #[inline]
441    pub fn is_mime(&self) -> bool {
442        (self.bitfield & 0b0100) == 0b0100
443    }
444
445    #[inline]
446    pub fn legacy_cipher_nomdc(&self) -> bool {
447        (self.bitfield & 0b1000) == 0b1000
448    }
449}
450
451#[repr(C)]
452#[non_exhaustive]
453#[derive(Copy, Clone)]
454pub struct _gpgme_new_signature {
455    pub next: gpgme_new_signature_t,
456    pub typ: gpgme_sig_mode_t,
457    pub pubkey_algo: gpgme_pubkey_algo_t,
458    pub hash_algo: gpgme_hash_algo_t,
459    _class1: c_ulong,
460    pub timestamp: c_long,
461    pub fpr: *mut c_char,
462    _class2: c_uint,
463    pub sig_class: c_uint,
464}
465pub type gpgme_new_signature_t = *mut _gpgme_new_signature;
466
467#[repr(C)]
468#[non_exhaustive]
469#[derive(Copy, Clone)]
470pub struct _gpgme_op_sign_result {
471    pub invalid_signers: gpgme_invalid_key_t,
472    pub signatures: gpgme_new_signature_t,
473}
474pub type gpgme_sign_result_t = *mut _gpgme_op_sign_result;
475
476#[repr(C)]
477#[non_exhaustive]
478#[derive(Copy, Clone)]
479pub struct _gpgme_signature {
480    pub next: gpgme_signature_t,
481    pub summary: gpgme_sigsum_t,
482    pub fpr: *mut c_char,
483    pub status: gpgme_error_t,
484    pub notations: gpgme_sig_notation_t,
485    pub timestamp: c_ulong,
486    pub exp_timestamp: c_ulong,
487    pub bitfield: u32,
488    pub validity: gpgme_validity_t,
489    pub validity_reason: gpgme_error_t,
490    pub pubkey_algo: gpgme_pubkey_algo_t,
491    pub hash_algo: gpgme_hash_algo_t,
492    pub pka_address: *mut c_char,
493    pub key: gpgme_key_t,
494}
495pub type gpgme_signature_t = *mut _gpgme_signature;
496
497impl _gpgme_signature {
498    #[inline]
499    pub fn wrong_key_usage(&self) -> bool {
500        (self.bitfield & 0b0001) == 0b0001
501    }
502
503    #[inline]
504    pub fn pka_trust(&self) -> c_uint {
505        (self.bitfield & 0b0110) >> 1
506    }
507
508    #[inline]
509    pub fn chain_model(&self) -> bool {
510        (self.bitfield & 0b1000) == 0b1000
511    }
512
513    #[inline]
514    pub fn is_de_vs(&self) -> bool {
515        (self.bitfield & 0b1_0000) == 0b1_0000
516    }
517}
518
519#[repr(C)]
520#[non_exhaustive]
521#[derive(Copy, Clone)]
522pub struct _gpgme_op_verify_result {
523    pub signatures: gpgme_signature_t,
524    pub file_name: *mut c_char,
525    pub bitfield: u32,
526}
527pub type gpgme_verify_result_t = *mut _gpgme_op_verify_result;
528
529impl _gpgme_op_verify_result {
530    #[inline]
531    pub fn is_mime(&self) -> bool {
532        (self.bitfield & 0b0001) == 0b0001
533    }
534}
535
536#[repr(C)]
537#[non_exhaustive]
538#[derive(Copy, Clone)]
539pub struct _gpgme_import_status {
540    pub next: gpgme_import_status_t,
541    pub fpr: *mut c_char,
542    pub result: gpgme_error_t,
543    pub status: c_uint,
544}
545pub type gpgme_import_status_t = *mut _gpgme_import_status;
546
547#[repr(C)]
548#[non_exhaustive]
549#[derive(Copy, Clone)]
550pub struct _gpgme_op_import_result {
551    pub considered: c_int,
552    pub no_user_id: c_int,
553    pub imported: c_int,
554    pub imported_rsa: c_int,
555    pub unchanged: c_int,
556    pub new_user_ids: c_int,
557    pub new_sub_keys: c_int,
558    pub new_signatures: c_int,
559    pub new_revocations: c_int,
560    pub secret_read: c_int,
561    pub secret_imported: c_int,
562    pub secret_unchanged: c_int,
563    pub skipped_new_keys: c_int,
564    pub not_imported: c_int,
565    pub imports: gpgme_import_status_t,
566    pub skipped_v3_keys: c_int,
567}
568pub type gpgme_import_result_t = *mut _gpgme_op_import_result;
569
570#[repr(C)]
571#[non_exhaustive]
572#[derive(Copy, Clone)]
573pub struct _gpgme_op_genkey_result {
574    pub bitfield: u32,
575    pub fpr: *mut c_char,
576    pub pubkey: gpgme_data_t,
577    pub seckey: gpgme_data_t,
578}
579pub type gpgme_genkey_result_t = *mut _gpgme_op_genkey_result;
580
581impl _gpgme_op_genkey_result {
582    #[inline]
583    pub fn primary(&self) -> bool {
584        (self.bitfield & 0b001) == 0b001
585    }
586
587    #[inline]
588    pub fn sub(&self) -> bool {
589        (self.bitfield & 0b010) == 0b010
590    }
591
592    #[inline]
593    pub fn uid(&self) -> bool {
594        (self.bitfield & 0b100) == 0b100
595    }
596}
597
598#[repr(C)]
599#[non_exhaustive]
600#[derive(Copy, Clone)]
601pub struct _gpgme_op_keylist_result {
602    pub bitfield: u32,
603}
604pub type gpgme_keylist_result_t = *mut _gpgme_op_keylist_result;
605
606impl _gpgme_op_keylist_result {
607    #[inline]
608    pub fn truncated(&self) -> bool {
609        (self.bitfield & 0b1) == 0b1
610    }
611}
612
613pub type gpgme_assuan_data_cb_t =
614    Option<unsafe extern "C" fn(*mut c_void, *const c_void, size_t) -> gpgme_error_t>;
615pub type gpgme_assuan_inquire_cb_t = Option<
616    unsafe extern "C" fn(
617        *mut c_void,
618        *const c_char,
619        *const c_char,
620        *mut gpgme_data_t,
621    ) -> gpgme_error_t,
622>;
623pub type gpgme_assuan_status_cb_t =
624    Option<unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char) -> gpgme_error_t>;
625
626#[repr(C)]
627#[non_exhaustive]
628#[derive(Copy, Clone)]
629pub struct _gpgme_op_vfs_mount_result {
630    pub mount_dir: *mut c_char,
631}
632pub type gpgme_vfs_mount_result_t = *mut _gpgme_op_vfs_mount_result;
633
634#[repr(C)]
635#[derive(Copy, Clone)]
636pub struct gpgme_conf_arg {
637    pub next: gpgme_conf_arg_t,
638    pub no_arg: c_uint,
639    pub value: libc::uintptr_t,
640}
641pub type gpgme_conf_arg_t = *mut gpgme_conf_arg;
642
643#[repr(C)]
644#[derive(Copy, Clone)]
645pub struct gpgme_conf_opt {
646    pub next: gpgme_conf_opt_t,
647    pub name: *mut c_char,
648    pub flags: c_uint,
649    pub level: gpgme_conf_level_t,
650    pub description: *mut c_char,
651    pub typ: gpgme_conf_type_t,
652    pub alt_type: gpgme_conf_type_t,
653    pub argname: *mut c_char,
654    pub default_value: gpgme_conf_arg_t,
655    pub default_description: *mut c_char,
656    pub no_arg_value: gpgme_conf_arg_t,
657    pub no_arg_description: *mut c_char,
658    pub value: gpgme_conf_arg_t,
659    pub change_value: c_int,
660    pub new_value: gpgme_conf_arg_t,
661    pub user_data: *mut c_void,
662}
663pub type gpgme_conf_opt_t = *mut gpgme_conf_opt;
664
665#[repr(C)]
666#[derive(Copy, Clone)]
667pub struct gpgme_conf_comp {
668    pub next: gpgme_conf_comp_t,
669    _last_opt_p: *mut gpgme_conf_opt_t,
670    pub name: *mut c_char,
671    pub description: *mut c_char,
672    pub program_name: *mut c_char,
673    pub options: gpgme_conf_opt_t,
674}
675pub type gpgme_conf_comp_t = *mut gpgme_conf_comp;
676
677#[repr(C)]
678#[non_exhaustive]
679#[derive(Copy, Clone)]
680pub struct _gpgme_op_query_swdb_result {
681    pub next: *mut _gpgme_op_query_swdb_result,
682    pub name: *mut c_char,
683    pub iversion: *mut c_char,
684    pub created: c_ulong,
685    pub retrieved: c_ulong,
686    bitfield: u32,
687    pub version: *mut c_char,
688    pub reldate: c_ulong,
689}
690
691impl _gpgme_op_query_swdb_result {
692    #[inline]
693    pub fn warning(&self) -> bool {
694        (self.bitfield & 0b0000_0001) == 0b0000_0001
695    }
696
697    #[inline]
698    pub fn update(&self) -> bool {
699        (self.bitfield & 0b0000_0010) == 0b0000_0010
700    }
701
702    #[inline]
703    pub fn urgent(&self) -> bool {
704        (self.bitfield & 0b0000_0100) == 0b0000_0100
705    }
706
707    #[inline]
708    pub fn noinfo(&self) -> bool {
709        (self.bitfield & 0b0000_1000) == 0b0000_1000
710    }
711
712    #[inline]
713    pub fn unknown(&self) -> bool {
714        (self.bitfield & 0b0001_0000) == 0b0001_0000
715    }
716
717    #[inline]
718    pub fn tooold(&self) -> bool {
719        (self.bitfield & 0b0010_0000) == 0b0010_0000
720    }
721
722    #[inline]
723    pub fn error(&self) -> bool {
724        (self.bitfield & 0b0100_0000) == 0b0100_0000
725    }
726}
727pub type gpgme_query_swdb_result_t = *mut _gpgme_op_query_swdb_result;