VirtualBox

source: vbox/trunk/include/VBox/usblib.h@ 55461

Last change on this file since 55461 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/** @file
2 * USBLib - Library for wrapping up the VBoxUSB functionality. (DEV,HDrv,Main)
3 */
4
5/*
6 * Copyright (C) 2006-2010 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_usblib_h
27#define ___VBox_usblib_h
28
29#include <VBox/cdefs.h>
30#include <VBox/types.h>
31#include <VBox/usb.h>
32#include <VBox/usbfilter.h>
33
34#ifdef RT_OS_WINDOWS
35# include <VBox/usblib-win.h>
36#endif
37#ifdef RT_OS_SOLARIS
38# include <VBox/usblib-solaris.h>
39#endif
40#ifdef RT_OS_DARWIN
41# include <VBox/usblib-darwin.h>
42#endif
43/** @todo merge the usblib-win.h interface into the darwin and linux ports where suitable. */
44
45RT_C_DECLS_BEGIN
46/** @defgroup grp_USBLib USBLib - USB Support Library
47 * This module implements the basic low-level OS interfaces and common USB code.
48 * @{
49 */
50
51#ifdef IN_RING3
52/**
53 * Initializes the USBLib component.
54 *
55 * The USBLib keeps a per process connection to the kernel driver
56 * and all USBLib users within a process will share the same
57 * connection. USBLib does reference counting to make sure that
58 * the connection remains open until all users has called USBLibTerm().
59 *
60 * @returns VBox status code.
61 *
62 * @remark The users within the process are responsible for not calling
63 * this function at the same time (because I'm lazy).
64 */
65USBLIB_DECL(int) USBLibInit(void);
66
67/**
68 * Terminates the USBLib component.
69 *
70 * Must match successful USBLibInit calls.
71 *
72 * @returns VBox status code.
73 */
74USBLIB_DECL(int) USBLibTerm(void);
75
76/**
77 * Adds a filter.
78 *
79 * This function will validate and transfer the specified filter
80 * to the kernel driver and make it start using it. The kernel
81 * driver will return a filter id that this function passes on
82 * to its caller.
83 *
84 * The kernel driver will associate the added filter with the
85 * calling process and automatically remove all filters when
86 * the process terminates the connection to it or dies.
87 *
88 * @returns Filter id for passing to USBLibRemoveFilter on success.
89 * @returns NULL on failure.
90 *
91 * @param pFilter The filter to add.
92 */
93USBLIB_DECL(void *) USBLibAddFilter(PCUSBFILTER pFilter);
94
95/**
96 * Removes a filter.
97 *
98 * @param pvId The ID returned by USBLibAddFilter.
99 */
100USBLIB_DECL(void) USBLibRemoveFilter(void *pvId);
101
102/**
103 * Calculate the hash of the serial string.
104 *
105 * 64bit FNV1a, chosen because it is designed to hash in to a power of two
106 * space, and is much quicker and simpler than, say, a half MD4.
107 *
108 * @returns the hash.
109 * @param pszSerial The serial string.
110 */
111USBLIB_DECL(uint64_t) USBLibHashSerial(const char *pszSerial);
112
113#endif /* IN_RING3 */
114
115/** @} */
116RT_C_DECLS_END
117
118#endif
119
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette