message.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. syntax = "proto3";
  2. package hbb;
  3. message EncodedVideoFrame {
  4. bytes data = 1;
  5. bool key = 2;
  6. int64 pts = 3;
  7. }
  8. message EncodedVideoFrames { repeated EncodedVideoFrame 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. EncodedVideoFrames vp9s = 6;
  18. RGB rgb = 7;
  19. YUV yuv = 8;
  20. EncodedVideoFrames h264s = 10;
  21. EncodedVideoFrames h265s = 11;
  22. }
  23. int64 timestamp = 9;
  24. }
  25. message IdPk {
  26. string id = 1;
  27. bytes pk = 2;
  28. }
  29. message DisplayInfo {
  30. sint32 x = 1;
  31. sint32 y = 2;
  32. int32 width = 3;
  33. int32 height = 4;
  34. string name = 5;
  35. bool online = 6;
  36. bool cursor_embedded = 7;
  37. }
  38. message PortForward {
  39. string host = 1;
  40. int32 port = 2;
  41. }
  42. message FileTransfer {
  43. string dir = 1;
  44. bool show_hidden = 2;
  45. }
  46. message LoginRequest {
  47. string username = 1;
  48. bytes password = 2;
  49. string my_id = 4;
  50. string my_name = 5;
  51. OptionMessage option = 6;
  52. oneof union {
  53. FileTransfer file_transfer = 7;
  54. PortForward port_forward = 8;
  55. }
  56. bool video_ack_required = 9;
  57. uint64 session_id = 10;
  58. string version = 11;
  59. }
  60. message ChatMessage { string text = 1; }
  61. message Features {
  62. bool privacy_mode = 1;
  63. }
  64. message SupportedEncoding {
  65. bool h264 = 1;
  66. bool h265 = 2;
  67. }
  68. message PeerInfo {
  69. string username = 1;
  70. string hostname = 2;
  71. string platform = 3;
  72. repeated DisplayInfo displays = 4;
  73. int32 current_display = 5;
  74. bool sas_enabled = 6;
  75. string version = 7;
  76. int32 conn_id = 8;
  77. Features features = 9;
  78. SupportedEncoding encoding = 10;
  79. }
  80. message LoginResponse {
  81. oneof union {
  82. string error = 1;
  83. PeerInfo peer_info = 2;
  84. }
  85. }
  86. message MouseEvent {
  87. int32 mask = 1;
  88. sint32 x = 2;
  89. sint32 y = 3;
  90. repeated ControlKey modifiers = 4;
  91. }
  92. enum KeyboardMode{
  93. Legacy = 0;
  94. Map = 1;
  95. Translate = 2;
  96. Auto = 3;
  97. }
  98. enum ControlKey {
  99. Unknown = 0;
  100. Alt = 1;
  101. Backspace = 2;
  102. CapsLock = 3;
  103. Control = 4;
  104. Delete = 5;
  105. DownArrow = 6;
  106. End = 7;
  107. Escape = 8;
  108. F1 = 9;
  109. F10 = 10;
  110. F11 = 11;
  111. F12 = 12;
  112. F2 = 13;
  113. F3 = 14;
  114. F4 = 15;
  115. F5 = 16;
  116. F6 = 17;
  117. F7 = 18;
  118. F8 = 19;
  119. F9 = 20;
  120. Home = 21;
  121. LeftArrow = 22;
  122. /// meta key (also known as "windows"; "super"; and "command")
  123. Meta = 23;
  124. /// option key on macOS (alt key on Linux and Windows)
  125. Option = 24; // deprecated, use Alt instead
  126. PageDown = 25;
  127. PageUp = 26;
  128. Return = 27;
  129. RightArrow = 28;
  130. Shift = 29;
  131. Space = 30;
  132. Tab = 31;
  133. UpArrow = 32;
  134. Numpad0 = 33;
  135. Numpad1 = 34;
  136. Numpad2 = 35;
  137. Numpad3 = 36;
  138. Numpad4 = 37;
  139. Numpad5 = 38;
  140. Numpad6 = 39;
  141. Numpad7 = 40;
  142. Numpad8 = 41;
  143. Numpad9 = 42;
  144. Cancel = 43;
  145. Clear = 44;
  146. Menu = 45; // deprecated, use Alt instead
  147. Pause = 46;
  148. Kana = 47;
  149. Hangul = 48;
  150. Junja = 49;
  151. Final = 50;
  152. Hanja = 51;
  153. Kanji = 52;
  154. Convert = 53;
  155. Select = 54;
  156. Print = 55;
  157. Execute = 56;
  158. Snapshot = 57;
  159. Insert = 58;
  160. Help = 59;
  161. Sleep = 60;
  162. Separator = 61;
  163. Scroll = 62;
  164. NumLock = 63;
  165. RWin = 64;
  166. Apps = 65;
  167. Multiply = 66;
  168. Add = 67;
  169. Subtract = 68;
  170. Decimal = 69;
  171. Divide = 70;
  172. Equals = 71;
  173. NumpadEnter = 72;
  174. RShift = 73;
  175. RControl = 74;
  176. RAlt = 75;
  177. CtrlAltDel = 100;
  178. LockScreen = 101;
  179. }
  180. message KeyEvent {
  181. bool down = 1;
  182. bool press = 2;
  183. oneof union {
  184. ControlKey control_key = 3;
  185. uint32 chr = 4;
  186. uint32 unicode = 5;
  187. string seq = 6;
  188. }
  189. repeated ControlKey modifiers = 8;
  190. KeyboardMode mode = 9;
  191. }
  192. message CursorData {
  193. uint64 id = 1;
  194. sint32 hotx = 2;
  195. sint32 hoty = 3;
  196. int32 width = 4;
  197. int32 height = 5;
  198. bytes colors = 6;
  199. }
  200. message CursorPosition {
  201. sint32 x = 1;
  202. sint32 y = 2;
  203. }
  204. message Hash {
  205. string salt = 1;
  206. string challenge = 2;
  207. }
  208. message Clipboard {
  209. bool compress = 1;
  210. bytes content = 2;
  211. }
  212. enum FileType {
  213. Dir = 0;
  214. DirLink = 2;
  215. DirDrive = 3;
  216. File = 4;
  217. FileLink = 5;
  218. }
  219. message FileEntry {
  220. FileType entry_type = 1;
  221. string name = 2;
  222. bool is_hidden = 3;
  223. uint64 size = 4;
  224. uint64 modified_time = 5;
  225. }
  226. message FileDirectory {
  227. int32 id = 1;
  228. string path = 2;
  229. repeated FileEntry entries = 3;
  230. }
  231. message ReadDir {
  232. string path = 1;
  233. bool include_hidden = 2;
  234. }
  235. message ReadAllFiles {
  236. int32 id = 1;
  237. string path = 2;
  238. bool include_hidden = 3;
  239. }
  240. message FileAction {
  241. oneof union {
  242. ReadDir read_dir = 1;
  243. FileTransferSendRequest send = 2;
  244. FileTransferReceiveRequest receive = 3;
  245. FileDirCreate create = 4;
  246. FileRemoveDir remove_dir = 5;
  247. FileRemoveFile remove_file = 6;
  248. ReadAllFiles all_files = 7;
  249. FileTransferCancel cancel = 8;
  250. FileTransferSendConfirmRequest send_confirm = 9;
  251. }
  252. }
  253. message FileTransferCancel { int32 id = 1; }
  254. message FileResponse {
  255. oneof union {
  256. FileDirectory dir = 1;
  257. FileTransferBlock block = 2;
  258. FileTransferError error = 3;
  259. FileTransferDone done = 4;
  260. FileTransferDigest digest = 5;
  261. }
  262. }
  263. message FileTransferDigest {
  264. int32 id = 1;
  265. sint32 file_num = 2;
  266. uint64 last_modified = 3;
  267. uint64 file_size = 4;
  268. bool is_upload = 5;
  269. }
  270. message FileTransferBlock {
  271. int32 id = 1;
  272. sint32 file_num = 2;
  273. bytes data = 3;
  274. bool compressed = 4;
  275. uint32 blk_id = 5;
  276. }
  277. message FileTransferError {
  278. int32 id = 1;
  279. string error = 2;
  280. sint32 file_num = 3;
  281. }
  282. message FileTransferSendRequest {
  283. int32 id = 1;
  284. string path = 2;
  285. bool include_hidden = 3;
  286. int32 file_num = 4;
  287. }
  288. message FileTransferSendConfirmRequest {
  289. int32 id = 1;
  290. sint32 file_num = 2;
  291. oneof union {
  292. bool skip = 3;
  293. uint32 offset_blk = 4;
  294. }
  295. }
  296. message FileTransferDone {
  297. int32 id = 1;
  298. sint32 file_num = 2;
  299. }
  300. message FileTransferReceiveRequest {
  301. int32 id = 1;
  302. string path = 2; // path written to
  303. repeated FileEntry files = 3;
  304. int32 file_num = 4;
  305. }
  306. message FileRemoveDir {
  307. int32 id = 1;
  308. string path = 2;
  309. bool recursive = 3;
  310. }
  311. message FileRemoveFile {
  312. int32 id = 1;
  313. string path = 2;
  314. sint32 file_num = 3;
  315. }
  316. message FileDirCreate {
  317. int32 id = 1;
  318. string path = 2;
  319. }
  320. // main logic from freeRDP
  321. message CliprdrMonitorReady {
  322. }
  323. message CliprdrFormat {
  324. int32 id = 2;
  325. string format = 3;
  326. }
  327. message CliprdrServerFormatList {
  328. repeated CliprdrFormat formats = 2;
  329. }
  330. message CliprdrServerFormatListResponse {
  331. int32 msg_flags = 2;
  332. }
  333. message CliprdrServerFormatDataRequest {
  334. int32 requested_format_id = 2;
  335. }
  336. message CliprdrServerFormatDataResponse {
  337. int32 msg_flags = 2;
  338. bytes format_data = 3;
  339. }
  340. message CliprdrFileContentsRequest {
  341. int32 stream_id = 2;
  342. int32 list_index = 3;
  343. int32 dw_flags = 4;
  344. int32 n_position_low = 5;
  345. int32 n_position_high = 6;
  346. int32 cb_requested = 7;
  347. bool have_clip_data_id = 8;
  348. int32 clip_data_id = 9;
  349. }
  350. message CliprdrFileContentsResponse {
  351. int32 msg_flags = 3;
  352. int32 stream_id = 4;
  353. bytes requested_data = 5;
  354. }
  355. message Cliprdr {
  356. oneof union {
  357. CliprdrMonitorReady ready = 1;
  358. CliprdrServerFormatList format_list = 2;
  359. CliprdrServerFormatListResponse format_list_response = 3;
  360. CliprdrServerFormatDataRequest format_data_request = 4;
  361. CliprdrServerFormatDataResponse format_data_response = 5;
  362. CliprdrFileContentsRequest file_contents_request = 6;
  363. CliprdrFileContentsResponse file_contents_response = 7;
  364. }
  365. }
  366. message SwitchDisplay {
  367. int32 display = 1;
  368. sint32 x = 2;
  369. sint32 y = 3;
  370. int32 width = 4;
  371. int32 height = 5;
  372. bool cursor_embedded = 6;
  373. }
  374. message PermissionInfo {
  375. enum Permission {
  376. Keyboard = 0;
  377. Clipboard = 2;
  378. Audio = 3;
  379. File = 4;
  380. Restart = 5;
  381. Recording = 6;
  382. }
  383. Permission permission = 1;
  384. bool enabled = 2;
  385. }
  386. enum ImageQuality {
  387. NotSet = 0;
  388. Low = 2;
  389. Balanced = 3;
  390. Best = 4;
  391. }
  392. message VideoCodecState {
  393. enum PreferCodec {
  394. Auto = 0;
  395. VPX = 1;
  396. H264 = 2;
  397. H265 = 3;
  398. }
  399. int32 score_vpx = 1;
  400. int32 score_h264 = 2;
  401. int32 score_h265 = 3;
  402. PreferCodec prefer = 4;
  403. }
  404. message OptionMessage {
  405. enum BoolOption {
  406. NotSet = 0;
  407. No = 1;
  408. Yes = 2;
  409. }
  410. ImageQuality image_quality = 1;
  411. BoolOption lock_after_session_end = 2;
  412. BoolOption show_remote_cursor = 3;
  413. BoolOption privacy_mode = 4;
  414. BoolOption block_input = 5;
  415. int32 custom_image_quality = 6;
  416. BoolOption disable_audio = 7;
  417. BoolOption disable_clipboard = 8;
  418. BoolOption enable_file_transfer = 9;
  419. VideoCodecState video_codec_state = 10;
  420. int32 custom_fps = 11;
  421. }
  422. message TestDelay {
  423. int64 time = 1;
  424. bool from_client = 2;
  425. uint32 last_delay = 3;
  426. uint32 target_bitrate = 4;
  427. }
  428. message PublicKey {
  429. bytes asymmetric_value = 1;
  430. bytes symmetric_value = 2;
  431. }
  432. message SignedId { bytes id = 1; }
  433. message AudioFormat {
  434. uint32 sample_rate = 1;
  435. uint32 channels = 2;
  436. }
  437. message AudioFrame {
  438. bytes data = 1;
  439. int64 timestamp = 2;
  440. }
  441. // Notify peer to show message box.
  442. message MessageBox {
  443. // Message type. Refer to flutter/lib/common.dart/msgBox().
  444. string msgtype = 1;
  445. string title = 2;
  446. // English
  447. string text = 3;
  448. // If not empty, msgbox provides a button to following the link.
  449. // The link here can't be directly http url.
  450. // It must be the key of http url configed in peer side or "rustdesk://*" (jump in app).
  451. string link = 4;
  452. }
  453. message BackNotification {
  454. // no need to consider block input by someone else
  455. enum BlockInputState {
  456. BlkStateUnknown = 0;
  457. BlkOnSucceeded = 2;
  458. BlkOnFailed = 3;
  459. BlkOffSucceeded = 4;
  460. BlkOffFailed = 5;
  461. }
  462. enum PrivacyModeState {
  463. PrvStateUnknown = 0;
  464. // Privacy mode on by someone else
  465. PrvOnByOther = 2;
  466. // Privacy mode is not supported on the remote side
  467. PrvNotSupported = 3;
  468. // Privacy mode on by self
  469. PrvOnSucceeded = 4;
  470. // Privacy mode on by self, but denied
  471. PrvOnFailedDenied = 5;
  472. // Some plugins are not found
  473. PrvOnFailedPlugin = 6;
  474. // Privacy mode on by self, but failed
  475. PrvOnFailed = 7;
  476. // Privacy mode off by self
  477. PrvOffSucceeded = 8;
  478. // Ctrl + P
  479. PrvOffByPeer = 9;
  480. // Privacy mode off by self, but failed
  481. PrvOffFailed = 10;
  482. PrvOffUnknown = 11;
  483. }
  484. oneof union {
  485. PrivacyModeState privacy_mode_state = 1;
  486. BlockInputState block_input_state = 2;
  487. }
  488. }
  489. message ElevationRequestWithLogon {
  490. string username = 1;
  491. string password = 2;
  492. }
  493. message ElevationRequest {
  494. oneof union {
  495. bool direct = 1;
  496. ElevationRequestWithLogon logon = 2;
  497. }
  498. }
  499. message SwitchSidesRequest {
  500. bytes uuid = 1;
  501. }
  502. message SwitchSidesResponse {
  503. bytes uuid = 1;
  504. LoginRequest lr = 2;
  505. }
  506. message SwitchBack {}
  507. message Misc {
  508. oneof union {
  509. ChatMessage chat_message = 4;
  510. SwitchDisplay switch_display = 5;
  511. PermissionInfo permission_info = 6;
  512. OptionMessage option = 7;
  513. AudioFormat audio_format = 8;
  514. string close_reason = 9;
  515. bool refresh_video = 10;
  516. bool video_received = 12;
  517. BackNotification back_notification = 13;
  518. bool restart_remote_device = 14;
  519. bool uac = 15;
  520. bool foreground_window_elevated = 16;
  521. bool stop_service = 17;
  522. ElevationRequest elevation_request = 18;
  523. string elevation_response = 19;
  524. bool portable_service_running = 20;
  525. SwitchSidesRequest switch_sides_request = 21;
  526. SwitchBack switch_back = 22;
  527. }
  528. }
  529. message VoiceCallRequest {
  530. int64 req_timestamp = 1;
  531. // Indicates whether the request is a connect action or a disconnect action.
  532. bool is_connect = 2;
  533. }
  534. message VoiceCallResponse {
  535. bool accepted = 1;
  536. int64 req_timestamp = 2; // Should copy from [VoiceCallRequest::req_timestamp].
  537. int64 ack_timestamp = 3;
  538. }
  539. message Message {
  540. oneof union {
  541. SignedId signed_id = 3;
  542. PublicKey public_key = 4;
  543. TestDelay test_delay = 5;
  544. VideoFrame video_frame = 6;
  545. LoginRequest login_request = 7;
  546. LoginResponse login_response = 8;
  547. Hash hash = 9;
  548. MouseEvent mouse_event = 10;
  549. AudioFrame audio_frame = 11;
  550. CursorData cursor_data = 12;
  551. CursorPosition cursor_position = 13;
  552. uint64 cursor_id = 14;
  553. KeyEvent key_event = 15;
  554. Clipboard clipboard = 16;
  555. FileAction file_action = 17;
  556. FileResponse file_response = 18;
  557. Misc misc = 19;
  558. Cliprdr cliprdr = 20;
  559. MessageBox message_box = 21;
  560. SwitchSidesResponse switch_sides_response = 22;
  561. VoiceCallRequest voice_call_request = 23;
  562. VoiceCallResponse voice_call_response = 24;
  563. }
  564. }