cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

ainput.h (3563B)


      1/**
      2 * FreeRDP: A Remote Desktop Protocol Implementation
      3 * AInput Virtual Channel Extension
      4 *
      5 * Copyright 2022 Armin Novak <anovak@thincast.com>
      6 * Copyright 2022 Thincast Technologies GmbH
      7 *
      8 * Licensed under the Apache License, Version 2.0 (the "License");
      9 * you may not use this file except in compliance with the License.
     10 * You may obtain a copy of the License at
     11 *
     12 *	 http://www.apache.org/licenses/LICENSE-2.0
     13 *
     14 * Unless required by applicable law or agreed to in writing, software
     15 * distributed under the License is distributed on an "AS IS" BASIS,
     16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     17 * See the License for the specific language governing permissions and
     18 * limitations under the License.
     19 */
     20
     21#ifndef FREERDP_CHANNEL_AINPUT_SERVER_H
     22#define FREERDP_CHANNEL_AINPUT_SERVER_H
     23
     24#include <freerdp/channels/wtsvc.h>
     25#include <freerdp/channels/ainput.h>
     26
     27typedef enum AINPUT_SERVER_OPEN_RESULT
     28{
     29	AINPUT_SERVER_OPEN_RESULT_OK = 0,
     30	AINPUT_SERVER_OPEN_RESULT_CLOSED = 1,
     31	AINPUT_SERVER_OPEN_RESULT_NOTSUPPORTED = 2,
     32	AINPUT_SERVER_OPEN_RESULT_ERROR = 3
     33} AINPUT_SERVER_OPEN_RESULT;
     34
     35typedef struct _ainput_server_context ainput_server_context;
     36
     37typedef BOOL (*psAInputChannelIdAssigned)(ainput_server_context* context, UINT32 channelId);
     38
     39typedef UINT (*psAInputServerInitialize)(ainput_server_context* context, BOOL externalThread);
     40typedef UINT (*psAInputServerPoll)(ainput_server_context* context);
     41typedef BOOL (*psAInputServerChannelHandle)(ainput_server_context* context, HANDLE* handle);
     42
     43typedef UINT (*psAInputServerOpen)(ainput_server_context* context);
     44typedef UINT (*psAInputServerClose)(ainput_server_context* context);
     45typedef BOOL (*psAInputServerIsOpen)(ainput_server_context* context);
     46
     47typedef UINT (*psAInputServerOpenResult)(ainput_server_context* context,
     48                                         AINPUT_SERVER_OPEN_RESULT result);
     49typedef UINT (*psAInputServerMouseEvent)(ainput_server_context* context, UINT64 timestamp,
     50                                         UINT64 flags, INT32 x, INT32 y);
     51
     52struct _ainput_server_context
     53{
     54	HANDLE vcm;
     55
     56	/* Server self-defined pointer. */
     57	void* data;
     58
     59	/*** APIs called by the server. ***/
     60	/**
     61	 * Open the ainput channel.
     62	 */
     63	psAInputServerOpen Open;
     64
     65	/**
     66	 * Optional: Set thread handling.
     67	 * When externalThread=TRUE the application is responsible to call
     68	 * ainput_server_context_poll periodically to process input events.
     69	 *
     70	 * Defaults to externalThread=FALSE
     71	 */
     72	psAInputServerInitialize Initialize;
     73
     74	/**
     75	 * @brief Poll When externalThread=TRUE call periodically from your main loop.
     76	 * if externalThread=FALSE do not call.
     77	 */
     78	psAInputServerPoll Poll;
     79
     80	/**
     81	 * @brief Poll When externalThread=TRUE call to get a handle to wait for events.
     82	 * Will return FALSE until the handle is available.
     83	 */
     84	psAInputServerChannelHandle ChannelHandle;
     85
     86	/**
     87	 * Close the ainput channel.
     88	 */
     89	psAInputServerClose Close;
     90	/**
     91	 * Status of the ainput channel.
     92	 */
     93	psAInputServerIsOpen IsOpen;
     94
     95	/*** Callbacks registered by the server. ***/
     96
     97	/**
     98	 * Receive ainput mouse event PDU.
     99	 */
    100	psAInputServerMouseEvent MouseEvent;
    101
    102	rdpContext* rdpcontext;
    103
    104	/**
    105	 * Callback, when the channel got its id assigned.
    106	 */
    107	psAInputChannelIdAssigned ChannelIdAssigned;
    108};
    109
    110#ifdef __cplusplus
    111extern "C"
    112{
    113#endif
    114
    115	FREERDP_API ainput_server_context* ainput_server_context_new(HANDLE vcm);
    116	FREERDP_API void ainput_server_context_free(ainput_server_context* context);
    117
    118#ifdef __cplusplus
    119}
    120#endif
    121
    122#endif /* FREERDP_CHANNEL_AINPUT_SERVER_H */