| | 667 | /** |
|---|
| | 668 | * Support driver component factory. |
|---|
| | 669 | * |
|---|
| | 670 | * Component factories are registered by drivers that provides services |
|---|
| | 671 | * such as the host network interface filtering and access to the host |
|---|
| | 672 | * TCP/IP stack. |
|---|
| | 673 | * |
|---|
| | 674 | * @remark Module dependencies and making sure that a component doesn't |
|---|
| | 675 | * get unloaded while in use, is the sole responsibility of the |
|---|
| | 676 | * driver/kext/whatever implementing the component. |
|---|
| | 677 | */ |
|---|
| | 678 | typedef struct SUPDRVFACTORY |
|---|
| | 679 | { |
|---|
| | 680 | /** The (unique) name of the component factory. */ |
|---|
| | 681 | char szName[56]; |
|---|
| | 682 | /** |
|---|
| | 683 | * Queries a factory interface. |
|---|
| | 684 | * |
|---|
| | 685 | * The factory interface is specific to each component and will be be |
|---|
| | 686 | * found in the header(s) for the component alongside its UUID. |
|---|
| | 687 | * |
|---|
| | 688 | * @returns Pointer to the factory interfaces on success, NULL on failure. |
|---|
| | 689 | * |
|---|
| | 690 | * @param pSession The SUPDRV session making the query. |
|---|
| | 691 | * @param pSupDrvFactory Pointer to this structure. |
|---|
| | 692 | * @param pInterfaceUuid The UUID of the factory interface. |
|---|
| | 693 | */ |
|---|
| | 694 | DECLR0CALLBACKMEMBER(void *, pfnQueryFactoryInterface,(PSUPDRVSESSION pSession, struct SUPDRVFACTORY *pSupDrvFactory, PCRTUUID pInterfaceUuid)); |
|---|
| | 695 | } SUPDRVFACTORY; |
|---|
| | 696 | /** Pointer to a support driver factory. */ |
|---|
| | 697 | typedef SUPDRVFACTORY *PSUPDRVFACTORY; |
|---|
| | 698 | |
|---|
| | 699 | /** |
|---|
| | 700 | * Register a component factory with the support driver. |
|---|
| | 701 | * |
|---|
| | 702 | * @returns VBox status code. |
|---|
| | 703 | * @param pSession The SUPDRV session (must be a ring-0 session). |
|---|
| | 704 | * @param pFactory Pointer to the component factory registration structure. |
|---|
| | 705 | * |
|---|
| | 706 | * @remarks This interface is also available thru the IDC interfaces. |
|---|
| | 707 | */ |
|---|
| | 708 | SUPR0DECL(int) SUPR0ComponentRegisterFactory(PSUPDRVSESSION pSession, PSUPDRVFACTORY pFactory); |
|---|
| | 709 | |
|---|
| | 710 | /** |
|---|
| | 711 | * Deregister a component factory. |
|---|
| | 712 | * |
|---|
| | 713 | * @returns VBox status code. |
|---|
| | 714 | * @param pSession The SUPDRV session (must be a ring-0 session). |
|---|
| | 715 | * @param pFactory Pointer to the component factory registration structure |
|---|
| | 716 | * previously passed SUPR0ComponentRegisterFactory(). |
|---|
| | 717 | * |
|---|
| | 718 | * @remarks This interface is also available thru the IDC interfaces. |
|---|
| | 719 | */ |
|---|
| | 720 | SUPR0DECL(int) SUPR0ComponentDeregisterFactory(PSUPDRVSESSION pSession, PSUPDRVFACTORY pFactory); |
|---|
| | 721 | |
|---|
| | 722 | /** |
|---|
| | 723 | * Queries a component factory. |
|---|
| | 724 | * |
|---|
| | 725 | * @returns VBox status code. |
|---|
| | 726 | * @retval VBOX_SUPDRV_COMPONENT_NOT_FOUND if the component factory wasn't found. |
|---|
| | 727 | * @retval VBOX_SUPDRV_INTERFACE_NOT_SUPPORTED if the interface wasn't supported. |
|---|
| | 728 | * |
|---|
| | 729 | * @param pSession The SUPDRV session. |
|---|
| | 730 | * @param pszName The name of the component factory. |
|---|
| | 731 | * @param pInterfaceUuid The UUID of the factory interface. |
|---|
| | 732 | * @param ppvFactoryIf Where to store the factory interface. |
|---|
| | 733 | */ |
|---|
| | 734 | SUPR0DECL(int) SUPR0ComponentQueryFactory(PSUPDRVSESSION pSession, const char *pszName, PCRTUUID pInterfaceUuid, void **ppvFactoryIf); |
|---|
| | 735 | |
|---|
| | 736 | |
|---|
| | 737 | /** @defgroup grp_sup_r0_idc The IDC Interface |
|---|
| | 738 | * @ingroup grp_sup_r0 |
|---|
| | 739 | * @{ |
|---|
| | 740 | */ |
|---|
| | 741 | |
|---|
| | 742 | /** The current SUPDRV IDC version. |
|---|
| | 743 | * This follows the usual high word / low word rules, i.e. high word is the |
|---|
| | 744 | * major number and it signifies incompatible interface changes. */ |
|---|
| | 745 | #define SUPDRV_IDC_VERSION 0x00010000 |
|---|
| | 746 | |
|---|
| | 747 | /** |
|---|
| | 748 | * The SUPDRV IDC entry point. |
|---|
| | 749 | * |
|---|
| | 750 | * (IDC = Inter-Driver Communication) |
|---|
| | 751 | * |
|---|
| | 752 | * @returns VBox status code. |
|---|
| | 753 | * |
|---|
| | 754 | * @param pSession The session. (This is NULL for SUPDRV_IDC_REQ_CONNECT.) |
|---|
| | 755 | * @param iReq The request number. |
|---|
| | 756 | * @param pvReq Pointer to the request packet. Optional for some requests. |
|---|
| | 757 | * @param cbReq The size of the request packet. |
|---|
| | 758 | */ |
|---|
| | 759 | typedef DECLCALLBACK(int) FNSUPDRVIDCENTRY(PSUPDRVSESSION pSession, uint32_t iReq, void *pvReq, uint32_t cbReq); |
|---|
| | 760 | /** Pointer to the SUPDRV IDC entry point. */ |
|---|
| | 761 | typedef FNSUPDRVIDCENTRY *PFNSUPDRVIDCENTRY; |
|---|
| | 762 | |
|---|
| | 763 | |
|---|
| | 764 | /** |
|---|
| | 765 | * SUPDRV IDC: Connect request. |
|---|
| | 766 | * This request takes a SUPDRVIDCREQCONNECT packet. |
|---|
| | 767 | */ |
|---|
| | 768 | #define SUPDRV_IDC_REQ_CONNECT UINT32_C(0xc0ffee01) |
|---|
| | 769 | /** A SUPDRV IDC connect request packet. */ |
|---|
| | 770 | typedef union SUPDRVIDCREQCONNECT |
|---|
| | 771 | { |
|---|
| | 772 | /** The input. */ |
|---|
| | 773 | struct SUPDRVIDCREQCONNECTIN |
|---|
| | 774 | { |
|---|
| | 775 | /** The magic cookie (SUPDRVIDCREQ_CONNECT_MAGIC). */ |
|---|
| | 776 | uint32_t u32MagicCookie; |
|---|
| | 777 | /** The desired version of the IDC interface. */ |
|---|
| | 778 | uint32_t iReqVersion; |
|---|
| | 779 | /** The minimum version of the IDC interface. */ |
|---|
| | 780 | uint32_t iMinVersion; |
|---|
| | 781 | } In; |
|---|
| | 782 | |
|---|
| | 783 | /** The output. */ |
|---|
| | 784 | struct SUPDRVIDCREQCONNECTOUT |
|---|
| | 785 | { |
|---|
| | 786 | /** The support driver session. (An opaque.) */ |
|---|
| | 787 | PSUPDRVSESSION pSession; |
|---|
| | 788 | /** The version of the IDC interface for this session. */ |
|---|
| | 789 | uint32_t iVersion; |
|---|
| | 790 | } Out; |
|---|
| | 791 | } SUPDRVIDCREQCONNECT; |
|---|
| | 792 | /** Pointer to a SUPDRV IDC connect request. */ |
|---|
| | 793 | typedef SUPDRVIDCREQCONNECT *PSUPDRVIDCREQCONNECT; |
|---|
| | 794 | /** Magic cookie value (SUPDRVIDCREQCONNECT::In.u32MagicCookie). ('tori') */ |
|---|
| | 795 | #define SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE UINT32_C(0x69726f74) |
|---|
| | 796 | |
|---|
| | 797 | |
|---|
| | 798 | /** |
|---|
| | 799 | * SUPDRV IDC: Disconnect request. |
|---|
| | 800 | * This request does not take request packet. |
|---|
| | 801 | */ |
|---|
| | 802 | #define SUPDRV_IDC_REQ_DISCONNECT UINT32_C(0xc0ffee02) |
|---|
| | 803 | |
|---|
| | 804 | |
|---|
| | 805 | /** |
|---|
| | 806 | * SUPDRV IDC: Disconnect request. |
|---|
| | 807 | * This request takes a SUPDRVFACTORY packet. |
|---|
| | 808 | */ |
|---|
| | 809 | #define SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY UINT32_C(0xc0ffee03) |
|---|
| | 810 | |
|---|
| | 811 | |
|---|
| | 812 | /** |
|---|
| | 813 | * SUPDRV IDC: Dergister a component factory. |
|---|
| | 814 | * This request takes a SUPDRVFACTORY packet. |
|---|
| | 815 | */ |
|---|
| | 816 | #define SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY UINT32_C(0xc0ffee04) |
|---|
| | 817 | |
|---|
| | 818 | /** @} */ |
|---|
| | 819 | |
|---|