The sockets.c and vncfunc.c should have their own function macros as they are "helper" functions not directly related to PHP bindings themselves. This is simple s/PHPFUNC/SOCKETFUNC/ and s/PHPFUNC/VNCFUNC/ --- src/sockets.c | 44 +++++++++---------- src/vncfunc.c | 138 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/sockets.c b/src/sockets.c index 9c66257..ef9d154 100644 --- a/src/sockets.c +++ b/src/sockets.c @@ -26,7 +26,7 @@ DEBUG_INIT("sockets"); /* Function macro */ -#define PHPFUNC __FUNCTION__ +#define SOCKETFUNC __FUNCTION__ /* * Private function name: connect_socket @@ -59,7 +59,7 @@ int connect_socket(char *server, char *port, int keepalive, int nodelay, int all server = strdup("localhost"); } - DPRINTF("%s: Connecting to %s:%s\n", PHPFUNC, server, port); + DPRINTF("%s: Connecting to %s:%s\n", SOCKETFUNC, server, port); s = getaddrinfo(server, port, &hints, &result); if (s != 0) @@ -80,18 +80,18 @@ int connect_socket(char *server, char *port, int keepalive, int nodelay, int all return -errno; freeaddrinfo(result); - DPRINTF("%s: Socket descriptor #%d opened\n", PHPFUNC, sfd); + DPRINTF("%s: Socket descriptor #%d opened\n", SOCKETFUNC, sfd); if (keepalive) { int on = 1; if (setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0) { int err = errno; close(sfd); - DPRINTF("%s: Cannot set keep alive option on socket\n", PHPFUNC); + DPRINTF("%s: Cannot set keep alive option on socket\n", SOCKETFUNC); return -err; } - DPRINTF("%s: Socket #%d set as keepalive socket\n", PHPFUNC, sfd); + DPRINTF("%s: Socket #%d set as keepalive socket\n", SOCKETFUNC, sfd); } if (nodelay) { @@ -99,11 +99,11 @@ int connect_socket(char *server, char *port, int keepalive, int nodelay, int all if (setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) { int err = errno; close(sfd); - DPRINTF("%s: Cannot set no delay option on socket\n", PHPFUNC); + DPRINTF("%s: Cannot set no delay option on socket\n", SOCKETFUNC); return -err; } - DPRINTF("%s: Socket #%d set as no delay socket\n", PHPFUNC, sfd); + DPRINTF("%s: Socket #%d set as no delay socket\n", SOCKETFUNC, sfd); } return sfd; @@ -130,7 +130,7 @@ int socket_has_data(int sfd, long maxtime, int ignoremsg) } if (!ignoremsg) - DPRINTF("%s: Checking data on socket %d, timeout = { %ld, %ld }\n", PHPFUNC, sfd, + DPRINTF("%s: Checking data on socket %d, timeout = { %ld, %ld }\n", SOCKETFUNC, sfd, (long)timeout.tv_sec, (long)timeout.tv_usec); FD_ZERO(&fds); @@ -141,12 +141,12 @@ int socket_has_data(int sfd, long maxtime, int ignoremsg) rc = select( sizeof(fds), &fds, NULL, NULL, NULL); if (rc==-1) { - DPRINTF("%s: Select with error %d (%s)\n", PHPFUNC, errno, strerror(-errno)); + DPRINTF("%s: Select with error %d (%s)\n", SOCKETFUNC, errno, strerror(-errno)); return -errno; } if (!ignoremsg) - DPRINTF("%s: Select returned %d\n", PHPFUNC, rc); + DPRINTF("%s: Select returned %d\n", SOCKETFUNC, rc); return (rc == 1); } @@ -165,19 +165,19 @@ void socket_read(int sfd, long length) unsigned char bigbuf[1048576]; if (socket_has_data(sfd, 50000, 0) != 1) { - DPRINTF("%s: No data appears to be available\n", PHPFUNC); + DPRINTF("%s: No data appears to be available\n", SOCKETFUNC); return; } if (length == -1) { - DPRINTF("%s: Reading all the data from socket\n", PHPFUNC); + DPRINTF("%s: Reading all the data from socket\n", SOCKETFUNC); while (socket_has_data(sfd, 50000, 1) == 1) while ((len = read(sfd, bigbuf, sizeof(bigbuf))) == sizeof(bigbuf)) ; - DPRINTF("%s: Read done ...\n", PHPFUNC); + DPRINTF("%s: Read done ...\n", SOCKETFUNC); return; } - DPRINTF("%s: Reading %ld bytes\n", PHPFUNC, length); + DPRINTF("%s: Reading %ld bytes\n", SOCKETFUNC, length); while (length > 0) { len = read(sfd, bigbuf, sizeof(bigbuf)); @@ -188,9 +188,9 @@ void socket_read(int sfd, long length) if (length && read(sfd, bigbuf, length) != length) - DPRINTF("%s: not all byes read\n", PHPFUNC); + DPRINTF("%s: not all byes read\n", SOCKETFUNC); else - DPRINTF("%s: All bytes read\n", PHPFUNC); + DPRINTF("%s: All bytes read\n", SOCKETFUNC); } /* @@ -218,11 +218,11 @@ int socket_read_and_save(int sfd, char *fn, long length) return -EPERM; if (socket_has_data(sfd, 50000, 0) != 1) { - DPRINTF("%s: No data appears to be available\n", PHPFUNC); + DPRINTF("%s: No data appears to be available\n", SOCKETFUNC); return -ENOENT; } - DPRINTF("%s: Reading %ld bytes\n", PHPFUNC, length); + DPRINTF("%s: Reading %ld bytes\n", SOCKETFUNC, length); while (length > 0) { len = read(sfd, bigbuf, sizeof(bigbuf)); @@ -230,7 +230,7 @@ int socket_read_and_save(int sfd, char *fn, long length) SWAP2_BYTES_ENDIAN(1, bigbuf[i+1], bigbuf[i+2]); if (write(fd, bigbuf, len) != len) - DPRINTF("%s: unable to write to %d", PHPFUNC, fd); + DPRINTF("%s: unable to write to %d", SOCKETFUNC, fd); length -= len; if (length < 0) @@ -244,14 +244,14 @@ int socket_read_and_save(int sfd, char *fn, long length) SWAP2_BYTES_ENDIAN(1, bigbuf[i+1], bigbuf[i+2]); if (write(fd, bigbuf, len) != len) - DPRINTF("%s: unable to write to %d", PHPFUNC, fd); + DPRINTF("%s: unable to write to %d", SOCKETFUNC, fd); } if (ftruncate(fd, orig_len) < 0) - DPRINTF("%s: Unable to truncate %d", PHPFUNC, fd); + DPRINTF("%s: Unable to truncate %d", SOCKETFUNC, fd); close(fd); - DPRINTF("%s: All bytes read\n", PHPFUNC); + DPRINTF("%s: All bytes read\n", SOCKETFUNC); return 0; } diff --git a/src/vncfunc.c b/src/vncfunc.c index eeadf42..c1430d1 100644 --- a/src/vncfunc.c +++ b/src/vncfunc.c @@ -23,7 +23,7 @@ DEBUG_INIT("vncfunc"); /* Function macro */ -#define PHPFUNC __FUNCTION__ +#define VNCFUNC __FUNCTION__ #define UC(a) (unsigned char)a #define CALC_UINT32(a, b, c, d) (uint32_t)((a >> 24) + (b >> 16) + (c >> 8) + d) @@ -93,11 +93,11 @@ vnc_write_client_version(int sfd) if (write(sfd, buf, 12) < 0) { int err = errno; close(sfd); - DPRINTF("%s: Write of client version failed\n", PHPFUNC); + DPRINTF("%s: Write of client version failed\n", VNCFUNC); return -err; } - DPRINTF("%s: VNC Client version packet sent\n", PHPFUNC); + DPRINTF("%s: VNC Client version packet sent\n", VNCFUNC); return 0; } @@ -121,7 +121,7 @@ vnc_authorize(int sfd) /* Read number security types supported */ if ((num = read(sfd, buf, 1)) < 0) { int err = errno; - DPRINTF("%s: Cannot read number of security types, error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Cannot read number of security types, error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -129,7 +129,7 @@ vnc_authorize(int sfd) /* Read all the security types */ if (read(sfd, buf2, num) < 0) { int err = errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -144,7 +144,7 @@ vnc_authorize(int sfd) /* Bail if security type None is not supported */ if (ok == 0) { close(sfd); - DPRINTF("%s: Security type None is not supported\n", PHPFUNC); + DPRINTF("%s: Security type None is not supported\n", VNCFUNC); return -ENOTSUP; } @@ -156,7 +156,7 @@ vnc_authorize(int sfd) return -err; } - DPRINTF("%s: Security None selected\n", PHPFUNC); + DPRINTF("%s: Security None selected\n", VNCFUNC); /* Just bogus to wait for proper auth response */ i = 0; @@ -164,7 +164,7 @@ vnc_authorize(int sfd) while (buf[0] + buf[1] + buf[2] + buf[3] != 0) { if (read(sfd, buf, 4) < 0) { int err = errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -174,7 +174,7 @@ vnc_authorize(int sfd) } } - DPRINTF("%s: VNC Client authorized\n", PHPFUNC); + DPRINTF("%s: VNC Client authorized\n", VNCFUNC); return 0; } @@ -200,13 +200,13 @@ vnc_parse_fb_params(unsigned char *buf, int len) little_endian = (buf[6] == 0); - DPRINTF("%s: Read dimension bytes: width = { 0x%02x, 0x%02x }, height = { 0x%02x, 0x%02x }, %s endian\n", PHPFUNC, + DPRINTF("%s: Read dimension bytes: width = { 0x%02x, 0x%02x }, height = { 0x%02x, 0x%02x }, %s endian\n", VNCFUNC, w1, w2, h1, h2, little_endian ? "little" : "big"); w = SWAP2_BY_ENDIAN(little_endian, w1, w2); h = SWAP2_BY_ENDIAN(little_endian, h1, h2); - DPRINTF("%s: Filling the parameters structure with width = %d, height = %d\n", PHPFUNC, w, h); + DPRINTF("%s: Filling the parameters structure with width = %d, height = %d\n", VNCFUNC, w, h); params.width = w; params.height = h; @@ -229,14 +229,14 @@ vnc_parse_fb_params(unsigned char *buf, int len) params.desktopNameLen = nlen; params.desktopName = (unsigned char*) strdup((char *)buf + 24); - DPRINTF("%s: Desktop name set to '%s'\n", PHPFUNC, params.desktopName); + DPRINTF("%s: Desktop name set to '%s'\n", VNCFUNC, params.desktopName); DPRINTF("%s: width = %d, height = %d, bpp = %d, depth = %d, bigEndian = %d, trueColor = %d\n", - PHPFUNC, params.width, params.height, params.bpp, params.depth, params.bigEndian, params.trueColor); - DPRINTF("%s: maxColors = { %d, %d, %d }, shifts = { %d, %d, %d }\n", PHPFUNC, params.maxRed, + VNCFUNC, params.width, params.height, params.bpp, params.depth, params.bigEndian, params.trueColor); + DPRINTF("%s: maxColors = { %d, %d, %d }, shifts = { %d, %d, %d }\n", VNCFUNC, params.maxRed, params.maxGreen, params.maxBlue, params.shiftRed, params.shiftGreen, params.shiftBlue); - DPRINTF("%s: Desktop name is '%s' (%d bytes)\n", PHPFUNC, params.desktopName, params.desktopNameLen); + DPRINTF("%s: Desktop name is '%s' (%d bytes)\n", VNCFUNC, params.desktopName, params.desktopNameLen); return params; } @@ -266,18 +266,18 @@ vnc_send_key(int sfd, unsigned char key, int modifier, int release) buf[6] = modifier ? 0xff : 0x00; buf[7] = key; - DPRINTF("%s: %s key %d [0x%02x], modifier: %s\n", PHPFUNC, (release ? "Releasing" : "Pressing"), + DPRINTF("%s: %s key %d [0x%02x], modifier: %s\n", VNCFUNC, (release ? "Releasing" : "Pressing"), key, key, modifier ? "true" : "false"); if (write(sfd, buf, 8) < 0) { int err = errno; DPRINTF("%s: Error occured while writing to socket descriptor #%d: %d (%s)\n", - PHPFUNC, sfd, err, strerror(err)); + VNCFUNC, sfd, err, strerror(err)); close(sfd); return -err; } - DPRINTF("%s: Write of 8 bytes successful\n", PHPFUNC); + DPRINTF("%s: Write of 8 bytes successful\n", VNCFUNC); return 0; } @@ -298,7 +298,7 @@ vnc_send_client_pointer(int sfd, int clicked, int pos_x, int pos_y) unsigned char buf[6] = { 0 }; if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } @@ -311,14 +311,14 @@ vnc_send_client_pointer(int sfd, int clicked, int pos_x, int pos_y) if (write(sfd, buf, 6) < 0) { int err = errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } DPRINTF("%s: Wrote 6 bytes of client pointer event, clicked = %d, x = { 0x%02x, 0x%02x }, y = { 0x%02x, 0x%02x }\n", - PHPFUNC, buf[1], buf[2], buf[3], buf[4], buf[5]); + VNCFUNC, buf[1], buf[2], buf[3], buf[4], buf[5]); return 0; } @@ -336,11 +336,11 @@ vnc_set_pixel_format(int sfd, tServerFBParams params) unsigned char buf[20]; if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } - DPRINTF("%s: Setting up pixel format\n", PHPFUNC); + DPRINTF("%s: Setting up pixel format\n", VNCFUNC); memset(buf, 0, 20); /* Message type 0 is SetPixelFormat message */ @@ -370,12 +370,12 @@ vnc_set_pixel_format(int sfd, tServerFBParams params) if (write(sfd, buf, 20) < 0) { int err = errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } - DPRINTF("%s: Pixel format set\n", PHPFUNC); + DPRINTF("%s: Pixel format set\n", VNCFUNC); return 0; } @@ -393,11 +393,11 @@ vnc_set_encoding(int sfd) unsigned char buf[8]; if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } - DPRINTF("%s: Setting up encoding\n", PHPFUNC); + DPRINTF("%s: Setting up encoding\n", VNCFUNC); memset(buf, 0, 8); buf[0] = 0x02; @@ -412,12 +412,12 @@ vnc_set_encoding(int sfd) if (write(sfd, buf, 8) < 0) { int err = errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } - DPRINTF("%s: Client encoding set\n", PHPFUNC); + DPRINTF("%s: Client encoding set\n", VNCFUNC); return 0; } @@ -439,11 +439,11 @@ vnc_send_framebuffer_update(int sfd, int incrementalUpdate, int x, int y, int w, unsigned char buf[10]; if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } - DPRINTF("%s: Sending %s update request\n", PHPFUNC, (incrementalUpdate ? "standard" : "incremental")); + DPRINTF("%s: Sending %s update request\n", VNCFUNC, (incrementalUpdate ? "standard" : "incremental")); memset(buf, 0, 10); buf[0] = 0x03; buf[1] = incrementalUpdate; @@ -455,12 +455,12 @@ vnc_send_framebuffer_update(int sfd, int incrementalUpdate, int x, int y, int w, if (write(sfd, buf, 10) < 0) { int err = errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } - DPRINTF("%s: Request sent\n", PHPFUNC); + DPRINTF("%s: Request sent\n", VNCFUNC); return 0; } @@ -499,11 +499,11 @@ vnc_connect(char *server, char *port, int share) if (sfd < 0) return sfd; - DPRINTF("%s: Opened socket with descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Opened socket with descriptor #%d\n", VNCFUNC, sfd); if (read(sfd, buf, 1024) < 0) { int err = errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -522,7 +522,7 @@ vnc_connect(char *server, char *port, int share) return -err; } - DPRINTF("%s: Share desktop flag sent (%d)\n", PHPFUNC, buf[0]); + DPRINTF("%s: Share desktop flag sent (%d)\n", VNCFUNC, buf[0]); return sfd; } @@ -542,16 +542,16 @@ vnc_read_server_init(int sfd) tServerFBParams params = { 0 }; int len = 0, namelen = 0; - DPRINTF("%s: Server init - reading framebuffer parameters\n", PHPFUNC); + DPRINTF("%s: Server init - reading framebuffer parameters\n", VNCFUNC); if (read(sfd, tmpbuf, 24) < 0) { int err = errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); goto cleanup; } namelen = (int)CALC_UINT32(tmpbuf[20], tmpbuf[21], tmpbuf[22], tmpbuf[23]); - DPRINTF("%s: Name length is %d\n", PHPFUNC, namelen); + DPRINTF("%s: Name length is %d\n", VNCFUNC, namelen); buf = (unsigned char *)malloc(namelen + 25); memset(buf, 0, namelen + 25); @@ -559,7 +559,7 @@ vnc_read_server_init(int sfd) if ((len = read(sfd, buf + 24, namelen)) < 0) { int err = errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); goto cleanup; } @@ -587,16 +587,16 @@ int vnc_get_dimensions(char *server, char *port, int *width, int *height) tServerFBParams params; if (!width && !height) { - DPRINTF("%s: Neither width or height output value not defined\n", PHPFUNC); + DPRINTF("%s: Neither width or height output value not defined\n", VNCFUNC); return -EINVAL; } - DPRINTF("%s: server is %s, port is %s\n", PHPFUNC, server, port); + DPRINTF("%s: server is %s, port is %s\n", VNCFUNC, server, port); sfd = vnc_connect(server, port, 1); if (sfd < 0) { int err = errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -606,13 +606,13 @@ int vnc_get_dimensions(char *server, char *port, int *width, int *height) if (width) { *width = params.width; - DPRINTF("%s: Output parameter of width set to %d\n", PHPFUNC, *width); + DPRINTF("%s: Output parameter of width set to %d\n", VNCFUNC, *width); } if (height) { *height = params.height; - DPRINTF("%s: Output parameter of height set to %d\n", PHPFUNC, *height); + DPRINTF("%s: Output parameter of height set to %d\n", VNCFUNC, *height); } while (socket_has_data(sfd, 500000, 0) == 1) @@ -620,7 +620,7 @@ int vnc_get_dimensions(char *server, char *port, int *width, int *height) shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } @@ -740,7 +740,7 @@ int vnc_get_bitmap(char *server, char *port, char *fn) sfd = vnc_connect(server, port, 1); if (sfd < 0) { int err = errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -748,12 +748,12 @@ int vnc_get_bitmap(char *server, char *port, char *fn) params = vnc_read_server_init(sfd); pattern_size = params.width * params.height * (params.bpp / 8); - DPRINTF("%s: %ld\n", PHPFUNC, pattern_size); + DPRINTF("%s: %ld\n", VNCFUNC, pattern_size); vnc_set_pixel_format(sfd, params); vnc_set_encoding(sfd); - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); while (socket_has_data(sfd, 50000, 0) == 0) { @@ -766,7 +766,7 @@ int vnc_get_bitmap(char *server, char *port, char *fn) vnc_raw_to_bmp(file, fn, params.width, params.height); unlink(file); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } @@ -785,12 +785,12 @@ int vnc_send_keys(char *server, char *port, char *keys) int i, skip_next; tServerFBParams params; - DPRINTF("%s: server is %s, port is %s, keys are '%s'\n", PHPFUNC, server, port, keys); + DPRINTF("%s: server is %s, port is %s, keys are '%s'\n", VNCFUNC, server, port, keys); sfd = vnc_connect(server, port, 1); if (sfd < 0) { int err = errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -798,9 +798,9 @@ int vnc_send_keys(char *server, char *port, char *keys) params = vnc_read_server_init(sfd); skip_next = 0; - DPRINTF("%s: About to process key sequence '%s' (%d keys)\n", PHPFUNC, keys, (int)strlen(keys)); + DPRINTF("%s: About to process key sequence '%s' (%d keys)\n", VNCFUNC, keys, (int)strlen(keys)); for (i = 0; i < strlen(keys); i++) { - DPRINTF("%s: Processing key %d: %d [0x%02x]\n", PHPFUNC, i, keys[i], keys[i]); + DPRINTF("%s: Processing key %d: %d [0x%02x]\n", VNCFUNC, i, keys[i], keys[i]); if (skip_next) { skip_next = 0; continue; @@ -815,25 +815,25 @@ int vnc_send_keys(char *server, char *port, char *keys) skip_next = 1; } - DPRINTF("%s: Sending key press emulation for key %d\n", PHPFUNC, keys[i]); + DPRINTF("%s: Sending key press emulation for key %d\n", VNCFUNC, keys[i]); vnc_send_key(sfd, keys[i], skip_next, 0); - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); - DPRINTF("%s: Sending key release emulation for key %d\n", PHPFUNC, keys[i]); + DPRINTF("%s: Sending key release emulation for key %d\n", VNCFUNC, keys[i]); vnc_send_key(sfd, keys[i], skip_next, 1); /* Sleep for 50 ms, required to make VNC server accept the keystroke emulation */ usleep(50000); } - DPRINTF("%s: All %d keys sent\n", PHPFUNC, (int)strlen(keys)); + DPRINTF("%s: All %d keys sent\n", VNCFUNC, (int)strlen(keys)); while (socket_has_data(sfd, 500000, 0) == 1) socket_read(sfd, -1); shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } @@ -854,13 +854,13 @@ int vnc_send_pointer_event(char *server, char *port, int pos_x, int pos_y, int c int sfd; tServerFBParams params; - DPRINTF("%s: Server is %s, port is %s, x is %d, y is %d, clicked is %d, release is %d\n", PHPFUNC, + DPRINTF("%s: Server is %s, port is %s, x is %d, y is %d, clicked is %d, release is %d\n", VNCFUNC, server, port, pos_x, pos_y, clicked, release); sfd = vnc_connect(server, port, 0); if (sfd < 0) { int err = errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -870,7 +870,7 @@ int vnc_send_pointer_event(char *server, char *port, int pos_x, int pos_y, int c if (((pos_x > params.width) || (pos_y < 0)) || ((pos_y > params.height) || (pos_y < 0))) { DPRINTF("%s: Required positions out of range (width = %d, height = %d, x = %d, y = %d) for '%s'\n", - PHPFUNC, params.width, params.height, pos_x, pos_y, params.desktopName); + VNCFUNC, params.width, params.height, pos_x, pos_y, params.desktopName); return -EINVAL; } @@ -901,7 +901,7 @@ int vnc_send_pointer_event(char *server, char *port, int pos_x, int pos_y, int c shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } @@ -920,29 +920,29 @@ int vnc_refresh_screen(char *server, char *port, int scancode) int sfd; tServerFBParams params; - DPRINTF("%s: Server is %s, port is %s, scancode is %d\n", PHPFUNC, server, port, scancode); + DPRINTF("%s: Server is %s, port is %s, scancode is %d\n", VNCFUNC, server, port, scancode); - DPRINTF("%s: server is %s, port is %s\n", PHPFUNC, server, port); + DPRINTF("%s: server is %s, port is %s\n", VNCFUNC, server, port); sfd = vnc_connect(server, port, 1); if (sfd < 0) { int err = errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } params = vnc_read_server_init(sfd); - DPRINTF("%s: Sending key press emulation for key %d\n", PHPFUNC, scancode); + DPRINTF("%s: Sending key press emulation for key %d\n", VNCFUNC, scancode); if (scancode > -1) vnc_send_key(sfd, scancode, 1, 0); - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } -- 2.13.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list