亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩1区2区日韩1区2区| 欧美韩国日本不卡| 日韩av电影一区| 欧美日韩亚洲综合在线| 婷婷开心久久网| 91精品在线观看入口| 美女高潮久久久| 精品国产乱码久久久久久影片| 激情六月婷婷综合| 国产精品久久久久四虎| 一本久久a久久精品亚洲| 五月婷婷激情综合网| 日韩一区二区在线看| 国产资源在线一区| 亚洲欧洲日韩av| 欧美日韩高清在线播放| 另类调教123区| 亚洲欧洲精品一区二区三区不卡| 在线观看亚洲一区| 精品一区二区免费| 亚洲免费在线播放| 日韩一区二区免费高清| 91在线国内视频| 日本亚洲免费观看| 中文幕一区二区三区久久蜜桃| 精品1区2区3区| 成人永久免费视频| 日日欢夜夜爽一区| 国产精品毛片久久久久久| 91精品综合久久久久久| 国产盗摄精品一区二区三区在线| 一区二区高清在线| 久久婷婷综合激情| 欧美日韩精品一区二区天天拍小说 | 天堂蜜桃一区二区三区 | 久久久精品黄色| 欧美日韩精品一区二区天天拍小说| 国产电影一区在线| 日日夜夜精品免费视频| 亚洲色图欧美在线| 久久久不卡影院| 欧美情侣在线播放| 91丨porny丨最新| 91在线观看美女| 日本欧美久久久久免费播放网| 欧美国产精品一区| 91精品欧美综合在线观看最新| 成人永久免费视频| 国产一区中文字幕| 婷婷国产在线综合| 17c精品麻豆一区二区免费| 欧美精品一区男女天堂| 91精品国产91久久综合桃花 | 在线观看av一区| 夫妻av一区二区| 黄色日韩网站视频| 日本最新不卡在线| 午夜天堂影视香蕉久久| 一区二区在线观看视频在线观看| 中文字幕成人网| 久久久久久亚洲综合影院红桃| 欧美三级日韩在线| 欧美午夜精品一区二区三区| 一本大道综合伊人精品热热| 成人免费观看男女羞羞视频| 国产在线不卡视频| 精品在线视频一区| 九九视频精品免费| 美女视频黄频大全不卡视频在线播放| 亚洲h在线观看| 亚洲自拍偷拍网站| 亚洲精品日日夜夜| 亚洲国产一区二区三区青草影视| 亚洲区小说区图片区qvod| 自拍偷拍亚洲激情| 亚洲另类在线一区| 亚洲成人www| 亚洲二区视频在线| 日韩—二三区免费观看av| 天堂午夜影视日韩欧美一区二区| 日韩成人免费电影| 久久精品国产亚洲一区二区三区| 看片网站欧美日韩| 国产一区二区三区免费观看| 国产激情一区二区三区四区| 国产精品综合在线视频| 成人看片黄a免费看在线| 99在线精品免费| 色狠狠一区二区三区香蕉| 欧美少妇bbb| 欧美成人欧美edvon| 国产欧美视频一区二区三区| 亚洲视频在线观看三级| 亚洲最新在线观看| 视频在线观看一区| 韩国成人精品a∨在线观看| 国产成人精品免费| 91年精品国产| 制服丝袜av成人在线看| 久久奇米777| 最新高清无码专区| 日日骚欧美日韩| 丁香啪啪综合成人亚洲小说 | 国产亚洲欧美中文| 最好看的中文字幕久久| 亚洲成va人在线观看| 久久91精品久久久久久秒播| 91在线看国产| 欧美一区二区在线视频| 国产欧美日韩另类视频免费观看| 亚洲免费资源在线播放| 精品一区二区综合| 色综合久久久久综合体桃花网| 欧美日韩在线播放一区| 精品国产三级电影在线观看| 亚洲女同女同女同女同女同69| 日本欧美大码aⅴ在线播放| 不卡的av电影| 精品久久久久久久久久久久包黑料| 17c精品麻豆一区二区免费| 日本亚洲三级在线| 91免费视频网| 久久这里只有精品首页| 亚洲亚洲人成综合网络| 国产在线精品免费| 欧美人动与zoxxxx乱| 国产精品久久久久天堂| 精品一区二区在线免费观看| 欧美在线制服丝袜| 欧美高清在线精品一区| 美女一区二区久久| 欧美日韩三级一区二区| 中文字幕在线不卡国产视频| 开心九九激情九九欧美日韩精美视频电影| 99热这里都是精品| 26uuu国产电影一区二区| 日韩精彩视频在线观看| 91视频在线观看| 国产精品丝袜在线| 国产精品18久久久久久久久久久久 | 精品日产卡一卡二卡麻豆| 亚洲一区二区美女| 成人av网址在线观看| 久久久综合激的五月天| 日本大胆欧美人术艺术动态| 91丨国产丨九色丨pron| 亚洲国产精品成人综合色在线婷婷| 婷婷综合五月天| 欧洲日韩一区二区三区| 国产精品久久毛片av大全日韩| 久久不见久久见免费视频7| 欧美日韩黄视频| 午夜精品福利在线| 欧美日韩二区三区| 亚洲国产成人精品视频| 色成人在线视频| 亚洲精品福利视频网站| 99精品久久久久久| 1024成人网| av在线一区二区| 亚洲免费高清视频在线| 91丨九色丨蝌蚪富婆spa| 一色屋精品亚洲香蕉网站| 99久久精品一区| 亚洲欧洲日韩一区二区三区| 91在线观看成人| 亚洲欧洲日产国码二区| 99v久久综合狠狠综合久久| 中文字幕综合网| 在线视频中文字幕一区二区| 亚洲精品乱码久久久久| 日本韩国精品在线| 香蕉成人伊视频在线观看| 欧美日韩黄色一区二区| 蜜臀va亚洲va欧美va天堂| 日韩一区二区在线播放| 国产乱码精品一区二区三区忘忧草| 精品免费视频一区二区| 国产精品一区二区在线观看网站| 久久精品亚洲精品国产欧美kt∨| 国产成人精品三级| 亚洲天堂a在线| 欧美三级韩国三级日本三斤| 青青国产91久久久久久| 2017欧美狠狠色| gogogo免费视频观看亚洲一| 一区二区三区四区高清精品免费观看| 色域天天综合网| 日本亚洲天堂网| 国产午夜精品一区二区三区视频 | 欧美一级免费大片| 国内精品免费**视频| 国产精品午夜免费| 精品视频一区 二区 三区| 美女视频黄久久| 亚洲三级在线免费观看| 91精品国产高清一区二区三区| 丰满少妇久久久久久久| 亚洲电影中文字幕在线观看| 久久伊人蜜桃av一区二区|