glib-2.0: Variant.byte() takes an uint8 argument
[vala-gnome.git] / vapi / libusb-1.0.vapi
bloba7655565c392afbc7ad4bb6b29ab181034391a62
1 [CCode (cprefix = "libusb_", cheader_filename = "libusb.h")]
2 namespace LibUSB {
3         [CCode (cname = "enum libusb_class_code", cprefix = "LIBUSB_CLASS_", has_type_id = false)]
4         public enum ClassCode {
5                 PER_INTERFACE,
6                 AUDIO,
7                 COMM,
8                 HID,
9                 PRINTER,
10                 PTP,
11                 MASS_STORAGE,
12                 HUB,
13                 DATA,
14                 VENDOR_SPEC
15         }
17         [CCode (cname = "enum libusb_descriptor_type", cprefix = "LIBUSB_DT_", has_type_id = false)]
18         public enum DescriptorType {
19                 DEVICE,
20                 CONFIG,
21                 STRING,
22                 INTERFACE,
23                 ENDPOINT,
24                 BOS,
25                 DEVICE_CAPABILITY,
26                 HID,
27                 REPORT,
28                 PHYSICAL,
29                 HUB,
30                 SUPERSPEED_HUB,
31                 SS_ENDPOINT_COMPANION
32         }
34         [CCode (cprefix = "LIBUSB_DT_")]
35         namespace DescriptorTypeSize {
36                 public const int DEVICE_SIZE;
37                 public const int CONFIG_SIZE;
38                 public const int INTERFACE_SIZE;
39                 public const int ENDPOINT_SIZE;
40                 public const int ENDPOINT_AUDIO_SIZE;
41                 public const int SS_ENDPOINT_COMPANION_SIZE;
42                 public const int BOS_SIZE;
43                 public const int DEVICE_CAPABILITY_SIZE;
44                 public const int USB_2_0_EXTENSION_SIZE;
45                 public const int SS_USB_DEVICE_CAPABILITY_SIZE;
46                 public const int CONTAINER_ID_SIZE;
47         }
49         namespace EndpointMask {
50                 [CCode (cname = "LIBUSB_ENDPOINT_ADDRESS_MASK")]
51                 public const int ADDRESS;
52                 [CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
53                 public const int DIR;
54                 [CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
55                 public const int DIRECTION;
56         }
58         [CCode (cname = "enum libusb_endpoint_direction", cprefix = "LIBUSB_ENDPOINT_", has_type_id = false)]
59         public enum EndpointDirection {
60                 IN,
61                 OUT,
62                 [CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
63                 MASK
64         }
66         [CCode (cname = "enum libusb_transfer_type", cprefix = "LIBUSB_TRANSFER_TYPE_", has_type_id = false)]
67         public enum TransferType {
68                 CONTROL,
69                 ISOCHRONOUS,
70                 BULK,
71                 INTERRUPT,
72                 BULK_STREAM
73         }
75         [CCode (cname = "enum libusb_standard_request", cprefix = "LIBUSB_REQUEST_", has_type_id = false)]
76         public enum StandardRequest {
77                 GET_STATUS,
78                 CLEAR_FEATURE,
79                 SET_FEATURE,
80                 SET_ADDRESS,
81                 GET_DESCRIPTOR,
82                 SET_DESCRIPTOR,
83                 GET_CONFIGURATION,
84                 SET_CONFIGURATION,
85                 GET_INTERFACE,
86                 SET_INTERFACE,
87                 SYNCH_FRAME,
88                 SET_SEL,
89                 [CCode (cname = "LIBUSB_SET_ISOCH_DELAY")]
90                 SET_ISOCH_DELAY
91         }
93         [CCode (cname = "enum libusb_request_type", cprefix = "LIBUSB_REQUEST_TYPE_", has_type_id = false)]
94         public enum RequestType {
95                 STANDARD,
96                 CLASS,
97                 VENDOR,
98                 RESERVED
99         }
101         [CCode (cname = "enum libusb_request_recipient", cprefix = "LIBUSB_RECIPIENT_", has_type_id = false)]
102         public enum RequestRecipient {
103                 DEVICE,
104                 INTERFACE,
105                 ENDPOINT,
106                 OTHER
107         }
109         [CCode (cname = "enum libusb_iso_sync_type", cprefix = "LIBUSB_ISO_SYNC_TYPE_", has_type_id = false)]
110         public enum IsoSyncType {
111                 NONE,
112                 ASYNC,
113                 ADAPTIVE,
114                 SYNC,
115                 MASK
116         }
118         [CCode (cname = "enum libusb_iso_usage_type", cprefix = "LIBUSB_ISO_USAGE_TYPE_", has_type_id = false)]
119         public enum IsoUsageType {
120                 DATA,
121                 FEEDBACK,
122                 IMPLICIT,
123                 MASK
124         }
126         [CCode (cname = "enum libusb_error", cprefix = "LIBUSB_ERROR_", has_type_id = false)]
127         public enum Error {
128                 [CCode (cname = "LIBUSB_SUCCESS")]
129                 SUCCESS,
130                 IO,
131                 INVALID_PARAM,
132                 ACCESS,
133                 NO_DEVICE,
134                 NOT_FOUND,
135                 BUSY,
136                 TIMEOUT,
137                 OVERFLOW,
138                 PIPE,
139                 INTERRUPTED,
140                 NO_MEM,
141                 NOT_SUPPORTED,
142                 OTHER;
143                 [CCode (cname = "libusb_strerror")]
144                 public unowned string get_description ();
145                 [CCode (cname = "libusb_error_name")]
146                 public unowned string get_name ();
147         }
149         [CCode (cname = "enum libusb_transfer_flags", cprefix = "LIBUSB_TRANSFER_", has_type_id = false)]
150         public enum TransferFlags {
151                 SHORT_NOT_OK,
152                 FREE_BUFFER,
153                 FREE_TRANSFER,
154                 ADD_ZERO_PACKET
155         }
157         [CCode (cname = "enum libusb_speed", cprefix = "LIBUSB_SPEED_", has_type_id = false)]
158         public enum Speed {
159                 UNKNOWN,
160                 LOW,
161                 FULL,
162                 HIGH,
163                 SUPER
164         }
166         [Flags]
167         [CCode (cname = "enum libusb_supported_speed", has_type_id = false)]
168         public enum SupportedSpeed {
169                 [CCode (cname = "LIBUSB_LOW_SPEED_OPERATION")]
170                 LOW,
171                 [CCode (cname = "LIBUSB_FULL_SPEED_OPERATION")]
172                 FULL,
173                 [CCode (cname = "LIBUSB_HIGH_SPEED_OPERATION")]
174                 HIGH,
175                 [CCode (cname = "LIBUSB_SUPER_SPEED_OPERATION")]
176                 SUPER
177         }
179         [Flags]
180         [CCode (cname = "enum libusb_usb_2_0_extension_attributes", has_type_id = false)]
181         public enum USB_2_0_ExtensionAttributes {
182                 [CCode (cname = "LIBUSB_BM_LPM_SUPPORT")]
183                 LPM_SUPPORT
184         }
186         [Flags]
187         [CCode (cname = "enum libusb_ss_usb_device_capability_attributes", has_type_id = false)]
188         public enum SSUsbDeviceCapabilityAttributes {
189                 [CCode (cname = "LIBUSB_BM_LTM_SUPPORT")]
190                 LTM_SUPPORT
191         }
193         [CCode (cname = "enum libusb_bos_type", cprefix = "LIBUSB_BT_", has_type_id = false)]
194         public enum BosType {
195                 WIRELESS_USB_DEVICE_CAPABILITY,
196                 USB_2_0_EXTENSION,
197                 SS_USB_DEVICE_CAPABILITY,
198                 CONTAINER_ID
199         }
201         [CCode (cname = "struct libusb_device_descriptor", has_type_id = false)]
202         public struct DeviceDescriptor {
203                 public uint8 bLength;
204                 public uint8 bDescriptorType;
205                 public uint16 bcdUSB;
206                 public uint8 bDeviceClass;
207                 public uint8 bDeviceSubClass;
208                 public uint8 bDeviceProtocol;
209                 public uint8 bMaxPacketSize0;
210                 public uint16 idVendor;
211                 public uint16 idProduct;
212                 public uint16 bcdDevice;
213                 public uint8 iManufacturer;
214                 public uint8 iProduct;
215                 public uint8 iSerialNumber;
216                 public uint8 bNumConfigurations;
218                 [CCode (cname = "libusb_get_device_descriptor", instance_pos = -1)]
219                 public DeviceDescriptor (Device device);
220         }
222         [CCode (cname = "struct libusb_endpoint_descriptor", cprefix = "libusb_", has_type_id = false)]
223         public struct EndpointDescriptor {
224                 public uint8 bLength;
225                 public uint8 bDescriptorType;
226                 public uint8 bEndpointAddress;
227                 public uint8 bmAttributes;
228                 public uint16 wMaxPacketSize;
229                 public uint8 bInterval;
230                 public uint8 bRefresh;
231                 public uint8 bSynchAddress;
232                 [CCode (array_length_cname = "extra_length")]
233                 public uint8[] extra;
234         }
236         [CCode (cname = "struct libusb_interface_descriptor", has_type_id = false)]
237         public struct InterfaceDescriptor {
238                 public uint8 bLength;
239                 public uint8 bDescriptorType;
240                 public uint8 bInterfaceNumber;
241                 public uint8 bAlternateSetting;
242                 public uint8 bNumEndpoints;
243                 public uint8 bInterfaceClass;
244                 public uint8 bInterfaceSubClass;
245                 public uint8 bInterfaceProtocol;
246                 public uint8 iInterface;
247                 [CCode (array_length_cname = "bNumEndpoints", array_length_type = "uint8_t")]
248                 public EndpointDescriptor[] endpoint;
249                 [CCode (array_length_cname = "extra_length")]
250                 public uint8[] extra;
251         }
253         [CCode (cname = "struct libusb_interface", has_type_id = false)]
254         public struct Interface {
255                 [CCode (array_length_cname = "num_altsetting")]
256                 public InterfaceDescriptor[] altsetting;
257         }
259         [CCode (cname = "struct libusb_config_descriptor", free_function = "libusb_free_config_descriptor")]
260         [Compact]
261         public class ConfigDescriptor {
262                 public uint8 bLength;
263                 public uint8 bDescriptorType;
264                 public uint16 wTotalLength;
265                 public uint8 bNumInterfaces;
266                 public uint8 bConfigurationValue;
267                 public uint8 iConfiguration;
268                 public uint8 bmAttributes;
269                 public uint8 MaxPower;
270                 [CCode (array_length_cname = "bNumInterfaces")]
271                 public Interface[] @interface;
272                 [CCode (array_length_cname = "extra_length")]
273                 public uint8[] extra;
274         }
276         [CCode (cname = "struct libusb_ss_endpoint_companion_descriptor", free_function = "libusb_free_ss_endpoint_companion_descriptor")]
277         [Compact]
278         public class SSEndpointCompanionDescriptor {
279                 public uint8 bLength;
280                 public uint8 bDescriptorType;
281                 public uint8 bMaxBurst;
282                 public uint8 bmAttributes;
283                 public uint16 wBytesPerInterval;
284         }
286         [CCode (cname = "struct libusb_bos_dev_capability_descriptor", has_type_id = false)]
287         public struct BosDevCapabilityDescriptor {
288                 public uint8 bLength;
289                 public uint8 bDescriptorType;
290                 public uint8 bDevCapabilityType;
291                 public uint8 dev_capability_data;
292         }
294         [CCode (cname = "struct libusb_bos_descriptor", free_function = "libusb_free_bos_descriptor")]
295         [Compact]
296         public class BosDescriptor {
297                 public uint8 bLength;
298                 public uint8 bDescriptorType;
299                 public uint16 wTotalLength;
300                 [CCode (array_length_cname = "bNumDeviceCaps", array_length_type = "uint8_t")]
301                 public BosDevCapabilityDescriptor[] dev_capability;
302         }
304         [CCode (cname = "struct libusb_usb_2_0_extension_descriptor", free_function = "libusb_free_usb_2_0_extension_descriptor")]
305         [Compact]
306         public class USB_2_0_ExtensionDescriptor {
307                 public uint8 bLength;
308                 public uint8 bDescriptorType;
309                 public uint8 bDevCapabilityType;
310                 public uint32 bmAttributes;
311         }
313         [CCode (cname = "struct libusb_ss_usb_device_capability_descriptor", free_function = "libusb_free_ss_usb_device_capability_descriptor")]
314         [Compact]
315         public class SSUsbDeviceCapabilityDescriptor {
316                 public uint8 bLength;
317                 public uint8 bDescriptorType;
318                 public uint8 bDevCapabilityType;
319                 public uint8 bmAttributes;
320                 public uint16 wSpeedSupported;
321                 public uint8 bFunctionalitySupport;
322                 public uint8 bU1DevExitLat;
323                 public uint8 bU2DevExitLat;
324         }
326         [CCode (cname = "struct libusb_container_id_descriptor", free_function = "libusb_free_container_id_descriptor")]
327         [Compact]
328         public class ContainerIdDescriptor {
329                 public uint8 bLength;
330                 public uint8 bDescriptorType;
331                 public uint8 bDevCapabilityType;
332                 public uint8 bReserved;
333                 public uint8 ContainerID[16];
334         }
336         [CCode (cname = "libusb_device_handle", cprefix = "libusb_", free_function = "libusb_close")]
337         [Compact]
338         public class DeviceHandle {
339                 [CCode (cname = "_vala_libusb_device_handle_new")]
340                 public DeviceHandle (Device device) {
341                         DeviceHandle handle;
342                         device.open(out handle);
343                 }
345                 [CCode (cname = "libusb_open_device_with_vid_pid")]
346                 public DeviceHandle.from_vid_pid (Context? context, uint16 vendor_id, uint16 product_id);
347                 public unowned Device get_device ();
348                 public LibUSB.Error get_configuration (out int config);
349                 public LibUSB.Error set_configuration (int configuration);
350                 public LibUSB.Error claim_interface (int interface_number);
351                 public LibUSB.Error release_interface (int interface_number);
352                 public LibUSB.Error set_interface_alt_setting (int interface_number, int alternate_setting);
353                 public LibUSB.Error clear_halt (uchar endpoint);
354                 [CCode (cname = "libusb_reset_device")]
355                 public LibUSB.Error reset ();
356                 public LibUSB.Error kernel_driver_active (int @interface);
357                 public LibUSB.Error detach_kernel_driver (int @interface);
358                 public LibUSB.Error attach_kernel_driver (int @interface);
359                 public LibUSB.Error set_auto_detach_kernel_driver (bool enable);
361                 public LibUSB.Error get_string_descriptor_ascii (uint8 desc_index, uint8[] data);
362                 public LibUSB.Error get_descriptor (uint8 desc_type, uint8 desc_index, uint8[] data);
363                 public LibUSB.Error get_string_descriptor (uint desc_index, uint16 langid, uint8[] data);
364                 public LibUSB.Error get_bos_descriptor (out BosDescriptor bos);
366                 public LibUSB.Error control_transfer (uint8 bmRequestType, uint8 bRequest, uint16 wValue, uint16 wIndex, [CCode (array_length = false)] uint8[] data, uint16 wLength, uint timeout);
367                 public LibUSB.Error bulk_transfer (uint8 endpoint, uint8[] data, out int transferred, uint timeout);
368                 public LibUSB.Error interrupt_transfer (uint8 endpoint, uint8[] data, out int transferred, uint timeout);
369         }
371         [CCode (cname = "libusb_device", cprefix = "libusb_", ref_function = "libusb_ref_device", unref_function = "libusb_unref_device")]
372         [Compact]
373         public class Device {
374                 public uint8 get_bus_number ();
375                 public uint8 get_port_number ();
376                 public int get_port_numbers (out uint8[] port_numbers);
377                 public uint8 get_device_address ();
378                 public int get_max_packet_size (uint8 endpoint);
379                 public int get_max_iso_packet_size (uint8 endpoint);
380                 public Speed get_device_speed ();
381                 public LibUSB.Error open (out DeviceHandle handle);
383                 public LibUSB.Error get_active_config_descriptor (out ConfigDescriptor config);
384                 public LibUSB.Error get_config_descriptor (uint8 config_index, out ConfigDescriptor config);
385                 public LibUSB.Error get_config_descriptor_by_value (uint8 ConfigurationValue, out ConfigDescriptor config);
386                 public LibUSB.Error get_device_descriptor (out DeviceDescriptor desc);
387                 public unowned Device get_parent ();
388         }
390         [CCode (cname = "enum libusb_log_level", cprefix = "LIBUSB_LOG_LEVEL_", has_type_id = false)]
391         public enum LogLevel {
392                 NONE,
393                 ERROR,
394                 WARNING,
395                 INFO,
396                 DEBUG
397         }
399         [CCode (cname = "libusb_context", cprefix = "libusb_", free_function = "libusb_exit")]
400         [Compact]
401         public class Context {
402                 protected Context ();
403                 public static LibUSB.Error init (out Context context);
404                 public void set_debug (LogLevel level);
405                 public ssize_t get_device_list ([CCode (array_length = false, array_null_terminated = true)] out Device[] list);
406                 public DeviceHandle open_device_with_vid_pid (uint16 vendor_id, uint16 product_id);
408                 public LibUSB.Error try_lock_events ();
409                 public void lock_events ();
410                 public void unlock_events ();
411                 public LibUSB.Error event_handling_ok ();
412                 public LibUSB.Error event_handler_active ();
413                 public void interrupt_event_handler ();
414                 public void lock_event_waiters ();
415                 public void unlock_event_waiters ();
416                 public LibUSB.Error wait_for_event (Posix.timeval tv);
417                 public LibUSB.Error handle_events_timeout (Posix.timeval tv);
418                 public LibUSB.Error handle_events_timeout_completed (Posix.timeval tv, out int completed);
419                 public LibUSB.Error handle_events ();
420                 public LibUSB.Error handle_events_completed (Posix.timeval tv, out int completed);
421                 public LibUSB.Error handle_events_locked (Posix.timeval tv);
422                 public LibUSB.Error pollfds_handle_timeouts ();
423                 public LibUSB.Error get_next_timeout (out Posix.timeval tv);
424                 public void set_pollfd_notifiers (pollfd_added_cb added_cb, pollfd_removed_cb removed_cb, void* user_data);
425                 [CCode (array_length = false, array_null_terminated = true)]
426                 public PollFD[] get_pollfds ();
428                 public LibUSB.Error get_ss_endpoint_companion_descriptor (EndpointDescriptor config, out SSEndpointCompanionDescriptor ep_comp);
429                 public LibUSB.Error get_usb_2_0_extension_descriptor (BosDevCapabilityDescriptor dev_cap, out USB_2_0_ExtensionDescriptor usb_2_0_extension);
430                 public LibUSB.Error get_ss_usb_device_capability_descriptor (BosDevCapabilityDescriptor dev_cap, out SSUsbDeviceCapabilityDescriptor usb_2_0_extension);
431                 public LibUSB.Error get_container_id_descriptor (BosDevCapabilityDescriptor dev_cap, out ContainerIdDescriptor container_id);
432                 public LibUSB.Error hotplug_register_callback (HotPlugEvent events, HotPlugFlags flags, int vendor_id, int product_id, int dev_class, HotPlugCb cb_fn, out HotCallbackHandle callback_handle);
433                 public LibUSB.Error hotplug_deregister_callback (HotCallbackHandle callback_handle);
434         }
436         public static uint16 le16_to_cpu (uint16 n);
437         public static uint16 cpu_to_le16 (uint16 n);
438         [CCode (cname = "malloc", cheader_filename = "stdlib.h")]
439         private static void* malloc (ulong n_bytes);
441         [CCode (cname = "struct libusb_control_setup")]
442         [Compact]
443         public class ControlSetup {
444                 public uint8 bmRequestType;
445                 public int8 bRequest;
446                 public uint16 wValue;
447                 public uint16 wIndex;
448                 public uint16 wLength;
449         }
451         [CCode (cname = "enum libusb_capability", cprefix = "LIBUSB_CAP_", has_type_id = false)]
452         public enum Capability {
453                 HAS_CAPABILITY,
454                 HAS_HOTPLUG,
455                 HAS_HID_ACCESS,
456                 SUPPORTS_DETACH_KERNEL_DRIVER
457         }
459         [CCode (cname = "enum libusb_transfer_status", cprefix = "LIBUSB_TRANSFER_", has_type_id = false)]
460         public enum TransferStatus {
461                 COMPLETED,
462                 ERROR,
463                 TIMED_OUT,
464                 CANCELLED,
465                 STALL,
466                 NO_DEVICE,
467                 OVERFLOW
468         }
470         [CCode (cname = "libusb_hotplug_event", cprefix = "LIBUSB_HOTPLUG_EVENT_", has_type_id = false)]
471         public enum HotPlugEvent {
472                 DEVICE_ARRIVED,
473                 DEVICE_LEFT,
474                 [CCode (cname = "LIBUSB_HOTPLUG_MATCH_ANY")]
475                 MATCH_ANY
476         }
478         [CCode (cname = "libusb_hotplug_flag", cprefix = "LIBUSB_HOTPLUG_", has_type_id = false)]
479         public enum HotPlugFlags {
480                 NO_FLAGS,
481                 ENUMERATE
482         }
484         [CCode (cname = "libusb_hotplug_callback_handle", has_type_id = false)]
485         [SimpleType]
486         public struct HotCallbackHandle : int {
487         }
489         [CCode (cname = "struct libusb_iso_packet_descriptor", has_type_id = false)]
490         public struct IsoPacketDescriptor {
491                 public uint length;
492                 public uint actual_length;
493                 public TransferStatus status;
494         }
496         [CCode (cname = "libusb_transfer_cb_fn")]
497         public delegate void TransferCb (Transfer transfer);
499         [CCode (cname = "struct libusb_transfer", cprefix = "libusb_", free_function = "libusb_free_transfer")]
500         [Compact]
501         public class Transfer {
502                 public DeviceHandle dev_handle;
503                 public uint8 flags;
504                 public uint8 endpoint;
505                 public uint8 type;
506                 public uint timeout;
507                 public TransferStatus status;
508                 public int length;
509                 public int actual_length;
510                 [CCode (delegate_target_cname = "user_data")]
511                 public TransferCb @callback;
512                 [CCode (array_length_cname = "length")]
513                 public uint8[] buffer;
514                 public int num_iso_packets;
515                 [CCode (array_length = false)]
516                 public IsoPacketDescriptor[] iso_packet_desc;
518                 [CCode (cname = "libusb_alloc_transfer")]
519                 public Transfer (int iso_packets = 0);
520                 [CCode (cname = "libusb_submit_transfer")]
521                 public LibUSB.Error submit ();
522                 [CCode (cname = "libusb_cancel_transfer")]
523                 public LibUSB.Error cancel ();
524                 [CCode (cname = "libusb_contrel_transfer_get_data", array_length = false)]
525                 public unowned char[] control_get_data ();
526                 [CCode (cname = "libusb_control_transfer_get_setup")]
527                 public unowned ControlSetup control_get_setup ();
529                 public static void fill_control_setup ([CCode (array_length = false)] uint8[] buffer, uint8 bmRequestType, uint8 bRequest, uint16 wValue, uint16 wIndex, uint16 wLength);
530                 public void fill_control_transfer (DeviceHandle dev_handle, [CCode (array_length = false)] uint8[] buffer, TransferCb @callback, uint timeout);
531                 public void fill_bulk_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, TransferCb @callback, uint timeout);
532                 public void fill_interrupt_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, TransferCb @callback, uint timeout);
533                 public void fill_iso_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, int num_iso_packets, TransferCb @callback, uint timeout);
534                 public void set_packet_lengths (uint length);
535                 [CCode (array_length = false)]
536                 public unowned uint8[] get_iso_packet_buffer (uint packet);
537                 [CCode (array_length = false)]
538                 public unowned uint8[] get_iso_packet_buffer_simple (int packet);
539         }
541         [CCode (has_target = false)]
542         public delegate void pollfd_added_cb (int fd, short events, void* user_data);
543         [CCode (has_target = false)]
544         public delegate void pollfd_removed_cb (int fd, void* user_data);
546         [CCode (cname = "libusb_hotplug_callback_fn")]
547         public delegate void HotPlugCb (Context ctx, Device device, HotPlugEvent event);
549         [CCode (cname = "struct libusb_pollfd")]
550         [Compact]
551         public class PollFD {
552                 public int fd;
553                 public short events;
554         }
556         public static int has_capability (Capability capability);