kill BackChannel and CustomClientMessage: the new extension technique makes these hooks obsolete

pull/1/head
dscho 19 years ago
parent 60f1770e10
commit d15e35586b

@ -25,13 +25,6 @@ if test "x$with_tightvnc_filetransfer" == "xyes"; then
AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER) AC_DEFINE(WITH_TIGHTVNC_FILETRANSFER)
fi fi
AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" == "yes") AM_CONDITIONAL(WITH_TIGHTVNC_FILETRANSFER, test "$with_tightvnc_filetransfer" == "yes")
AH_TEMPLATE(BACKCHANNEL, [Enable BackChannel communication])
AC_ARG_WITH(backchannel,
[ --without-backchannel disable backchannel method],
, [ with_backchannel=yes ])
if test "x$with_backchannel" = "xyes"; then
AC_DEFINE(BACKCHANNEL)
fi
AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer]) AH_TEMPLATE(ALLOW24BPP, [Enable 24 bit per pixel in native framebuffer])
AC_ARG_WITH(24bpp, AC_ARG_WITH(24bpp,
[ --without-24bpp disable 24 bpp framebuffers], [ --without-24bpp disable 24 bpp framebuffers],

@ -27,10 +27,6 @@
* *
*/ */
#ifdef LOCAL_CONTROL
#include "1instance.c"
#endif
#include <unistd.h> #include <unistd.h>
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
@ -476,39 +472,11 @@ ScreenInit(int argc, char**argv)
rfbInitServer(rfbScreen); rfbInitServer(rfbScreen);
} }
#ifdef LOCAL_CONTROL
single_instance_struct single_instance = { "/tmp/OSXvnc_control" };
#endif
static void static void
refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore) refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore)
{ {
int i; int i;
#ifdef LOCAL_CONTROL
char message[1024];
if(get_next_message(message,1024,&single_instance,50)) {
if(message[0]=='l' && message[1]==0) {
rfbClientPtr cl;
int i;
for(i=0,cl=rfbScreen->rfbClientHead;cl;cl=cl->next,i++)
rfbLog("%02d: %s\n",i,cl->host);
} else if(message[0]=='t') {
rfbClientPtr cl;
for(cl=rfbScreen->rfbClientHead;cl;cl=cl->next)
if(!strcmp(message+1,cl->host)) {
cl->clientData=(void*)((cl->clientData==0)?-1:0);
break;
}
}
#ifdef LIBVNCSERVER_BACKCHANNEL
else if(message[0]=='b')
rfbSendBackChannel(rfbScreen,message+1,strlen(message+1));
#endif
}
#endif
if(startTime>0 && time(0)>startTime+maxSecsToConnect) if(startTime>0 && time(0)>startTime+maxSecsToConnect)
rfbShutdown(0); rfbShutdown(0);
@ -541,35 +509,7 @@ int main(int argc,char *argv[])
{ {
int i; int i;
#ifdef LOCAL_CONTROL
char message[1024];
open_control_file(&single_instance);
#endif
for(i=argc-1;i>0;i--) for(i=argc-1;i>0;i--)
#ifdef LOCAL_CONTROL
if(i<argc-1 && !strcmp(argv[i],"-toggleviewonly")) {
if(strlen(argv[i+1])>1022)
argv[i+1][1022]=0;
sprintf(message,"t%s",argv[i+1]);
send_message(&single_instance,message);
exit(0);
} else if(!strcmp(argv[i],"-listclients")) {
rfbLog("list clients\n");
send_message(&single_instance,"l");
exit(0);
} else
#ifdef LIBVNCSERVER_BACKCHANNEL
if(i<argc-1 && !strcmp(argv[i],"-backchannel")) {
if(strlen(argv[i+1])>1022)
argv[i+1][1022]=0;
sprintf(message,"b%s",argv[i+1]);
send_message(&single_instance,message);
exit(0);
} else
#endif
#endif
if(i<argc-1 && strcmp(argv[i],"-wait4client")==0) { if(i<argc-1 && strcmp(argv[i],"-wait4client")==0) {
maxSecsToConnect = atoi(argv[i+1])/1000; maxSecsToConnect = atoi(argv[i+1])/1000;
startTime = time(0); startTime = time(0);

@ -596,11 +596,6 @@ static enum rfbNewClientAction rfbDefaultNewClientHook(rfbClientPtr cl)
return RFB_CLIENT_ACCEPT; return RFB_CLIENT_ACCEPT;
} }
static rfbBool rfbDefaultProcessCustomClientMessage(rfbClientPtr cl,uint8_t type)
{
return FALSE;
}
/* /*
* Update server's pixel format in screenInfo structure. This * Update server's pixel format in screenInfo structure. This
* function is called from rfbGetScreen() and rfbNewFramebuffer(). * function is called from rfbGetScreen() and rfbNewFramebuffer().
@ -745,7 +740,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->setTranslateFunction = rfbSetTranslateFunction; screen->setTranslateFunction = rfbSetTranslateFunction;
screen->newClientHook = rfbDefaultNewClientHook; screen->newClientHook = rfbDefaultNewClientHook;
screen->displayHook = NULL; screen->displayHook = NULL;
screen->processCustomClientMessage = rfbDefaultProcessCustomClientMessage;
/* initialize client list and iterator mutex */ /* initialize client list and iterator mutex */
rfbClientListInit(screen); rfbClientListInit(screen);

@ -889,15 +889,6 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->useNewFBSize = TRUE; cl->useNewFBSize = TRUE;
} }
break; break;
#ifdef LIBVNCSERVER_BACKCHANNEL
case rfbEncodingBackChannel:
if (!cl->enableBackChannel) {
rfbLog("Enabling BackChannel protocol extension for "
"client %s\n", cl->host);
cl->enableBackChannel = TRUE;
}
break;
#endif
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
case rfbEncodingZRLE: case rfbEncodingZRLE:
if (cl->preferredEncoding == -1) { if (cl->preferredEncoding == -1) {
@ -1128,13 +1119,6 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
e = next; e = next;
} }
if(cl->screen->processCustomClientMessage(cl,msg.type)) {
rfbLog("Warning: this program uses processCustomClientMessage, "
"which is deprecated.\n"
"Please use rfbRegisterProtocolExtension instead.\n");
return;
}
rfbLog("rfbProcessClientNormalMessage: unknown message type %d\n", rfbLog("rfbProcessClientNormalMessage: unknown message type %d\n",
msg.type); msg.type);
rfbLog(" ... closing connection\n"); rfbLog(" ... closing connection\n");
@ -1857,30 +1841,4 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen)
} }
} }
#ifdef LIBVNCSERVER_BACKCHANNEL
void rfbSendBackChannel(rfbScreenInfoPtr rfbScreen,char* str,int len)
{
rfbClientPtr cl;
rfbBackChannelMsg sct;
rfbClientIteratorPtr iterator;
iterator = rfbGetClientIterator(rfbScreen);
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
if (cl->enableBackChannel) {
sct.type = rfbBackChannel;
sct.length = Swap32IfLE(len);
if (rfbWriteExact(cl, (char *)&sct,
sz_rfbBackChannelMsg) < 0) {
rfbLogPerror("rfbSendBackChannel: write");
rfbCloseClient(cl);
continue;
}
if (rfbWriteExact(cl, str, len) < 0) {
rfbLogPerror("rfbSendBackChannel: write");
rfbCloseClient(cl);
}
}
}
rfbReleaseClientIterator(iterator);
}
#endif

