summaryrefslogtreecommitdiffstats
path: root/include/freerdp/channels/gfxredir.h
blob: b21bcc8e3559a4b094ad63a377dc3c1f6fce27be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
 * FreeRDP: A Remote Desktop Protocol Implementation
 * RDPXXXX Remote App Graphics Redirection Virtual Channel Extension
 *
 * Copyright 2020 Hideyuki Nagase <hideyukn@microsoft.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	 http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FREERDP_CHANNEL_GFXREDIR_H
#define FREERDP_CHANNEL_GFXREDIR_H

#include <freerdp/api.h>
#include <freerdp/types.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define GFXREDIR_DVC_CHANNEL_NAME "Microsoft::Windows::RDS::RemoteAppGraphicsRedirection"

/* GFXREDIR_LEGACY_CAPS_PDU.version */
#define GFXREDIR_CHANNEL_VERSION_LEGACY 1

#define GFXREDIR_CHANNEL_VERSION_MAJOR 2
#define GFXREDIR_CHANNEL_VERSION_MINOR 0

/* GFXREDIR_CAPS_VERSION1 */
#define GFXREDIR_CMDID_LEGACY_CAPS 0x00000001
#define GFXREDIR_CMDID_ERROR 0x00000006
#define GFXREDIR_CMDID_CAPS_ADVERTISE 0x00000008
#define GFXREDIR_CMDID_CAPS_CONFIRM 0x00000009
/* GFXREDIR_CAPS_VERSION2_0 */
#define GFXREDIR_CMDID_OPEN_POOL 0x0000000a
#define GFXREDIR_CMDID_CLOSE_POOL 0x0000000b
#define GFXREDIR_CMDID_CREATE_BUFFER 0x0000000c
#define GFXREDIR_CMDID_DESTROY_BUFFER 0x0000000d
#define GFXREDIR_CMDID_PRESENT_BUFFER 0x0000000e
#define GFXREDIR_CMDID_PRESENT_BUFFER_ACK 0x0000000f

/* GFXREDIR_HEADER */
#define GFXREDIR_HEADER_SIZE 8

/* GFXREDIR_CAPS_HEADER */
#define GFXREDIR_CAPS_HEADER_SIZE 12
/* GFXREDIR_CAPS_HEADER.signature */
#define GFXREDIR_CAPS_SIGNATURE 0x53504143 /* = 'SPAC' */
/* GFXREDIR_CAPS_HEADER.version */
#define GFXREDIR_CAPS_VERSION1 0x1
#define GFXREDIR_CAPS_VERSION2_0 0x2000

/* GFXREDIR_CREATE_BUFFER_PDU.format */
#define GFXREDIR_BUFFER_PIXEL_FORMAT_XRGB_8888 1
#define GFXREDIR_BUFFER_PIXEL_FORMAT_ARGB_8888 2

/* GFXREDIR_PRESENT_BUFFER_PDU.numOpaqueRects */
#define GFXREDIR_MAX_OPAQUE_RECTS 0x10

typedef struct
{
	UINT32 cmdId;
	UINT32 length;
} GFXREDIR_HEADER;

typedef struct
{
	UINT16 version; // GFXREDIR_CHANNEL_VERSION_LEGACY
} GFXREDIR_LEGACY_CAPS_PDU;

typedef struct
{
	UINT32 signature; // GFXREDIR_CAPS_SIGNATURE
	UINT32 version;   // GFXREDIR_CAPS_VERSION
	UINT32 length;    // GFXREDIR_CAPS_HEADER_SIZE + size of capsData
} GFXREDIR_CAPS_HEADER;

typedef struct
{
	GFXREDIR_CAPS_HEADER header;
	UINT32 supportedFeatures; /* Reserved for future extensions */
} GFXREDIR_CAPS_V2_0_PDU;

typedef struct
{
	UINT32 errorCode;
} GFXREDIR_ERROR_PDU;

typedef struct
{
	UINT32 length;    // length of caps;
	const BYTE* caps; // points variable length array of GFXREDIR_CAPS_HEADER.
} GFXREDIR_CAPS_ADVERTISE_PDU;

typedef struct
{
	UINT32 version;       // confirmed version, must be one of advertised by client.
	UINT32 length;        // GFXREDIR_CAPS_HEADER_SIZE + size of capsData.
	const BYTE* capsData; // confirmed capsData from selected GFXREDIR_CAPS_HEADER.capsData.
} GFXREDIR_CAPS_CONFIRM_PDU;

typedef struct
{
	UINT64 poolId;
	UINT64 poolSize;
	UINT32 sectionNameLength;          // number of charactor, must include null terminated char.
	const unsigned short* sectionName; // Windows-style 2 bytes wchar_t with null-terminated.
} GFXREDIR_OPEN_POOL_PDU;

typedef struct
{
	UINT64 poolId;
} GFXREDIR_CLOSE_POOL_PDU;

typedef struct
{
	UINT64 poolId;
	UINT64 bufferId;
	UINT64 offset;
	UINT32 stride;
	UINT32 width;
	UINT32 height;
	UINT32 format; // GFXREDIR_BUFFER_PIXEL_FORMAT_
} GFXREDIR_CREATE_BUFFER_PDU;

typedef struct
{
	UINT64 bufferId;
} GFXREDIR_DESTROY_BUFFER_PDU;

typedef struct
{
	UINT64 timestamp;
	UINT64 presentId;
	UINT64 windowId;
	UINT64 bufferId;
	UINT32 orientation; // 0, 90, 180 or 270.
	UINT32 targetWidth;
	UINT32 targetHeight;
	RECTANGLE_32 dirtyRect;
	UINT32 numOpaqueRects;
	RECTANGLE_32* opaqueRects;
} GFXREDIR_PRESENT_BUFFER_PDU;

typedef struct
{
	UINT64 windowId;
	UINT64 presentId;
} GFXREDIR_PRESENT_BUFFER_ACK_PDU;

#ifdef __cplusplus
}
#endif

#endif /* FREERDP_CHANNEL_GFXREDIR_H */