亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vnc.c

?? QEMU 0.91 source code, supports ARM processor including S3C24xx series
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* * QEMU VNC display driver * * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws> * Copyright (C) 2006 Fabrice Bellard * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */#include "qemu-common.h"#include "console.h"#include "sysemu.h"#include "qemu_socket.h"#include "qemu-timer.h"#define VNC_REFRESH_INTERVAL (1000 / 30)#include "vnc_keysym.h"#include "keymaps.c"#include "d3des.h"#if CONFIG_VNC_TLS#include <gnutls/gnutls.h>#include <gnutls/x509.h>#endif /* CONFIG_VNC_TLS */// #define _VNC_DEBUG 1#if _VNC_DEBUG#define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)#if CONFIG_VNC_TLS && _VNC_DEBUG >= 2/* Very verbose, so only enabled for _VNC_DEBUG >= 2 */static void vnc_debug_gnutls_log(int level, const char* str) {    VNC_DEBUG("%d %s", level, str);}#endif /* CONFIG_VNC_TLS && _VNC_DEBUG */#else#define VNC_DEBUG(fmt, ...) do { } while (0)#endiftypedef struct Buffer{    size_t capacity;    size_t offset;    uint8_t *buffer;} Buffer;typedef struct VncState VncState;typedef int VncReadEvent(VncState *vs, uint8_t *data, size_t len);typedef void VncWritePixels(VncState *vs, void *data, int size);typedef void VncSendHextileTile(VncState *vs,                                int x, int y, int w, int h,                                uint32_t *last_bg,                                uint32_t *last_fg,                                int *has_bg, int *has_fg);#define VNC_MAX_WIDTH 2048#define VNC_MAX_HEIGHT 2048#define VNC_DIRTY_WORDS (VNC_MAX_WIDTH / (16 * 32))#define VNC_AUTH_CHALLENGE_SIZE 16enum {    VNC_AUTH_INVALID = 0,    VNC_AUTH_NONE = 1,    VNC_AUTH_VNC = 2,    VNC_AUTH_RA2 = 5,    VNC_AUTH_RA2NE = 6,    VNC_AUTH_TIGHT = 16,    VNC_AUTH_ULTRA = 17,    VNC_AUTH_TLS = 18,    VNC_AUTH_VENCRYPT = 19};#if CONFIG_VNC_TLSenum {    VNC_WIREMODE_CLEAR,    VNC_WIREMODE_TLS,};enum {    VNC_AUTH_VENCRYPT_PLAIN = 256,    VNC_AUTH_VENCRYPT_TLSNONE = 257,    VNC_AUTH_VENCRYPT_TLSVNC = 258,    VNC_AUTH_VENCRYPT_TLSPLAIN = 259,    VNC_AUTH_VENCRYPT_X509NONE = 260,    VNC_AUTH_VENCRYPT_X509VNC = 261,    VNC_AUTH_VENCRYPT_X509PLAIN = 262,};#if CONFIG_VNC_TLS#define X509_CA_CERT_FILE "ca-cert.pem"#define X509_CA_CRL_FILE "ca-crl.pem"#define X509_SERVER_KEY_FILE "server-key.pem"#define X509_SERVER_CERT_FILE "server-cert.pem"#endif#endif /* CONFIG_VNC_TLS */struct VncState{    QEMUTimer *timer;    int lsock;    int csock;    DisplayState *ds;    int need_update;    int width;    int height;    uint32_t dirty_row[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS];    char *old_data;    int depth; /* internal VNC frame buffer byte per pixel */    int has_resize;    int has_hextile;    int has_pointer_type_change;    int absolute;    int last_x;    int last_y;    int major;    int minor;    char *display;    char *password;    int auth;#if CONFIG_VNC_TLS    int subauth;    int x509verify;    char *x509cacert;    char *x509cacrl;    char *x509cert;    char *x509key;#endif    char challenge[VNC_AUTH_CHALLENGE_SIZE];#if CONFIG_VNC_TLS    int wiremode;    gnutls_session_t tls_session;#endif    Buffer output;    Buffer input;    kbd_layout_t *kbd_layout;    /* current output mode information */    VncWritePixels *write_pixels;    VncSendHextileTile *send_hextile_tile;    int pix_bpp, pix_big_endian;    int red_shift, red_max, red_shift1;    int green_shift, green_max, green_shift1;    int blue_shift, blue_max, blue_shift1;    VncReadEvent *read_handler;    size_t read_handler_expect;    /* input */    uint8_t modifiers_state[256];};static VncState *vnc_state; /* needed for info vnc */void do_info_vnc(void){    if (vnc_state == NULL)	term_printf("VNC server disabled\n");    else {	term_printf("VNC server active on: ");	term_print_filename(vnc_state->display);	term_printf("\n");	if (vnc_state->csock == -1)	    term_printf("No client connected\n");	else	    term_printf("Client connected\n");    }}/* TODO   1) Get the queue working for IO.   2) there is some weirdness when using the -S option (the screen is grey      and not totally invalidated   3) resolutions > 1024*/static void vnc_write(VncState *vs, const void *data, size_t len);static void vnc_write_u32(VncState *vs, uint32_t value);static void vnc_write_s32(VncState *vs, int32_t value);static void vnc_write_u16(VncState *vs, uint16_t value);static void vnc_write_u8(VncState *vs, uint8_t value);static void vnc_flush(VncState *vs);static void vnc_update_client(void *opaque);static void vnc_client_read(void *opaque);static inline void vnc_set_bit(uint32_t *d, int k){    d[k >> 5] |= 1 << (k & 0x1f);}static inline void vnc_clear_bit(uint32_t *d, int k){    d[k >> 5] &= ~(1 << (k & 0x1f));}static inline void vnc_set_bits(uint32_t *d, int n, int nb_words){    int j;    j = 0;    while (n >= 32) {        d[j++] = -1;        n -= 32;    }    if (n > 0)        d[j++] = (1 << n) - 1;    while (j < nb_words)        d[j++] = 0;}static inline int vnc_get_bit(const uint32_t *d, int k){    return (d[k >> 5] >> (k & 0x1f)) & 1;}static inline int vnc_and_bits(const uint32_t *d1, const uint32_t *d2,                               int nb_words){    int i;    for(i = 0; i < nb_words; i++) {        if ((d1[i] & d2[i]) != 0)            return 1;    }    return 0;}static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h){    VncState *vs = ds->opaque;    int i;    h += y;    /* round x down to ensure the loop only spans one 16-pixel block per,       iteration.  otherwise, if (x % 16) != 0, the last iteration may span       two 16-pixel blocks but we only mark the first as dirty    */    w += (x % 16);    x -= (x % 16);    for (; y < h; y++)	for (i = 0; i < w; i += 16)	    vnc_set_bit(vs->dirty_row[y], (x + i) / 16);}static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,				   int32_t encoding){    vnc_write_u16(vs, x);    vnc_write_u16(vs, y);    vnc_write_u16(vs, w);    vnc_write_u16(vs, h);    vnc_write_s32(vs, encoding);}static void vnc_dpy_resize(DisplayState *ds, int w, int h){    int size_changed;    VncState *vs = ds->opaque;    ds->data = realloc(ds->data, w * h * vs->depth);    vs->old_data = realloc(vs->old_data, w * h * vs->depth);    if (ds->data == NULL || vs->old_data == NULL) {	fprintf(stderr, "vnc: memory allocation failed\n");	exit(1);    }    if (ds->depth != vs->depth * 8) {        ds->depth = vs->depth * 8;        console_color_init(ds);    }    size_changed = ds->width != w || ds->height != h;    ds->width = w;    ds->height = h;    ds->linesize = w * vs->depth;    if (vs->csock != -1 && vs->has_resize && size_changed) {	vnc_write_u8(vs, 0);  /* msg id */	vnc_write_u8(vs, 0);	vnc_write_u16(vs, 1); /* number of rects */	vnc_framebuffer_update(vs, 0, 0, ds->width, ds->height, -223);	vnc_flush(vs);	vs->width = ds->width;	vs->height = ds->height;    }}/* fastest code */static void vnc_write_pixels_copy(VncState *vs, void *pixels, int size){    vnc_write(vs, pixels, size);}/* slowest but generic code. */static void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint32_t v){    unsigned int r, g, b;    r = (v >> vs->red_shift1) & vs->red_max;    g = (v >> vs->green_shift1) & vs->green_max;    b = (v >> vs->blue_shift1) & vs->blue_max;    v = (r << vs->red_shift) |        (g << vs->green_shift) |        (b << vs->blue_shift);    switch(vs->pix_bpp) {    case 1:        buf[0] = v;        break;    case 2:        if (vs->pix_big_endian) {            buf[0] = v >> 8;            buf[1] = v;        } else {            buf[1] = v >> 8;            buf[0] = v;        }        break;    default:    case 4:        if (vs->pix_big_endian) {            buf[0] = v >> 24;            buf[1] = v >> 16;            buf[2] = v >> 8;            buf[3] = v;        } else {            buf[3] = v >> 24;            buf[2] = v >> 16;            buf[1] = v >> 8;            buf[0] = v;        }        break;    }}static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size){    uint32_t *pixels = pixels1;    uint8_t buf[4];    int n, i;    n = size >> 2;    for(i = 0; i < n; i++) {        vnc_convert_pixel(vs, buf, pixels[i]);        vnc_write(vs, buf, vs->pix_bpp);    }}static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h){    int i;    uint8_t *row;    vnc_framebuffer_update(vs, x, y, w, h, 0);    row = vs->ds->data + y * vs->ds->linesize + x * vs->depth;    for (i = 0; i < h; i++) {	vs->write_pixels(vs, row, w * vs->depth);	row += vs->ds->linesize;    }}static void hextile_enc_cord(uint8_t *ptr, int x, int y, int w, int h){    ptr[0] = ((x & 0x0F) << 4) | (y & 0x0F);    ptr[1] = (((w - 1) & 0x0F) << 4) | ((h - 1) & 0x0F);}#define BPP 8#include "vnchextile.h"#undef BPP#define BPP 16#include "vnchextile.h"#undef BPP#define BPP 32#include "vnchextile.h"#undef BPP#define GENERIC#define BPP 32#include "vnchextile.h"#undef BPP#undef GENERICstatic void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, int h){    int i, j;    int has_fg, has_bg;    uint32_t last_fg32, last_bg32;    vnc_framebuffer_update(vs, x, y, w, h, 5);    has_fg = has_bg = 0;    for (j = y; j < (y + h); j += 16) {	for (i = x; i < (x + w); i += 16) {            vs->send_hextile_tile(vs, i, j,                                  MIN(16, x + w - i), MIN(16, y + h - j),                                  &last_bg32, &last_fg32, &has_bg, &has_fg);	}    }}static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h){	if (vs->has_hextile)	    send_framebuffer_update_hextile(vs, x, y, w, h);	else	    send_framebuffer_update_raw(vs, x, y, w, h);}static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h){    int src, dst;    uint8_t *src_row;    uint8_t *dst_row;    char *old_row;    int y = 0;    int pitch = ds->linesize;    VncState *vs = ds->opaque;    vnc_update_client(vs);    if (dst_y > src_y) {	y = h - 1;	pitch = -pitch;    }    src = (ds->linesize * (src_y + y) + vs->depth * src_x);    dst = (ds->linesize * (dst_y + y) + vs->depth * dst_x);    src_row = ds->data + src;    dst_row = ds->data + dst;    old_row = vs->old_data + dst;    for (y = 0; y < h; y++) {	memmove(old_row, src_row, w * vs->depth);	memmove(dst_row, src_row, w * vs->depth);	src_row += pitch;	dst_row += pitch;	old_row += pitch;    }    vnc_write_u8(vs, 0);  /* msg id */    vnc_write_u8(vs, 0);    vnc_write_u16(vs, 1); /* number of rects */    vnc_framebuffer_update(vs, dst_x, dst_y, w, h, 1);    vnc_write_u16(vs, src_x);    vnc_write_u16(vs, src_y);    vnc_flush(vs);}static int find_dirty_height(VncState *vs, int y, int last_x, int x){    int h;    for (h = 1; h < (vs->height - y); h++) {	int tmp_x;	if (!vnc_get_bit(vs->dirty_row[y + h], last_x))	    break;	for (tmp_x = last_x; tmp_x < x; tmp_x++)	    vnc_clear_bit(vs->dirty_row[y + h], tmp_x);    }    return h;}static void vnc_update_client(void *opaque){    VncState *vs = opaque;    if (vs->need_update && vs->csock != -1) {	int y;	uint8_t *row;	char *old_row;	uint32_t width_mask[VNC_DIRTY_WORDS];	int n_rectangles;	int saved_offset;	int has_dirty = 0;        vnc_set_bits(width_mask, (vs->width / 16), VNC_DIRTY_WORDS);	/* Walk through the dirty map and eliminate tiles that	   really aren't dirty */	row = vs->ds->data;	old_row = vs->old_data;	for (y = 0; y < vs->height; y++) {	    if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) {		int x;		uint8_t *ptr;		char *old_ptr;		ptr = row;		old_ptr = (char*)old_row;		for (x = 0; x < vs->ds->width; x += 16) {		    if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {			vnc_clear_bit(vs->dirty_row[y], (x / 16));		    } else {			has_dirty = 1;			memcpy(old_ptr, ptr, 16 * vs->depth);		    }		    ptr += 16 * vs->depth;		    old_ptr += 16 * vs->depth;		}	    }	    row += vs->ds->linesize;	    old_row += vs->ds->linesize;	}	if (!has_dirty) {	    qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);	    return;	}	/* Count rectangles */	n_rectangles = 0;	vnc_write_u8(vs, 0);  /* msg id */	vnc_write_u8(vs, 0);	saved_offset = vs->output.offset;	vnc_write_u16(vs, 0);	for (y = 0; y < vs->height; y++) {	    int x;	    int last_x = -1;	    for (x = 0; x < vs->width / 16; x++) {		if (vnc_get_bit(vs->dirty_row[y], x)) {		    if (last_x == -1) {			last_x = x;		    }		    vnc_clear_bit(vs->dirty_row[y], x);		} else {		    if (last_x != -1) {			int h = find_dirty_height(vs, y, last_x, x);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美色区777第一页| 视频一区在线视频| 亚洲精品在线免费观看视频| 欧美体内she精视频| 欧美亚洲一区二区三区四区| 一本久久a久久精品亚洲| 国产在线播放一区| 国产精品一二三四| 国产乱子伦一区二区三区国色天香| 美女视频网站久久| 国产一区在线不卡| 国产成人av一区二区三区在线观看| 国产精品996| 99视频国产精品| 欧美影院一区二区三区| 欧美人成免费网站| 精品国产乱码久久久久久1区2区| 久久在线免费观看| 中文字幕亚洲视频| 亚洲第一精品在线| 国内精品嫩模私拍在线| av电影一区二区| 91精品免费在线| 久久精品人人做人人爽人人| 1区2区3区欧美| 五月天激情小说综合| 国内外成人在线视频| 99视频在线精品| 欧美一区二区私人影院日本| 国产午夜一区二区三区| 亚洲久草在线视频| 日本亚洲一区二区| 成人国产免费视频| 制服丝袜中文字幕亚洲| 国产日韩精品一区二区三区在线| 亚洲免费视频中文字幕| 奇米一区二区三区| 99综合影院在线| 日韩视频一区二区| 亚洲综合色噜噜狠狠| 黄色精品一二区| 欧美午夜精品理论片a级按摩| 欧美va天堂va视频va在线| 中文字幕一区免费在线观看| 日韩一区欧美二区| 91久久一区二区| 久久久91精品国产一区二区三区| 亚洲国产一区二区视频| 成人免费看黄yyy456| 欧美sm极限捆绑bd| 香蕉久久夜色精品国产使用方法 | 在线成人免费视频| 国产精品夫妻自拍| 国产成人综合自拍| 欧美大白屁股肥臀xxxxxx| 亚洲精品国产一区二区三区四区在线| 九一九一国产精品| 欧美另类久久久品| 一区二区三区国产| 97se亚洲国产综合自在线不卡| 欧美tickling挠脚心丨vk| 男男视频亚洲欧美| 欧美高清你懂得| 日日夜夜精品视频免费| 色综合久久久久综合99| 亚洲欧洲成人自拍| 99视频有精品| 亚洲视频网在线直播| 成人av中文字幕| 国产欧美一区二区精品仙草咪| 精品一区二区三区的国产在线播放| 在线观看日韩高清av| 亚洲精品免费在线播放| 97se亚洲国产综合自在线观| 中文字幕亚洲综合久久菠萝蜜| 成人av网站在线| 亚洲视频网在线直播| heyzo一本久久综合| 中文字幕电影一区| 99精品久久只有精品| 国产精品久久久久精k8| 91片在线免费观看| 亚洲图片自拍偷拍| 欧美肥胖老妇做爰| 国产主播一区二区| 国产精品久久毛片av大全日韩| av成人免费在线| 亚洲国产欧美日韩另类综合| 欧美综合天天夜夜久久| 午夜在线电影亚洲一区| 91精品国产91综合久久蜜臀| 麻豆精品国产91久久久久久| 久久综合九色综合97婷婷女人 | 亚洲成av人片www| 制服丝袜在线91| 国产99久久久精品| 一区二区三区四区五区视频在线观看 | 99久久伊人网影院| 亚洲一区二区三区视频在线播放| 欧美剧在线免费观看网站| 久久精品国产成人一区二区三区| 精品成人佐山爱一区二区| 国产不卡免费视频| 亚洲一区影音先锋| 久久综合狠狠综合久久激情| k8久久久一区二区三区| 日韩中文字幕一区二区三区| 久久精品视频免费观看| 欧美在线999| 国产精品一区二区男女羞羞无遮挡| 成人欧美一区二区三区1314 | 日本网站在线观看一区二区三区| 欧美伊人久久久久久午夜久久久久| 男人的天堂亚洲一区| **网站欧美大片在线观看| 91精品国产一区二区三区蜜臀| 国产福利一区二区三区视频| 中文字幕一区免费在线观看| 日韩欧美电影在线| 国产成人亚洲精品狼色在线| 亚洲综合男人的天堂| 26uuu国产在线精品一区二区| 91理论电影在线观看| 久99久精品视频免费观看| 亚洲一区二区三区国产| 国产精品久久久久影院色老大 | 欧美三级一区二区| 国产 日韩 欧美大片| 日本怡春院一区二区| 亚洲品质自拍视频网站| 国产三级精品视频| 欧美日韩国产天堂| 91豆麻精品91久久久久久| 国产v综合v亚洲欧| 国内成人精品2018免费看| 视频一区欧美精品| 亚洲一区国产视频| 伊人开心综合网| 中文字幕一区二区三区精华液| 久久伊人中文字幕| 欧美精品一区二区三区蜜桃| 欧美久久久一区| 欧美日韩精品系列| 欧美日韩国产免费一区二区| 91网站在线播放| 一本大道久久a久久精二百| 成人18视频在线播放| 国产精品99久久久久久宅男| 国产在线不卡一区| 国模一区二区三区白浆| 国产伦精品一区二区三区免费迷| 国精产品一区一区三区mba桃花 | 国产人久久人人人人爽| 久久久久青草大香线综合精品| 欧美亚洲一区二区三区四区| 在线观看国产91| 欧美伦理影视网| 777亚洲妇女| 亚洲精品一区二区三区福利 | 国产成人aaa| av中文字幕不卡| 91视频国产观看| 欧美色爱综合网| 日韩色视频在线观看| 精品久久久久久久久久久院品网| www一区二区| 中文字幕日本乱码精品影院| 亚洲日本在线a| 亚洲二区在线观看| 久久精品国产99| 风流少妇一区二区| 色婷婷亚洲综合| 欧美一区二区久久久| 久久久激情视频| 亚洲女人的天堂| 视频一区二区三区在线| 久久99精品国产| 91啪在线观看| 日韩免费在线观看| 国产精品入口麻豆九色| 玉米视频成人免费看| 蜜桃av噜噜一区| 99视频热这里只有精品免费| 欧美日韩亚洲综合一区 | 大白屁股一区二区视频| 日本二三区不卡| 久久人人爽爽爽人久久久| 亚洲丝袜制服诱惑| 麻豆成人久久精品二区三区小说| 国产大陆a不卡| 51久久夜色精品国产麻豆| 国产欧美日韩在线| 天天免费综合色| 成人黄色一级视频| 日韩欧美亚洲国产另类| 一区二区在线观看视频| 国产成人精品免费| 日韩视频一区二区三区在线播放| 日韩一区日韩二区| 国产精品一区二区你懂的|