[client] spice: move protocol into transport

This commit is contained in:
Geoffrey McRae
2026-08-11 15:33:53 +10:00
parent 2bd0db1a26
commit 5b12685e3c
28 changed files with 2398 additions and 1058 deletions

View File

@@ -71,6 +71,7 @@ typedef uint32_t LG_TransportFeatureFlags;
typedef struct LG_TransportSession
{
char version[32];
char name[256];
LG_TransportFeatureFlags features;
bool uuidValid;
@@ -181,8 +182,8 @@ typedef struct LG_TransportPointer
int16_t x;
int16_t y;
CursorType type;
int8_t hx;
int8_t hy;
int16_t hx;
int16_t hy;
uint32_t width;
uint32_t height;
uint32_t pitch;
@@ -267,9 +268,34 @@ typedef struct LG_FrameOps
}
LG_FrameOps;
typedef struct LG_SwSurfaceEventOps
{
void (*configure)(void * opaque, unsigned int width, unsigned int height);
void (*destroy)(void * opaque);
void (*drawFill)(void * opaque, int x, int y, int width, int height,
uint32_t color);
/* Bitmap data is BGRA32 and remains valid only for the callback. */
void (*drawBitmap)(void * opaque, bool topDown, int x, int y,
int width, int height, int stride, const void * data);
/* Pointer payloads remain valid only for the callback. */
void (*pointer)(void * opaque, const LG_TransportPointer * pointer);
}
LG_SwSurfaceEventOps;
typedef struct LG_SwSurfaceOps
{
/* detach synchronously quiesces all event callbacks. */
bool (*attach)(LG_Transport * transport,
const LG_SwSurfaceEventOps * events, void * opaque);
void (*detach)(LG_Transport * transport);
bool (*setActive)(LG_Transport * transport, bool active);
}
LG_SwSurfaceOps;
typedef enum LG_VideoType
{
LG_VIDEO_TYPE_FRAME,
LG_VIDEO_TYPE_SW_SURFACE,
}
LG_VideoType;
@@ -277,7 +303,11 @@ typedef struct LG_VideoOps
{
const char * name;
LG_VideoType type;
const LG_FrameOps * frame;
union
{
const LG_FrameOps * frame;
const LG_SwSurfaceOps * swSurface;
};
}
LG_VideoOps;

View File

@@ -0,0 +1,46 @@
/**
* Looking Glass
* Copyright © 2017-2026 The Looking Glass Authors
* https://looking-glass.io
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_LG_CLIENT_USBREDIR_INTERFACE_
#define _H_LG_CLIENT_USBREDIR_INTERFACE_
struct usbredirparser;
typedef struct LG_USBRedirDeviceOps
{
/* Install the device packet callbacks on a newly-created parser. */
void (*setup)(void * opaque, struct usbredirparser * parser);
/* Queue the device descriptors and connection announcement. */
void (*plug)(void * opaque, struct usbredirparser * parser);
/* Queue time-sensitive device data immediately before parser output is
* flushed. */
void (*process)(void * opaque);
/* Stop all device activity. The bridge sends the disconnect packet. */
void (*unplug)(void * opaque);
}
LG_USBRedirDeviceOps;
/* Parser callbacks receive the bridge as their opaque value. */
void * lgUsbRedir_device(void * parserOpaque);
#endif