sohotcall

MessagePack

Mar 10th, 2020
187
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MessagePack
  2. ===========
  3. (https://github.com/msgpack/msgpack)
  4. MessagePack is an object serialization specification.
  5. Unlike JSON, MessagePack is more compact but not human-readable.
  6.  
  7. NULL
  8. ====
  9. 11000000 : Null
  10.  
  11. BOOLEAN, INTEGER
  12. ================
  13. 11000010 : False
  14. 11000011 : True
  15. 0XXXXXXX : Positive integer
  16. 111XXXXX : Negative integer
  17. 11001100 1*XXXXXXXX : Uint8
  18. 11001101 2*XXXXXXXX : Uint16
  19. 11001110 4*XXXXXXXX : Uint32
  20. 11001111 8*XXXXXXXX : Uint64
  21. 11010000 1*XXXXXXXX : Int8
  22. 11010001 2*XXXXXXXX : Int16
  23. 11010010 4*XXXXXXXX : Int32
  24. 11010011 8*XXXXXXXX : Int64
  25.  
  26. FLOAT
  27. =====
  28. 11001010 4*XXXXXXXX : Float32
  29. 11001011 8*XXXXXXXX : Float64
  30.  
  31. STRING, BLOB
  32. ============
  33. - X: Length of data in bytes
  34. - Y: Data, array of char/byte
  35. 101XXXXX ( YYYYYYYY )* : String
  36. 11011001 1*XXXXXXXX ( YYYYYYYY )* : String
  37. 11011010 2*XXXXXXXX ( YYYYYYYY )* : String
  38. 11011011 4*XXXXXXXX ( YYYYYYYY )* : String
  39. 11000100 1*XXXXXXXX ( YYYYYYYY )* : Blob
  40. 11000101 2*XXXXXXXX ( YYYYYYYY )* : Blob
  41. 11000110 4*XXXXXXXX ( YYYYYYYY )* : Blob
  42.  
  43. ARRAY, KEY-VALUES
  44. =================
  45. - X: Number of items, number of key-value pairs
  46. - <item>, <key>, <value>: Item, key, value
  47. 1001XXXX ( <item> )* : array
  48. 11011100 2*XXXXXXXX ( <item> )* : array
  49. 11011101 4*XXXXXXXX ( <item> )* : array
  50. 1000XXXX ( <key> <value> )* : key-values
  51. 11011110 2*XXXXXXXX ( <key> <value> )* : key-values
  52. 11011111 4*XXXXXXXX ( <key> <value> )* : key-values
  53.  
  54. CUSTOM TYPE DATA
  55. ================
  56. - X: Length of data in bytes
  57. - Y: Type, use 0YYYYYYY because 1YYYYYYY is reserved
  58. - Z: Data, array of byte
  59. 11010100 0YYYYYYY 1*ZZZZZZZZ
  60. 11010101 0YYYYYYY 2*ZZZZZZZZ
  61. 11010110 0YYYYYYY 4*ZZZZZZZZ
  62. 11010111 0YYYYYYY 8*ZZZZZZZZ
  63. 11011000 0YYYYYYY 16*ZZZZZZZZ
  64. 11000111 1*XXXXXXXX 0YYYYYYY ( ZZZZZZZZ )*
  65. 11001000 2*XXXXXXXX 0YYYYYYY ( ZZZZZZZZ )*
  66. 11001001 4*XXXXXXXX ( ZZZZZZZZ )*
  67.  
  68. TIMESTAMP
  69. =========
  70. - N: Nanoseconds (0 to 999999)
  71. - S: Seconds
  72. 11010110 11111111 4*SSSSSSSS (S is unsigned)
  73. 11010111 11111111 30*N 34*S (S is unsigned)
  74. 11000111 00001100 11111111 4*NNNNNNNN 8*SSSSSSSS (S is signed)
RAW Paste Data