2005-02-11 22:01:19 +00:00
|
|
|
#ifndef _LIBRFB_DECODER_H_
|
|
|
|
#define _LIBRFB_DECODER_H_
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <librfb/rfbbytestream.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2007-09-18 16:32:19 +00:00
|
|
|
enum {
|
|
|
|
SECURITY_FAIL = 0,
|
|
|
|
SECURITY_NONE,
|
|
|
|
SECURITY_VNC,
|
|
|
|
};
|
|
|
|
|
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)
|
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
typedef struct _RfbDecoder RfbDecoder;
|
|
|
|
|
|
|
|
struct _RfbDecoder
|
|
|
|
{
|
2006-11-17 03:15:40 +00:00
|
|
|
/* callbacks */
|
|
|
|
gint (*send_data) (guint8 *buffer, gint length, gpointer user_data);
|
|
|
|
void (*paint_rect) (RfbDecoder *decoder, gint x, gint y, gint w, gint h,
|
|
|
|
guint8 *data);
|
|
|
|
void (*copy_rect) (RfbDecoder *decoder, gint x, gint y, gint w, gint h,
|
|
|
|
gint src_x, gint src_y);
|
|
|
|
gboolean (*state) (RfbDecoder *decoder);
|
|
|
|
|
2005-02-11 22:01:19 +00:00
|
|
|
gpointer buffer_handler_data;
|
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
gint fd;
|
2005-02-11 22:01:19 +00:00
|
|
|
RfbBytestream *bytestream;
|
|
|
|
|
|
|
|
gpointer decoder_private;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
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;
|
2005-02-11 22:01:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
typedef struct _RfbRect
|
|
|
|
{
|
|
|
|
RfbConnection *connection;
|
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
guint x_pos;
|
|
|
|
guint y_pos;
|
|
|
|
guint width;
|
|
|
|
guint height;
|
|
|
|
guint encoding_type;
|
2005-02-11 22:01:19 +00:00
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
gchar *data;
|
2005-02-11 22:01:19 +00:00
|
|
|
} RfbRect;
|
|
|
|
#endif
|
|
|
|
|
2006-11-17 03:15:40 +00:00
|
|
|
RfbDecoder *rfb_decoder_new (void);
|
|
|
|
void rfb_decoder_free (RfbDecoder * decoder);
|
|
|
|
void rfb_decoder_use_file_descriptor (RfbDecoder * decoder,
|
|
|
|
gint fd);
|
|
|
|
gboolean rfb_decoder_connect_tcp (RfbDecoder * decoder,
|
|
|
|
gchar * addr,
|
|
|
|
guint port);
|
|
|
|
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
|