Commit 60f1770e authored by dscho's avatar dscho

provide a list of the pseudo encodings understood by the extension

parent 354d3c9a
...@@ -935,13 +935,46 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -935,13 +935,46 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
break; break;
e = next; e = next;
} }
if(e == NULL) if(e == NULL) {
rfbBool handled = FALSE;
/* if the pseudo encoding is not handled by the
enabled extensions, search through all
extensions. */
rfbProtocolExtension* e;
for(e = rfbGetExtensionIterator(); e;) {
int* encs = e->pseudoEncodings;
while(encs && *encs!=0) {
if(*encs==(int)enc) {
void* data = NULL;
if(e->newClient)
e->newClient(cl, &data);
if(!e->enablePseudoEncoding(cl, data, (int)enc)) {
rfbLog("Installed extension pretends to handle pseudo encoding 0x%x, but does not!\n",(int)enc);
} else {
rfbEnableExtension(cl, e, data);
handled = TRUE;
e = NULL;
break;
}
}
encs++;
}
rfbReleaseExtensionIterator();
if(e)
e = e->next;
}
if(!handled)
rfbLog("rfbProcessClientNormalMessage: ignoring" rfbLog("rfbProcessClientNormalMessage: ignoring"
"unknown encoding type %d\n", " unknown encoding type %d\n",
(int)enc); (int)enc);
} }
} }
} }
}
if (cl->preferredEncoding == -1) { if (cl->preferredEncoding == -1) {
cl->preferredEncoding = rfbEncodingRaw; cl->preferredEncoding = rfbEncodingRaw;
......
...@@ -485,6 +485,7 @@ rfbProtocolExtension tightVncFileTransferExtension = { ...@@ -485,6 +485,7 @@ rfbProtocolExtension tightVncFileTransferExtension = {
NULL, NULL,
rfbTightExtensionInit, rfbTightExtensionInit,
NULL, NULL,
NULL,
rfbTightExtensionMsgHandler, rfbTightExtensionMsgHandler,
rfbTightExtensionClientClose, rfbTightExtensionClientClose,
rfbTightUsage, rfbTightUsage,
......
...@@ -165,7 +165,11 @@ typedef struct _rfbProtocolExtension { ...@@ -165,7 +165,11 @@ typedef struct _rfbProtocolExtension {
/* returns FALSE if extension should be deactivated for client. /* returns FALSE if extension should be deactivated for client.
if init == NULL, it stays activated. */ if init == NULL, it stays activated. */
rfbBool (*init)(struct _rfbClientRec* client, void* data); rfbBool (*init)(struct _rfbClientRec* client, void* data);
/* returns TRUE if that pseudo encoding is handled by the extension */ /* if pseudoEncodings is not NULL, it contains a 0 terminated
list of the pseudo encodings handled by this extension. */
int *pseudoEncodings;
/* returns TRUE if that pseudo encoding is handled by the extension.
encodingNumber==0 means "reset encodings". */
rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client, rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
void* data, int encodingNumber); void* data, int encodingNumber);
/* returns TRUE if message was handled */ /* returns TRUE if message was handled */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment