@@ -192,6 +192,86 @@ typedef struct _rfbExtensionData {
192
192
struct _rfbExtensionData * next ;
193
193
} rfbExtensionData ;
194
194
195
+ /**
196
+ * Protocol extended extension handling.
197
+ */
198
+
199
+ enum rfbProtocolExtensionHookType {
200
+ RFB_PROTOCOL_EXTENSION_HOOK_NONE = 0 ,
201
+ RFB_PROTOCOL_EXTENSION_HOOK_RESERVED_1 = 1 ,
202
+ RFB_PROTOCOL_EXTENSION_HOOK_NEW_CLIENT ,
203
+ RFB_PROTOCOL_EXTENSION_HOOK_INIT ,
204
+ RFB_PROTOCOL_EXTENSION_HOOK_PSEUDO_ENCODINGS ,
205
+ RFB_PROTOCOL_EXTENSION_HOOK_ENABLE_PSEUDO_ENCODING ,
206
+ RFB_PROTOCOL_EXTENSION_HOOK_HANDLE_MESSAGE ,
207
+ RFB_PROTOCOL_EXTENSION_HOOK_CLOSE ,
208
+ RFB_PROTOCOL_EXTENSION_HOOK_USAGE ,
209
+ RFB_PROTOCOL_EXTENSION_HOOK_PROCESS_ARGUMENT ,
210
+ };
211
+
212
+ typedef void * rfbProtocolExtensionHookGeneric ;
213
+
214
+ /** returns FALSE if extension should be deactivated for client.
215
+ if newClient == NULL, it is always deactivated. */
216
+ typedef rfbBool (* rfbProtocolExtensionHookNewClient )(struct _rfbClientRec * client , void * * data );
217
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookNewClient ), "extension hook size doesn't match" );
218
+
219
+ /** returns FALSE if extension should be deactivated for client.
220
+ if init == NULL, it stays activated. */
221
+ typedef rfbBool (* rfbProtocolExtensionHookInit )(struct _rfbClientRec * client , void * data );
222
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookInit ), "extension hook size doesn't match" );
223
+
224
+ /** if pseudoEncodings is not NULL, it contains a 0 terminated
225
+ list of the pseudo encodings handled by this extension. */
226
+ typedef int * rfbProtocolExtensionHookPseudoEncodings ;
227
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookPseudoEncodings ), "extension hook size doesn't match" );
228
+
229
+ /** returns TRUE if that pseudo encoding is handled by the extension.
230
+ encodingNumber==0 means "reset encodings". */
231
+ typedef rfbBool (* rfbProtocolExtensionHookEnablePseudoEncoding )(struct _rfbClientRec * client ,
232
+ void * * data , int encodingNumber );
233
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookEnablePseudoEncoding ), "extension hook size doesn't match" );
234
+
235
+ /** returns TRUE if message was handled */
236
+ typedef rfbBool (* rfbProtocolExtensionHookHandleMessage )(struct _rfbClientRec * client ,
237
+ void * data ,
238
+ const rfbClientToServerMsg * message );
239
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookHandleMessage ), "extension hook size doesn't match" );
240
+
241
+ typedef void (* rfbProtocolExtensionHookClose )(struct _rfbClientRec * client , void * data );
242
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookClose ), "extension hook size doesn't match" );
243
+
244
+ typedef void (* rfbProtocolExtensionHookUsage )(void );
245
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookUsage ), "extension hook size doesn't match" );
246
+
247
+ /** processArguments returns the number of handled arguments */
248
+ typedef int (* rfbProtocolExtensionHookProcessArgument )(int argc , char * argv []);
249
+ _Static_assert (sizeof (rfbProtocolExtensionHookGeneric ) == sizeof (rfbProtocolExtensionHookProcessArgument ), "extension hook size doesn't match" );
250
+
251
+ typedef struct _rfbProtocolExtensionElement {
252
+ union {
253
+ /** for the type 1 extensions */
254
+ rfbProtocolExtensionHookGeneric generic ;
255
+
256
+ rfbProtocolExtensionHookNewClient newClient ;
257
+ rfbProtocolExtensionHookInit init ;
258
+ rfbProtocolExtensionHookPseudoEncodings pseudoEncodings ;
259
+ rfbProtocolExtensionHookEnablePseudoEncoding enablePseudoEncoding ;
260
+ rfbProtocolExtensionHookHandleMessage handleMessage ;
261
+ rfbProtocolExtensionHookClose close ;
262
+ rfbProtocolExtensionHookUsage usage ;
263
+ rfbProtocolExtensionHookProcessArgument processArgument ;
264
+ } hook ;
265
+ /** which hook it is */
266
+ int type ;
267
+ } rfbProtocolExtensionElement ;
268
+
269
+ typedef struct _rfbProtocolExtension2 {
270
+ rfbProtocolExtensionElement * elements ;
271
+ size_t elementsCount ;
272
+ struct _rfbProtocolExtension2 * next ;
273
+ } rfbProtocolExtension2 ;
274
+
195
275
/**
196
276
* Per-screen (framebuffer) structure. There can be as many as you wish,
197
277
* each serving different clients. However, you have to call
@@ -707,6 +787,8 @@ typedef struct _rfbClientRec {
707
787
int tightPngDstDataLen ;
708
788
#endif
709
789
#endif
790
+
791
+ struct _rfbExtension2Data * extensions2 ;
710
792
} rfbClientRec , * rfbClientPtr ;
711
793
712
794
/**
@@ -1039,6 +1121,15 @@ rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension* extension,
1039
1121
rfbBool rfbDisableExtension (rfbClientPtr cl , rfbProtocolExtension * extension );
1040
1122
void * rfbGetExtensionClientData (rfbClientPtr cl , rfbProtocolExtension * extension );
1041
1123
1124
+ void rfbRegisterProtocolExtension2 (rfbProtocolExtension2 * extension2 );
1125
+ void rfbUnregisterProtocolExtension2 (rfbProtocolExtension2 * extension2 );
1126
+ struct _rfbProtocolExtension2 * rfbGetExtension2Iterator (void );
1127
+ void rfbReleaseExtension2Iterator (void );
1128
+ rfbBool rfbEnableExtension2 (rfbClientPtr cl , rfbProtocolExtension2 * extension2 ,
1129
+ void * data );
1130
+ rfbBool rfbDisableExtension2 (rfbClientPtr cl , rfbProtocolExtension2 * extension2 );
1131
+ void * rfbGetExtension2ClientData (rfbClientPtr cl , rfbProtocolExtension2 * extension2 );
1132
+
1042
1133
/** to check against plain passwords */
1043
1134
rfbBool rfbCheckPasswordByList (rfbClientPtr cl ,const char * response ,int len );
1044
1135
0 commit comments