source: mainline/uspace/srv/hid/rfb/rfb.h@ 5c65e61

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5c65e61 was 38c822e, checked in by Martin Sucha <sucha14@…>, 12 years ago

rfb: add very basic support for TRLE encoding

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/*
2 * Copyright (c) 2013 Martin Sucha
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef RFB_H__
30#define RFB_H__
31
32#include <io/pixelmap.h>
33#include <fibril_synch.h>
34
35#define RFB_SECURITY_NONE 1
36#define RFB_SECURITY_HANDSHAKE_OK 0
37
38#define RFB_CMSG_SET_PIXEL_FORMAT 0
39#define RFB_CMSG_SET_ENCODINGS 2
40#define RFB_CMSG_FRAMEBUFFER_UPDATE_REQUEST 3
41#define RFB_CMSG_KEY_EVENT 4
42#define RFB_CMSG_POINTER_EVENT 5
43#define RFB_CMSG_CLIENT_CUT_TEXT 6
44
45#define RFB_SMSG_FRAMEBUFFER_UPDATE 0
46#define RFB_SMSG_SET_COLOR_MAP_ENTRIES 1
47#define RFB_SMSG_BELL 2
48#define RFB_SMSG_SERVER_CUT_TEXT 3
49
50#define RFB_ENCODING_RAW 0
51#define RFB_ENCODING_TRLE 15
52
53#define RFB_TILE_ENCODING_RAW 0
54#define RFB_TILE_ENCODING_SOLID 1
55
56typedef struct {
57 uint8_t bpp;
58 uint8_t depth;
59 uint8_t big_endian;
60 uint8_t true_color;
61 uint16_t r_max;
62 uint16_t g_max;
63 uint16_t b_max;
64 uint8_t r_shift;
65 uint8_t g_shift;
66 uint8_t b_shift;
67 uint8_t pad[3];
68} __attribute__((packed)) rfb_pixel_format_t;
69
70typedef struct {
71 uint16_t width;
72 uint16_t height;
73 rfb_pixel_format_t pixel_format;
74 uint32_t name_length;
75 char name[0];
76} __attribute__((packed)) rfb_server_init_t;
77
78typedef struct {
79 uint8_t message_type;
80 uint8_t pad[3];
81 rfb_pixel_format_t pixel_format;
82} __attribute__((packed)) rfb_set_pixel_format_t;
83
84typedef struct {
85 uint8_t message_type;
86 uint8_t pad;
87 uint16_t count;
88} __attribute__((packed)) rfb_set_encodings_t;
89
90typedef struct {
91 uint8_t message_type;
92 uint8_t incremental;
93 uint16_t x;
94 uint16_t y;
95 uint16_t width;
96 uint16_t height;
97} __attribute__((packed)) rfb_framebuffer_update_request_t;
98
99typedef struct {
100 uint8_t message_type;
101 uint8_t down_flag;
102 uint8_t pad[2];
103 uint32_t key;
104} __attribute__((packed)) rfb_key_event_t;
105
106typedef struct {
107 uint8_t message_type;
108 uint8_t button_mask;
109 uint16_t x;
110 uint16_t y;
111} __attribute__((packed)) rfb_pointer_event_t;
112
113typedef struct {
114 uint8_t message_type;
115 uint8_t pad;
116 uint32_t length;
117 char text[0];
118} __attribute__((packed)) rfb_client_cut_text_t;
119
120typedef struct {
121 uint16_t x;
122 uint16_t y;
123 uint16_t width;
124 uint16_t height;
125 int32_t enctype;
126 uint8_t data[0];
127} __attribute__((packed)) rfb_rectangle_t;
128
129typedef struct {
130 uint8_t message_type;
131 uint8_t pad;
132 uint16_t rect_count;
133} __attribute__((packed)) rfb_framebuffer_update_t;
134
135typedef struct {
136 uint8_t message_type;
137 uint8_t pad;
138 uint16_t first_color;
139 uint16_t color_count;
140} __attribute((packed)) rfb_set_color_map_entries_t;
141
142typedef struct {
143 uint16_t red;
144 uint16_t green;
145 uint16_t blue;
146} __attribute__((packed)) rfb_color_map_entry_t;
147
148typedef struct {
149 uint16_t width;
150 uint16_t height;
151 rfb_pixel_format_t pixel_format;
152 const char *name;
153 int listen_sd;
154 pixelmap_t framebuffer;
155 rfb_rectangle_t damage_rect;
156 bool damage_valid;
157 fibril_mutex_t lock;
158 pixel_t *palette;
159 size_t palette_used;
160 bool supports_trle;
161} rfb_t;
162
163
164extern int rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
165extern int rfb_set_size(rfb_t *, uint16_t, uint16_t);
166extern int rfb_listen(rfb_t *, uint16_t);
167extern void rfb_accept(rfb_t *);
168
169#endif
Note: See TracBrowser for help on using the repository browser.