38 #ifndef _GUAC_SOCKET_H
39 #define _GUAC_SOCKET_H
54 #define GUAC_SOCKET_OUTPUT_BUFFER_SIZE 8192
69 void* buf,
size_t count);
82 const void* buf,
size_t count);
166 int __instructionbuf_parse_start;
171 int __instructionbuf_size;
176 int __instructionbuf_used_length;
183 char* __instructionbuf;
188 int __instructionbuf_elementc;
194 char* __instructionbuf_elementv[64];
200 int __threadsafe_instructions;
206 pthread_mutex_t __instruction_write_lock;
211 pthread_mutex_t __buffer_lock;
guac_socket * guac_socket_nest(guac_socket *parent, int index)
Allocates and initializes a new guac_socket which writes all data via nest instructions to the given ...
ssize_t guac_socket_flush_base64(guac_socket *socket)
Flushes the base64 buffer, writing padding characters as necessary.
guac_socket_free_handler * free_handler
Handler which will be called when the socket is free'd (closed).
Definition: socket.h:139
void guac_socket_instruction_begin(guac_socket *socket)
Marks the beginning of a Guacamole protocol instruction.
ssize_t guac_socket_read_handler(guac_socket *socket, void *buf, size_t count)
Generic read handler for socket read operations, modeled after the standard POSIX read() function...
Definition: socket.h:68
The core I/O object of Guacamole.
Definition: socket.h:111
void guac_socket_update_buffer_begin(guac_socket *socket)
Marks the beginning of a socket's buffer modification.
void guac_socket_free(guac_socket *socket)
Frees the given guac_socket and all associated resources.
guac_socket * guac_socket_open(int fd)
Allocates and initializes a new guac_socket object with the given open file descriptor.
ssize_t guac_socket_write_string(guac_socket *socket, const char *str)
Writes the given string to the given guac_socket object.
guac_socket_write_handler * write_handler
Handler which will be called whenever data is written to this socket.
Definition: socket.h:128
ssize_t guac_socket_write_handler(guac_socket *socket, const void *buf, size_t count)
Generic write handler for socket write operations, modeled after the standard POSIX write() function...
Definition: socket.h:81
int guac_socket_select_handler(guac_socket *socket, int usec_timeout)
Generic handler for socket select operations, similar to the POSIX select() function.
Definition: socket.h:95
ssize_t guac_socket_write_base64(guac_socket *socket, const void *buf, size_t count)
Writes the given binary data to the given guac_socket object as base64- encoded data.
void guac_socket_require_threadsafe(guac_socket *socket)
Declares that the given socket must behave in a threadsafe way.
void guac_socket_update_buffer_end(guac_socket *socket)
Marks the end of a socket's buffer modification.
ssize_t guac_socket_read(guac_socket *socket, void *buf, size_t count)
Attempts to read data from the socket, filling up to the specified number of bytes in the given buffe...
ssize_t guac_socket_write(guac_socket *socket, const void *buf, size_t count)
Writes the given data to the specified socket.
#define GUAC_SOCKET_OUTPUT_BUFFER_SIZE
The number of bytes to buffer within each socket before flushing.
Definition: socket.h:54
void guac_socket_instruction_end(guac_socket *socket)
Marks the end of a Guacamole protocol instruction.
guac_socket * guac_socket_alloc()
Allocates a new, completely blank guac_socket.
int guac_socket_select(guac_socket *socket, int usec_timeout)
Waits for input to be available on the given guac_socket object until the specified timeout elapses...
guac_socket_select_handler * select_handler
Handler which will be called whenever guac_socket_select is invoked on this socket.
Definition: socket.h:134
ssize_t guac_socket_flush(guac_socket *socket)
Flushes the write buffer.
ssize_t guac_socket_write_int(guac_socket *socket, int64_t i)
Writes the given unsigned int to the given guac_socket object.
void * data
Arbitrary socket-specific data.
Definition: socket.h:116
int guac_socket_free_handler(guac_socket *socket)
Generic handler for the closing of a socket, modeled after the standard POSIX close() function...
Definition: socket.h:105
guac_socket_read_handler * read_handler
Handler which will be called when data needs to be read from the socket.
Definition: socket.h:121