1 | /* $Id: SUPR0IdcClientComponent.c 10258 2008-07-04 23:31:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Support Driver - IDC Client Lib, Component APIs.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008 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 | /*******************************************************************************
|
---|
32 | * Header Files *
|
---|
33 | *******************************************************************************/
|
---|
34 | #include "SUPR0IdcClientInternal.h"
|
---|
35 | #include <VBox/err.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Registers a component factory with SUPDRV.
|
---|
40 | *
|
---|
41 | * @returns VBox status code.
|
---|
42 | * @param pHandle The IDC handle.
|
---|
43 | * @param pFactory The factory to register.
|
---|
44 | */
|
---|
45 | SUPR0DECL(int) SUPR0IdcComponentRegisterFactory(PSUPDRVIDCHANDLE pHandle, PCSUPDRVFACTORY pFactory)
|
---|
46 | {
|
---|
47 | SUPDRVIDCREQCOMPREGFACTORY Req;
|
---|
48 |
|
---|
49 | /*
|
---|
50 | * Validate the handle before we access it.
|
---|
51 | */
|
---|
52 | AssertPtrReturn(pHandle, VERR_INVALID_HANDLE);
|
---|
53 | AssertPtrReturn(pHandle->s.pSession, VERR_INVALID_HANDLE);
|
---|
54 |
|
---|
55 | /*
|
---|
56 | * Construct and fire off the request.
|
---|
57 | */
|
---|
58 | Req.Hdr.cb = sizeof(Req);
|
---|
59 | Req.Hdr.rc = VERR_WRONG_ORDER;
|
---|
60 | Req.Hdr.pSession = pHandle->s.pSession;
|
---|
61 | Req.u.In.pFactory = pFactory;
|
---|
62 |
|
---|
63 | return supR0IdcNativeCall(pHandle, SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY, &Req.Hdr);
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Deregisters a component factory with SUPDRV.
|
---|
69 | *
|
---|
70 | * @returns VBox status code.
|
---|
71 | * @param pHandle The IDC handle.
|
---|
72 | * @param pFactory The factory to register.
|
---|
73 | */
|
---|
74 | SUPR0DECL(int) SUPR0IdcComponentDeregisterFactory(PSUPDRVIDCHANDLE pHandle, PCSUPDRVFACTORY pFactory)
|
---|
75 | {
|
---|
76 | SUPDRVIDCREQCOMPDEREGFACTORY Req;
|
---|
77 |
|
---|
78 | /*
|
---|
79 | * Validate the handle before we access it.
|
---|
80 | */
|
---|
81 | AssertPtrReturn(pHandle, VERR_INVALID_HANDLE);
|
---|
82 | AssertPtrReturn(pHandle->s.pSession, VERR_INVALID_HANDLE);
|
---|
83 |
|
---|
84 | /*
|
---|
85 | * Construct and fire off the request.
|
---|
86 | */
|
---|
87 | Req.Hdr.cb = sizeof(Req);
|
---|
88 | Req.Hdr.rc = VERR_WRONG_ORDER;
|
---|
89 | Req.Hdr.pSession = pHandle->s.pSession;
|
---|
90 | Req.u.In.pFactory = pFactory;
|
---|
91 |
|
---|
92 | return supR0IdcNativeCall(pHandle, SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY, &Req.Hdr);
|
---|
93 | }
|
---|
94 |
|
---|