@ -30,11 +30,7 @@ static const char* encNames[] = {
"raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile", "raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile",
"zlib", "tight", "[encoding 8]", "[encoding 9]", "[encoding 10]", "zlib", "tight", "[encoding 8]", "[encoding 9]", "[encoding 10]",
"[encoding 11]", "[encoding 12]", "[encoding 13]", "[encoding 14]", "[encoding 11]", "[encoding 12]", "[encoding 13]", "[encoding 14]",
#ifdef LIBVNCSERVER_BACKCHANNEL
"BackChannel",
#else
"[encoding 15]", "[encoding 15]",
#endif
"ZRLE", "[encoding 17]", "[encoding 18]", "[encoding 19]", "[encoding 20]" "ZRLE", "[encoding 17]", "[encoding 18]", "[encoding 19]", "[encoding 20]"
}; };

@ -319,6 +319,7 @@ GetFileDownloadResponseMsgInBlocks(rfbClientPtr cl, rfbTightClientPtr rtcp)
} }
return CreateFileDownloadBlockSizeDataMsg(numOfBytesRead, pBuf); return CreateFileDownloadBlockSizeDataMsg(numOfBytesRead, pBuf);
} }
return GetFileDownLoadErrMsg();
} }

@ -133,7 +133,6 @@ typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len); typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl); typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl); typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
typedef rfbBool (*rfbProcessCustomClientMessageProcPtr)(struct _rfbClientRec* cl,uint8_t type);
typedef struct { typedef struct {
uint32_t count; uint32_t count;
@ -307,10 +306,6 @@ typedef struct _rfbScreenInfo
* link more interactive. */ * link more interactive. */
int progressiveSliceHeight; 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;
in_addr_t listenInterface; in_addr_t listenInterface;
} rfbScreenInfo, *rfbScreenInfoPtr; } rfbScreenInfo, *rfbScreenInfoPtr;
@ -486,10 +481,6 @@ typedef struct _rfbClientRec {
rfbBool useNewFBSize; /* client supports NewFBSize encoding */ rfbBool useNewFBSize; /* client supports NewFBSize encoding */
rfbBool newFBSizePending; /* framebuffer size was changed */ rfbBool newFBSizePending; /* framebuffer size was changed */
#ifdef LIBVNCSERVER_BACKCHANNEL
rfbBool enableBackChannel; /* custom channel for special clients */
#endif
struct _rfbClientRec *prev; struct _rfbClientRec *prev;
struct _rfbClientRec *next; struct _rfbClientRec *next;
@ -606,10 +597,6 @@ extern void rfbSendBell(rfbScreenInfoPtr rfbScreen);
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len); void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len);
#ifdef LIBVNCSERVER_BACKCHANNEL
extern void rfbSendBackChannel(rfbScreenInfoPtr s,char* message,int len);
#endif
/* translate.c */ /* translate.c */
extern rfbBool rfbEconomicTranslate; extern rfbBool rfbEconomicTranslate;

