Commit 8490de3f authored by dscho's avatar dscho

add enablePseudoEncoding() to rfbProtocolExtension

parent 1a20edd7
2005-10-03 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* libvncserver/rfbserver.c, rfb/rfb.h: add a method to the
extension struct which is called to enable pseudo encodings.
This is a versatile mechanism to enable/disable custom
extensions with custom clients and servers.
2005-09-28 Rohit Kumar <rokumar@novell.com> 2005-09-28 Rohit Kumar <rokumar@novell.com>
* examples/filetransfer.c, rfb/rfb.h, configure.ac, * examples/filetransfer.c, rfb/rfb.h, configure.ac,
libvncserver/{auth,cargs,main,rfbserver,sockets}.c, libvncserver/{auth,cargs,main,rfbserver,sockets}.c,
......
...@@ -105,7 +105,7 @@ rfbClientListInit(rfbScreenInfoPtr rfbScreen) ...@@ -105,7 +105,7 @@ rfbClientListInit(rfbScreenInfoPtr rfbScreen)
{ {
if(sizeof(rfbBool)!=1) { if(sizeof(rfbBool)!=1) {
/* a sanity check */ /* a sanity check */
fprintf(stderr,"rfbBool's size is not 1 (%d)!\n",sizeof(rfbBool)); fprintf(stderr,"rfbBool's size is not 1 (%d)!\n",(int)sizeof(rfbBool));
/* we cannot continue, because rfbBool is supposed to be char everywhere */ /* we cannot continue, because rfbBool is supposed to be char everywhere */
exit(1); exit(1);
} }
...@@ -924,8 +924,22 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -924,8 +924,22 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
#endif #endif
} else } else
#endif #endif
rfbLog("rfbProcessClientNormalMessage: ignoring unknown " {
"encoding type %d\n", (int)enc); rfbExtensionData* e;
for(e = cl->extensions; e;) {
rfbExtensionData* next = e->next;
if(e->extension->enablePseudoEncoding &&
e->extension->enablePseudoEncoding(cl,
e->data, (int)enc))
/* ext handles this encoding */
break;
e = next;
}
if(e == NULL)
rfbLog("rfbProcessClientNormalMessage: ignoring"
"unknown encoding type %d\n",
(int)enc);
}
} }
} }
...@@ -1071,12 +1085,15 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -1071,12 +1085,15 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
default: default:
{ {
rfbExtensionData* extension; rfbExtensionData *e,*next;
for(extension=cl->extensions; extension; extension=extension->next) for(e=cl->extensions; e;) {
if(extension->extension->handleMessage && next = e->next;
extension->extension->handleMessage(cl, extension->data, &msg)) if(e->extension->handleMessage &&
e->extension->handleMessage(cl, e->data, &msg))
return; return;
e = next;
}
if(cl->screen->processCustomClientMessage(cl,msg.type)) { if(cl->screen->processCustomClientMessage(cl,msg.type)) {
rfbLog("Warning: this program uses processCustomClientMessage, " rfbLog("Warning: this program uses processCustomClientMessage, "
......
...@@ -156,7 +156,6 @@ static void ...@@ -156,7 +156,6 @@ static void
rfbSendAuthCaps(cl) rfbSendAuthCaps(cl)
rfbClientPtr cl; rfbClientPtr cl;
{ {
rfbBool authRequired;
rfbAuthenticationCapsMsg caps; rfbAuthenticationCapsMsg caps;
rfbCapabilityInfo caplist[MAX_AUTH_CAPS]; rfbCapabilityInfo caplist[MAX_AUTH_CAPS];
int count = 0; int count = 0;
...@@ -485,6 +484,7 @@ rfbHandleSecTypeTight(rfbClientPtr cl) { ...@@ -485,6 +484,7 @@ rfbHandleSecTypeTight(rfbClientPtr cl) {
rfbProtocolExtension tightVncFileTransferExtension = { rfbProtocolExtension tightVncFileTransferExtension = {
NULL, NULL,
rfbTightExtensionInit, rfbTightExtensionInit,
NULL,
rfbTightExtensionMsgHandler, rfbTightExtensionMsgHandler,
rfbTightExtensionClientClose, rfbTightExtensionClientClose,
rfbTightUsage, rfbTightUsage,
......
...@@ -165,6 +165,9 @@ typedef struct _rfbProtocolExtension { ...@@ -165,6 +165,9 @@ 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 */
rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
void* data, int encodingNumber);
/* returns TRUE if message was handled */ /* returns TRUE if message was handled */
rfbBool (*handleMessage)(struct _rfbClientRec* client, rfbBool (*handleMessage)(struct _rfbClientRec* client,
void* data, void* data,
......
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