Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative extension system #584

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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

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

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