VirtualBox

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

Last change on this file since 18190 was 8770, checked in by vboxsync, 16 years ago

Moved the windows usblib implementation to HostDrivers/VBoxUSB/win.

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