libgsh 1.2.0

Graphical Shell server SDK library
Documentation
syntax = "proto3";
package protocol;

import "google/protobuf/empty.proto";

// Initial connection message from the client to the server
// Client -> Server
message ClientHello {
	enum OS {
		UNKNOWN = 0;
		WINDOWS = 1;
		LINUX = 2;
		MACOS = 3;
		IOS = 4;
		ANDROID = 5;
		WEB = 6;
	}
	message MonitorInfo {
		uint32 monitor_id   = 1;
		int32  x            = 2;
		int32  y            = 3;
		uint32 width        = 4;
		uint32 height       = 5;
		uint32 refresh_hz   = 6;
	}
	uint32 protocol_version = 1;
	OS os = 2;           // Operating system of the client
	string os_version = 3; // Version of the operating system
	repeated MonitorInfo monitors = 4; // List of monitor information
}

// Acknowledgment message from the server to the client
// Server -> Client
message ServerHelloAck {
	// Frame format enum, used to specify the format of the image data
	enum FrameFormat {
		RGB = 0;
		RGBA = 1;
	}
	FrameFormat format = 1;
	oneof compression {
		ZstdCompression zstd = 2; // Zstandard compression
	}
	message ZstdCompression {
		int32 level = 1; // Compression level (0-22)
	}
	// Window settings message, used to configure the window properties for the client.
	message WindowSettings {
		enum WindowMode {
			FULLSCREEN = 0;
			BORDERLESS = 1;
			WINDOWED = 2;
			WINDOWED_MAXIMIZED = 3;
		}
		uint32 window_id = 1;       // Unique identifier for the window
		optional uint32 monitor_id = 2; // Monitor ID for the window
		WindowMode initial_mode = 3; // Window mode (fullscreen, windowed, borderless)
		uint32 width = 4;    // Width of the window in pixels
		uint32 height = 5;   // Height of the window in pixels
		string title = 6;    // Title of the window
		bool always_on_top = 7; // Whether the window is always on top
		bool allow_resize = 8; // Whether the window can be resized
		// If allow_resize = true, this flag determines
		// whether frame images should be resized to fit the window
		// when the window is resized or stay fixed to the original frame size.
		bool resize_frame = 9;
		// Determines how the frame image is anchored in the window
		enum WindowAnchor {
			TOP_LEFT = 0;
			CENTER = 1;
		}
		WindowAnchor frame_anchor = 10; // Anchor position of the frame image in the window
	}
	// List of initial window settings for the client
	repeated WindowSettings windows = 3;
	oneof auth_method {
		google.protobuf.Empty password = 4; // Password-based authentication
		SignatureMethod signature = 5; // Signature-based authentication
	}
	message SignatureMethod {
		bytes sign_message = 1; // Message to be signed for authentication
	}
}

// Message representing client authentication data
// Client -> Server
message ClientAuth {
	oneof auth_data {
		Password password = 1;
		Signature signature = 2;
	}
	message Password {
		string password = 1;
	}
	message Signature {
		bytes signature = 1;
		bytes public_key = 2;
	}
}

// Message representing server authentication data
// Server -> Client
message ServerAuthAck {
	enum AuthStatus {
		SUCCESS = 0;
		FAILURE = 1;
	}
	AuthStatus status = 1; // Authentication status (success or failure)
	string message = 2;   // Message providing additional information about the authentication status
}

// Message representing a frame of image data
// Server -> Client
message Frame {
	uint32 window_id = 1; // Unique identifier for the window
	uint32 width = 2;     // Width of the image in pixels
	uint32 height = 3;    // Height of the image in pixels

	// Partial frame segments
	message Segment {
		int32 x = 1;        // X coordinate of the top-left corner of the segment
		int32 y = 2;        // Y coordinate of the top-left corner of the segment
		uint32 width = 3;    // Width of the segment in pixels
		uint32 height = 4;   // Height of the segment in pixels
		bytes data = 5;      // Raw image data in bytes
	}
	repeated Segment segments = 4; // List of segments in the frame
}

// Message representing user input events
// Client -> Server
message UserInput {
	enum InputType {
		KEY_EVENT = 0;
		MOUSE_EVENT = 1;
		WINDOW_EVENT = 2;
	}
	InputType kind = 1;   // Type of input event
	uint32 window_id = 2; // Unique identifier for the window

	// Oneof field to handle different types of input events
	oneof input_event {
		KeyEvent key_event = 3; // Keyboard event
		MouseEvent mouse_event = 4; // Mouse event
		WindowEvent window_event = 5; // Window event
	}

	// Nested message for keyboard events
	message KeyEvent {
		enum KeyAction {
			PRESS = 0;
			RELEASE = 1;
		}
		KeyAction action = 1; // Action (press or release)
		int32 key_code = 2;  // Key code (e.g., ASCII value)
		uint32 modifiers = 3; // Modifier keys (e.g., Shift, Ctrl, Alt)
	}

	// Nested message for mouse events
	message MouseEvent {
		enum MouseAction {
			MOVE = 0;
			PRESS = 1;
			RELEASE = 2;
			SCROLL = 3;
		}
		MouseAction action = 1; // Action (move, click, scroll)
		enum MouseButton {
			LEFT = 0;
			RIGHT = 1;
			MIDDLE = 2;
		}
		int32 button = 2; // Mouse button (e.g., left, right, middle)
		int32 x = 3;     // X coordinate of the mouse event
		int32 y = 4;     // Y coordinate of the mouse event
		float delta_x = 5; // Scroll delta (for scroll events)
		float delta_y = 6; // Scroll delta (for scroll events)
	}

	// Nested message for window events
	message WindowEvent {
		enum WindowAction {
			RESIZE = 0;
			MOVE = 1;
			CLOSE = 2;
			MINIMIZE = 3;
			MAXIMIZE = 4;
			FULLSCREEN = 5;
			UNFULLSCREEN = 6;
			FOCUS = 7;
			UNFOCUS = 8;
		}
		WindowAction action = 1; // Action (resize, move, close, etc.)
		int32 x = 2;            // X coordinate of the window
		int32 y = 3;            // Y coordinate of the window
		uint32 width = 4;       // Width of the window in pixels
		uint32 height = 5;      // Height of the window in pixels
	}
}

// Message representing status updates
// Server -> Client
// Client -> Server
message StatusUpdate {
	enum StatusType {
		INFO = 0;
		WARNING = 1;
		ERROR = 2;
		EXIT = 3;
	}
	StatusType kind = 1; // Type of status update
	oneof details {
		Info info = 2;
		Warning warning = 3;
		Error error = 4;
	}

	// Nested message for informational updates
	message Info {
		string message = 1; // Informational message
	}

	// Nested message for warning updates
	message Warning {
		string message = 1; // Warning message
		int32 code = 2;     // Warning code
	}

	// Nested message for error updates
	message Error {
		string message = 1; // Error message
		int32 code = 2;     // Error code
	}
}