@ -358,9 +358,6 @@ typedef struct {
#define rfbResizeFrameBuffer 4 #define rfbResizeFrameBuffer 4
#define rfbKeyFrameUpdate 5 #define rfbKeyFrameUpdate 5
#define rfbPalmVNCReSizeFrameBuffer 0xF #define rfbPalmVNCReSizeFrameBuffer 0xF
#ifdef LIBVNCSERVER_BACKCHANNEL
#define rfbBackChannel 15
#endif
/* client -> server */ /* client -> server */
@ -406,9 +403,6 @@ typedef struct {
#define rfbEncodingZlibHex 8 #define rfbEncodingZlibHex 8
#define rfbEncodingUltra 9 #define rfbEncodingUltra 9
#endif #endif
#ifdef LIBVNCSERVER_BACKCHANNEL
#define rfbEncodingBackChannel 15
#endif
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
#define rfbEncodingZRLE 16 #define rfbEncodingZRLE 16
#endif #endif
@ -899,11 +893,6 @@ typedef struct {
#define sz_rfbServerCutTextMsg 8 #define sz_rfbServerCutTextMsg 8
#ifdef LIBVNCSERVER_BACKCHANNEL
typedef rfbServerCutTextMsg rfbBackChannelMsg;
#define sz_rfbBackChannelMsg 8
#endif
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* // Modif sf@2002 * // Modif sf@2002

Loading…
Cancel
Save