From e78a41c69c0b8d32c0742c11610f1918c98f35e4 Mon Sep 17 00:00:00 2001 From: dscho Date: Mon, 3 Jan 2005 22:34:48 +0000 Subject: add hook to allow for custom client messages --- libvncserver/main.c | 6 ++++++ libvncserver/rfbserver.c | 3 +++ rfb/rfb.h | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/libvncserver/main.c b/libvncserver/main.c index 96aeda7..0c87d8e 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -498,6 +498,11 @@ enum rfbNewClientAction rfbDefaultNewClientHook(rfbClientPtr cl) return RFB_CLIENT_ACCEPT; } +rfbBool rfbDefaultProcessCustomClientMessage(rfbClientPtr cl,uint8_t type) +{ + return FALSE; +} + /* * Update server's pixel format in screenInfo structure. This * function is called from rfbGetScreen() and rfbNewFramebuffer(). @@ -641,6 +646,7 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, screen->setTranslateFunction = rfbSetTranslateFunction; screen->newClientHook = rfbDefaultNewClientHook; screen->displayHook = 0; + screen->processCustomClientMessage = rfbDefaultProcessCustomClientMessage; /* initialize client list and iterator mutex */ rfbClientListInit(screen); diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 33e277d..0e6a4ce 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -1039,6 +1039,9 @@ rfbProcessClientNormalMessage(cl) default: + if(cl->screen->processCustomClientMessage(cl,msg.type)) + return; + rfbLog("rfbProcessClientNormalMessage: unknown message type %d\n", msg.type); rfbLog(" ... closing connection\n"); diff --git a/rfb/rfb.h b/rfb/rfb.h index d97cd19..dd61660 100644 --- a/rfb/rfb.h +++ b/rfb/rfb.h @@ -125,6 +125,7 @@ typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl); typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len); typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl); typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl); +typedef rfbBool (*rfbProcessCustomClientMessageProcPtr)(struct _rfbClientRec* cl,uint8_t type); typedef struct { uint32_t count; @@ -291,6 +292,10 @@ typedef struct _rfbScreenInfo * an update should be sent. This should make working on a slow * link more interactive. */ int progressiveSliceHeight; + + /* if LibVNCServer doesn't know the normal message, it calls this + * hook. If the hook handles the message, it returns TRUE. */ + rfbProcessCustomClientMessageProcPtr processCustomClientMessage; } rfbScreenInfo, *rfbScreenInfoPtr; -- cgit v1.2.1