libguac 1.5.5
Loading...
Searching...
No Matches
socket.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef _GUAC_SOCKET_H
21#define _GUAC_SOCKET_H
22
29#include "client-types.h"
30#include "socket-constants.h"
31#include "socket-fntypes.h"
32#include "socket-types.h"
33#include "timestamp-types.h"
34
35#include <pthread.h>
36#include <stdint.h>
37#include <unistd.h>
38
117
126
133
143
151
159
174
198
230
256
282
295ssize_t guac_socket_write_int(guac_socket* socket, int64_t i);
296
309ssize_t guac_socket_write_string(guac_socket* socket, const char* str);
310
327ssize_t guac_socket_write_base64(guac_socket* socket, const void* buf, size_t count);
328
341ssize_t guac_socket_write(guac_socket* socket, const void* buf, size_t count);
342
356ssize_t guac_socket_read(guac_socket* socket, void* buf, size_t count);
357
368
379
396int guac_socket_select(guac_socket* socket, int usec_timeout);
397
398#endif
399
Type definitions related to the Guacamole client structure, guac_client.
Constants related to the guac_socket object.
Function type definitions related to the guac_socket object.
void guac_socket_lock_handler(guac_socket *socket)
When set within a guac_socket, a handler of this type will be called whenever exclusive access to the...
Definition socket-fntypes.h:93
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-fntypes.h:56
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-fntypes.h:43
ssize_t guac_socket_flush_handler(guac_socket *socket)
Generic flush handler for socket flush operations.
Definition socket-fntypes.h:83
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-fntypes.h:70
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-fntypes.h:113
void guac_socket_unlock_handler(guac_socket *socket)
When set within a guac_socket, a handler of this type will be called whenever exclusive access to the...
Definition socket-fntypes.h:103
Type definitions related to the guac_socket object.
guac_socket_state
Possible current states of a guac_socket.
Definition socket-types.h:38
void guac_socket_instruction_begin(guac_socket *socket)
Marks the beginning of a Guacamole protocol instruction.
ssize_t guac_socket_flush_base64(guac_socket *socket)
Flushes the base64 buffer, writing padding characters as necessary.
void guac_socket_require_keep_alive(guac_socket *socket)
Declares that the given socket must automatically send a keep-alive ping to ensure neither side of th...
guac_socket * guac_socket_tee(guac_socket *primary, guac_socket *secondary)
Allocates and initializes a new guac_socket which delegates all socket operations to the given primar...
guac_socket * guac_socket_broadcast(guac_client *client)
Allocates and initializes a new guac_socket which duplicates all instructions written across the sock...
void guac_socket_free(guac_socket *socket)
Frees the given guac_socket and all associated resources.
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.
ssize_t guac_socket_write_int(guac_socket *socket, int64_t i)
Writes the given unsigned int to the given guac_socket object.
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.
guac_socket * guac_socket_broadcast_pending(guac_client *client)
Allocates and initializes a new guac_socket which duplicates all instructions written across the sock...
ssize_t guac_socket_flush(guac_socket *socket)
Flushes the write buffer.
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.
ssize_t guac_socket_write_string(guac_socket *socket, const char *str)
Writes the given string to the given guac_socket object.
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(guac_socket *socket, const void *buf, size_t count)
Writes the given data to the specified socket.
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...
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 ...
Guacamole proxy client.
Definition client.h:48
The core I/O object of Guacamole.
Definition socket.h:39
guac_socket_write_handler * write_handler
Handler which will be called whenever data is written to this socket.
Definition socket.h:54
guac_socket_read_handler * read_handler
Handler which will be called when data needs to be read from the socket.
Definition socket.h:49
guac_socket_free_handler * free_handler
Handler which will be called when the socket is free'd (closed).
Definition socket.h:82
guac_socket_lock_handler * lock_handler
Handler which will be called whenever a socket needs to be acquired for exclusive access,...
Definition socket.h:65
guac_socket_unlock_handler * unlock_handler
Handler which will be called whenever exclusive access to a socket is being released,...
Definition socket.h:71
guac_socket_state state
The current state of this guac_socket.
Definition socket.h:87
void * data
Arbitrary socket-specific data.
Definition socket.h:44
guac_socket_select_handler * select_handler
Handler which will be called whenever guac_socket_select() is invoked on this socket.
Definition socket.h:77
guac_timestamp last_write_timestamp
The timestamp associated with the time the last block of data was written to this guac_socket.
Definition socket.h:93
guac_socket_flush_handler * flush_handler
Handler which will be called whenever this socket needs to be flushed.
Definition socket.h:59
Type definitions related to Guacamole protocol timestamps.
int64_t guac_timestamp
An arbitrary timestamp denoting a relative time value in milliseconds.
Definition timestamp-types.h:34