mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Working pluggable protocols.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
CFLAGS=-O2 -pedantic -Wall -Werror -I../libguac/include
|
CFLAGS=-O2 -pedantic -Wall -Werror -I../libguac/include
|
||||||
LDFLAGS=-L../libguac -lpng -lguac
|
LDFLAGS=-L../libguac -lpng -lguac -ldl
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
@@ -103,10 +104,37 @@ int main(int argc, char* argv[]) {
|
|||||||
else if (client_pid == 0) {
|
else if (client_pid == 0) {
|
||||||
|
|
||||||
guac_client* client;
|
guac_client* client;
|
||||||
|
void* client_plugin_handle;
|
||||||
|
|
||||||
|
union {
|
||||||
|
void (*client_init)(guac_client* client, const char* hostname, int port);
|
||||||
|
void* obj;
|
||||||
|
} alias;
|
||||||
|
|
||||||
|
char* error;
|
||||||
|
|
||||||
|
|
||||||
fprintf(stderr, "[guacamole] spawning client\n");
|
fprintf(stderr, "[guacamole] spawning client\n");
|
||||||
|
|
||||||
client = NULL; /*guac_get_client(connected_socket_fd, vnc_guac_client_init, connect_host, connect_port); */ /* STUB! */
|
/* Load client plugin */
|
||||||
|
client_plugin_handle = dlopen("libguac_client_vnc.so", RTLD_LAZY);
|
||||||
|
if (!client_plugin_handle) {
|
||||||
|
fprintf(stderr, "[guacamole] could not open client plugin: %s\n", dlerror());
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
dlerror(); /* Clear errors */
|
||||||
|
|
||||||
|
/* Get init function */
|
||||||
|
alias.obj = dlsym(client_plugin_handle, "guac_client_init");
|
||||||
|
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf(stderr, "[guacamole] could not get guac_client_init in plugin: %s\n", error);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load and start client */
|
||||||
|
client = guac_get_client(connected_socket_fd, alias.client_init, connect_host, connect_port);
|
||||||
guac_start_client(client);
|
guac_start_client(client);
|
||||||
guac_free_client(client);
|
guac_free_client(client);
|
||||||
|
|
||||||
@@ -116,6 +144,12 @@ int main(int argc, char* argv[]) {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Load client plugin */
|
||||||
|
if (dlclose(client_plugin_handle)) {
|
||||||
|
fprintf(stderr, "[guacamole] could not close client plugin: %s\n", dlerror());
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "[guacamole] client finished\n");
|
fprintf(stderr, "[guacamole] client finished\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
CFLAGS=-O2 -fPIC -pedantic -Wall -Werror -I../libguac/include
|
CFLAGS=-O2 -fPIC -pedantic -Wall -Werror -I../libguac/include
|
||||||
LDFLAGS=-L../libguac -lpng -lguac
|
LDFLAGS=-L../libguac -lpng -lguac -lvncclient
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
|
@@ -264,7 +264,7 @@ void vnc_guac_client_free_handler(guac_client* client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vnc_guac_client_init(guac_client* client, const char* hostname, int port) {
|
void guac_client_init(guac_client* client, const char* hostname, int port) {
|
||||||
|
|
||||||
char* hostname_copy;
|
char* hostname_copy;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user