guacamole/instruction.h File Reference

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

void guac_instruction_free (guac_instruction *instruction)
 Frees all memory allocated to the given instruction.
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.
guac_instructionguac_instruction_read (guac_socket *socket, int usec_timeout)
 Reads a single instruction from the given guac_socket connection.
guac_instructionguac_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.

Detailed Description

Provides functions and structures for reading, writing, and manipulating Guacamole instructions.


Function Documentation

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.

Parameters:
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.
Returns:
A new instruction if an instruction with the given opcode was read, NULL otherwise. If an instruction was read, but the instruction had a different opcode, NULL is returned and guac_error is set to GUAC_STATUS_BAD_STATE.
void guac_instruction_free ( guac_instruction instruction  ) 

Frees all memory allocated to the given instruction.

Parameters:
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.

Parameters:
socket The guac_socket connection to use.
usec_timeout The maximum number of microseconds to wait before giving up.
Returns:
A new instruction if data was successfully read, NULL on error or if the instruction could not be read completely because the timeout elapsed, in which case guac_error will be set to GUAC_STATUS_INPUT_TIMEOUT and subsequent calls to guac_protocol_read_instruction() will return the parsed instruction once enough data is available.
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.

Parameters:
socket The guac_socket connection to use.
usec_timeout The maximum number of microseconds to wait before giving up.
Returns:
A positive value if data is available, negative on error, or zero if no data is currently available.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 26 May 2014 for libguac by  doxygen 1.6.1