GUAC-911: Add log levels. Refactor guac_client_log_*() into guac_client_log().

This commit is contained in:
Michael Jumper 2014-11-07 16:32:19 -08:00
parent 5f308c9f31
commit 431fd2de6f
34 changed files with 356 additions and 336 deletions

View File

@ -150,7 +150,7 @@ void* __guacd_client_input_thread(void* data) {
"Client instruction handler error");
/* Log handler details */
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Failing instruction handler in client was \"%s\"",
instruction->opcode);
@ -173,12 +173,12 @@ int guacd_client_start(guac_client* client) {
pthread_t input_thread, output_thread;
if (pthread_create(&output_thread, NULL, __guacd_client_output_thread, (void*) client)) {
guac_client_log_error(client, "Unable to start output thread");
guac_client_log(client, GUAC_LOG_ERROR, "Unable to start output thread");
return -1;
}
if (pthread_create(&input_thread, NULL, __guacd_client_input_thread, (void*) client)) {
guac_client_log_error(client, "Unable to start input thread");
guac_client_log(client, GUAC_LOG_ERROR, "Unable to start input thread");
guac_client_stop(client);
pthread_join(output_thread, NULL);
return -1;

View File

@ -94,7 +94,7 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
if (select->argc != 1) {
/* Log error */
guacd_log_error("Bad number of arguments to \"select\" (%i)",
guacd_log(GUAC_LOG_ERROR, "Bad number of arguments to \"select\" (%i)",
select->argc);
/* Free resources */
@ -102,7 +102,7 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
return;
}
guacd_log_info("Protocol \"%s\" selected", select->argv[0]);
guacd_log(GUAC_LOG_INFO, "Protocol \"%s\" selected", select->argv[0]);
/* Get plugin from protocol in select */
plugin = guac_client_plugin_open(select->argv[0]);
@ -195,8 +195,7 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
}
client->socket = socket;
client->log_info_handler = guacd_client_log_info;
client->log_error_handler = guacd_client_log_error;
client->log_handler = guacd_client_log;
/* Parse optimal screen dimensions from size instruction */
client->info.optimal_width = atoi(size->argv[0]);
@ -224,10 +223,10 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
/* Store client */
if (guacd_client_map_add(map, client))
guacd_log_error("Unable to add client. Internal client storage has failed");
guacd_log(GUAC_LOG_ERROR, "Unable to add client. Internal client storage has failed");
/* Send connection ID */
guacd_log_info("Connection ID is \"%s\"", client->connection_id);
guacd_log(GUAC_LOG_INFO, "Connection ID is \"%s\"", client->connection_id);
guac_protocol_send_ready(socket, client->connection_id);
/* Init client */
@ -251,15 +250,15 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
}
/* Start client threads */
guacd_log_info("Starting client");
guacd_log(GUAC_LOG_INFO, "Starting client");
if (guacd_client_start(client))
guacd_log_error("Client finished abnormally");
guacd_log(GUAC_LOG_ERROR, "Client finished abnormally");
else
guacd_log_info("Client finished normally");
guacd_log(GUAC_LOG_INFO, "Client finished normally");
/* Remove client */
if (guacd_client_map_remove(map, client->connection_id) == NULL)
guacd_log_error("Unable to remove client. Internal client storage has failed");
guacd_log(GUAC_LOG_ERROR, "Unable to remove client. Internal client storage has failed");
/* Free mimetype lists */
free(client->info.audio_mimetypes);
@ -273,7 +272,7 @@ static void guacd_handle_connection(guacd_client_map* map, guac_socket* socket)
/* Clean up */
guac_client_free(client);
if (guac_client_plugin_close(plugin))
guacd_log_error("Error closing client plugin");
guacd_log(GUAC_LOG_ERROR, "Error closing client plugin");
/* Close socket */
guac_socket_free(socket);
@ -304,13 +303,13 @@ int daemonize() {
/* Fork once to ensure we aren't the process group leader */
pid = fork();
if (pid < 0) {
guacd_log_error("Could not fork() parent: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Could not fork() parent: %s", strerror(errno));
return 1;
}
/* Exit if we are the parent */
if (pid > 0) {
guacd_log_info("Exiting and passing control to PID %i", pid);
guacd_log(GUAC_LOG_INFO, "Exiting and passing control to PID %i", pid);
_exit(0);
}
@ -320,19 +319,19 @@ int daemonize() {
/* Fork again so the session group leader exits */
pid = fork();
if (pid < 0) {
guacd_log_error("Could not fork() group leader: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Could not fork() group leader: %s", strerror(errno));
return 1;
}
/* Exit if we are the parent */
if (pid > 0) {
guacd_log_info("Exiting and passing control to PID %i", pid);
guacd_log(GUAC_LOG_INFO, "Exiting and passing control to PID %i", pid);
_exit(0);
}
/* Change to root directory */
if (chdir(GUACD_ROOT) < 0) {
guacd_log_error(
guacd_log(GUAC_LOG_ERROR,
"Unable to change working directory to "
GUACD_ROOT);
return 1;
@ -344,7 +343,7 @@ int daemonize() {
|| redirect_fd(STDOUT_FILENO, O_WRONLY)
|| redirect_fd(STDERR_FILENO, O_WRONLY)) {
guacd_log_error(
guacd_log(GUAC_LOG_ERROR,
"Unable to redirect standard file descriptors to "
GUACD_DEV_NULL);
return 1;
@ -394,16 +393,16 @@ int main(int argc, char* argv[]) {
strncpy(log_prefix, basename(argv[0]), sizeof(log_prefix));
/* Open log as early as we can */
openlog(NULL, LOG_PID, LOG_DAEMON);
openlog("guacd", LOG_PID, LOG_DAEMON);
/* Log start */
guacd_log_info("Guacamole proxy daemon (guacd) version " VERSION);
guacd_log(GUAC_LOG_INFO, "Guacamole proxy daemon (guacd) version " VERSION);
/* Get addresses for binding */
if ((retval = getaddrinfo(config->bind_host, config->bind_port,
&hints, &addresses))) {
guacd_log_error("Error parsing given address or port: %s",
guacd_log(GUAC_LOG_ERROR, "Error parsing given address or port: %s",
gai_strerror(retval));
exit(EXIT_FAILURE);
@ -412,14 +411,14 @@ int main(int argc, char* argv[]) {
/* Get socket */
socket_fd = socket(AF_INET, SOCK_STREAM, 0);
if (socket_fd < 0) {
guacd_log_error("Error opening socket: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Error opening socket: %s", strerror(errno));
exit(EXIT_FAILURE);
}
/* Allow socket reuse */
if (setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR,
(void*) &opt_on, sizeof(opt_on))) {
guacd_log_info("Unable to set socket options for reuse: %s",
guacd_log(GUAC_LOG_INFO, "Unable to set socket options for reuse: %s",
strerror(errno));
}
@ -435,7 +434,7 @@ int main(int argc, char* argv[]) {
bound_address, sizeof(bound_address),
bound_port, sizeof(bound_port),
NI_NUMERICHOST | NI_NUMERICSERV)))
guacd_log_error("Unable to resolve host: %s",
guacd_log(GUAC_LOG_ERROR, "Unable to resolve host: %s",
gai_strerror(retval));
/* Attempt to bind socket to address */
@ -443,7 +442,7 @@ int main(int argc, char* argv[]) {
current_address->ai_addr,
current_address->ai_addrlen) == 0) {
guacd_log_info("Successfully bound socket to "
guacd_log(GUAC_LOG_INFO, "Successfully bound socket to "
"host %s, port %s", bound_address, bound_port);
/* Done if successful bind */
@ -453,7 +452,7 @@ int main(int argc, char* argv[]) {
/* Otherwise log information regarding bind failure */
else
guacd_log_info("Unable to bind socket to "
guacd_log(GUAC_LOG_INFO, "Unable to bind socket to "
"host %s, port %s: %s",
bound_address, bound_port, strerror(errno));
@ -463,7 +462,7 @@ int main(int argc, char* argv[]) {
/* If unable to bind to anything, fail */
if (current_address == NULL) {
guacd_log_error("Unable to bind socket to any addresses.");
guacd_log(GUAC_LOG_ERROR, "Unable to bind socket to any addresses.");
exit(EXIT_FAILURE);
}
@ -472,32 +471,32 @@ int main(int argc, char* argv[]) {
if (config->key_file != NULL || config->cert_file != NULL) {
/* Init SSL */
guacd_log_info("Communication will require SSL/TLS.");
guacd_log(GUAC_LOG_INFO, "Communication will require SSL/TLS.");
SSL_library_init();
SSL_load_error_strings();
ssl_context = SSL_CTX_new(SSLv23_server_method());
/* Load key */
if (config->key_file != NULL) {
guacd_log_info("Using PEM keyfile %s", config->key_file);
guacd_log(GUAC_LOG_INFO, "Using PEM keyfile %s", config->key_file);
if (!SSL_CTX_use_PrivateKey_file(ssl_context, config->key_file, SSL_FILETYPE_PEM)) {
guacd_log_error("Unable to load keyfile.");
guacd_log(GUAC_LOG_ERROR, "Unable to load keyfile.");
exit(EXIT_FAILURE);
}
}
else
guacd_log_info("No PEM keyfile given - SSL/TLS may not work.");
guacd_log(GUAC_LOG_INFO, "No PEM keyfile given - SSL/TLS may not work.");
/* Load cert file if specified */
if (config->cert_file != NULL) {
guacd_log_info("Using certificate file %s", config->cert_file);
guacd_log(GUAC_LOG_INFO, "Using certificate file %s", config->cert_file);
if (!SSL_CTX_use_certificate_chain_file(ssl_context, config->cert_file)) {
guacd_log_error("Unable to load certificate.");
guacd_log(GUAC_LOG_ERROR, "Unable to load certificate.");
exit(EXIT_FAILURE);
}
}
else
guacd_log_info("No certificate file given - SSL/TLS may not work.");
guacd_log(GUAC_LOG_INFO, "No certificate file given - SSL/TLS may not work.");
}
#endif
@ -507,7 +506,7 @@ int main(int argc, char* argv[]) {
/* Attempt to daemonize process */
if (daemonize()) {
guacd_log_error("Could not become a daemon.");
guacd_log(GUAC_LOG_ERROR, "Could not become a daemon.");
exit(EXIT_FAILURE);
}
@ -525,7 +524,7 @@ int main(int argc, char* argv[]) {
/* Fail if could not write PID file*/
else {
guacd_log_error("Could not write PID file: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Could not write PID file: %s", strerror(errno));
exit(EXIT_FAILURE);
}
@ -533,18 +532,18 @@ int main(int argc, char* argv[]) {
/* Ignore SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
guacd_log_info("Could not set handler for SIGPIPE to ignore. "
guacd_log(GUAC_LOG_INFO, "Could not set handler for SIGPIPE to ignore. "
"SIGPIPE may cause termination of the daemon.");
}
/* Ignore SIGCHLD (force automatic removal of children) */
if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
guacd_log_info("Could not set handler for SIGCHLD to ignore. "
guacd_log(GUAC_LOG_INFO, "Could not set handler for SIGCHLD to ignore. "
"Child processes may pile up in the process table.");
}
/* Log listening status */
guacd_log_info("Listening on host %s, port %s", bound_address, bound_port);
guacd_log(GUAC_LOG_INFO, "Listening on host %s, port %s", bound_address, bound_port);
/* Free addresses */
freeaddrinfo(addresses);
@ -556,7 +555,7 @@ int main(int argc, char* argv[]) {
/* Listen for connections */
if (listen(socket_fd, 5) < 0) {
guacd_log_error("Could not listen on socket: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Could not listen on socket: %s", strerror(errno));
return 3;
}
@ -566,7 +565,7 @@ int main(int argc, char* argv[]) {
(struct sockaddr*) &client_addr, &client_addr_len);
if (connected_socket_fd < 0) {
guacd_log_error("Could not accept client connection: %s",
guacd_log(GUAC_LOG_ERROR, "Could not accept client connection: %s",
strerror(errno));
return 3;
}
@ -584,7 +583,7 @@ int main(int argc, char* argv[]) {
/* If error, log */
if (child_pid == -1)
guacd_log_error("Error forking child process: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Error forking child process: %s", strerror(errno));
/* If child, start client, and exit when finished */
else if (child_pid == 0) {
@ -615,7 +614,7 @@ int main(int argc, char* argv[]) {
/* If parent, close reference to child's descriptor */
else if (close(connected_socket_fd) < 0) {
guacd_log_error("Error closing daemon reference to "
guacd_log(GUAC_LOG_ERROR, "Error closing daemon reference to "
"child descriptor: %s", strerror(errno));
}
@ -623,7 +622,7 @@ int main(int argc, char* argv[]) {
/* Close socket */
if (close(socket_fd) < 0) {
guacd_log_error("Could not close socket: %s", strerror(errno));
guacd_log(GUAC_LOG_ERROR, "Could not close socket: %s", strerror(errno));
return 3;
}

View File

@ -33,56 +33,94 @@
/* Log prefix, defaulting to "guacd" */
char log_prefix[64] = "guacd";
void vguacd_log_info(const char* format, va_list args) {
void vguacd_log(guac_client_log_level level, const char* format,
va_list args) {
const char* priority_name;
int priority;
/* Copy log message into buffer */
char message[2048];
vsnprintf(message, sizeof(message), format, args);
/* Log to syslog */
syslog(LOG_INFO, "%s", message);
/* Convert log level to syslog priority */
switch (level) {
/* Log to STDERR */
fprintf(stderr, "%s[%i]: INFO: %s\n", log_prefix, getpid(), message);
/* Emergency log level */
case GUAC_LOG_EMERGENCY:
priority = LOG_EMERG;
priority_name = "EMERGENCY";
break;
/* Alert log level */
case GUAC_LOG_ALERT:
priority = LOG_ALERT;
priority_name = "ALERT";
break;
/* Critical log level */
case GUAC_LOG_CRITICAL:
priority = LOG_CRIT;
priority_name = "CRITICAL";
break;
/* Error log level */
case GUAC_LOG_ERROR:
priority = LOG_ERR;
priority_name = "ERROR";
break;
/* Warning log level */
case GUAC_LOG_WARNING:
priority = LOG_WARNING;
priority_name = "WARNING";
break;
/* Notice log level */
case GUAC_LOG_NOTICE:
priority = LOG_NOTICE;
priority_name = "NOTICE";
break;
/* Informational log level */
case GUAC_LOG_INFO:
priority = LOG_INFO;
priority_name = "INFO";
break;
/* Debug log level */
case GUAC_LOG_DEBUG:
priority = LOG_DEBUG;
priority_name = "DEBUG";
break;
/* Any unknown/undefined log level */
default:
priority = LOG_INFO;
priority_name = "UNKNOWN";
break;
}
/* Log to syslog */
syslog(priority, "%s", message);
/* Log to STDERR, if high enough log level */
if (priority <= LOG_INFO)
fprintf(stderr, "%s[%i]: %s: %s\n", log_prefix, getpid(),
priority_name, message);
}
void vguacd_log_error(const char* format, va_list args) {
/* Copy log message into buffer */
char message[2048];
vsnprintf(message, sizeof(message), format, args);
/* Log to syslog */
syslog(LOG_ERR, "%s", message);
/* Log to STDERR */
fprintf(stderr, "%s[%i]: ERROR: %s\n", log_prefix, getpid(), message);
}
void guacd_log_info(const char* format, ...) {
void guacd_log(guac_client_log_level level, const char* format, ...) {
va_list args;
va_start(args, format);
vguacd_log_info(format, args);
vguacd_log(level, format, args);
va_end(args);
}
void guacd_log_error(const char* format, ...) {
va_list args;
va_start(args, format);
vguacd_log_error(format, args);
va_end(args);
}
void guacd_client_log_info(guac_client* client, const char* format,
va_list args) {
vguacd_log_info(format, args);
}
void guacd_client_log_error(guac_client* client, const char* format,
va_list args) {
vguacd_log_error(format, args);
void guacd_client_log(guac_client* client, guac_client_log_level level,
const char* format, va_list args) {
vguacd_log(level, format, args);
}
void guacd_log_guac_error(const char* message) {
@ -91,14 +129,14 @@ void guacd_log_guac_error(const char* message) {
/* If error message provided, include in log */
if (guac_error_message != NULL)
guacd_log_error("%s: %s: %s",
guacd_log(GUAC_LOG_ERROR, "%s: %s: %s",
message,
guac_status_string(guac_error),
guac_error_message);
/* Otherwise just log with standard status string */
else
guacd_log_error("%s: %s",
guacd_log(GUAC_LOG_ERROR, "%s: %s",
message,
guac_status_string(guac_error));
@ -106,7 +144,7 @@ void guacd_log_guac_error(const char* message) {
/* Just log message if no status code */
else
guacd_log_error("%s", message);
guacd_log(GUAC_LOG_ERROR, "%s", message);
}
@ -116,14 +154,14 @@ void guacd_client_log_guac_error(guac_client* client, const char* message) {
/* If error message provided, include in log */
if (guac_error_message != NULL)
guac_client_log_error(client, "%s: %s: %s",
guac_client_log(client, GUAC_LOG_ERROR, "%s: %s: %s",
message,
guac_status_string(guac_error),
guac_error_message);
/* Otherwise just log with standard status string */
else
guac_client_log_error(client, "%s: %s",
guac_client_log(client, GUAC_LOG_ERROR, "%s: %s",
message,
guac_status_string(guac_error));
@ -131,7 +169,7 @@ void guacd_client_log_guac_error(guac_client* client, const char* message) {
/* Just log message if no status code */
else
guac_client_log_error(client, "%s", message);
guac_client_log(client, GUAC_LOG_ERROR, "%s", message);
}

View File

@ -30,13 +30,10 @@
extern char log_prefix[64];
void vguacd_log_info(const char* format, va_list args);
void vguacd_log_error(const char* format, va_list args);
void guacd_log_info(const char* format, ...);
void guacd_log_error(const char* format, ...);
void vguacd_log(guac_client_log_level level, const char* format, va_list args);
void guacd_log(guac_client_log_level level, const char* format, ...);
void guacd_client_log_info(guac_client* client, const char* format, va_list args);
void guacd_client_log_error(guac_client* client, const char* format, va_list args);
void guacd_client_log(guac_client* client, guac_client_log_level level, const char* format, va_list args);
void guacd_log_guac_error(const char* message);
void guacd_client_log_guac_error(guac_client* client, const char* message);

View File

@ -320,7 +320,8 @@ int __guac_handle_end(guac_client* client, guac_instruction* instruction) {
}
int __guac_handle_disconnect(guac_client* client, guac_instruction* instruction) {
guac_client_log_info(client, "Disconnect requested. Stopping client...");
guac_client_log(client, GUAC_LOG_NOTICE,
"Disconnect requested. Stopping client...");
guac_client_stop(client);
return 0;
}

View File

@ -270,41 +270,22 @@ int guac_client_handle_instruction(guac_client* client, guac_instruction* instru
}
void vguac_client_log_info(guac_client* client, const char* format,
va_list ap) {
void vguac_client_log(guac_client* client, guac_client_log_level level,
const char* format, va_list ap) {
/* Call handler if defined */
if (client->log_info_handler != NULL)
client->log_info_handler(client, format, ap);
if (client->log_handler != NULL)
client->log_handler(client, level, format, ap);
}
void vguac_client_log_error(guac_client* client, const char* format,
va_list ap) {
/* Call handler if defined */
if (client->log_error_handler != NULL)
client->log_error_handler(client, format, ap);
}
void guac_client_log_info(guac_client* client, const char* format, ...) {
void guac_client_log(guac_client* client, guac_client_log_level level,
const char* format, ...) {
va_list args;
va_start(args, format);
vguac_client_log_info(client, format, args);
va_end(args);
}
void guac_client_log_error(guac_client* client, const char* format, ...) {
va_list args;
va_start(args, format);
vguac_client_log_error(client, format, args);
vguac_client_log(client, level, format, args);
va_end(args);
@ -321,7 +302,7 @@ void vguac_client_abort(guac_client* client, guac_protocol_status status,
if (client->state == GUAC_CLIENT_RUNNING) {
/* Log detail of error */
vguac_client_log_error(client, format, ap);
vguac_client_log(client, GUAC_LOG_ERROR, format, ap);
/* Send error immediately, limit information given */
guac_protocol_send_error(client->socket, "Aborted. See logs.", status);

View File

@ -111,7 +111,7 @@ typedef int guac_client_free_handler(guac_client* client);
/**
* Handler for logging messages
*/
typedef void guac_client_log_handler(guac_client* client, const char* format, va_list args);
typedef void guac_client_log_handler(guac_client* client, guac_client_log_level level, const char* format, va_list args);
/**
* Handler which should initialize the given guac_client.

View File

@ -57,6 +57,57 @@ typedef enum guac_client_state {
} guac_client_state;
/**
* All supported log levels used by the logging subsystem of each Guacamole
* client. These log levels correspond to the log levels defined by RFC 5424.
*/
typedef enum guac_client_log_level {
/**
* Emergencies which render the system unusable.
*/
GUAC_LOG_EMERGENCY = 0,
/**
* The system may be usable, but the current state is dangerous enough that
* action must be taken immediately.
*/
GUAC_LOG_ALERT = 1,
/**
* Critically-important messages.
*/
GUAC_LOG_CRITICAL = 2,
/**
* General errors: important, but not necessarily critically so.
*/
GUAC_LOG_ERROR = 3,
/**
* Non-fatal conditions that are likely unintentional.
*/
GUAC_LOG_WARNING = 4,
/**
* Significant but normal conditions.
*/
GUAC_LOG_NOTICE = 5,
/**
* Normal conditions that may be interesting but in most cases should be
* ignored.
*/
GUAC_LOG_INFO = 6,
/**
* Informational messages that are too frequent or too detailed for a more
* severe log level, but can be useful for debugging.
*/
GUAC_LOG_DEBUG = 7
} guac_client_log_level;
/**
* Information exposed by the remote client during the connection handshake
* which can be used by a client plugin.

View File

@ -343,8 +343,8 @@ struct guac_client {
guac_client_free_handler* free_handler;
/**
* Handler for logging informational messages. This handler will be called
* via guac_client_log_info() when the client needs to log information.
* Logging handler. This handler will be called via guac_client_log() when
* the client needs to log messages of any type.
*
* In general, only programs loading the client should implement this
* handler, as those are the programs that would provide the logging
@ -355,7 +355,7 @@ struct guac_client {
*
* Example:
* @code
* void log_handler(guac_client* client, const char* format, va_list args);
* void log_handler(guac_client* client, guac_client_log_level level, const char* format, va_list args);
*
* void function_of_daemon() {
*
@ -364,31 +364,7 @@ struct guac_client {
* }
* @endcode
*/
guac_client_log_handler* log_info_handler;
/**
* Handler for logging error messages. This handler will be called
* via guac_client_log_error() when the client needs to log an error.
*
* In general, only programs loading the client should implement this
* handler, as those are the programs that would provide the logging
* facilities.
*
* Client implementations should expect these handlers to already be
* set.
*
* Example:
* @code
* void log_handler(guac_client* client, const char* format, va_list args);
*
* void function_of_daemon() {
*
* guac_client* client = [pass log_handler to guac_client_plugin_get_client()];
*
* }
* @endcode
*/
guac_client_log_handler* log_error_handler;
guac_client_log_handler* log_handler;
/**
* Pool of buffer indices. Buffers are simply layers with negative indices.
@ -458,54 +434,31 @@ void guac_client_free(guac_client* client);
int guac_client_handle_instruction(guac_client* client, guac_instruction* instruction);
/**
* Logs an informational message in the log used by the given client. The
* logger used will normally be defined by guacd (or whichever program loads
* the proxy client) by setting the logging handlers of the client when it is
* loaded.
* Writes a message in the log used by the given client. The logger used will
* normally be defined by guacd (or whichever program loads the proxy client)
* by setting the logging handlers of the client when it is loaded.
*
* @param client The proxy client to log an informational message for.
* @param client The proxy client logging this message.
* @param level The level at which to log this message.
* @param format A printf-style format string to log.
* @param ... Arguments to use when filling the format string for printing.
*/
void guac_client_log_info(guac_client* client, const char* format, ...);
void guac_client_log(guac_client* client, guac_client_log_level level,
const char* format, ...);
/**
* Logs an error message in the log used by the given client. The logger
* used will normally be defined by guacd (or whichever program loads the
* proxy client) by setting the logging handlers of the client when it is
* loaded.
* Writes a message in the log used by the given client. The logger used will
* normally be defined by guacd (or whichever program loads the proxy client)
* by setting the logging handlers of the client when it is loaded.
*
* @param client The proxy client to log an error for.
* @param format A printf-style format string to log.
* @param ... Arguments to use when filling the format string for printing.
*/
void guac_client_log_error(guac_client* client, const char* format, ...);
/**
* Logs an informational message in the log used by the given client. The
* logger used will normally be defined by guacd (or whichever program loads
* the proxy client) by setting the logging handlers of the client when it is
* loaded.
*
* @param client The proxy client to log an informational message for.
* @param client The proxy client logging this message.
* @param level The level at which to log this message.
* @param format A printf-style format string to log.
* @param ap The va_list containing the arguments to be used when filling the
* format string for printing.
*/
void vguac_client_log_info(guac_client* client, const char* format, va_list ap);
/**
* Logs an error message in the log used by the given client. The logger
* used will normally be defined by guacd (or whichever program loads the
* proxy client) by setting the logging handlers of the client when it is
* loaded.
*
* @param client The proxy client to log an error for.
* @param format A printf-style format string to log.
* @param ap The va_list containing the arguments to be used when filling the
* format string for printing.
*/
void vguac_client_log_error(guac_client* client, const char* format, va_list ap);
void vguac_client_log(guac_client* client, guac_client_log_level level,
const char* format, va_list ap);
/**
* Signals the given client to stop gracefully. This is a completely

View File

@ -162,7 +162,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Load clipboard plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
"cliprdr", NULL))
guac_client_log_error(client, "Failed to load cliprdr plugin.");
guac_client_log(client, GUAC_LOG_ERROR, "Failed to load cliprdr plugin.");
/* If audio enabled, choose an encoder */
if (guac_client_data->settings.audio_enabled) {
@ -175,12 +175,12 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Load sound plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
"guacsnd", guac_client_data->audio))
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Failed to load guacsnd plugin.");
}
else
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"No available audio encoding. Sound disabled.");
} /* end if audio enabled */
@ -199,7 +199,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Load RDPDR plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
"guacdr", client))
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Failed to load guacdr plugin.");
}
@ -221,12 +221,12 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Attempt to load rail */
if (freerdp_channels_load_plugin(channels, instance->settings,
"rail", plugin_data))
guac_client_log_error(client, "Failed to load rail plugin.");
guac_client_log(client, GUAC_LOG_ERROR, "Failed to load rail plugin.");
#else
/* Attempt to load rail */
if (freerdp_channels_load_plugin(channels, instance->settings,
"rail", instance->settings))
guac_client_log_error(client, "Failed to load rail plugin.");
guac_client_log(client, GUAC_LOG_ERROR, "Failed to load rail plugin.");
#endif
}
@ -242,7 +242,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Attempt to load guacsvc plugin for new static channel */
if (freerdp_channels_load_plugin(channels, instance->settings,
"guacsvc", svc)) {
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Failed to load guacsvc plugin for channel \"%s\".",
svc->name);
guac_rdp_free_svc(svc);
@ -251,7 +251,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
/* Store and log on success */
else {
guac_rdp_add_svc(client, svc);
guac_client_log_info(client, "Created static channel \"%s\"...",
guac_client_log(client, GUAC_LOG_INFO, "Created static channel \"%s\"...",
svc->name);
}
@ -371,7 +371,7 @@ BOOL rdp_freerdp_authenticate(freerdp* instance, char** username,
guac_client* client = ((rdp_freerdp_context*) context)->client;
/* Warn if connection is likely to fail due to lack of credentials */
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Authentication requested but username or password not given");
return TRUE;
@ -387,11 +387,11 @@ BOOL rdp_freerdp_verify_certificate(freerdp* instance, char* subject,
/* Bypass validation if ignore_certificate given */
if (guac_client_data->settings.ignore_certificate) {
guac_client_log_info(client, "Certificate validation bypassed");
guac_client_log(client, GUAC_LOG_INFO, "Certificate validation bypassed");
return TRUE;
}
guac_client_log_info(client, "Certificate validation failed");
guac_client_log(client, GUAC_LOG_INFO, "Certificate validation failed");
return FALSE;
}
@ -418,7 +418,7 @@ void __guac_rdp_client_load_keymap(guac_client* client,
__guac_rdp_client_load_keymap(client, keymap->parent);
/* Log load */
guac_client_log_info(client, "Loading keymap \"%s\"", keymap->name);
guac_client_log(client, GUAC_LOG_INFO, "Loading keymap \"%s\"", keymap->name);
/* Load mapping into keymap */
while (mapping->keysym != 0) {
@ -449,7 +449,7 @@ static int __guac_rdp_reduce_resolution(guac_client* client, int resolution) {
client->info.optimal_width = width;
client->info.optimal_height = height;
client->info.optimal_resolution = resolution;
guac_client_log_info(client, "Reducing resolution to %ix%i at %i DPI", width, height, resolution);
guac_client_log(client, GUAC_LOG_INFO, "Reducing resolution to %ix%i at %i DPI", width, height, resolution);
return 1;
}
@ -511,31 +511,31 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* NLA security */
if (strcmp(argv[IDX_SECURITY], "nla") == 0) {
guac_client_log_info(client, "Security mode: NLA");
guac_client_log(client, GUAC_LOG_INFO, "Security mode: NLA");
settings->security_mode = GUAC_SECURITY_NLA;
}
/* TLS security */
else if (strcmp(argv[IDX_SECURITY], "tls") == 0) {
guac_client_log_info(client, "Security mode: TLS");
guac_client_log(client, GUAC_LOG_INFO, "Security mode: TLS");
settings->security_mode = GUAC_SECURITY_TLS;
}
/* RDP security */
else if (strcmp(argv[IDX_SECURITY], "rdp") == 0) {
guac_client_log_info(client, "Security mode: RDP");
guac_client_log(client, GUAC_LOG_INFO, "Security mode: RDP");
settings->security_mode = GUAC_SECURITY_RDP;
}
/* ANY security (allow server to choose) */
else if (strcmp(argv[IDX_SECURITY], "any") == 0) {
guac_client_log_info(client, "Security mode: ANY");
guac_client_log(client, GUAC_LOG_INFO, "Security mode: ANY");
settings->security_mode = GUAC_SECURITY_ANY;
}
/* If nothing given, default to RDP */
else {
guac_client_log_info(client, "No security mode specified. Defaulting to RDP.");
guac_client_log(client, GUAC_LOG_INFO, "No security mode specified. Defaulting to RDP.");
settings->security_mode = GUAC_SECURITY_RDP;
}
@ -547,7 +547,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
if (argv[IDX_PORT][0] != '\0')
settings->port = atoi(argv[IDX_PORT]);
guac_client_log_info(client, "Client resolution is %ix%i at %i DPI",
guac_client_log(client, GUAC_LOG_INFO, "Client resolution is %ix%i at %i DPI",
client->info.optimal_width,
client->info.optimal_height,
client->info.optimal_resolution);
@ -556,7 +556,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
if (client->info.optimal_resolution > GUAC_RDP_NATIVE_RESOLUTION
&& !__guac_rdp_reduce_resolution(client, GUAC_RDP_NATIVE_RESOLUTION)
&& !__guac_rdp_reduce_resolution(client, GUAC_RDP_HIGH_RESOLUTION))
guac_client_log_info(client, "No reasonable lower resolution");
guac_client_log(client, GUAC_LOG_INFO, "No reasonable lower resolution");
/* Use optimal width unless overridden */
settings->width = client->info.optimal_width;
@ -566,7 +566,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Use default width if given width is invalid. */
if (settings->width <= 0) {
settings->width = RDP_DEFAULT_WIDTH;
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Invalid width: \"%s\". Using default of %i.",
argv[IDX_WIDTH], settings->width);
}
@ -582,7 +582,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Use default height if given height is invalid. */
if (settings->height <= 0) {
settings->height = RDP_DEFAULT_HEIGHT;
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Invalid height: \"%s\". Using default of %i.",
argv[IDX_WIDTH], settings->height);
}
@ -635,7 +635,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Use default depth if given depth is invalid. */
if (settings->color_depth == 0) {
settings->color_depth = RDP_DEFAULT_DEPTH;
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Invalid color-depth: \"%s\". Using default of %i.",
argv[IDX_WIDTH], settings->color_depth);
}

View File

@ -405,7 +405,7 @@ int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
else if (keysym >= 0x1000000)
codepoint = keysym & 0xFFFFFF;
else {
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unmapped keysym has no equivalent unicode "
"value: 0x%x", keysym);
return 0;

View File

@ -85,7 +85,7 @@ void guac_rdpdr_fs_process_create(guac_rdpdr_device* device,
/* If an error occurred, notify server */
if (file_id < 0) {
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"File open refused (%i): \"%s\"", file_id, path);
output_stream = guac_rdpdr_new_io_completion(device, completion_id,
@ -278,7 +278,7 @@ void guac_rdpdr_fs_process_volume_info(guac_rdpdr_device* device, wStream* input
break;
default:
guac_client_log_info(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO,
"Unknown volume information class: 0x%x", fs_information_class);
}
@ -310,7 +310,7 @@ void guac_rdpdr_fs_process_file_info(guac_rdpdr_device* device, wStream* input_s
break;
default:
guac_client_log_info(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO,
"Unknown file information class: 0x%x", fs_information_class);
}
@ -367,7 +367,7 @@ void guac_rdpdr_fs_process_set_file_info(guac_rdpdr_device* device,
break;
default:
guac_client_log_info(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO,
"Unknown file information class: 0x%x",
fs_information_class);
}
@ -476,7 +476,7 @@ void guac_rdpdr_fs_process_query_directory(guac_rdpdr_device* device, wStream* i
break;
default:
guac_client_log_info(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO,
"Unknown dir information class: 0x%x",
fs_information_class);
}

View File

@ -41,7 +41,7 @@ static void guac_rdpdr_device_fs_announce_handler(guac_rdpdr_device* device,
wStream* output_stream, int device_id) {
/* Filesystem header */
guac_client_log_info(device->rdpdr->client, "Sending filesystem");
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Sending filesystem");
Stream_Write_UINT32(output_stream, RDPDR_DTYP_FILESYSTEM);
Stream_Write_UINT32(output_stream, device_id);
Stream_Write(output_stream, "GUAC\0\0\0\0", 8); /* DOS name */
@ -121,7 +121,7 @@ static void guac_rdpdr_device_fs_iorequest_handler(guac_rdpdr_device* device,
break;
default:
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"Unknown filesystem I/O request function: 0x%x/0x%x",
major_func, minor_func);
}

View File

@ -77,7 +77,7 @@ static void guac_rdpdr_send_client_name_request(guac_rdpdrPlugin* rdpdr, const c
static void guac_rdpdr_send_client_capability(guac_rdpdrPlugin* rdpdr) {
wStream* output_stream = Stream_New(NULL, 256);
guac_client_log_info(rdpdr->client, "Sending capabilities...");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Sending capabilities...");
/* Write header */
Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE);
@ -118,7 +118,7 @@ static void guac_rdpdr_send_client_capability(guac_rdpdrPlugin* rdpdr) {
Stream_Write_UINT32(output_stream, DRIVE_CAPABILITY_VERSION_02);
svc_plugin_send((rdpSvcPlugin*) rdpdr, output_stream);
guac_client_log_info(rdpdr->client, "Capabilities sent.");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Capabilities sent.");
}
@ -136,12 +136,12 @@ static void guac_rdpdr_send_client_device_list_announce_request(guac_rdpdrPlugin
for (i=0; i<rdpdr->devices_registered; i++) {
guac_rdpdr_device* device = &(rdpdr->devices[i]);
device->announce_handler(device, output_stream, i);
guac_client_log_info(rdpdr->client, "Registered device %i (%s)",
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Registered device %i (%s)",
device->device_id, device->device_name);
}
svc_plugin_send((rdpSvcPlugin*) rdpdr, output_stream);
guac_client_log_info(rdpdr->client, "All supported devices sent.");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "All supported devices sent.");
}
@ -158,7 +158,7 @@ void guac_rdpdr_process_server_announce(guac_rdpdrPlugin* rdpdr,
if (minor < 12)
client_id = random() & 0xFFFF;
guac_client_log_info(rdpdr->client, "Connected to RDPDR %u.%u as client 0x%04x", major, minor, client_id);
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Connected to RDPDR %u.%u as client 0x%04x", major, minor, client_id);
/* Respond to announce */
guac_rdpdr_send_client_announce_reply(rdpdr, major, minor, client_id);
@ -169,7 +169,7 @@ void guac_rdpdr_process_server_announce(guac_rdpdrPlugin* rdpdr,
}
void guac_rdpdr_process_clientid_confirm(guac_rdpdrPlugin* rdpdr, wStream* input_stream) {
guac_client_log_info(rdpdr->client, "Client ID confirmed");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Client ID confirmed");
}
void guac_rdpdr_process_device_reply(guac_rdpdrPlugin* rdpdr, wStream* input_stream) {
@ -190,11 +190,11 @@ void guac_rdpdr_process_device_reply(guac_rdpdrPlugin* rdpdr, wStream* input_str
if (device_id < rdpdr->devices_registered) {
if (severity == 0x0)
guac_client_log_info(rdpdr->client, "Device %i (%s) connected successfully",
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Device %i (%s) connected successfully",
device_id, rdpdr->devices[device_id].device_name);
else
guac_client_log_error(rdpdr->client, "Problem connecting device %i (%s): "
guac_client_log(rdpdr->client, GUAC_LOG_ERROR, "Problem connecting device %i (%s): "
"severity=0x%x, c=0x%x, n=0x%x, facility=0x%x, code=0x%x",
device_id, rdpdr->devices[device_id].device_name,
severity, c, n, facility, code);
@ -202,7 +202,7 @@ void guac_rdpdr_process_device_reply(guac_rdpdrPlugin* rdpdr, wStream* input_str
}
else
guac_client_log_error(rdpdr->client, "Unknown device ID: 0x%08x", device_id);
guac_client_log(rdpdr->client, GUAC_LOG_ERROR, "Unknown device ID: 0x%08x", device_id);
}
@ -228,7 +228,7 @@ void guac_rdpdr_process_device_iorequest(guac_rdpdrPlugin* rdpdr, wStream* input
}
else
guac_client_log_error(rdpdr->client, "Unknown device ID: 0x%08x", device_id);
guac_client_log(rdpdr->client, GUAC_LOG_ERROR, "Unknown device ID: 0x%08x", device_id);
}
@ -251,7 +251,7 @@ void guac_rdpdr_process_server_capability(guac_rdpdrPlugin* rdpdr, wStream* inpu
Stream_Read_UINT16(input_stream, length);
/* Ignore all for now */
guac_client_log_info(rdpdr->client, "Ignoring server capability set type=0x%04x, length=%i", type, length);
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Ignoring server capability set type=0x%04x, length=%i", type, length);
Stream_Seek(input_stream, length - 4);
}
@ -263,16 +263,16 @@ void guac_rdpdr_process_server_capability(guac_rdpdrPlugin* rdpdr, wStream* inpu
void guac_rdpdr_process_user_loggedon(guac_rdpdrPlugin* rdpdr, wStream* input_stream) {
guac_client_log_info(rdpdr->client, "User logged on");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "User logged on");
guac_rdpdr_send_client_device_list_announce_request(rdpdr);
}
void guac_rdpdr_process_prn_cache_data(guac_rdpdrPlugin* rdpdr, wStream* input_stream) {
guac_client_log_info(rdpdr->client, "Ignoring printer cached configuration data");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Ignoring printer cached configuration data");
}
void guac_rdpdr_process_prn_using_xps(guac_rdpdrPlugin* rdpdr, wStream* input_stream) {
guac_client_log_info(rdpdr->client, "Printer unexpectedly switched to XPS mode");
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Printer unexpectedly switched to XPS mode");
}

View File

@ -74,7 +74,7 @@ static void* guac_rdpdr_print_filter_output_thread(void* data) {
/* Log any error */
if (length < 0)
guac_client_log_error(device->rdpdr->client, "Error reading from filter: %s", strerror(errno));
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR, "Error reading from filter: %s", strerror(errno));
return NULL;
@ -90,14 +90,14 @@ static int guac_rdpdr_create_print_process(guac_rdpdr_device* device) {
/* Create STDIN pipe */
if (pipe(stdin_pipe)) {
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"Unable to create STDIN pipe for PDF filter process: %s", strerror(errno));
return 1;
}
/* Create STDOUT pipe */
if (pipe(stdout_pipe)) {
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"Unable to create STDIN pipe for PDF filter process: %s", strerror(errno));
close(stdin_pipe[0]);
close(stdin_pipe[1]);
@ -110,7 +110,7 @@ static int guac_rdpdr_create_print_process(guac_rdpdr_device* device) {
/* Start output thread */
if (pthread_create(&(printer_data->printer_output_thread), NULL, guac_rdpdr_print_filter_output_thread, device)) {
guac_client_log_error(device->rdpdr->client, "Unable to fork PDF filter process");
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR, "Unable to fork PDF filter process");
close(stdin_pipe[0]);
close(stdin_pipe[1]);
close(stdout_pipe[0]);
@ -123,7 +123,7 @@ static int guac_rdpdr_create_print_process(guac_rdpdr_device* device) {
/* Log fork errors */
if (child_pid == -1) {
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"Unable to fork PDF filter process: %s", strerror(errno));
close(stdin_pipe[0]);
close(stdin_pipe[1]);
@ -144,11 +144,11 @@ static int guac_rdpdr_create_print_process(guac_rdpdr_device* device) {
dup2(stdout_pipe[1], STDOUT_FILENO);
/* Run PDF filter */
guac_client_log_info(device->rdpdr->client, "Running %s", guac_rdpdr_pdf_filter_command[0]);
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Running %s", guac_rdpdr_pdf_filter_command[0]);
if (execvp(guac_rdpdr_pdf_filter_command[0], guac_rdpdr_pdf_filter_command) < 0)
guac_client_log_error(device->rdpdr->client, "Unable to execute PDF filter command: %s", strerror(errno));
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR, "Unable to execute PDF filter command: %s", strerror(errno));
else
guac_client_log_error(device->rdpdr->client, "Unable to execute PDF filter command, but no error given");
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR, "Unable to execute PDF filter command, but no error given");
/* Terminate child process */
exit(1);
@ -156,7 +156,7 @@ static int guac_rdpdr_create_print_process(guac_rdpdr_device* device) {
}
/* Log fork success */
guac_client_log_info(device->rdpdr->client, "Created PDF filter process PID=%i", child_pid);
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Created PDF filter process PID=%i", child_pid);
/* Close unneeded ends of pipe */
close(stdin_pipe[0]);
@ -237,7 +237,7 @@ void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device,
}
/* Begin file */
guac_client_log_info(device->rdpdr->client, "Print job created");
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Print job created");
guac_protocol_send_file(device->rdpdr->client->socket,
printer_data->stream, "application/pdf", filename);
@ -257,7 +257,7 @@ void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device,
/* Write data to printer, translate output for RDP */
length = write(printer_data->printer_input, buffer, length);
if (length == -1) {
guac_client_log_error(device->rdpdr->client, "Error writing to printer: %s", strerror(errno));
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR, "Error writing to printer: %s", strerror(errno));
status = STATUS_DEVICE_OFF_LINE;
length = 0;
}
@ -293,7 +293,7 @@ void guac_rdpdr_process_print_job_close(guac_rdpdr_device* device,
close(printer_data->printer_output);
/* Close file */
guac_client_log_info(device->rdpdr->client, "Print job closed");
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Print job closed");
guac_protocol_send_end(device->rdpdr->client->socket, printer_data->stream);
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
@ -304,7 +304,7 @@ static void guac_rdpdr_device_printer_announce_handler(guac_rdpdr_device* device
wStream* output_stream, int device_id) {
/* Printer header */
guac_client_log_info(device->rdpdr->client, "Sending printer");
guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Sending printer");
Stream_Write_UINT32(output_stream, RDPDR_DTYP_PRINT);
Stream_Write_UINT32(output_stream, device_id);
Stream_Write(output_stream, "PRN1\0\0\0\0", 8); /* DOS name */
@ -347,7 +347,7 @@ static void guac_rdpdr_device_printer_iorequest_handler(guac_rdpdr_device* devic
/* Log unknown */
default:
guac_client_log_error(device->rdpdr->client,
guac_client_log(device->rdpdr->client, GUAC_LOG_ERROR,
"Unknown printer I/O request function: 0x%x/0x%x",
major_func, minor_func);

View File

@ -107,7 +107,7 @@ void guac_rdpdr_process_connect(rdpSvcPlugin* plugin) {
guac_rdpdr_register_fs(rdpdr);
/* Log that printing, etc. has been loaded */
guac_client_log_info(client, "guacdr connected.");
guac_client_log(client, GUAC_LOG_INFO, "guacdr connected.");
}
@ -118,7 +118,7 @@ void guac_rdpdr_process_terminate(rdpSvcPlugin* plugin) {
for (i=0; i<rdpdr->devices_registered; i++) {
guac_rdpdr_device* device = &(rdpdr->devices[i]);
guac_client_log_info(rdpdr->client, "Unloading device %i (%s)",
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Unloading device %i (%s)",
device->device_id, device->device_name);
device->free_handler(device);
}
@ -173,7 +173,7 @@ void guac_rdpdr_process_receive(rdpSvcPlugin* plugin,
break;
default:
guac_client_log_info(rdpdr->client, "Ignoring RDPDR core packet with unexpected ID: 0x%04x", packet_id);
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Ignoring RDPDR core packet with unexpected ID: 0x%04x", packet_id);
}
@ -194,14 +194,14 @@ void guac_rdpdr_process_receive(rdpSvcPlugin* plugin,
break;
default:
guac_client_log_info(rdpdr->client, "Ignoring RDPDR printer packet with unexpected ID: 0x%04x", packet_id);
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Ignoring RDPDR printer packet with unexpected ID: 0x%04x", packet_id);
}
} /* end if printer */
else
guac_client_log_info(rdpdr->client, "Ignoring packet for unknown RDPDR component: 0x%04x", component);
guac_client_log(rdpdr->client, GUAC_LOG_INFO, "Ignoring packet for unknown RDPDR component: 0x%04x", component);
}
@ -270,7 +270,7 @@ void guac_rdpdr_start_download(guac_rdpdr_device* device, const char* path) {
}
else
guac_client_log_error(client, "Unable to download \"%s\"", path);
guac_client_log(client, GUAC_LOG_ERROR, "Unable to download \"%s\"", path);
}

View File

@ -128,7 +128,7 @@ void guac_rdpsnd_formats_handler(guac_rdpsndPlugin* rdpsnd,
rdpsnd->formats[current].bps = bps;
/* Log format */
guac_client_log_info(audio->client,
guac_client_log(audio->client, GUAC_LOG_INFO,
"Accepted format: %i-bit PCM with %i channels at "
"%i Hz",
bps, channels, rate);
@ -146,7 +146,7 @@ void guac_rdpsnd_formats_handler(guac_rdpsndPlugin* rdpsnd,
/* Otherwise, log that we dropped one */
else
guac_client_log_info(audio->client,
guac_client_log(audio->client, GUAC_LOG_INFO,
"Dropped valid format: %i-bit PCM with %i channels at "
"%i Hz",
bps, channels, rate);

View File

@ -87,7 +87,7 @@ void guac_rdpsnd_process_connect(rdpSvcPlugin* plugin) {
#endif
/* Log that sound has been loaded */
guac_client_log_info(audio->client, "guacsnd connected.");
guac_client_log(audio->client, GUAC_LOG_INFO, "guacsnd connected.");
}

View File

@ -101,7 +101,7 @@ void guac_svc_process_connect(rdpSvcPlugin* plugin) {
"application/octet-stream", svc->name);
/* Log connection to static channel */
guac_client_log_info(svc->client,
guac_client_log(svc->client, GUAC_LOG_INFO,
"Static channel \"%s\" connected.", svc->name);
}
@ -113,7 +113,7 @@ void guac_svc_process_terminate(rdpSvcPlugin* plugin) {
guac_rdp_svc* svc = svc_plugin->svc;
/* Remove and free SVC */
guac_client_log_info(svc->client, "Closing channel \"%s\"...", svc->name);
guac_client_log(svc->client, GUAC_LOG_INFO, "Closing channel \"%s\"...", svc->name);
guac_rdp_remove_svc(svc->client, svc->name);
free(svc);
@ -134,7 +134,7 @@ void guac_svc_process_receive(rdpSvcPlugin* plugin,
/* Fail if output not created */
if (svc->output_pipe == NULL) {
guac_client_log_error(svc->client,
guac_client_log(svc->client, GUAC_LOG_ERROR,
"Output for channel \"%s\" dropped.",
svc->name);
return;

View File

@ -171,7 +171,7 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL pri
/* Make sure that the recieved bitmap is not NULL before processing */
if (bitmap == NULL) {
guac_client_log_info(client, "NULL bitmap found in bitmap_setsurface instruction.");
guac_client_log(client, GUAC_LOG_INFO, "NULL bitmap found in bitmap_setsurface instruction.");
return;
}

View File

@ -76,11 +76,11 @@ void guac_rdp_process_cliprdr_event(guac_client* client, wMessage* event) {
default:
#ifdef LEGACY_EVENT
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown cliprdr event type: 0x%x",
event->event_type);
#else
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown cliprdr event type: 0x%x",
GetMessageType(event->id));
#endif
@ -167,7 +167,7 @@ void guac_rdp_process_cb_format_list(guac_client* client,
}
/* Ignore if no supported format available */
guac_client_log_info(client, "Ignoring unsupported clipboard data");
guac_client_log(client, GUAC_LOG_INFO, "Ignoring unsupported clipboard data");
}
@ -195,7 +195,7 @@ void guac_rdp_process_cb_data_request(guac_client* client,
break;
default:
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Server requested unsupported clipboard data type");
return;
@ -242,7 +242,7 @@ void guac_rdp_process_cb_data_response(guac_client* client,
break;
default:
guac_client_log_error(client, "Requested clipboard data in "
guac_client_log(client, GUAC_LOG_ERROR, "Requested clipboard data in "
"unsupported format %i",
client_data->requested_clipboard_format);
return;

View File

@ -90,7 +90,7 @@ guac_transfer_function guac_rdp_rop3_transfer_function(guac_client* client,
}
/* Log warning if ROP3 opcode not supported */
guac_client_log_info (client, "guac_rdp_rop3_transfer_function: "
guac_client_log(client, GUAC_LOG_INFO, "guac_rdp_rop3_transfer_function: "
"UNSUPPORTED opcode = 0x%02X", rop3);
/* Default to BINARY_SRC */
@ -134,7 +134,7 @@ void guac_rdp_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) {
/* Unsupported ROP3 */
default:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"guac_rdp_gdi_dstblt(rop3=0x%x)", dstblt->bRop);
}
@ -168,7 +168,7 @@ void guac_rdp_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) {
* Warn that rendering is a fallback, as the server should not be sending
* this order.
*/
guac_client_log_info(client, "Using fallback PATBLT (server is ignoring "
guac_client_log(client, GUAC_LOG_INFO, "Using fallback PATBLT (server is ignoring "
"negotiated client capabilities)");
/* Render rectangle based on ROP */
@ -243,7 +243,7 @@ void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) {
/* Make sure that the recieved bitmap is not NULL before processing */
if (bitmap == NULL) {
guac_client_log_info(client, "NULL bitmap found in memblt instruction.");
guac_client_log(client, GUAC_LOG_INFO, "NULL bitmap found in memblt instruction.");
return;
}

View File

@ -69,11 +69,11 @@ void guac_rdp_process_rail_event(guac_client* client, wMessage* event) {
default:
#ifdef LEGACY_EVENT
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown rail event type: 0x%x",
event->event_type);
#else
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown rail event type: 0x%x",
GetMessageType(event->id));
#endif

View File

@ -135,7 +135,7 @@ int guac_rdp_svc_pipe_handler(guac_client* client, guac_stream* stream,
/* Fail if no such SVC */
if (svc == NULL) {
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Requested non-existent pipe: \"%s\".",
name);
guac_protocol_send_ack(client->socket, stream, "FAIL (NO SUCH PIPE)",
@ -144,7 +144,7 @@ int guac_rdp_svc_pipe_handler(guac_client* client, guac_stream* stream,
return 0;
}
else
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Inbound half of channel \"%s\" connected.",
name);
@ -337,7 +337,7 @@ int guac_rdp_download_ack_handler(guac_client* client, guac_stream* stream,
/* Otherwise, fail stream */
else {
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Error reading file for download");
guac_protocol_send_end(client->socket, stream);
guac_client_free_stream(client, stream);

View File

@ -49,7 +49,7 @@ guac_rdp_svc* guac_rdp_alloc_svc(guac_client* client, char* name) {
/* Warn about name length */
if (strnlen(name, GUAC_RDP_SVC_MAX_LENGTH+1) > GUAC_RDP_SVC_MAX_LENGTH)
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Static channel name \"%s\" exceeds maximum of %i characters "
"and will be truncated",
name, GUAC_RDP_SVC_MAX_LENGTH);
@ -138,7 +138,7 @@ void guac_rdp_svc_write(guac_rdp_svc* svc, void* data, int length) {
/* Do not write of plugin not associated */
if (svc->plugin == NULL) {
guac_client_log_error(svc->client,
guac_client_log(svc->client, GUAC_LOG_ERROR,
"Channel \"%s\" output dropped.",
svc->name);
return;

View File

@ -134,7 +134,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Set locale and warn if not UTF-8 */
setlocale(LC_CTYPE, "");
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
guac_client_log_info(client, "Current locale does not use UTF-8. Some characters may not render correctly.");
guac_client_log(client, GUAC_LOG_INFO, "Current locale does not use UTF-8. Some characters may not render correctly.");
/* Read parameters */
strcpy(client_data->hostname, argv[IDX_HOSTNAME]);

View File

@ -121,7 +121,7 @@ int guac_sftp_file_handler(guac_client* client, guac_stream* stream,
guac_socket_flush(client->socket);
}
else {
guac_client_log_error(client, "Unable to open file \"%s\": %s",
guac_client_log(client, GUAC_LOG_ERROR, "Unable to open file \"%s\": %s",
fullpath, libssh2_sftp_last_error(client_data->sftp_session));
guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed", GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND);
guac_socket_flush(client->socket);
@ -152,7 +152,7 @@ int guac_sftp_blob_handler(guac_client* client, guac_stream* stream,
/* Inform of any errors */
else {
guac_client_log_error(client, "Unable to write to file: %s",
guac_client_log(client, GUAC_LOG_ERROR, "Unable to write to file: %s",
libssh2_sftp_last_error(client_data->sftp_session));
guac_protocol_send_ack(client->socket, stream, "SFTP: Write failed", GUAC_PROTOCOL_STATUS_SERVER_ERROR);
guac_socket_flush(client->socket);
@ -173,7 +173,7 @@ int guac_sftp_end_handler(guac_client* client, guac_stream* stream) {
guac_socket_flush(client->socket);
}
else {
guac_client_log_error(client, "Unable to close file");
guac_client_log(client, GUAC_LOG_ERROR, "Unable to close file");
guac_protocol_send_ack(client->socket, stream, "SFTP: Close failed", GUAC_PROTOCOL_STATUS_SERVER_ERROR);
guac_socket_flush(client->socket);
}
@ -208,7 +208,7 @@ int guac_sftp_ack_handler(guac_client* client, guac_stream* stream,
/* Otherwise, fail stream */
else {
guac_client_log_error(client, "Error reading file: %s",
guac_client_log(client, GUAC_LOG_ERROR, "Error reading file: %s",
libssh2_sftp_last_error(client_data->sftp_session));
guac_protocol_send_end(client->socket, stream);
guac_client_free_stream(client, stream);
@ -236,7 +236,7 @@ guac_stream* guac_sftp_download_file(guac_client* client,
file = libssh2_sftp_open(client_data->sftp_session, filename,
LIBSSH2_FXF_READ, 0);
if (file == NULL) {
guac_client_log_error(client, "Unable to read file \"%s\": %s",
guac_client_log(client, GUAC_LOG_ERROR, "Unable to read file \"%s\": %s",
filename,
libssh2_sftp_last_error(client_data->sftp_session));
return NULL;
@ -264,7 +264,7 @@ void guac_sftp_set_upload_path(guac_client* client, char* path) {
/* Ignore requests which exceed maximum-allowed path */
if (length > GUAC_SFTP_MAX_PATH) {
guac_client_log_error(client,
guac_client_log(client, GUAC_LOG_ERROR,
"Submitted path exceeds limit of %i bytes",
GUAC_SFTP_MAX_PATH);
return;

View File

@ -112,7 +112,7 @@ static void __kbd_callback(const char *name, int name_len,
responses[0].length = strlen(client_data->password);
}
else
guac_client_log_info(client, "Unsupported number of keyboard-interactive prompts: %i", num_prompts);
guac_client_log(client, GUAC_LOG_INFO, "Unsupported number of keyboard-interactive prompts: %i", num_prompts);
}
@ -161,13 +161,13 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
connected_address, sizeof(connected_address),
connected_port, sizeof(connected_port),
NI_NUMERICHOST | NI_NUMERICSERV)))
guac_client_log_info(client, "Unable to resolve host: %s", gai_strerror(retval));
guac_client_log(client, GUAC_LOG_INFO, "Unable to resolve host: %s", gai_strerror(retval));
/* Connect */
if (connect(fd, current_address->ai_addr,
current_address->ai_addrlen) == 0) {
guac_client_log_info(client, "Successfully connected to "
guac_client_log(client, GUAC_LOG_INFO, "Successfully connected to "
"host %s, port %s", connected_address, connected_port);
/* Done if successful connect */
@ -177,7 +177,7 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
/* Otherwise log information regarding bind failure */
else
guac_client_log_info(client, "Unable to connect to "
guac_client_log(client, GUAC_LOG_INFO, "Unable to connect to "
"host %s, port %s: %s",
connected_address, connected_port, strerror(errno));
@ -214,7 +214,7 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
/* Get list of suported authentication methods */
user_authlist = libssh2_userauth_list(session, client_data->username, strlen(client_data->username));
guac_client_log_info(client, "Supported authentication methods: %s", user_authlist);
guac_client_log(client, GUAC_LOG_INFO, "Supported authentication methods: %s", user_authlist);
/* Authenticate with key if available */
if (client_data->key != NULL) {
@ -242,11 +242,11 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
/* Authenticate with password */
if (strstr(user_authlist, "password") != NULL) {
guac_client_log_info(client, "Using password authentication method");
guac_client_log(client, GUAC_LOG_INFO, "Using password authentication method");
retval = libssh2_userauth_password(session, client_data->username, client_data->password);
}
else if (strstr(user_authlist, "keyboard-interactive") != NULL) {
guac_client_log_info(client, "Using keyboard-interactive authentication method");
guac_client_log(client, GUAC_LOG_INFO, "Using keyboard-interactive authentication method");
retval = libssh2_userauth_keyboard_interactive(session, client_data->username, &__kbd_callback);
}
else {
@ -339,7 +339,7 @@ void* ssh_client_thread(void* data) {
/* Init threadsafety in libgcrypt */
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
if (!gcry_check_version(GCRYPT_VERSION)) {
guac_client_log_error(client, "libgcrypt version mismatch.");
guac_client_log(client, GUAC_LOG_ERROR, "libgcrypt version mismatch.");
return NULL;
}
#endif
@ -383,14 +383,14 @@ void* ssh_client_thread(void* data) {
/* If still failing, give up */
if (client_data->key == NULL) {
guac_client_log_error(client, "Auth key import failed.");
guac_client_log(client, GUAC_LOG_ERROR, "Auth key import failed.");
return NULL;
}
} /* end decrypt key with passphrase */
/* Success */
guac_client_log_info(client, "Auth key successfully imported.");
guac_client_log(client, GUAC_LOG_INFO, "Auth key successfully imported.");
} /* end if key given */
@ -426,9 +426,9 @@ void* ssh_client_thread(void* data) {
/* Request agent forwarding */
if (libssh2_channel_request_auth_agent(client_data->term_channel))
guac_client_log_error(client, "Agent forwarding request failed");
guac_client_log(client, GUAC_LOG_ERROR, "Agent forwarding request failed");
else
guac_client_log_info(client, "Agent forwarding enabled.");
guac_client_log(client, GUAC_LOG_INFO, "Agent forwarding enabled.");
}
client_data->auth_agent = NULL;
@ -442,7 +442,7 @@ void* ssh_client_thread(void* data) {
client_data->term->file_download_handler = guac_sftp_download_file;
/* Create SSH session specific for SFTP */
guac_client_log_info(client, "Reconnecting for SFTP...");
guac_client_log(client, GUAC_LOG_INFO, "Reconnecting for SFTP...");
client_data->sftp_ssh_session = __guac_ssh_create_session(client, NULL);
if (client_data->sftp_ssh_session == NULL) {
/* Already aborted within __guac_ssh_create_session() */
@ -459,7 +459,7 @@ void* ssh_client_thread(void* data) {
/* Set file handler */
client->file_handler = guac_sftp_file_handler;
guac_client_log_info(client, "SFTP session initialized");
guac_client_log(client, GUAC_LOG_INFO, "SFTP session initialized");
}
@ -477,7 +477,7 @@ void* ssh_client_thread(void* data) {
}
/* Logged in */
guac_client_log_info(client, "SSH connection successful.");
guac_client_log(client, GUAC_LOG_INFO, "SSH connection successful.");
/* Start input thread */
if (pthread_create(&(input_thread), NULL, ssh_input_thread, (void*) client)) {
@ -557,7 +557,7 @@ void* ssh_client_thread(void* data) {
__openssl_free_locks(CRYPTO_num_locks());
pthread_mutex_destroy(&client_data->term_channel_lock);
guac_client_log_info(client, "SSH connection ended.");
guac_client_log(client, GUAC_LOG_INFO, "SSH connection ended.");
return NULL;
}

View File

@ -116,7 +116,7 @@ static regex_t* __guac_telnet_compile_regex(guac_client* client, char* pattern)
/* Notify of failure to parse/compile */
if (compile_result != 0) {
guac_client_log_error(client, "Regular expression '%s' could not be compiled.", pattern);
guac_client_log(client, GUAC_LOG_ERROR, "Regular expression '%s' could not be compiled.", pattern);
free(regex);
return NULL;
}
@ -145,7 +145,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Set locale and warn if not UTF-8 */
setlocale(LC_CTYPE, "");
if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0)
guac_client_log_info(client, "Current locale does not use UTF-8. Some characters may not render correctly.");
guac_client_log(client, GUAC_LOG_INFO, "Current locale does not use UTF-8. Some characters may not render correctly.");
/* Read parameters */
strcpy(client_data->hostname, argv[IDX_HOSTNAME]);

View File

@ -63,7 +63,7 @@ int guac_telnet_client_key_handler(guac_client* client, int keysym, int pressed)
/* Stop searching for password */
if (client_data->password_regex != NULL) {
guac_client_log_info(client, "Stopping password prompt search due to user input.");
guac_client_log(client, GUAC_LOG_INFO, "Stopping password prompt search due to user input.");
regfree(client_data->password_regex);
free(client_data->password_regex);
@ -74,7 +74,7 @@ int guac_telnet_client_key_handler(guac_client* client, int keysym, int pressed)
/* Stop searching for username */
if (client_data->username_regex != NULL) {
guac_client_log_info(client, "Stopping username prompt search due to user input.");
guac_client_log(client, GUAC_LOG_INFO, "Stopping username prompt search due to user input.");
regfree(client_data->username_regex);
free(client_data->username_regex);

View File

@ -227,7 +227,7 @@ static void __guac_telnet_event_handler(telnet_t* telnet, telnet_event_t* event,
/* Connection warnings */
case TELNET_EV_WARNING:
guac_client_log_info(client, "%s", event->error.msg);
guac_client_log(client, GUAC_LOG_INFO, "%s", event->error.msg);
break;
/* Connection errors */
@ -322,13 +322,13 @@ static telnet_t* __guac_telnet_create_session(guac_client* client) {
connected_address, sizeof(connected_address),
connected_port, sizeof(connected_port),
NI_NUMERICHOST | NI_NUMERICSERV)))
guac_client_log_info(client, "Unable to resolve host: %s", gai_strerror(retval));
guac_client_log(client, GUAC_LOG_INFO, "Unable to resolve host: %s", gai_strerror(retval));
/* Connect */
if (connect(fd, current_address->ai_addr,
current_address->ai_addrlen) == 0) {
guac_client_log_info(client, "Successfully connected to "
guac_client_log(client, GUAC_LOG_INFO, "Successfully connected to "
"host %s, port %s", connected_address, connected_port);
/* Done if successful connect */
@ -338,7 +338,7 @@ static telnet_t* __guac_telnet_create_session(guac_client* client) {
/* Otherwise log information regarding bind failure */
else
guac_client_log_info(client, "Unable to connect to "
guac_client_log(client, GUAC_LOG_INFO, "Unable to connect to "
"host %s, port %s: %s",
connected_address, connected_port, strerror(errno));
@ -464,7 +464,7 @@ void* guac_telnet_client_thread(void* data) {
}
/* Logged in */
guac_client_log_info(client, "Telnet connection successful.");
guac_client_log(client, GUAC_LOG_INFO, "Telnet connection successful.");
/* Start input thread */
if (pthread_create(&(input_thread), NULL, __guac_telnet_input_thread, (void*) client)) {
@ -491,7 +491,7 @@ void* guac_telnet_client_thread(void* data) {
guac_client_stop(client);
pthread_join(input_thread, NULL);
guac_client_log_info(client, "Telnet connection ended.");
guac_client_log(client, GUAC_LOG_INFO, "Telnet connection ended.");
return NULL;
}

View File

@ -167,7 +167,7 @@ static rfbClient* __guac_vnc_get_client(guac_client* client) {
/* If reverse connection enabled, start listening */
if (guac_client_data->reverse_connect) {
guac_client_log_info(client, "Listening for connections on port %i",
guac_client_log(client, GUAC_LOG_INFO, "Listening for connections on port %i",
guac_client_data->port);
/* Listen for connection from server */
@ -281,7 +281,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
.tv_nsec = (GUAC_VNC_CONNECT_INTERVAL%1000)*1000000
};
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Connect failed. Waiting %ims before retrying...",
GUAC_VNC_CONNECT_INTERVAL);
@ -317,7 +317,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* If successful, init audio system */
if (guac_client_data->audio != NULL) {
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Audio will be encoded as %s",
guac_client_data->audio->encoder->mimetype);
@ -331,7 +331,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Otherwise, audio loading failed */
else
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"No available audio encoding. Sound disabled.");
} /* end if audio enabled */

View File

@ -65,28 +65,28 @@ static void __stream_state_callback(pa_stream* stream, void* data) {
switch (pa_stream_get_state(stream)) {
case PA_STREAM_UNCONNECTED:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"PulseAudio stream currently unconnected");
break;
case PA_STREAM_CREATING:
guac_client_log_info(client, "PulseAudio stream being created...");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio stream being created...");
break;
case PA_STREAM_READY:
guac_client_log_info(client, "PulseAudio stream now ready");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio stream now ready");
break;
case PA_STREAM_FAILED:
guac_client_log_info(client, "PulseAudio stream connection failed");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio stream connection failed");
break;
case PA_STREAM_TERMINATED:
guac_client_log_info(client, "PulseAudio stream terminated");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio stream terminated");
break;
default:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown PulseAudio stream state: 0x%x",
pa_stream_get_state(stream));
@ -106,7 +106,7 @@ static void __context_get_sink_info_callback(pa_context* context,
if (is_last)
return;
guac_client_log_info(client, "Starting streaming from \"%s\"",
guac_client_log(client, GUAC_LOG_INFO, "Starting streaming from \"%s\"",
info->description);
/* Set format */
@ -138,11 +138,11 @@ static void __context_get_server_info_callback(pa_context* context,
/* If no default sink, cannot continue */
if (info->default_sink_name == NULL) {
guac_client_log_error(client, "No default sink. Cannot stream audio.");
guac_client_log(client, GUAC_LOG_ERROR, "No default sink. Cannot stream audio.");
return;
}
guac_client_log_info(client, "Will use default sink: \"%s\"",
guac_client_log(client, GUAC_LOG_INFO, "Will use default sink: \"%s\"",
info->default_sink_name);
/* Wait for default sink information */
@ -160,39 +160,39 @@ static void __context_state_callback(pa_context* context, void* data) {
switch (pa_context_get_state(context)) {
case PA_CONTEXT_UNCONNECTED:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"PulseAudio reports it is unconnected");
break;
case PA_CONTEXT_CONNECTING:
guac_client_log_info(client, "Connecting to PulseAudio...");
guac_client_log(client, GUAC_LOG_INFO, "Connecting to PulseAudio...");
break;
case PA_CONTEXT_AUTHORIZING:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Authorizing PulseAudio connection...");
break;
case PA_CONTEXT_SETTING_NAME:
guac_client_log_info(client, "Sending client name...");
guac_client_log(client, GUAC_LOG_INFO, "Sending client name...");
break;
case PA_CONTEXT_READY:
guac_client_log_info(client, "PulseAudio now ready");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio now ready");
pa_operation_unref(pa_context_get_server_info(context,
__context_get_server_info_callback, client));
break;
case PA_CONTEXT_FAILED:
guac_client_log_info(client, "PulseAudio connection failed");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio connection failed");
break;
case PA_CONTEXT_TERMINATED:
guac_client_log_info(client, "PulseAudio connection terminated");
guac_client_log(client, GUAC_LOG_INFO, "PulseAudio connection terminated");
break;
default:
guac_client_log_info(client,
guac_client_log(client, GUAC_LOG_INFO,
"Unknown PulseAudio context state: 0x%x",
pa_context_get_state(context));
@ -205,7 +205,7 @@ void guac_pa_start_stream(guac_client* client) {
vnc_guac_client_data* client_data = (vnc_guac_client_data*) client->data;
pa_context* context;
guac_client_log_info(client, "Starting audio stream");
guac_client_log(client, GUAC_LOG_INFO, "Starting audio stream");
guac_audio_stream_begin(client_data->audio,
GUAC_VNC_AUDIO_RATE,
GUAC_VNC_AUDIO_CHANNELS,
@ -236,7 +236,7 @@ void guac_pa_stop_stream(guac_client* client) {
/* Stop loop */
pa_threaded_mainloop_stop(client_data->pa_mainloop);
guac_client_log_info(client, "Audio stream finished");
guac_client_log(client, GUAC_LOG_INFO, "Audio stream finished");
}

View File

@ -342,7 +342,7 @@ int guac_terminal_escape(guac_terminal* term, unsigned char c) {
break;
default:
guac_client_log_info(term->client, "Unhandled ESC sequence: %c", c);
guac_client_log(term->client, GUAC_LOG_INFO, "Unhandled ESC sequence: %c", c);
term->char_handler = guac_terminal_echo;
}
@ -849,11 +849,11 @@ int guac_terminal_csi(guac_terminal* term, unsigned char c) {
default:
if (c != ';') {
guac_client_log_info(term->client,
guac_client_log(term->client, GUAC_LOG_INFO,
"Unhandled CSI sequence: %c", c);
for (i=0; i<argc; i++)
guac_client_log_info(term->client,
guac_client_log(term->client, GUAC_LOG_INFO,
" -> argv[%i] = %i", i, argv[i]);
}
@ -960,7 +960,7 @@ int guac_terminal_osc(guac_terminal* term, unsigned char c) {
/* Stop on unrecognized character */
else {
guac_client_log_info(term->client, "Unexpected character in OSC: 0x%X", c);
guac_client_log(term->client, GUAC_LOG_INFO, "Unexpected character in OSC: 0x%X", c);
term->char_handler = guac_terminal_echo;
}