Changeset 3359 in vbox
- Timestamp:
- Jul 2, 2007 5:04:29 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 22556
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vrdpapi.h
r3280 r3359 23 23 #define __VBox_vrdpapi_h__ 24 24 25 #ifdef VRDP_NO_COM 26 #include <iprt/cdefs.h> 27 #include <iprt/types.h> 28 #else 25 29 #include <VBox/cdefs.h> 26 30 #include <VBox/types.h> 31 #endif /* VRDP_NO_COM */ 27 32 28 33 #ifdef IN_RING0 … … 54 59 #endif /* __cplusplus */ 55 60 56 /** 57 * Start server for the specified IConsole. 58 * 59 * @return VBox status code 60 * @param pconsole Pointer to IConsole instance to fetch display, mouse and keyboard interfaces. 61 * @param pvrdpserver Pointer to IVRDPServer instance to fetch configuration. 62 * @param phserver Pointer to server instance handle, 63 * created by the function. 64 */ 65 VRDPR3DECL(int) VRDPStartServer (IConsole *pconsole, IVRDPServer *pvrdpserver, HVRDPSERVER *phserver); 66 67 68 /** 69 * Shutdown server. 70 * 71 * @param hserver Handle of VRDP server instance to be stopped. 72 */ 73 VRDPR3DECL(void) VRDPShutdownServer (HVRDPSERVER hserver); 74 75 76 /** 77 * Send framebuffer bitmap to client. 78 * 79 * @param hserver Handle of VRDP server instance. 80 * @param x top left horizontal coordinate in framebuffer. 81 * @param y top left vertical coordinate in framebuffer. 82 * @param w width of rectangle. 83 * @param h height of rectangle. 84 */ 85 VRDPR3DECL(void) VRDPSendUpdateBitmap (HVRDPSERVER hserver, unsigned uScreenId, unsigned x, unsigned y, unsigned w, unsigned h); 86 87 /** 88 * Inform client that display was resized. 89 * New width and height are taken from the current framebuffer. 90 * 91 * @param hserver Handle of VRDP server instance. 92 */ 93 VRDPR3DECL(void) VRDPSendResize (HVRDPSERVER hserver); 94 95 /** 96 * Send an update in accelerated mode. 97 * 98 * @param hserver Handle of VRDP server instance. 99 * @param pvUpdate The update information. Actually pointer to VBoxGuest.h::VBVACMDHDR structure with extra data. 100 * @param cbUpdate Size of the update data. 101 */ 102 VRDPR3DECL(void) VRDPSendUpdate (HVRDPSERVER hserver, unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate); 103 104 /** @todo comment the structure. */ 61 #ifdef VRDP_NO_COM 62 /* New, callback based VRDP server interface declarations. */ 63 64 #if defined(IN_VRDP) 65 # define VRDPDECL(type) DECLEXPORT(type) RTCALL 66 #else 67 # define VRDPDECL(type) DECLIMPORT(type) RTCALL 68 #endif /* IN_VRDP */ 69 70 /** The color mouse pointer information. */ 105 71 typedef struct _VRDPCOLORPOINTER 106 72 { 107 uint16_t xHot;108 uint16_t yHot;109 uint16_t width;110 uint16_t height;111 uint16_t masklen;112 uint16_t datalen;113 uint32_t vrdpInternal;73 uint16_t u16HotX; 74 uint16_t u16HotY; 75 uint16_t u16Width; 76 uint16_t u16Height; 77 uint16_t u16MaskLen; 78 uint16_t u16DataLen; 79 /* The mask and the bitmap follow. */ 114 80 } VRDPCOLORPOINTER; 115 116 typedef VRDPCOLORPOINTER *PVRDPCOLORPOINTER;117 118 /**119 * Set mouse pointer shape.120 *121 * @param hserver Handle of VRDP server instance.122 * @param porder The pointer shape information.123 */124 VRDPR3DECL(void) VRDPSendColorPointer (HVRDPSERVER hserver, PVRDPCOLORPOINTER pdata);125 126 /**127 * Hide mouse pointer.128 *129 * @param hserver Handle of VRDP server instance.130 */131 VRDPR3DECL(void) VRDPSendHidePointer (HVRDPSERVER hserver);132 81 133 82 /** Audio format information packed in a 32 bit value. */ … … 148 97 #define VRDP_AUDIO_FMT_BYTES_PER_SAMPLE(a) ((VRDP_AUDIO_FMT_BITS_PER_SAMPLE(a) + 7) / 8) 149 98 150 /**151 * Queues the samples to be sent to client.152 *153 * @param hserver Handle of VRDP server instance.154 * @param pvSamples Address of samples to be sent.155 * @param cSamples Number of samples.156 * @param format Encoded audio format for these samples.157 */158 VRDPR3DECL(void) VRDPSendAudioSamples (HVRDPSERVER hserver, void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format);159 160 /**161 * Sets sound volume on client.162 *163 * @param hserver Handle of VRDP server instance.164 * @param left 0..0xFFFF volume level for left channel.165 * @param right 0..0xFFFF volume level for right channel.166 */167 VRDPR3DECL(void) VRDPSendAudioVolume (HVRDPSERVER hserver, uint16_t left, uint16_t right);168 169 170 99 /* 171 * Remote USB backendprotocol.100 * Remote USB protocol. 172 101 */ 173 102 … … 204 133 205 134 /* 206 * Data structures to use with VRDP SendUSBRequest.135 * Data structures to use with VRDPUSBRequest. 207 136 * The *RET* structures always represent the layout of VRDP data. 208 137 * The *PARM* structures normally the same as VRDP layout. … … 225 154 /* VRDP layout has no aligments. */ 226 155 #pragma pack(1) 227 228 156 /* Common header for all VRDP USB packets. After the reply hdr follows *PARM* or *RET* data. */ 229 157 typedef struct _VRDPUSBPKTHDR … … 516 444 uint8_t flags; 517 445 } VRDPUSBREQNEGOTIATERET; 446 #pragma pack() 447 448 #define VRDP_CLIPBOARD_FORMAT_NULL (0x0) 449 #define VRDP_CLIPBOARD_FORMAT_UNICODE_TEXT (0x1) 450 #define VRDP_CLIPBOARD_FORMAT_BITMAP (0x2) 451 #define VRDP_CLIPBOARD_FORMAT_HTML (0x4) 452 453 #define VRDP_CLIPBOARD_FUNCTION_FORMAT_ANNOUNCE (0) 454 #define VRDP_CLIPBOARD_FUNCTION_DATA_READ (1) 455 #define VRDP_CLIPBOARD_FUNCTION_DATA_WRITE (2) 456 457 458 /** Indexes of information values. */ 459 460 /** Whether a client is connected at the moment. 461 * uint32_t 462 */ 463 #define VRDP_QI_ACTIVE (0) 464 465 /** How many times a client connected up to current moment. 466 * uint32_t 467 */ 468 #define VRDP_QI_NUMBER_OF_CLIENTS (1) 469 470 /** When last connection was established. 471 * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC 472 */ 473 #define VRDP_QI_BEGIN_TIME (2) 474 475 /** When last connection was terminated or current time if connection still active. 476 * int64_t time in milliseconds since 1970-01-01 00:00:00 UTC 477 */ 478 #define VRDP_QI_END_TIME (3) 479 480 /** How many bytes were sent in last (current) connection. 481 * uint64_t 482 */ 483 #define VRDP_QI_BYTES_SENT (4) 484 485 /** How many bytes were sent in all connections. 486 * uint64_t 487 */ 488 #define VRDP_QI_BYTES_SENT_TOTAL (5) 489 490 /** How many bytes were received in last (current) connection. 491 * uint64_t 492 */ 493 #define VRDP_QI_BYTES_RECEIVED (6) 494 495 /** How many bytes were received in all connections. 496 * uint64_t 497 */ 498 #define VRDP_QI_BYTES_RECEIVED_TOTAL (7) 499 500 /** Login user name supplied by the client. 501 * UTF8 nul terminated string. 502 */ 503 #define VRDP_QI_USER (8) 504 505 /** Login domain supplied by the client. 506 * UTF8 nul terminated string. 507 */ 508 #define VRDP_QI_DOMAIN (9) 509 510 /** The client name supplied by the client. 511 * UTF8 nul terminated string. 512 */ 513 #define VRDP_QI_CLIENT_NAME (10) 514 515 /** IP address of the client. 516 * UTF8 nul terminated string. 517 */ 518 #define VRDP_QI_CLIENT_IP (11) 519 520 /** The client software version number. 521 * uint32_t. 522 */ 523 #define VRDP_QI_CLIENT_VERSION (12) 524 525 /** Public key exchange method used when connection was established. 526 * Values: 0 - RDP4 public key exchange scheme. 527 * 1 - X509 sertificates were sent to client. 528 * uint32_t. 529 */ 530 #define VRDP_QI_ENCRYPTION_STYLE (13) 531 532 533 /** Hints what has been intercepted by the application. */ 534 #define VRDP_CLIENT_INTERCEPT_AUDIO (0x1) 535 #define VRDP_CLIENT_INTERCEPT_USB (0x2) 536 #define VRDP_CLIENT_INTERCEPT_CLIPBOARD (0x4) 537 538 539 /** The version of the VRDP server interface. */ 540 #define VRDP_INTERFACE_VERSION_1 (1) 541 542 /** The header that does not change when the interface changes. */ 543 typedef struct _VRDPINTERFACEHDR 544 { 545 /** The version of the interface. */ 546 uint64_t u64Version; 547 548 /** The size of the structure. */ 549 uint64_t u64Size; 550 551 } VRDPINTERFACEHDR; 552 553 /** The VRDP server entry points. Interface version 1. */ 554 typedef struct _VRDPENTRYPOINTS_1 555 { 556 /** The header. */ 557 VRDPINTERFACEHDR header; 558 559 /** Destroy the server instance. 560 * 561 * @param hServer The server instance handle. 562 * 563 * @return IPRT status code. 564 */ 565 DECLCALLBACKMEMBER(void, VRDPDestroy)(HVRDPSERVER hServer); 566 567 /** The server should start to accept clients connections. 568 * 569 * @param hServer The server instance handle. 570 * @param fEnable Whether to enable or disable client connections. 571 * When is false, all existing clients are disconnected. 572 * 573 * @return IPRT status code. 574 */ 575 DECLCALLBACKMEMBER(int, VRDPEnableConnections)(HVRDPSERVER hServer, 576 bool fEnable); 577 578 /** The server should disconnect the client. 579 * 580 * @param hServer The server instance handle. 581 * @param u32ClientId The client identifier. 582 * @param fReconnect Whether to send a RECONNECT message to the 583 * client before disconnecting. 584 * 585 * @return IPRT status code. 586 */ 587 DECLCALLBACKMEMBER(void, VRDPDisconnect)(HVRDPSERVER hServer, 588 uint32_t u32ClientId, 589 bool fReconnect); 590 591 /** 592 * Inform the server that the display was resized. 593 * The server will query information about display 594 * from the application via callbacks. 595 * 596 * @param hServer Handle of VRDP server instance. 597 */ 598 DECLCALLBACKMEMBER(void, VRDPResize)(HVRDPSERVER hServer); 599 600 /** 601 * Send a update. 602 * 603 * @param hServer Handle of VRDP server instance. 604 * @param uScreenId The screen index. 605 * @param pvUpdate Pointer to VBoxGuest.h::VRDPORDERHDR structure with extra data. 606 * @param cbUpdate Size of the update data. 607 */ 608 DECLCALLBACKMEMBER(void, VRDPUpdate)(HVRDPSERVER hServer, 609 unsigned uScreenId, 610 void *pvUpdate, 611 uint32_t cbUpdate); 612 613 /** 614 * Set the mouse pointer shape. 615 * 616 * @param hServer Handle of VRDP server instance. 617 * @param pPointer The pointer shape information. 618 */ 619 DECLCALLBACKMEMBER(void, VRDPColorPointer)(HVRDPSERVER hServer, 620 const VRDPCOLORPOINTER *pPointer); 621 622 /** 623 * Hide the mouse pointer. 624 * 625 * @param hServer Handle of VRDP server instance. 626 */ 627 DECLCALLBACKMEMBER(void, VRDPHidePointer)(HVRDPSERVER hServer); 628 629 /** 630 * Queues the samples to be sent to clients. 631 * 632 * @param hServer Handle of VRDP server instance. 633 * @param pvSamples Address of samples to be sent. 634 * @param cSamples Number of samples. 635 * @param format Encoded audio format for these samples. 636 * 637 * @note Initialized to NULL when the application audio callbacks are NULL. 638 */ 639 DECLCALLBACKMEMBER(void, VRDPAudioSamples)(HVRDPSERVER hServer, 640 const void *pvSamples, 641 uint32_t cSamples, 642 VRDPAUDIOFORMAT format); 643 644 /** 645 * Sets the sound volume on clients. 646 * 647 * @param hServer Handle of VRDP server instance. 648 * @param left 0..0xFFFF volume level for left channel. 649 * @param right 0..0xFFFF volume level for right channel. 650 * 651 * @note Initialized to NULL when the application audio callbacks are NULL. 652 */ 653 DECLCALLBACKMEMBER(void, VRDPAudioVolume)(HVRDPSERVER hServer, 654 uint16_t u16Left, 655 uint16_t u16Right); 656 657 /** 658 * Sends a USB request. 659 * 660 * @param hServer Handle of VRDP server instance. 661 * @param u32ClientId An identifier that allows the server to find the corresponding client. 662 * The identifier is always passed by the server as a parameter 663 * of the FNVRDPUSBCALLBACK. Note that the value is the same as 664 * in the VRDPSERVERCALLBACK functions. 665 * @param pvParm Function specific parameters buffer. 666 * @param cbParm Size of the buffer. 667 * 668 * @note Initialized to NULL when the application USB callbacks are NULL. 669 */ 670 DECLCALLBACKMEMBER(void, VRDPUSBRequest)(HVRDPSERVER hServer, 671 uint32_t u32ClientId, 672 void *pvParm, 673 uint32_t cbRarm); 674 675 /** 676 * Called by the application when (VRDP_CLIPBOARD_FUNCTION_*): 677 * - (0) guest announces available clipboard formats; 678 * - (1) guest requests clipboard data; 679 * - (2) guest responds to the client's request for clipboard data. 680 * 681 * @param hServer The VRDP server handle. 682 * @param u32Function The cause of the call. 683 * @param u32Format Bitmask of announced formats or the format of data. 684 * @param pvData Points to: (1) buffer to be filled with clients data; 685 * (2) data from the host. 686 * @param cbData Size of 'pvData' buffer in bytes. 687 * @param pcbActualRead Size of the copied data in bytes. 688 * 689 * @note Initialized to NULL when the application clipboard callbacks are NULL. 690 */ 691 DECLCALLBACKMEMBER(void, VRDPClipboard)(HVRDPSERVER hserver, 692 uint32_t u32Function, 693 uint32_t u32Format, 694 void *pvData, 695 uint32_t cbData, 696 uint32_t *pcbActualRead); 697 698 /** 699 * Query various information from the VRDP server. 700 * 701 * @param index VRDP_QI_* identifier of information to be returned. 702 * @param pvBuffer Address of memory buffer to which the information must be written. 703 * @param cbBuffer Size of the memory buffer in bytes. 704 * @param pcbOut Size in bytes of returned information value. 705 * 706 * @remark The caller must check the *pcbOut. 0 there means no information was returned. 707 * A value greater than cbBuffer means that information is too big to fit in the 708 * buffer, in that case no information was placed to the buffer. 709 */ 710 DECLCALLBACKMEMBER(void, VRDPQueryInfo)(HVRDPSERVER hServer, 711 uint32_t index, 712 void *pvBuffer, 713 uint32_t cbBuffer, 714 uint32_t *pcbOut); 715 } VRDPENTRYPOINTS_1; 716 717 #define VRDP_QP_NETWORK_PORT (1) 718 #define VRDP_QP_NETWORK_ADDRESS (2) 719 #define VRDP_QP_NUMBER_MONITORS (3) 720 721 /** The VRDP server callbacks. Interface version 1. */ 722 typedef struct _VRDPCALLBACKS_1 723 { 724 /** The header. */ 725 VRDPINTERFACEHDR header; 726 727 /** 728 * Query various information, on how the VRDP server must operate, from the application. 729 * 730 * @param pvCallback The callback specific pointer. 731 * @param index VRDP_QP_* identifier of information to be returned. 732 * @param pvBuffer Address of memory buffer to which the information must be written. 733 * @param cbBuffer Size of the memory buffer in bytes. 734 * @param pcbOut Size in bytes of returned information value. 735 * 736 * @remark The VRDP server checks the *pcbOut. 0 there means no information was returned. 737 * A value greater than cbBuffer means that information is too big to fit in the 738 * buffer, in that case no information was placed to the buffer. 739 */ 740 DECLCALLBACKMEMBER(void, VRDPQueryProperty)(void *pvCallback, 741 uint32_t index, 742 void *pvBuffer, 743 uint32_t cbBuffer, 744 uint32_t *pcbOut); 745 746 /* A client is logging in, the application must decide whether 747 * to let to connect the client. The server will drop the connection, 748 * when an error code is returned by the callback. 749 * 750 * @param pvCallback The callback specific pointer. 751 * @param u32ClientId An unique client identifier generated by the server. 752 * @param pszUser The username. 753 * @param pszPassword The password. 754 * @param pszDomain The domain. 755 * 756 * @return IPRT status code. 757 */ 758 DECLCALLBACKMEMBER(int, VRDPCallbackClientLogon)(void *pvCallback, 759 uint32_t u32ClientId, 760 const char *pszUser, 761 const char *pszPassword, 762 const char *pszDomain); 763 764 /* The client has been successfully connected. 765 * 766 * @param pvCallback The callback specific pointer. 767 * @param u32ClientId An unique client identifier generated by the server. 768 */ 769 DECLCALLBACKMEMBER(void, VRDPCallbackClientConnect)(void *pvCallback, 770 uint32_t u32ClientId); 771 772 /* The client has been disconnected. 773 * 774 * @param pvCallback The callback specific pointer. 775 * @param u32ClientId An unique client identifier generated by the server. 776 * @param fu32Intercepted What was intercepted by the client (VRDP_CLIENT_INTERCEPT_*). 777 */ 778 DECLCALLBACKMEMBER(void, VRDPCallbackClientDisconnect)(void *pvCallback, 779 uint32_t u32ClientId, 780 uint32_t fu32Intercepted); 781 /* The client supports one of RDP channels. 782 * 783 * @param pvCallback The callback specific pointer. 784 * @param u32ClientId An unique client identifier generated by the server. 785 * @param fu32Intercept What the client wants to intercept. One of VRDP_CLIENT_INTERCEPT_* flags. 786 * @param ppvIntercept The value to be passed to the channel specific callback. 787 * 788 * @return IPRT status code. 789 */ 790 DECLCALLBACKMEMBER(int, VRDPCallbackIntercept)(void *pvCallback, 791 uint32_t u32ClientId, 792 uint32_t fu32Intercept, 793 void **ppvIntercept); 794 795 /** 796 * Called by the server when a reply is received from a client. 797 * 798 * @param pvCallback The callback specific pointer. 799 * @param ppvIntercept The value returned by VRDPCallbackIntercept for the VRDP_CLIENT_INTERCEPT_USB. 800 * @param u32ClientId Identifies the client that sent the reply. 801 * @param u8Code The operation code VRDP_USB_REQ_*. 802 * @param pvRet Points to data received from the client. 803 * @param cbRet Size of the data in bytes. 804 * 805 * @return IPRT status code. 806 */ 807 DECLCALLBACKMEMBER(int, VRDPCallbackUSB)(void *pvCallback, 808 void *pvIntercept, 809 uint32_t u32ClientId, 810 uint8_t u8Code, 811 const void *pvRet, 812 uint32_t cbRet); 813 814 /** 815 * Called by the server when (VRDP_CLIPBOARD_FUNCTION_*): 816 * - (0) client announces available clipboard formats; 817 * - (1) client requests clipboard data. 818 * 819 * @param pvCallback The callback specific pointer. 820 * @param ppvIntercept The value returned by VRDPCallbackIntercept for the VRDP_CLIENT_INTERCEPT_CLIPBOARD. 821 * @param u32ClientId Identifies the RDP client that sent the reply. 822 * @param u32Function The cause of the callback. 823 * @param u32Format Bitmask of reported formats or the format of received data. 824 * @param pvData Reserved. 825 * @param cbData Reserved. 826 * 827 * @return IPRT status code. 828 */ 829 DECLCALLBACKMEMBER(int, VRDPCallbackClipboard)(void *pvCallback, 830 void *pvIntercept, 831 uint32_t u32ClientId, 832 uint32_t u32Function, 833 uint32_t u32Format, 834 const void *pvData, 835 uint32_t cbData); 836 } VRDPCALLBACKS_1; 837 838 /** 839 * Create a new VRDP server instance. The instance is fully functional but refuses 840 * client connections until the entry point VRDPEnableConnections is called by the application. 841 * 842 * The caller prepares the callbacks structure. The header.u64Version field 843 * must be initialized with the version of the insterface to use. 844 * The server will initialize the callbacks table to match the requested interface. 845 * 846 * @param pCallback Pointer to the application callbacks which let the server to fetch 847 * the configuration data and to access the desktop. 848 * @param pvCallback The callback specific pointer to be passed back to the application. 849 * @param ppEntryPoints Where to store the pointer to the VRDP entry points structure. 850 * @param phServer Pointer to the created server instance handle. 851 * 852 * @return IPRT status code. 853 */ 854 VRDPDECL(int) VRDPCreateServer (const VRDPINTERFACEHDR *pCallbacks, 855 void *pvCallback, 856 VRDPINTERFACEHDR **ppEntryPoints, 857 HVRDPSERVER *phServer); 858 859 860 #else 861 /** 862 * Start server for the specified IConsole. 863 * 864 * @return VBox status code 865 * @param pconsole Pointer to IConsole instance to fetch display, mouse and keyboard interfaces. 866 * @param pvrdpserver Pointer to IVRDPServer instance to fetch configuration. 867 * @param phserver Pointer to server instance handle, 868 * created by the function. 869 */ 870 VRDPR3DECL(int) VRDPStartServer (IConsole *pconsole, IVRDPServer *pvrdpserver, HVRDPSERVER *phserver); 871 872 873 /** 874 * Shutdown server. 875 * 876 * @param hserver Handle of VRDP server instance to be stopped. 877 */ 878 VRDPR3DECL(void) VRDPShutdownServer (HVRDPSERVER hserver); 879 880 881 /** 882 * Send framebuffer bitmap to client. 883 * 884 * @param hserver Handle of VRDP server instance. 885 * @param x top left horizontal coordinate in framebuffer. 886 * @param y top left vertical coordinate in framebuffer. 887 * @param w width of rectangle. 888 * @param h height of rectangle. 889 */ 890 VRDPR3DECL(void) VRDPSendUpdateBitmap (HVRDPSERVER hserver, unsigned uScreenId, unsigned x, unsigned y, unsigned w, unsigned h); 891 892 /** 893 * Inform client that display was resized. 894 * New width and height are taken from the current framebuffer. 895 * 896 * @param hserver Handle of VRDP server instance. 897 */ 898 VRDPR3DECL(void) VRDPSendResize (HVRDPSERVER hserver); 899 900 /** 901 * Send an update in accelerated mode. 902 * 903 * @param hserver Handle of VRDP server instance. 904 * @param pvUpdate The update information. Actually pointer to VBoxGuest.h::VBVACMDHDR structure with extra data. 905 * @param cbUpdate Size of the update data. 906 */ 907 VRDPR3DECL(void) VRDPSendUpdate (HVRDPSERVER hserver, unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate); 908 909 /** @todo comment the structure. */ 910 typedef struct _VRDPCOLORPOINTER 911 { 912 uint16_t xHot; 913 uint16_t yHot; 914 uint16_t width; 915 uint16_t height; 916 uint16_t masklen; 917 uint16_t datalen; 918 uint32_t vrdpInternal; 919 } VRDPCOLORPOINTER; 920 921 typedef VRDPCOLORPOINTER *PVRDPCOLORPOINTER; 922 923 /** 924 * Set mouse pointer shape. 925 * 926 * @param hserver Handle of VRDP server instance. 927 * @param porder The pointer shape information. 928 */ 929 VRDPR3DECL(void) VRDPSendColorPointer (HVRDPSERVER hserver, PVRDPCOLORPOINTER pdata); 930 931 /** 932 * Hide mouse pointer. 933 * 934 * @param hserver Handle of VRDP server instance. 935 */ 936 VRDPR3DECL(void) VRDPSendHidePointer (HVRDPSERVER hserver); 937 938 /** Audio format information packed in a 32 bit value. */ 939 typedef uint32_t VRDPAUDIOFORMAT; 940 941 /** Constructs 32 bit value for given frequency, number of channel and bits per sample. */ 942 #define VRDP_AUDIO_FMT_MAKE(freq, c, bps, s) ((((s) & 0x1) << 28) + (((bps) & 0xFF) << 20) + (((c) & 0xF) << 16) + ((freq) & 0xFFFF)) 943 944 /** Decode frequency. */ 945 #define VRDP_AUDIO_FMT_SAMPLE_FREQ(a) ((a) & 0xFFFF) 946 /** Decode number of channels. */ 947 #define VRDP_AUDIO_FMT_CHANNELS(a) (((a) >> 16) & 0xF) 948 /** Decode number signess. */ 949 #define VRDP_AUDIO_FMT_SIGNED(a) (((a) >> 28) & 0x1) 950 /** Decode number of bits per sample. */ 951 #define VRDP_AUDIO_FMT_BITS_PER_SAMPLE(a) (((a) >> 20) & 0xFF) 952 /** Decode number of bytes per sample. */ 953 #define VRDP_AUDIO_FMT_BYTES_PER_SAMPLE(a) ((VRDP_AUDIO_FMT_BITS_PER_SAMPLE(a) + 7) / 8) 954 955 /** 956 * Queues the samples to be sent to client. 957 * 958 * @param hserver Handle of VRDP server instance. 959 * @param pvSamples Address of samples to be sent. 960 * @param cSamples Number of samples. 961 * @param format Encoded audio format for these samples. 962 */ 963 VRDPR3DECL(void) VRDPSendAudioSamples (HVRDPSERVER hserver, void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format); 964 965 /** 966 * Sets sound volume on client. 967 * 968 * @param hserver Handle of VRDP server instance. 969 * @param left 0..0xFFFF volume level for left channel. 970 * @param right 0..0xFFFF volume level for right channel. 971 */ 972 VRDPR3DECL(void) VRDPSendAudioVolume (HVRDPSERVER hserver, uint16_t left, uint16_t right); 973 974 975 /* 976 * Remote USB backend protocol. 977 */ 978 979 /* The version of Remote USB Protocol. */ 980 #define VRDP_USB_VERSION (1) 981 982 /** USB backend operations. */ 983 #define VRDP_USB_REQ_OPEN (0) 984 #define VRDP_USB_REQ_CLOSE (1) 985 #define VRDP_USB_REQ_RESET (2) 986 #define VRDP_USB_REQ_SET_CONFIG (3) 987 #define VRDP_USB_REQ_CLAIM_INTERFACE (4) 988 #define VRDP_USB_REQ_RELEASE_INTERFACE (5) 989 #define VRDP_USB_REQ_INTERFACE_SETTING (6) 990 #define VRDP_USB_REQ_QUEUE_URB (7) 991 #define VRDP_USB_REQ_REAP_URB (8) 992 #define VRDP_USB_REQ_CLEAR_HALTED_EP (9) 993 #define VRDP_USB_REQ_CANCEL_URB (10) 994 995 /** USB service operations. */ 996 #define VRDP_USB_REQ_DEVICE_LIST (11) 997 #define VRDP_USB_REQ_NEGOTIATE (12) 998 999 /** An operation completion status is a byte. */ 1000 typedef uint8_t VRDPUSBSTATUS; 1001 1002 /** USB device identifier is an 32 bit value. */ 1003 typedef uint32_t VRDPUSBDEVID; 1004 1005 /** Status codes. */ 1006 #define VRDP_USB_STATUS_SUCCESS ((VRDPUSBSTATUS)0) 1007 #define VRDP_USB_STATUS_ACCESS_DENIED ((VRDPUSBSTATUS)1) 1008 #define VRDP_USB_STATUS_DEVICE_REMOVED ((VRDPUSBSTATUS)2) 1009 1010 /* 1011 * Data structures to use with VRDPSendUSBRequest. 1012 * The *RET* structures always represent the layout of VRDP data. 1013 * The *PARM* structures normally the same as VRDP layout. 1014 * However the VRDP_USB_REQ_QUEUE_URB_PARM has a pointer to 1015 * URB data in place where actual data will be in VRDP layout. 1016 * 1017 * Since replies (*RET*) are asynchronous, the 'success' 1018 * replies are not required for operations which return 1019 * only the status code (VRDPUSBREQRETHDR only): 1020 * VRDP_USB_REQ_OPEN 1021 * VRDP_USB_REQ_RESET 1022 * VRDP_USB_REQ_SET_CONFIG 1023 * VRDP_USB_REQ_CLAIM_INTERFACE 1024 * VRDP_USB_REQ_RELEASE_INTERFACE 1025 * VRDP_USB_REQ_INTERFACE_SETTING 1026 * VRDP_USB_REQ_CLEAR_HALTED_EP 1027 * 1028 */ 1029 1030 /* VRDP layout has no aligments. */ 1031 #pragma pack(1) 1032 1033 /* Common header for all VRDP USB packets. After the reply hdr follows *PARM* or *RET* data. */ 1034 typedef struct _VRDPUSBPKTHDR 1035 { 1036 /* Total length of the reply NOT including the 'length' field. */ 1037 uint32_t length; 1038 /* The operation code for which the reply was sent by the client. */ 1039 uint8_t code; 1040 } VRDPUSBPKTHDR; 1041 1042 /* Common header for all return structures. */ 1043 typedef struct _VRDPUSBREQRETHDR 1044 { 1045 /* Device status. */ 1046 VRDPUSBSTATUS status; 1047 /* Device id. */ 1048 VRDPUSBDEVID id; 1049 } VRDPUSBREQRETHDR; 1050 1051 1052 /* VRDP_USB_REQ_OPEN 1053 */ 1054 typedef struct _VRDP_USB_REQ_OPEN_PARM 1055 { 1056 uint8_t code; 1057 VRDPUSBDEVID id; 1058 } VRDP_USB_REQ_OPEN_PARM; 1059 1060 typedef struct _VRDP_USB_REQ_OPEN_RET 1061 { 1062 VRDPUSBREQRETHDR hdr; 1063 } VRDP_USB_REQ_OPEN_RET; 1064 1065 1066 /* VRDP_USB_REQ_CLOSE 1067 */ 1068 typedef struct _VRDP_USB_REQ_CLOSE_PARM 1069 { 1070 uint8_t code; 1071 VRDPUSBDEVID id; 1072 } VRDP_USB_REQ_CLOSE_PARM; 1073 1074 /* The close request has no returned data. */ 1075 1076 1077 /* VRDP_USB_REQ_RESET 1078 */ 1079 typedef struct _VRDP_USB_REQ_RESET_PARM 1080 { 1081 uint8_t code; 1082 VRDPUSBDEVID id; 1083 } VRDP_USB_REQ_RESET_PARM; 1084 1085 typedef struct _VRDP_USB_REQ_RESET_RET 1086 { 1087 VRDPUSBREQRETHDR hdr; 1088 } VRDP_USB_REQ_RESET_RET; 1089 1090 1091 /* VRDP_USB_REQ_SET_CONFIG 1092 */ 1093 typedef struct _VRDP_USB_REQ_SET_CONFIG_PARM 1094 { 1095 uint8_t code; 1096 VRDPUSBDEVID id; 1097 uint8_t configuration; 1098 } VRDP_USB_REQ_SET_CONFIG_PARM; 1099 1100 typedef struct _VRDP_USB_REQ_SET_CONFIG_RET 1101 { 1102 VRDPUSBREQRETHDR hdr; 1103 } VRDP_USB_REQ_SET_CONFIG_RET; 1104 1105 1106 /* VRDP_USB_REQ_CLAIM_INTERFACE 1107 */ 1108 typedef struct _VRDP_USB_REQ_CLAIM_INTERFACE_PARM 1109 { 1110 uint8_t code; 1111 VRDPUSBDEVID id; 1112 uint8_t iface; 1113 } VRDP_USB_REQ_CLAIM_INTERFACE_PARM; 1114 1115 typedef struct _VRDP_USB_REQ_CLAIM_INTERFACE_RET 1116 { 1117 VRDPUSBREQRETHDR hdr; 1118 } VRDP_USB_REQ_CLAIM_INTERFACE_RET; 1119 1120 1121 /* VRDP_USB_REQ_RELEASE_INTERFACE 1122 */ 1123 typedef struct _VRDP_USB_REQ_RELEASE_INTERFACE_PARM 1124 { 1125 uint8_t code; 1126 VRDPUSBDEVID id; 1127 uint8_t iface; 1128 } VRDP_USB_REQ_RELEASE_INTERFACE_PARM; 1129 1130 typedef struct _VRDP_USB_REQ_RELEASE_INTERFACE_RET 1131 { 1132 VRDPUSBREQRETHDR hdr; 1133 } VRDP_USB_REQ_RELEASE_INTERFACE_RET; 1134 1135 1136 /* VRDP_USB_REQ_INTERFACE_SETTING 1137 */ 1138 typedef struct _VRDP_USB_REQ_INTERFACE_SETTING_PARM 1139 { 1140 uint8_t code; 1141 VRDPUSBDEVID id; 1142 uint8_t iface; 1143 uint8_t setting; 1144 } VRDP_USB_REQ_INTERFACE_SETTING_PARM; 1145 1146 typedef struct _VRDP_USB_REQ_INTERFACE_SETTING_RET 1147 { 1148 VRDPUSBREQRETHDR hdr; 1149 } VRDP_USB_REQ_INTERFACE_SETTING_RET; 1150 1151 1152 /* VRDP_USB_REQ_QUEUE_URB 1153 */ 1154 1155 #define VRDP_USB_TRANSFER_TYPE_CTRL (0) 1156 #define VRDP_USB_TRANSFER_TYPE_ISOC (1) 1157 #define VRDP_USB_TRANSFER_TYPE_BULK (2) 1158 #define VRDP_USB_TRANSFER_TYPE_INTR (3) 1159 #define VRDP_USB_TRANSFER_TYPE_MSG (4) 1160 1161 #define VRDP_USB_DIRECTION_SETUP (0) 1162 #define VRDP_USB_DIRECTION_IN (1) 1163 #define VRDP_USB_DIRECTION_OUT (2) 1164 1165 typedef struct _VRDP_USB_REQ_QUEUE_URB_PARM 1166 { 1167 uint8_t code; 1168 VRDPUSBDEVID id; 1169 uint32_t handle; /* Distinguishes that particular URB. Later used in CancelURB and returned by ReapURB */ 1170 uint8_t type; 1171 uint8_t ep; 1172 uint8_t direction; 1173 uint32_t urblen; /* Length of the URB. */ 1174 uint32_t datalen; /* Length of the data. */ 1175 void *data; /* In RDP layout the data follow. */ 1176 } VRDP_USB_REQ_QUEUE_URB_PARM; 1177 1178 /* The queue URB has no explicit return. The reap URB reply will be 1179 * eventually the indirect result. 1180 */ 1181 1182 1183 /* VRDP_USB_REQ_REAP_URB 1184 * Notificationg from server to client that server expects an URB 1185 * from any device. 1186 * Only sent if negotiated URB return method is polling. 1187 * Normally, the client will send URBs back as soon as they are ready. 1188 */ 1189 typedef struct _VRDP_USB_REQ_REAP_URB_PARM 1190 { 1191 uint8_t code; 1192 } VRDP_USB_REQ_REAP_URB_PARM; 1193 1194 1195 #define VRDP_USB_XFER_OK (0) 1196 #define VRDP_USB_XFER_STALL (1) 1197 #define VRDP_USB_XFER_DNR (2) 1198 #define VRDP_USB_XFER_CRC (3) 1199 1200 #define VRDP_USB_REAP_FLAG_CONTINUED (0x0) 1201 #define VRDP_USB_REAP_FLAG_LAST (0x1) 1202 1203 #define VRDP_USB_REAP_VALID_FLAGS (VRDP_USB_REAP_FLAG_LAST) 1204 1205 typedef struct _VRDPUSBREQREAPURBBODY 1206 { 1207 VRDPUSBDEVID id; /* From which device the URB arrives. */ 1208 uint8_t flags; /* VRDP_USB_REAP_FLAG_* */ 1209 uint8_t error; /* VRDP_USB_XFER_* */ 1210 uint32_t handle; /* Handle of returned URB. Not 0. */ 1211 uint32_t len; /* Length of data actually transferred. */ 1212 /* Data follow. */ 1213 } VRDPUSBREQREAPURBBODY; 1214 1215 typedef struct _VRDP_USB_REQ_REAP_URB_RET 1216 { 1217 /* The REAP URB has no header, only completed URBs are returned. */ 1218 VRDPUSBREQREAPURBBODY body; 1219 /* Another body may follow, depending on flags. */ 1220 } VRDP_USB_REQ_REAP_URB_RET; 1221 1222 1223 /* VRDP_USB_REQ_CLEAR_HALTED_EP 1224 */ 1225 typedef struct _VRDP_USB_REQ_CLEAR_HALTED_EP_PARM 1226 { 1227 uint8_t code; 1228 VRDPUSBDEVID id; 1229 uint8_t ep; 1230 } VRDP_USB_REQ_CLEAR_HALTED_EP_PARM; 1231 1232 typedef struct _VRDP_USB_REQ_CLEAR_HALTED_EP_RET 1233 { 1234 VRDPUSBREQRETHDR hdr; 1235 } VRDP_USB_REQ_CLEAR_HALTED_EP_RET; 1236 1237 1238 /* VRDP_USB_REQ_CANCEL_URB 1239 */ 1240 typedef struct _VRDP_USB_REQ_CANCEL_URB_PARM 1241 { 1242 uint8_t code; 1243 VRDPUSBDEVID id; 1244 uint32_t handle; 1245 } VRDP_USB_REQ_CANCEL_URB_PARM; 1246 1247 /* The cancel URB request has no return. */ 1248 1249 1250 /* VRDP_USB_REQ_DEVICE_LIST 1251 * 1252 * Server polls USB devices on client by sending this request 1253 * periodically. Client sends back a list of all devices 1254 * connected to it. Each device is assigned with an identifier, 1255 * that is used to distinguish the particular device. 1256 */ 1257 typedef struct _VRDP_USB_REQ_DEVICE_LIST_PARM 1258 { 1259 uint8_t code; 1260 } VRDP_USB_REQ_DEVICE_LIST_PARM; 1261 1262 /* Data is a list of the following variable length structures. */ 1263 typedef struct _VRDPUSBDEVICEDESC 1264 { 1265 /* Offset of the next structure. 0 if last. */ 1266 uint16_t oNext; 1267 1268 /* Identifier of the device assigned by client. */ 1269 VRDPUSBDEVID id; 1270 1271 /** USB version number. */ 1272 uint16_t bcdUSB; 1273 /** Device class. */ 1274 uint8_t bDeviceClass; 1275 /** Device subclass. */ 1276 uint8_t bDeviceSubClass; 1277 /** Device protocol */ 1278 uint8_t bDeviceProtocol; 1279 /** Vendor ID. */ 1280 uint16_t idVendor; 1281 /** Product ID. */ 1282 uint16_t idProduct; 1283 /** Revision, integer part. */ 1284 uint16_t bcdRev; 1285 /** Manufacturer string. */ 1286 uint16_t oManufacturer; 1287 /** Product string. */ 1288 uint16_t oProduct; 1289 /** Serial number string. */ 1290 uint16_t oSerialNumber; 1291 /** Physical USB port the device is connected to. */ 1292 uint16_t idPort; 1293 1294 } VRDPUSBDEVICEDESC; 1295 1296 typedef struct _VRDP_USB_REQ_DEVICE_LIST_RET 1297 { 1298 VRDPUSBDEVICEDESC body; 1299 /* Other devices may follow. 1300 * The list ends with (uint16_t)0, 1301 * which means that an empty list consists of 2 zero bytes. 1302 */ 1303 } VRDP_USB_REQ_DEVICE_LIST_RET; 1304 1305 typedef struct _VRDPUSBREQNEGOTIATEPARM 1306 { 1307 uint8_t code; 1308 1309 /* Remote USB Protocol version. */ 1310 uint32_t version; 1311 1312 } VRDPUSBREQNEGOTIATEPARM; 1313 1314 #define VRDP_USB_CAPS_FLAG_ASYNC (0x0) 1315 #define VRDP_USB_CAPS_FLAG_POLL (0x1) 1316 1317 #define VRDP_USB_CAPS_VALID_FLAGS (VRDP_USB_CAPS_FLAG_POLL) 1318 1319 typedef struct _VRDPUSBREQNEGOTIATERET 1320 { 1321 uint8_t flags; 1322 } VRDPUSBREQNEGOTIATERET; 518 1323 519 1324 #pragma pack() … … 761 1566 */ 762 1567 VRDPR3DECL(void) VRDPQueryInfo (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut); 1568 #endif /* VRDP_NO_COM */ 763 1569 764 1570 __END_DECLS
Note:
See TracChangeset
for help on using the changeset viewer.