message.proto 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. syntax = "proto3";
  2. package hbb;
  3. message VP9 {
  4. bytes data = 1;
  5. bool key = 2;
  6. int64 pts = 3;
  7. }
  8. message VP9s { repeated VP9 frames = 1; }
  9. message RGB { bool compress = 1; }
  10. // planes data send directly in binary for better use arraybuffer on web
  11. message YUV {
  12. bool compress = 1;
  13. int32 stride = 2;
  14. }
  15. message VideoFrame {
  16. oneof union {
  17. VP9s vp9s = 6;
  18. RGB rgb = 7;
  19. YUV yuv = 8;
  20. }
  21. int64 timestamp = 9;
  22. }
  23. message IdPk {
  24. string id = 1;
  25. bytes pk = 2;
  26. }
  27. message DisplayInfo {
  28. sint32 x = 1;
  29. sint32 y = 2;
  30. int32 width = 3;
  31. int32 height = 4;
  32. string name = 5;
  33. bool online = 6;
  34. }
  35. message PortForward {
  36. string host = 1;
  37. int32 port = 2;
  38. }
  39. message FileTransfer {
  40. string dir = 1;
  41. bool show_hidden = 2;
  42. }
  43. message LoginRequest {
  44. string username = 1;
  45. bytes password = 2;
  46. string my_id = 4;
  47. string my_name = 5;
  48. OptionMessage option = 6;
  49. oneof union {
  50. FileTransfer file_transfer = 7;
  51. PortForward port_forward = 8;
  52. }
  53. bool video_ack_required = 9;
  54. }
  55. message ChatMessage { string text = 1; }
  56. message PeerInfo {
  57. string username = 1;
  58. string hostname = 2;
  59. string platform = 3;
  60. repeated DisplayInfo displays = 4;
  61. int32 current_display = 5;
  62. bool sas_enabled = 6;
  63. string version = 7;
  64. int32 conn_id = 8;
  65. }
  66. message LoginResponse {
  67. oneof union {
  68. string error = 1;
  69. PeerInfo peer_info = 2;
  70. }
  71. }
  72. message MouseEvent {
  73. int32 mask = 1;
  74. sint32 x = 2;
  75. sint32 y = 3;
  76. repeated ControlKey modifiers = 4;
  77. }
  78. enum ControlKey {
  79. Unknown = 0;
  80. Alt = 1;
  81. Backspace = 2;
  82. CapsLock = 3;
  83. Control = 4;
  84. Delete = 5;
  85. DownArrow = 6;
  86. End = 7;
  87. Escape = 8;
  88. F1 = 9;
  89. F10 = 10;
  90. F11 = 11;
  91. F12 = 12;
  92. F2 = 13;
  93. F3 = 14;
  94. F4 = 15;
  95. F5 = 16;
  96. F6 = 17;
  97. F7 = 18;
  98. F8 = 19;
  99. F9 = 20;
  100. Home = 21;
  101. LeftArrow = 22;
  102. /// meta key (also known as "windows"; "super"; and "command")
  103. Meta = 23;
  104. /// option key on macOS (alt key on Linux and Windows)
  105. Option = 24; // deprecated, use Alt instead
  106. PageDown = 25;
  107. PageUp = 26;
  108. Return = 27;
  109. RightArrow = 28;
  110. Shift = 29;
  111. Space = 30;
  112. Tab = 31;
  113. UpArrow = 32;
  114. Numpad0 = 33;
  115. Numpad1 = 34;
  116. Numpad2 = 35;
  117. Numpad3 = 36;
  118. Numpad4 = 37;
  119. Numpad5 = 38;
  120. Numpad6 = 39;
  121. Numpad7 = 40;
  122. Numpad8 = 41;
  123. Numpad9 = 42;
  124. Cancel = 43;
  125. Clear = 44;
  126. Menu = 45; // deprecated, use Alt instead
  127. Pause = 46;
  128. Kana = 47;
  129. Hangul = 48;
  130. Junja = 49;
  131. Final = 50;
  132. Hanja = 51;
  133. Kanji = 52;
  134. Convert = 53;
  135. Select = 54;
  136. Print = 55;
  137. Execute = 56;
  138. Snapshot = 57;
  139. Insert = 58;
  140. Help = 59;
  141. Sleep = 60;
  142. Separator = 61;
  143. Scroll = 62;
  144. NumLock = 63;
  145. RWin = 64;
  146. Apps = 65;
  147. Multiply = 66;
  148. Add = 67;
  149. Subtract = 68;
  150. Decimal = 69;
  151. Divide = 70;
  152. Equals = 71;
  153. NumpadEnter = 72;
  154. RShift = 73;
  155. RControl = 74;
  156. RAlt = 75;
  157. CtrlAltDel = 100;
  158. LockScreen = 101;
  159. }
  160. message KeyEvent {
  161. bool down = 1;
  162. bool press = 2;
  163. oneof union {
  164. ControlKey control_key = 3;
  165. uint32 chr = 4;
  166. uint32 unicode = 5;
  167. string seq = 6;
  168. }
  169. repeated ControlKey modifiers = 8;
  170. }
  171. message CursorData {
  172. uint64 id = 1;
  173. sint32 hotx = 2;
  174. sint32 hoty = 3;
  175. int32 width = 4;
  176. int32 height = 5;
  177. bytes colors = 6;
  178. }
  179. message CursorPosition {
  180. sint32 x = 1;
  181. sint32 y = 2;
  182. }
  183. message Hash {
  184. string salt = 1;
  185. string challenge = 2;
  186. }
  187. message Clipboard {
  188. bool compress = 1;
  189. bytes content = 2;
  190. }
  191. enum FileType {
  192. Dir = 0;
  193. DirLink = 2;
  194. DirDrive = 3;
  195. File = 4;
  196. FileLink = 5;
  197. }
  198. message FileEntry {
  199. FileType entry_type = 1;
  200. string name = 2;
  201. bool is_hidden = 3;
  202. uint64 size = 4;
  203. uint64 modified_time = 5;
  204. }
  205. message FileDirectory {
  206. int32 id = 1;
  207. string path = 2;
  208. repeated FileEntry entries = 3;
  209. }
  210. message ReadDir {
  211. string path = 1;
  212. bool include_hidden = 2;
  213. }
  214. message ReadAllFiles {
  215. int32 id = 1;
  216. string path = 2;
  217. bool include_hidden = 3;
  218. }
  219. message FileAction {
  220. oneof union {
  221. ReadDir read_dir = 1;
  222. FileTransferSendRequest send = 2;
  223. FileTransferReceiveRequest receive = 3;
  224. FileDirCreate create = 4;
  225. FileRemoveDir remove_dir = 5;
  226. FileRemoveFile remove_file = 6;
  227. ReadAllFiles all_files = 7;
  228. FileTransferCancel cancel = 8;
  229. }
  230. }
  231. message FileTransferCancel { int32 id = 1; }
  232. message FileResponse {
  233. oneof union {
  234. FileDirectory dir = 1;
  235. FileTransferBlock block = 2;
  236. FileTransferError error = 3;
  237. FileTransferDone done = 4;
  238. }
  239. }
  240. message FileTransferBlock {
  241. int32 id = 1;
  242. sint32 file_num = 2;
  243. bytes data = 3;
  244. bool compressed = 4;
  245. }
  246. message FileTransferError {
  247. int32 id = 1;
  248. string error = 2;
  249. sint32 file_num = 3;
  250. }
  251. message FileTransferSendRequest {
  252. int32 id = 1;
  253. string path = 2;
  254. bool include_hidden = 3;
  255. }
  256. message FileTransferDone {
  257. int32 id = 1;
  258. sint32 file_num = 2;
  259. }
  260. message FileTransferReceiveRequest {
  261. int32 id = 1;
  262. string path = 2; // path written to
  263. repeated FileEntry files = 3;
  264. }
  265. message FileRemoveDir {
  266. int32 id = 1;
  267. string path = 2;
  268. bool recursive = 3;
  269. }
  270. message FileRemoveFile {
  271. int32 id = 1;
  272. string path = 2;
  273. sint32 file_num = 3;
  274. }
  275. message FileDirCreate {
  276. int32 id = 1;
  277. string path = 2;
  278. }
  279. // main logic from freeRDP
  280. message CliprdrMonitorReady {
  281. int32 conn_id = 1;
  282. }
  283. message CliprdrFormat {
  284. int32 conn_id = 1;
  285. int32 id = 2;
  286. string format = 3;
  287. }
  288. message CliprdrServerFormatList {
  289. int32 conn_id = 1;
  290. repeated CliprdrFormat formats = 2;
  291. }
  292. message CliprdrServerFormatListResponse {
  293. int32 conn_id = 1;
  294. int32 msg_flags = 2;
  295. }
  296. message CliprdrServerFormatDataRequest {
  297. int32 conn_id = 1;
  298. int32 requested_format_id = 2;
  299. }
  300. message CliprdrServerFormatDataResponse {
  301. int32 conn_id = 1;
  302. int32 msg_flags = 2;
  303. bytes format_data = 3;
  304. }
  305. message CliprdrFileContentsRequest {
  306. int32 conn_id = 1;
  307. int32 stream_id = 2;
  308. int32 list_index = 3;
  309. int32 dw_flags = 4;
  310. int32 n_position_low = 5;
  311. int32 n_position_high = 6;
  312. int32 cb_requested = 7;
  313. bool have_clip_data_id = 8;
  314. int32 clip_data_id = 9;
  315. }
  316. message CliprdrFileContentsResponse {
  317. int32 conn_id = 1;
  318. int32 msg_flags = 3;
  319. int32 stream_id = 4;
  320. bytes requested_data = 5;
  321. }
  322. message Cliprdr {
  323. oneof union {
  324. CliprdrMonitorReady ready = 1;
  325. CliprdrServerFormatList format_list = 2;
  326. CliprdrServerFormatListResponse format_list_response = 3;
  327. CliprdrServerFormatDataRequest format_data_request = 4;
  328. CliprdrServerFormatDataResponse format_data_response = 5;
  329. CliprdrFileContentsRequest file_contents_request = 6;
  330. CliprdrFileContentsResponse file_contents_response = 7;
  331. }
  332. }
  333. message SwitchDisplay {
  334. int32 display = 1;
  335. sint32 x = 2;
  336. sint32 y = 3;
  337. int32 width = 4;
  338. int32 height = 5;
  339. }
  340. message PermissionInfo {
  341. enum Permission {
  342. Keyboard = 0;
  343. Clipboard = 2;
  344. Audio = 3;
  345. File = 4;
  346. }
  347. Permission permission = 1;
  348. bool enabled = 2;
  349. }
  350. enum ImageQuality {
  351. NotSet = 0;
  352. Low = 2;
  353. Balanced = 3;
  354. Best = 4;
  355. }
  356. message OptionMessage {
  357. enum BoolOption {
  358. NotSet = 0;
  359. No = 1;
  360. Yes = 2;
  361. }
  362. ImageQuality image_quality = 1;
  363. BoolOption lock_after_session_end = 2;
  364. BoolOption show_remote_cursor = 3;
  365. BoolOption privacy_mode = 4;
  366. BoolOption block_input = 5;
  367. int32 custom_image_quality = 6;
  368. BoolOption disable_audio = 7;
  369. BoolOption disable_clipboard = 8;
  370. BoolOption enable_file_transfer = 9;
  371. }
  372. message OptionResponse {
  373. OptionMessage opt = 1;
  374. string error = 2;
  375. }
  376. message TestDelay {
  377. int64 time = 1;
  378. bool from_client = 2;
  379. }
  380. message PublicKey {
  381. bytes asymmetric_value = 1;
  382. bytes symmetric_value = 2;
  383. }
  384. message SignedId { bytes id = 1; }
  385. message AudioFormat {
  386. uint32 sample_rate = 1;
  387. uint32 channels = 2;
  388. }
  389. message AudioFrame {
  390. bytes data = 1;
  391. int64 timestamp = 2;
  392. }
  393. message Misc {
  394. oneof union {
  395. ChatMessage chat_message = 4;
  396. SwitchDisplay switch_display = 5;
  397. PermissionInfo permission_info = 6;
  398. OptionMessage option = 7;
  399. AudioFormat audio_format = 8;
  400. string close_reason = 9;
  401. bool refresh_video = 10;
  402. OptionResponse option_response = 11;
  403. bool video_received = 12;
  404. }
  405. }
  406. message Message {
  407. oneof union {
  408. SignedId signed_id = 3;
  409. PublicKey public_key = 4;
  410. TestDelay test_delay = 5;
  411. VideoFrame video_frame = 6;
  412. LoginRequest login_request = 7;
  413. LoginResponse login_response = 8;
  414. Hash hash = 9;
  415. MouseEvent mouse_event = 10;
  416. AudioFrame audio_frame = 11;
  417. CursorData cursor_data = 12;
  418. CursorPosition cursor_position = 13;
  419. uint64 cursor_id = 14;
  420. KeyEvent key_event = 15;
  421. Clipboard clipboard = 16;
  422. FileAction file_action = 17;
  423. FileResponse file_response = 18;
  424. Misc misc = 19;
  425. Cliprdr cliprdr = 20;
  426. }
  427. }