Skip to content

Conversation

VelorumS
Copy link

@VelorumS VelorumS commented Jun 7, 2023

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);
}

@@ -2647,6 +2647,18 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->enableCursorPosUpdates = FALSE;
}

rfbProtocolExtension2 *extension2 = rfbGetExtension2Iterator();
for (; extension2; extension2 = extension2->next) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not put the declaration of extensions2 into the head of the for() loop?

@RokerHRO
Copy link
Contributor

RokerHRO commented Aug 4, 2024

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

register is a keyword in C so it cannot be used as the name for a function. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants