#include <string.h>
#include <rfb/Exception.h>
#include <rfb/secTypes.h>
+#include <rfb/msgTypes.h>
#include <rfb/CapsList.h>
#include <rfb/SMsgReaderV3.h>
#include <rfb/SMsgWriterV3.h>
// FIXME: Move sendInteractionCaps() to a class derived from SMsgWriterV3?
void SConnection::sendInteractionCaps()
{
+ //
// Advertise support for non-standard server-to-client messages
- // (this version has nothing to advertise).
+ //
+
CapsList scaps;
+ // File transfer:
+ /* FIXME: File transfers are not finished yet:
+ scaps.addTightExt(msgTypeFileListData, "FTS_LSDT");
+ scaps.addTightExt(msgTypeFileDownloadData, "FTS_DNDT");
+ scaps.addTightExt(msgTypeFileUploadCancel, "FTS_UPCN");
+ scaps.addTightExt(msgTypeFileDownloadFailed, "FTS_DNFL");
+ scaps.addTightExt(msgTypeFileDirSizeData, "FTS_DSDT");
+ scaps.addTightExt(msgTypeFileLastRequestFailed, "FTS_RQFL");
+ */
+
+ // Continuous updates:
+ /* FIXME: EndOfContinuousUpdates message is not supported yet:
+ scaps.addTightExt(msgTypeEndOfContinuousUpdates, "CUS_EOCU");
+ */
+
+ //
// Advertise support for non-standard client-to-server messages
- // (this version has nothing to advertise).
+ //
+
CapsList ccaps;
+ // File transfer:
+ /* FIXME: File transfers are not finished yet:
+ ccaps.addTightExt(msgTypeFileListRequest, "FTC_LSRQ");
+ ccaps.addTightExt(msgTypeFileDownloadRequest, "FTC_DNRQ");
+ ccaps.addTightExt(msgTypeFileUploadRequest, "FTC_UPRQ");
+ ccaps.addTightExt(msgTypeFileUploadRequest, "FTC_UPDT");
+ ccaps.addTightExt(msgTypeFileDownloadCancel, "FTC_DNCN");
+ ccaps.addTightExt(msgTypeFileUploadFailed, "FTC_UPFL");
+ ccaps.addTightExt(msgTypeFileCreateDirRequest, "FTC_FCDR");
+ ccaps.addTightExt(msgTypeFileDirSizeRequest, "FTC_DSRQ");
+ ccaps.addTightExt(msgTypeFileRenameRequest, "FTC_RNRQ");
+ ccaps.addTightExt(msgTypeFileDeleteRequest, "FTC_RMRQ");
+ */
+
+ // Continuous updates:
+ ccaps.addTightExt(msgTypeEnableContinuousUpdates, "CUC_ENCU");
+
// Advertise all supported encoding types (except raw encoding).
CapsList ecaps;
void SMsgHandler::supportsLocalCursor()
{
}
+
+void SMsgHandler::enableContinuousUpdates(const Rect& r)
+{
+}
+
+void SMsgHandler::disableContinuousUpdates()
+{
+}
virtual void setEncodings(int nEncodings, rdr::U32* encodings);
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
+ virtual void enableContinuousUpdates(const Rect& r);
+ virtual void disableContinuousUpdates();
+
// InputHandler interface
// The InputHandler methods will be called for the corresponding messages.
is->readBytes(ca.buf, len);
handler->clientCutText(ca.buf, len);
}
+
+void SMsgReader::readEnableContinuousUpdates()
+{
+ bool enable = is->readU8();
+ int x = is->readU16();
+ int y = is->readU16();
+ int w = is->readU16();
+ int h = is->readU16();
+ if (enable) {
+ handler->enableContinuousUpdates(Rect(x, y, x+w, y+h));
+ } else {
+ handler->disableContinuousUpdates();
+ }
+}
+
virtual void readPointerEvent();
virtual void readClientCutText();
+ // Read TightVNC-specific protocol messages.
+ virtual void readEnableContinuousUpdates();
+
SMsgReader(SMsgHandler* handler, rdr::InStream* is);
SMsgHandler* handler;
case msgTypeFileRenameRequest:
case msgTypeFileDeleteRequest: handler->processFTMsg(msgType); break;
+ case msgTypeEnableContinuousUpdates: readEnableContinuousUpdates(); break;
+
default:
fprintf(stderr, "unknown message type %d\n", msgType);
throw Exception("unknown message type");
: SConnection(server_->securityFactory, reverse), sock(s), server(server_),
updates(false), image_getter(server->useEconomicTranslate),
drawRenderedCursor(false), removeRenderedCursor(false),
+ autoUpdatesActive(false),
pointerEventTime(0), accessRights(AccessDefault),
startTime(time(0)), m_pFileTransfer(0)
{
writeFramebufferUpdate();
}
+void VNCSConnectionST::enableContinuousUpdates(const Rect& r)
+{
+ // TightVNC-specific EnableContinuousUpdates message is very much like
+ // incremental FramebufferUpdateRequest. So here we copy some code from
+ // VNCSConnectionST::framebufferUpdateRequest().
+
+ if (!(accessRights & AccessView)) return;
+
+ SConnection::framebufferUpdateRequest(r, true);
+
+ autoUpdatesActive = true;
+ autoUpdatedRect = r;
+
+ Region reqRgn(autoUpdatedRect);
+ requested.assign_union(reqRgn);
+
+ writeFramebufferUpdate();
+}
+
+void VNCSConnectionST::disableContinuousUpdates()
+{
+ autoUpdatesActive = false;
+ autoUpdatedRect.clear();
+
+ writeFramebufferUpdate();
+
+ // FIXME: Send EndOfContinuousUpdates message.
+}
+
void VNCSConnectionST::setInitialColourMap()
{
setColourMapEntries(0, 0);
if (drawRenderedCursor)
writeRenderedCursorRect();
writer()->writeFramebufferUpdateEnd();
+ resetRequestedRegion();
+ }
+}
+
+void VNCSConnectionST::resetRequestedRegion()
+{
+ if (autoUpdatesActive) {
+ requested.reset(autoUpdatedRect);
+ } else {
requested.clear();
}
}
virtual void setInitialColourMap();
virtual void supportsLocalCursor();
+ virtual void enableContinuousUpdates(const Rect& r);
+ virtual void disableContinuousUpdates();
+
// setAccessRights() allows a security package to limit the access rights
// of a VNCSConnectioST to the server. These access rights are applied
// such that the actual rights granted are the minimum of the server's
void setCursor();
void setSocketTimeouts();
+ void resetRequestedRegion();
+
network::Socket* sock;
CharArray peerEndpoint;
VNCServerST* server;
bool drawRenderedCursor, removeRenderedCursor;
Rect renderedCursorRect;
+ bool autoUpdatesActive; // continuous updates enabled
+ Rect autoUpdatedRect; // continuously updated area
+
std::set<rdr::U32> pressedKeys;
time_t lastEventTime;
const int msgTypeFileDirSizeData = 134;
const int msgTypeFileLastRequestFailed = 135;
+ const int msgTypeEndOfContinuousUpdates = 150;
+
// client to server
const int msgTypeSetPixelFormat = 0;
const int msgTypeFileDirSizeRequest = 137;
const int msgTypeFileRenameRequest = 138;
const int msgTypeFileDeleteRequest = 139;
+
+ const int msgTypeEnableContinuousUpdates = 150;
}
#endif