VirtualBox

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

Last change on this file since 25337 was 21217, checked in by vboxsync, 15 years ago

include/VBox/*.h: Mark which components the header files relate to.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 * USBLib - Library for wrapping up the VBoxUSB functionality. (DEV,HDrv,Main)
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_usblib_h
31#define ___VBox_usblib_h
32
33#include <VBox/cdefs.h>
34#include <VBox/types.h>
35#include <VBox/usb.h>
36#include <VBox/usbfilter.h>
37
38#ifdef RT_OS_WINDOWS
39# include <VBox/usblib-win.h>
40#endif
41#ifdef RT_OS_SOLARIS
42# include <VBox/usblib-solaris.h>
43#endif
44#ifdef RT_OS_DARWIN
45# include <VBox/usblib-darwin.h>
46#endif
47/** @todo merge the usblib-win.h interface into the darwin and linux ports where suitable. */
48
49RT_C_DECLS_BEGIN
50/** @defgroup grp_USBLib USBLib - USB Support Library
51 * This module implements the basic low-level OS interfaces and common USB code.
52 * @{
53 */
54
55#ifdef IN_RING3
56/**
57 * Initializes the USBLib component.
58 *
59 * The USBLib keeps a per process connection to the kernel driver
60 * and all USBLib users within a process will share the same
61 * connection. USBLib does reference counting to make sure that
62 * the connection remains open until all users has called USBLibTerm().
63 *
64 * @returns VBox status code.
65 *
66 * @remark The users within the process are responsible for not calling
67 * this function at the same time (because I'm lazy).
68 */
69USBLIB_DECL(int) USBLibInit(void);
70
71/**
72 * Terminates the USBLib component.
73 *
74 * Must match successfull USBLibInit calls.
75 *
76 * @returns VBox status code.
77 */
78USBLIB_DECL(int) USBLibTerm(void);
79
80/**
81 * Adds a filter.
82 *
83 * This function will validate and transfer the specified filter
84 * to the kernel driver and make it start using it. The kernel
85 * driver will return a filter id that this function passes on
86 * to its caller.
87 *
88 * The kernel driver will associate the added filter with the
89 * calling process and automatically remove all filters when
90 * the process terminates the connection to it or dies.
91 *
92 * @returns Filter id for passing to USBLibRemoveFilter on success.
93 * @returns NULL on failure.
94 *
95 * @param pFilter The filter to add.
96 */
97USBLIB_DECL(void *) USBLibAddFilter(PCUSBFILTER pFilter);
98
99/**
100 * Removes a filter.
101 *
102 * @param pvId The ID returned by USBLibAddFilter.
103 */
104USBLIB_DECL(void) USBLibRemoveFilter(void *pvId);
105
106/**
107 * Calculate the hash of the serial string.
108 *
109 * 64bit FNV1a, chosen because it is designed to hash in to a power of two
110 * space, and is much quicker and simpler than, say, a half MD4.
111 *
112 * @returns the hash.
113 * @param pszSerial The serial string.
114 */
115USBLIB_DECL(uint64_t) USBLibHashSerial(const char *pszSerial);
116
117#endif /* IN_RING3 */
118
119/** @} */
120RT_C_DECLS_END
121
122#endif
123
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