diff options
-rw-r--r-- | 1instance.c | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cargs.c | 2 | ||||
-rw-r--r-- | mac.c | 11 | ||||
-rw-r--r-- | rfb.h | 7 | ||||
-rw-r--r-- | rfbproto.h | 12 | ||||
-rw-r--r-- | rfbserver.c | 26 | ||||
-rw-r--r-- | x11vnc.c | 15 |
8 files changed, 69 insertions, 8 deletions
diff --git a/1instance.c b/1instance.c index 580b9cd..78d6b27 100644 --- a/1instance.c +++ b/1instance.c @@ -98,7 +98,9 @@ int loop_if_server(single_instance_struct* str,event_dispatcher dispatcher) void send_message(single_instance_struct* str,char* message) { +#ifdef DEBUG_1INSTANCE int i= +#endif write(str->fd,message,strlen(message)); #ifdef DEBUG_1INSTANCE fprintf(stderr,"send: %s => %d(%d)\n",message,i,strlen(message)); @@ -11,7 +11,7 @@ FLAG24 = -DALLOW24BPP #OPTFLAGS=-g # -Wall OPTFLAGS=-O2 -Wall -CFLAGS=$(OPTFLAGS) $(PTHREADDEF) $(FLAG24) $(INCLUDES) +CFLAGS=$(OPTFLAGS) $(PTHREADDEF) $(FLAG24) $(INCLUDES) -DBACKCHANNEL RANLIB=ranlib LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(PTHREADLIB) @@ -60,7 +60,7 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[]) if (i + 1 >= *argc) rfbUsage(); passwds[0] = argv[++i]; passwds[1] = 0; - rfbScreen->rfbAuthPasswdData = passwds; + rfbScreen->rfbAuthPasswdData = (void*)passwds; rfbScreen->passwordCheck = rfbCheckPasswordByList; } else if (strcmp(argv[i], "-deferupdate") == 0) { /* -desktop desktop-name */ if (i + 1 >= *argc) rfbUsage(); @@ -327,6 +327,10 @@ refreshCallback(CGRectCount count, const CGRect *rectArray, void *ignore) break; } } +#ifdef BACKCHANNEL + else if(message[0]=='b') + rfbSendBackChannel(screen,message+1,strlen(message+1)); +#endif } #endif @@ -377,6 +381,13 @@ int main(int argc,char *argv[]) send_message(&single_instance,"l"); exit(0); } else +#ifdef BACKCHANNEL + if(i<argc-1 && !strcmp(argv[i],"-backchannel")) { + 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) { maxSecsToConnect = atoi(argv[i+1])/1000; @@ -273,7 +273,7 @@ typedef struct FILE* httpFP; PasswordCheckProcPtr passwordCheck; - char* rfbAuthPasswdData; + void* rfbAuthPasswdData; /* this is the amount of milliseconds to wait at least before sending * an update. */ @@ -574,6 +574,10 @@ extern void rfbSendBell(rfbScreenInfoPtr rfbScreen); void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len); +#ifdef BACKCHANNEL +extern void rfbSendBackChannel(rfbScreenInfoPtr s,char* message,int len); +#endif + /* translate.c */ extern Bool rfbEconomicTranslate; @@ -599,7 +603,6 @@ extern void httpCheckFds(); /* auth.c */ -extern char *rfbAuthPasswdFile; extern void rfbAuthNewClient(rfbClientPtr cl); extern void rfbAuthProcessClientMessage(rfbClientPtr cl); @@ -268,7 +268,9 @@ typedef struct { #define rfbSetColourMapEntries 1 #define rfbBell 2 #define rfbServerCutText 3 - +#ifdef BACKCHANNEL +#define rfbBackChannel 15 +#endif /* client -> server */ @@ -297,6 +299,9 @@ typedef struct { #define rfbEncodingZlib 6 #define rfbEncodingTight 7 #define rfbEncodingZlibHex 8 +#ifdef BACKCHANNEL +#define rfbEncodingBackChannel 15 +#endif /* * Special encoding numbers: @@ -508,7 +513,6 @@ typedef struct { #define rfbTightFilterPalette 0x01 #define rfbTightFilterGradient 0x02 - /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * XCursor encoding. This is a special encoding used to transmit X-style * cursor shapes from server to clients. Note that for this encoding, @@ -604,6 +608,10 @@ typedef struct { #define sz_rfbServerCutTextMsg 8 +#ifdef BACKCHANNEL +typedef rfbServerCutTextMsg rfbBackChannelMsg; +#endif + /*----------------------------------------------------------------------------- * Union of all server->client messages. diff --git a/rfbserver.c b/rfbserver.c index 34ac38e..94533f3 100644 --- a/rfbserver.c +++ b/rfbserver.c @@ -1460,3 +1460,29 @@ rfbProcessUDPInput(rfbScreenInfoPtr rfbScreen) rfbDisconnectUDPSock(rfbScreen); } } + +#ifdef BACKCHANNEL +void rfbSendBackChannel(rfbScreenInfoPtr rfbScreen,char* str,int len) +{ + rfbClientPtr cl; + rfbBackChannelMsg sct; + rfbClientIteratorPtr iterator; + + iterator = rfbGetClientIterator(rfbScreen); + while ((cl = rfbClientIteratorNext(iterator)) != NULL) { + sct.type = rfbBackChannel; + sct.length = Swap32IfLE(len); + if (WriteExact(cl, (char *)&sct, + sz_rfbServerCutTextMsg) < 0) { + rfbLogPerror("rfbSendServerCutText: write"); + rfbCloseClient(cl); + continue; + } + if (WriteExact(cl, str, len) < 0) { + rfbLogPerror("rfbSendServerCutText: write"); + rfbCloseClient(cl); + } + } + rfbReleaseClientIterator(iterator); +} +#endif @@ -232,8 +232,8 @@ int probeX=0,probeY=0; void probeScreen(rfbScreenInfoPtr s,int xscreen) { - int i,j,pixel,i1,j1, - bpp=s->rfbServerFormat.bitsPerPixel/8,mask=(1<<bpp)-1, + int i,j,/*pixel,i1,*/j1, + bpp=s->rfbServerFormat.bitsPerPixel/8,/*mask=(1<<bpp)-1,*/ rstride=s->paddedWidthInBytes; XImage* im; //fprintf(stderr,"/%d,%d",probeX,probeY); @@ -316,6 +316,13 @@ int main(int argc,char** argv) send_message(&single_instance,"l"); exit(0); } else +#ifdef BACKCHANNEL + if(i<argc-1 && !strcmp(argv[i],"-backchannel")) { + sprintf(message,"b%s",argv[i+1]); + send_message(&single_instance,message); + exit(0); + } else +#endif #endif if(i<argc-1 && strcmp(argv[i],"-display")==0) { fprintf(stderr,"Using display %s\n",argv[i+1]); @@ -459,6 +466,10 @@ int main(int argc,char** argv) break; } } +#ifdef BACKCHANNEL + else if(message[0]=='b') + rfbSendBackChannel(screen,message+1,strlen(message+1)); +#endif } #endif |