From 93be927b1c1c74bc4da6f6d5978ba8e6e52f3cc2 Mon Sep 17 00:00:00 2001 From: dscho Date: Tue, 27 Sep 2005 15:18:22 +0000 Subject: Introduce generic protocol extension method. Deprecate the processCustomClientMessage() method. --- libvncserver/main.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'libvncserver/main.c') diff --git a/libvncserver/main.c b/libvncserver/main.c index a9161ce..905bb83 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -40,6 +40,7 @@ #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD static MUTEX(logMutex); +static MUTEX(extMutex); #endif static int rfbEnableLogging=1; @@ -50,6 +51,43 @@ char rfbEndianTest = 0; char rfbEndianTest = -1; #endif +/* + * Protocol extensions + */ + +static rfbProtocolExtension* rfbExtensionHead = NULL; + +void +rfbRegisterProtocolExtension(rfbProtocolExtension* extension) +{ + rfbProtocolExtension* last; + + LOCK(extMutex); + last = extension; + + while(last->next) + last = last->next; + + last->next = rfbExtensionHead; + rfbExtensionHead = extension; + UNLOCK(extMutex); +} + +rfbProtocolExtension* rfbGetExtensionIterator() +{ + LOCK(extMutex); + return rfbExtensionHead; +} + +void rfbReleaseExtensionIterator() +{ + UNLOCK(extMutex); +} + +/* + * Logging + */ + void rfbLogEnable(int enabled) { rfbEnableLogging=enabled; } -- cgit v1.2.3