Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/limbo/module/vnc.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



Vnc: module	# vnc.b
{
	PATH : con "/appl/lib/vnc.dis";
	init:	fn(ctxt: ref Context, argv: list of string);

	Rect : adt {
		x, y, w, h : int;
		to_string : fn(r : self ref Rect) : string;
	};

	ServerIO : adt {
		in, out : ref Iobuf;
		pick {
			cmd =>
				clone : ref Sys->FD;
				ctl : ref Sys->FD;
			conn =>
				connection : Sys->Connection;
		}
		read : fn(s : self ref ServerIO, n : int) : array of byte;
		read_int : fn(s : self ref ServerIO, byte_count : int) : int;
		read_rect : fn(s : self ref ServerIO, byte_count : int) : ref Rect;
		read_sint : fn(s : self ref ServerIO, byte_count : int) : int;
		read_string : fn(s : self ref ServerIO) : string;
		write : fn(s : self ref ServerIO, data : array of byte, n : int);
		write_int : fn(s : self ref ServerIO, i, byte_count : int);
		write_rect : fn(s : self ref ServerIO, r : ref Rect, byte_count : int);
	};

	Server : adt { # vnc.b
		io : ref ServerIO;
		protocol : int;
		width : int;
		height : int;
		bpp : int;
		depth : int;
		big_endian : int;
		truecolour : int;
		redmax : int;
		greenmax : int;
		bluemax : int;
		redshift : int;
		greenshift : int;
		blueshift : int;
		name : string;

		image : ref Image;
		updates : chan of ref Rect;

		handshake : fn(s : self ref Server, password : string, protocol_ver, client_security_type, exclusive : int);
		init : fn(s : self ref Server);
		to_string : fn(s : self ref Server) : string;
		set_exclusive : fn(s : self ref Server, exclusive : int);
		send_framebuffer_request : fn(s : self ref Server, incremental : int, r : ref Rect);
		update_framebuffer : fn(s : self ref Server, num_rectangles : int);
		update_fb_raw : fn(s : self ref Server, r : ref Rect);
		key_event : fn(s : self ref Server, k, down : int);
		key_press : fn(s : self ref Server, k : int);
		alt_key_press : fn(s : self ref Server, k : int);
		ctrl_key_press : fn(s : self ref Server, k : int);
		string_press : fn(s : self ref Server, txt : string);
	};

	new_server: fn(addr, password : string, protocol_ver, client_security_type, exclusive : int) : ref Server;

	RRE_Rectangle : adt {
		pixel : array of byte;
		x : int;
		y : int;
		w : int;
		h : int;
	};

	Hextile_Rectangle : adt {
		pixel : array of byte;
		x : int;
		y : int;
		w : int;
		h : int;
	};

	Rectangle : adt {
		x : int;
		y : int;
		w : int;
		h : int;
		pick {
		Raw =>
			pixels : array of byte;
		CopyRect =>
			x_src : int;
			y_src : int;
		RRE =>
			bg_pixel : array of byte;
			sub_rectangles : array of RRE_Rectangle;
		Hextile =>
			hextype : int;
			rectangles : array of Hextile_Rectangle;
		ZRLE =>
			data : array of byte;
		Cursor =>
			pixels : array of byte;
			bitmask : array of byte;
		Desktop =>
		}

		# encoding : int; # 0 Raw, 1 CopyRect, 2 RRE, 4, CoREE, 5 Hextile, 6 zlib, 7 tight, 8 zlibhex, 15 TRLE, 16 ZRLE, 17 Hitachi ZYWRLE, -1 to -222 & -224 to -238 & -240 to-256 Tight options, -239 Cursor, -223 DesktopSize, -273 to -304 VMWare, -305 gii, 0x574d5600 to 0x574d56ff VMWare
	};

	Colour_Map : adt {
		r : int;
		g : int;
		b : int;
	};

	Server_Message : adt {
		
		pick {
		Version =>
			major : int;
			minor : int;
		Security_Types =>
			types : array of int; # 0 invalid, 1 None, 2 VNC Auth,
			error : string;
		Security_Result =>
			status : int; # 0 ok, 1 failed
			error : string;
		VNC_Auth =>
			challenge : array of byte; # 16 bytes
		}
	};

	Client_Message : adt {
		pick {
		Version =>
			major : int;
			minor : int;
		VNC_Auth =>
			response : array of byte;# 16 bytes
		Client_Init =>
			shared : int;
		Set_Pixel_Format => # 0
			bpp : int;
			depth : int;
			big_endian : int;
			truecolour : int;
			redmax : int;
			greenmax : int;
			bluemax : int;
			redshift : int;
			greenshift : int;
			blueshift : int;
		Set_Encodings => # 2
			encoding_types : array of int;
		Framebuffer_Update_Request => # 3
			incremental : int;
			x : int;
			y : int;
			w : int;
			h : int;
		Key_Event => # 4
			down : int;
			key : int; # see X11/keysymdef.h
		Pointer_Event => # 5
			button_mask : int;
			x : int;
			y : int;	
		Client_Cut_Text => # 6
			text : string;
		Anthony_Liguori => # 255
		VMWare => # 254 & 127
		Gii => # 253
		}
	};
};



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].