venti.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. protocol version id
  2. both client and server send '\n' terminated ascii of the form
  3. venti-<versions>-<software>
  4. <software> = is a software id which is ignored but may be useful for debugging
  5. If the server and client have the same version number then this
  6. version is used. Otherwise backup to the greatest common
  7. major version number, e.g. 1.00 2.00 etc. If no version in
  8. common then abort. The idea is both client and server should
  9. support a continusous range of major versions. The minor version
  10. numbers are used for development purposes.
  11. After protocol negotiation switch to binary format
  12. all numbers sent big endian
  13. strings are sent with 2 byte length without nulls and in utf-8 max size of 1K
  14. RPC protocol
  15. header
  16. op[1] byte op
  17. tid[2] transation id
  18. client manages the tid space. Until session is established tid must equal 0.
  19. i.e. only one outstanding op.
  20. CipherStrength
  21. None,
  22. Auth,
  23. Weak,
  24. Strong
  25. CipherAlgorithms
  26. None
  27. SSL3
  28. TLS1
  29. CompressionAlgorithms
  30. None
  31. Deflate
  32. Thwack?
  33. BlockTypes
  34. Root
  35. Pointer
  36. Data
  37. ==============================================
  38. TPing
  39. RPing
  40. RError
  41. error: string
  42. THello
  43. version:string; know to be supported by both
  44. uid: string
  45. uhash[20] use for cipher boot strapping
  46. cipherstrength[1]
  47. ncipher[1];
  48. cipher[ncipher];
  49. ncompressor[1];
  50. compressor[ncompressor];
  51. RHello
  52. sid: string
  53. shash[20]; use for cipher bott strapping
  54. cipher[1];
  55. compressor[1];
  56. use srp style authentication
  57. g=2
  58. N is safe prime 1024 bits - find a good prime!
  59. x = H("venti" H(sid) H(uid) H(password))
  60. v = g^x
  61. a = random
  62. b = random
  63. B = (v + g^b)
  64. A = g^a
  65. u = first four bytes of H(B)
  66. S = (B - g^x) ^ (a + u*x) = (A * v^u) ^ b
  67. K = H(S)
  68. M1 = H(H(versions) H(THello) H(RHello) A B K)
  69. M2 = H(A M1 K)
  70. TAuth0
  71. A[128]
  72. RAuth0
  73. B[128]
  74. TAuth1
  75. M1[20]
  76. RAuth1
  77. M2[20]
  78. push cipher
  79. push compression
  80. TWrite
  81. length[2] max 56*1024
  82. type[1]
  83. data[length]
  84. RWrite
  85. hash[20]
  86. TRead
  87. hash[20]
  88. type[1]
  89. length[2]
  90. RRead
  91. length[2]
  92. data[length]
  93. ============================================================
  94. simplified access when trusting the server
  95. reduces network bandwidth since pointer blocks are not
  96. sent to the client - can also enable permission checking
  97. RReadRoot
  98. root[20]
  99. TReadRoot
  100. name: string
  101. type: string
  102. blocksize[2]
  103. nblock[8]
  104. time[4]
  105. uid: string;
  106. gid: string
  107. RReadData
  108. root[20]
  109. block[8]
  110. length[2]
  111. TReadData
  112. length[2]
  113. collision[1]
  114. data[length]
  115. ==============================================
  116. maybe some clients should be required to navigate to block via root nodes.
  117. This would enable permission checking via access to the root node.
  118. RTagOpen
  119. tag[2]
  120. root[20]
  121. TTagOpen
  122. QTagRead
  123. tag[2]
  124. type[1]
  125. length[2]
  126. RTagRead
  127. length[2]
  128. data[length]
  129. QTagWalkRead
  130. tag[2]
  131. ntag[2] can reuse a tag to do an implict clunk
  132. index[2]
  133. type[1]
  134. length[2]
  135. RTagWalkRead
  136. length[2]
  137. data[length]
  138. RTagClunk
  139. tag[2]
  140. TTagClunk
  141. ============================
  142. Types of blocks
  143. Data
  144. Root
  145. name[128]
  146. type[128]
  147. score[20] - DirBlock
  148. Pointer
  149. score[20]* the number of hashes can be less than fanout when the
  150. tree is not full
  151. DirBlock
  152. DirEntry[32]*
  153. DirEntry
  154. pointersize[2] - pointer block size
  155. datasize[2] - data blocks size
  156. flag[1] directory
  157. size[7] in bytes - determines pointer depth - intermidate truncated block count as full
  158. score[20] root of pointer blocks or data block
  159. ============================
  160. mode flags
  161. (1<<0) ModeOtherExec
  162. (1<<1) ModeOtherWrite
  163. (1<<2) ModeOtherRead
  164. (1<<3) ModeGroupExec
  165. (1<<4) ModeGroupWrite
  166. (1<<5) ModeGroupRead
  167. (1<<6) ModeOwnerExec
  168. (1<<7) ModeOwnerWrite
  169. (1<<8) ModeOwnerRead
  170. (1<<9) ModeSticky
  171. (1<<10) ModeSetUid
  172. (1<<11) ModeSetGid
  173. (1<<12) ModeAppend
  174. (1<<13) ModeExclusive
  175. (1<<14) ModeLink
  176. (1<<15) ModeDir - duplicates dir entry
  177. (1<<16) ModeHidden
  178. (1<<17) ModeSystem
  179. (1<<18) ModeArchive
  180. (1<<19) ModeTemporary
  181. (1<<18) ModeCompressed
  182. (1<<19) ModeEncrypted
  183. extraType
  184. 2 Plan9
  185. version[4]
  186. muid: string
  187. 3 NT Time
  188. createTime[8];
  189. modifyTime[8];
  190. accessTime[8]
  191. MetaEntry
  192. name: string /* must be first */
  193. direntry[4]
  194. id[8]
  195. uid: string
  196. gui: string
  197. mtime[4]
  198. ctime[4]
  199. atime[4]
  200. mode[4]
  201. extratype;
  202. extrasize[2]
  203. extra:[nextra]
  204. MetaEntry Block
  205. magic[4]
  206. size[2]
  207. free[2] - used to determine if work compacting
  208. maxindex[2] - size of index table in bytes
  209. nindex[2]
  210. index[2*nindex]
  211. per OS directory entries?
  212. inode...