2005-02-11 22:01:19 +00:00
|
|
|
#ifndef _LIBRFB_DECODER_H_
|
|
|
|
#define _LIBRFB_DECODER_H_
|
|
|
|
|
2013-05-10 16:49:46 +00:00
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
2013-05-11 18:41:22 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
enum
|
2007-10-31 14:09:25 +00:00
|
|
|
{
|
|
|
|
SECURITY_FAIL = 0,
|
|
|
|
SECURITY_NONE,
|
|
|
|
SECURITY_VNC,
|
2007-09-18 16:32:19 +00:00
|
|
|
};
|
|
|
|
|
2007-09-19 13:06:17 +00:00
|
|
|
#define IS_VERSION(x, ma, mi) ((x->protocol_major == ma) && (x->protocol_minor == mi))
|
|
|
|
#define IS_VERSION_3_3(x) IS_VERSION(x, 3, 3)
|
|
|
|
#define IS_VERSION_3_7(x) IS_VERSION(x, 3, 7)
|
|
|
|
#define IS_VERSION_3_8(x) IS_VERSION(x, 3, 8)
|
|
|
|
|
2007-10-31 14:09:25 +00:00
|
|
|
#define MESSAGE_TYPE_FRAMEBUFFER_UPDATE 0
|
|
|
|
|
|
|
|
#define ENCODING_TYPE_RAW 0
|
|
|
|
#define ENCODING_TYPE_COPYRECT 1
|
2007-11-29 13:32:11 +00:00
|
|
|
#define ENCODING_TYPE_RRE 2
|
2007-11-30 14:08:15 +00:00
|
|
|
#define ENCODING_TYPE_CORRE 4
|
2008-11-05 22:25:25 +00:00
|
|
|
#define ENCODING_TYPE_HEXTILE 5
|
|
|
|
|
|
|
|
#define SUBENCODING_RAW 1
|
|
|
|
#define SUBENCODING_BACKGROUND 2
|
|
|
|
#define SUBENCODING_FOREGROUND 4
|
|
|
|
#define SUBENCODING_ANYSUBRECTS 8
|
|
|
|
#define SUBENCODING_SUBRECTSCOLORED 16
|
2007-10-31 14:09:25 +00:00
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
typedef struct _RfbDecoder RfbDecoder;
|
|
|
|
|
|
|
|
struct _RfbDecoder
|
|
|
|
{
|
2006-11-17 03:15:40 +00:00
|
|
|
/* callbacks */
|
2007-10-31 14:09:25 +00:00
|
|
|
gboolean (*state) (RfbDecoder * decoder);
|
2006-11-17 03:15:40 +00:00
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
gpointer buffer_handler_data;
|
|
|
|
|
2016-03-16 22:48:49 +00:00
|
|
|
GSocketClient *socket_client;
|
|
|
|
GSocketConnection *connection;
|
2013-05-10 16:49:46 +00:00
|
|
|
GCancellable *cancellable;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2008-11-05 22:25:25 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint32 data_len;
|
2005-02-11 22:01:19 +00:00
|
|
|
gpointer decoder_private;
|
2007-10-31 14:09:25 +00:00
|
|
|
guint8 *frame;
|
|
|
|
guint8 *prev_frame;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2013-05-11 18:41:22 +00:00
|
|
|
GError *error;
|
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
/* settable properties */
|
|
|
|
gboolean shared_flag;
|
|
|
|
|
|
|
|
/* readable properties */
|
|
|
|
gboolean inited;
|
|
|
|
|
2007-09-17 21:12:17 +00:00
|
|
|
guint protocol_major;
|
|
|
|
guint protocol_minor;
|
2006-11-17 03:15:40 +00:00
|
|
|
guint security_type;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2007-09-19 13:06:17 +00:00
|
|
|
gchar *password;
|
2007-11-29 13:32:11 +00:00
|
|
|
gboolean use_copyrect;
|
2007-09-19 13:06:17 +00:00
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
guint bpp;
|
|
|
|
guint depth;
|
2005-02-11 22:01:19 +00:00
|
|
|
gboolean big_endian;
|
|
|
|
gboolean true_colour;
|
2006-11-17 03:15:40 +00:00
|
|
|
guint red_max;
|
|
|
|
guint green_max;
|
|
|
|
guint blue_max;
|
|
|
|
guint red_shift;
|
|
|
|
guint green_shift;
|
|
|
|
guint blue_shift;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
gchar *name;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2007-09-21 14:55:19 +00:00
|
|
|
/* information if we don't want to update the whole screen */
|
|
|
|
guint offset_x;
|
|
|
|
guint offset_y;
|
|
|
|
guint rect_width;
|
|
|
|
guint rect_height;
|
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
gint n_rects;
|
2007-11-15 15:32:47 +00:00
|
|
|
|
|
|
|
/* some many used values */
|
|
|
|
guint bytespp;
|
|
|
|
guint line_size;
|
2016-03-24 20:46:49 +00:00
|
|
|
|
|
|
|
/* Seriliaze writes operations */
|
|
|
|
GMutex write_lock;
|
2005-02-11 22:01:19 +00:00
|
|
|
};
|
|
|
|
|
2007-10-31 14:09:25 +00:00
|
|
|
RfbDecoder *rfb_decoder_new (void);
|
|
|
|
void rfb_decoder_free (RfbDecoder * decoder);
|
|
|
|
gboolean rfb_decoder_connect_tcp (RfbDecoder * decoder,
|
2013-05-10 16:49:46 +00:00
|
|
|
gchar * host, guint port);
|
2016-03-24 22:14:17 +00:00
|
|
|
void rfb_decoder_disconnect (RfbDecoder * decoder);
|
2007-10-31 14:09:25 +00:00
|
|
|
gboolean rfb_decoder_iterate (RfbDecoder * decoder);
|
|
|
|
void rfb_decoder_send_update_request (RfbDecoder * decoder,
|
|
|
|
gboolean incremental, gint x, gint y, gint width, gint height);
|
|
|
|
void rfb_decoder_send_key_event (RfbDecoder * decoder,
|
|
|
|
guint key, gboolean down_flag);
|
|
|
|
void rfb_decoder_send_pointer_event (RfbDecoder * decoder,
|
|
|
|
gint button_mask, gint x, gint y);
|
2005-02-11 22:01:19 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
#endif
|