LibVNC / libvncserver

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.
GNU General Public License v2.0
1.07k stars 481 forks source link

Alternative extension system #584

Open VelorumS opened 1 year ago

VelorumS commented 1 year ago

Extension points in extension2 system are integer-coded so the future versions of the libvncserver can add extension points.

Additional extension points: pre-FBU, post-FBU and post-SetEncodings.

Example of registering an extension:

static rfbProtocolExtensionElement extElements[] = {
        { { .newClient=onNewClient }, RFB_PROTOCOL_EXTENSION_HOOK_NEW_CLIENT },
        { { .pseudoEncodings=encodings }, RFB_PROTOCOL_EXTENSION_HOOK_PSEUDO_ENCODINGS },
        { { .handleMessage=onHandleMessage }, RFB_PROTOCOL_EXTENSION_HOOK_HANDLE_MESSAGE },
        { { .close=onClose }, RFB_PROTOCOL_EXTENSION_HOOK_CLOSE },
};

static rfbProtocolExtension2 extStruct = {
        extElements,
        sizeof(extElements) / sizeof(extElements[0]),
};

static void register()
{
    rfbRegisterProtocolExtension2(&extStruct);
}