GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A proxy backend protocol definitions. More...
#include <core/gp_pixmap.h>
#include <core/gp_pixel.h>
#include <input/gp_event.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | gp_proxy_event |
A proxy input event message. More... | |
struct | gp_proxy_path |
A SHM path and size for a mmap(). More... | |
struct | gp_proxy_rect_ |
A rectangle. More... | |
struct | gp_proxy_map |
A mmap() request. More... | |
struct | gp_proxy_pixmap |
A pixmap request. More... | |
struct | gp_proxy_rect |
A rectangle update request. More... | |
struct | gp_proxy_cli_init_ |
An initial infromation send to a client (application). More... | |
struct | gp_proxy_cli_init |
An initial infromation send to a client (application). More... | |
struct | gp_proxy_coord |
A coordinate. More... | |
struct | gp_proxy_cursor |
A proxy cursor position. More... | |
union | gp_proxy_msg |
A proxy message. More... | |
struct | gp_proxy_buf |
A proxy message buffer. More... | |
Macros | |
#define | GP_PROXY_BUF_SIZE 128 |
A proxy buffer size. | |
Typedefs | |
typedef struct gp_proxy_coord | gp_proxy_coord |
A coordinate. | |
typedef union gp_proxy_msg | gp_proxy_msg |
A proxy message. | |
typedef struct gp_proxy_buf | gp_proxy_buf |
A proxy message buffer. | |
Enumerations | |
enum | gp_proxy_msg_types { GP_PROXY_NAME , GP_PROXY_EXIT , GP_PROXY_CLI_INIT , GP_PROXY_EVENT , GP_PROXY_MAP , GP_PROXY_UNMAP , GP_PROXY_PIXMAP , GP_PROXY_SHOW , GP_PROXY_HIDE , GP_PROXY_UPDATE , GP_PROXY_CURSOR_POS , GP_PROXY_MAX } |
A proxy message type, identifies the type of the payload. More... | |
Functions | |
static void | gp_proxy_buf_init (gp_proxy_buf *buf) |
Initialize proxy buffer position and size. | |
const char * | gp_proxy_msg_type_name (enum gp_proxy_msg_types type) |
Returns a string name for a proxy message type. | |
int | gp_proxy_next (gp_proxy_buf *buf, gp_proxy_msg **msg) |
Parse next message in the buffer. | |
int | gp_proxy_buf_recv (int fd, gp_proxy_buf *buf) |
Receives data from from fd and stores them to the proxy buffer. | |
int | gp_proxy_send (int fd, enum gp_proxy_msg_types type, void *payload) |
Sends a message to the server/client. | |
A proxy backend protocol definitions.
Definition in file gp_proxy_proto.h.
#define GP_PROXY_BUF_SIZE 128 |
A proxy buffer size.
Must be bigger than maximal message size!
Definition at line 281 of file gp_proxy_proto.h.
typedef union gp_proxy_msg gp_proxy_msg |
A proxy message.
The type of payload is determined by the type field.
enum gp_proxy_msg_types |
A proxy message type, identifies the type of the payload.
A message type is always send in the first 32bits of the proxy message. A message type is followed by a 32bit field with message lenght and optional payload. The size field always includes the header size, so it's always at least set to 8 bytes. Messages are also padded with zeroes so that the size is always multiple of 4 bytes.
Enumerator | |
---|---|
GP_PROXY_NAME | Sets an application name. This is send to the sever by the application after successfull connection. The string in the message is not NULL terminated and passed directly after the hader. The lenght of the string plus the size of the header is stored in the size field. |
GP_PROXY_EXIT | Requests an application exit. When application receives this message a GP_EV_SYS_QUIT event is put into the application event queue. There is no payload the message size is always 8 bytes long. |
GP_PROXY_CLI_INIT | Backend sends a basic information to the client (application). The payload lenght is sizeof(struct gp_proxy_cli_init) and among other things stores the pixel type for the application to use for drawing. This message is send to the application right after it connects to the server and the application waits for this message before it finished its initialization. See also struct gp_proxy_cli_init. |
GP_PROXY_EVENT | Backend sends a gp_event to the application. The payload is an input gp_event which is put into the application event queue. See also struct gp_proxy_event. |
GP_PROXY_MAP | A buffer map request or confirmation. This message is send both by the sever and the application:
|
GP_PROXY_UNMAP | A buffer unmap request or confirmation. This message is send both by the sever and the application, there is no payload in both cases:
|
GP_PROXY_PIXMAP | Server asks client to create a pixmap from the shared buffer. This request is send by the sever after application successfully maped a shared buffer to create a pixmap to draw to. The payload is a gp_pixmap structure. |
GP_PROXY_SHOW | Server requests to show application is on screen. The application will start rendering and screen updates. |
GP_PROXY_HIDE | Server requests to hide application is from screen. The application will stop rendering and screen updated. |
GP_PROXY_UPDATE | Application asks server to update a rect on screen. This is send to a sever by the application when application rendered a rectangle into the shared memory and requests the sever to update it. The payload is the struct gp_proxy_rect. |
GP_PROXY_CURSOR_POS | Sets a cursor position. Send by the sever to an application to set the intial cursor position. |
GP_PROXY_MAX | Last message type + 1. |
Definition at line 30 of file gp_proxy_proto.h.
|
inlinestatic |
Initialize proxy buffer position and size.
buf | A proxy buffer. |
Definition at line 298 of file gp_proxy_proto.h.
References gp_proxy_buf::pos, and gp_proxy_buf::size.
int gp_proxy_buf_recv | ( | int | fd, |
gp_proxy_buf * | buf | ||
) |
Receives data from from fd and stores them to the proxy buffer.
fd | File descriptor connected to the server/client. |
buf | Proxy buffer to store data to. |
const char * gp_proxy_msg_type_name | ( | enum gp_proxy_msg_types | type | ) |
Returns a string name for a proxy message type.
type | A proxy message type. |
int gp_proxy_next | ( | gp_proxy_buf * | buf, |
gp_proxy_msg ** | msg | ||
) |
Parse next message in the buffer.
Parses next message in the proxy buffer, the start of the message is stored into the msg pointer. If there was no message parsed the msg pointer is set to NULL.
buf | Proxy buffer filled by the gp_proxy_buf_recv() function. |
msg | Pointer to store the start of the next message to. |
int gp_proxy_send | ( | int | fd, |
enum gp_proxy_msg_types | type, | ||
void * | payload | ||
) |
Sends a message to the server/client.
fd | File descriptor connected to the server/client. |
type | Type of the message. |
payload | Pointer to message payload accordingly to the message type. |
Referenced by gp_proxy_cli_event(), and gp_proxy_cli_send().