Provides functions and structures for reading, writing, and manipulating Guacamole instructions. More...
Go to the source code of this file.
Data Structures | |
struct | guac_instruction |
Represents a single instruction within the Guacamole protocol. More... | |
Functions | |
guac_instruction * | guac_instruction_alloc () |
Allocates a new instruction. More... | |
void | guac_instruction_reset (guac_instruction *instruction) |
Resets the parse state and contents of the given instruction, such that the memory of that instruction can be reused for another parse cycle. More... | |
int | guac_instruction_append (guac_instruction *instruction, void *buffer, int length) |
Appends data from the given buffer to the given instruction. More... | |
void | guac_instruction_free (guac_instruction *instruction) |
Frees all memory allocated to the given instruction. More... | |
int | guac_instruction_waiting (guac_socket *socket, int usec_timeout) |
Returns whether new instruction data is available on the given guac_socket connection for parsing. More... | |
guac_instruction * | guac_instruction_read (guac_socket *socket, int usec_timeout) |
Reads a single instruction from the given guac_socket connection. More... | |
guac_instruction * | guac_instruction_expect (guac_socket *socket, int usec_timeout, const char *opcode) |
Reads a single instruction with the given opcode from the given guac_socket connection. More... | |
Provides functions and structures for reading, writing, and manipulating Guacamole instructions.
guac_instruction* guac_instruction_alloc | ( | ) |
Allocates a new instruction.
Each instruction contains within itself the necessary facilities to parse instruction data.
int guac_instruction_append | ( | guac_instruction * | instruction, |
void * | buffer, | ||
int | length | ||
) |
Appends data from the given buffer to the given instruction.
The data will be appended, if possible, to this instruction as a reference and thus the buffer must remain valid throughout the life of the instruction. This function may modify the contents of the buffer when those contents are part of an element within the instruction being read.
instruction | The instruction to append data to. |
buffer | A buffer containing data that should be appended to this instruction. |
length | The number of bytes available for appending within the buffer. |
guac_instruction* guac_instruction_expect | ( | guac_socket * | socket, |
int | usec_timeout, | ||
const char * | opcode | ||
) |
Reads a single instruction with the given opcode from the given guac_socket connection.
If an error occurs reading the instruction, NULL is returned, and guac_error is set appropriately.
If the instruction read is not the expected instruction, NULL is returned, and guac_error is set to GUAC_STATUS_BAD_STATE.
socket | The guac_socket connection to use. |
usec_timeout | The maximum number of microseconds to wait before giving up. |
opcode | The opcode of the instruction to read. |
void guac_instruction_free | ( | guac_instruction * | instruction | ) |
Frees all memory allocated to the given instruction.
instruction | The instruction to free. |
guac_instruction* guac_instruction_read | ( | guac_socket * | socket, |
int | usec_timeout | ||
) |
Reads a single instruction from the given guac_socket connection.
If an error occurs reading the instruction, NULL is returned, and guac_error is set appropriately.
socket | The guac_socket connection to use. |
usec_timeout | The maximum number of microseconds to wait before giving up. |
void guac_instruction_reset | ( | guac_instruction * | instruction | ) |
Resets the parse state and contents of the given instruction, such that the memory of that instruction can be reused for another parse cycle.
instruction | The instruction to reset. |
int guac_instruction_waiting | ( | guac_socket * | socket, |
int | usec_timeout | ||
) |
Returns whether new instruction data is available on the given guac_socket connection for parsing.
socket | The guac_socket connection to use. |
usec_timeout | The maximum number of microseconds to wait before giving up. |