Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/liboventi/venti.txt

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



protocol version id

both client and server send '\n' terminated ascii of the form

venti-<versions>-<software>


<software> = is a software id which is ignored but may be useful for debugging

If the server and client have the same version number then this
version is used.  Otherwise backup to the greatest common
major version number, e.g. 1.00 2.00 etc.  If no version in
common then abort.  The idea is both client and server should
support a continusous range of major versions.  The minor version
numbers are used for development purposes.

After protocol negotiation switch to binary format

all numbers sent big endian

strings are sent with 2 byte length without nulls and in utf-8 max size of 1K

RPC protocol

header 
	op[1]	byte op
	tid[2]	transation id

client manages the tid space.  Until session is established tid must equal 0.
i.e. only one outstanding op.

CipherStrength
	None,
	Auth,
	Weak,
	Strong
CipherAlgorithms
	None
	SSL3
	TLS1
CompressionAlgorithms
	None
	Deflate
	Thwack?

BlockTypes
	Root
	Pointer
	Data

==============================================

TPing
RPing

RError
	error: string

THello
	version:string;		know to be supported by both
	uid: string
	uhash[20]		use for cipher boot strapping
	cipherstrength[1]
	ncipher[1];
	cipher[ncipher];
	ncompressor[1];
	compressor[ncompressor];
RHello
	sid: string
	shash[20];		use for cipher bott strapping
	cipher[1];
	compressor[1];

use srp style authentication
	g=2
	N is safe prime 1024 bits - find a good prime!

	x = H("venti" H(sid) H(uid) H(password))
	v = g^x
	a = random
	b = random
	B = (v + g^b)
	A = g^a
	u = first four bytes of H(B)
	S = (B - g^x) ^ (a + u*x) = (A * v^u) ^ b
	K = H(S)
	M1 = H(H(versions) H(THello) H(RHello) A B K)
	M2 = H(A M1 K)

TAuth0
	A[128]
RAuth0
	B[128]
TAuth1
	M1[20]
RAuth1
	M2[20]

push cipher
push compression

TWrite
	length[2] max 56*1024
	type[1]
	data[length]
RWrite
	hash[20]

TRead
	hash[20]
	type[1]
	length[2]
RRead
	length[2]
	data[length]

============================================================

simplified access when trusting the server
reduces network bandwidth since pointer blocks are not
sent to the client - can also enable permission checking

RReadRoot
	root[20]
TReadRoot
	name: string
	type: string
	blocksize[2]
	nblock[8]
	time[4]
	uid: string;
	gid: string

RReadData
	root[20]
	block[8]
	length[2]
TReadData
	length[2]
	collision[1]
	data[length]

==============================================

maybe some clients should be required to navigate to block via root nodes.
This would enable permission checking via access to the root node.

RTagOpen
	tag[2]
	root[20]
TTagOpen

QTagRead
	tag[2]
	type[1]
	length[2]
RTagRead
	length[2]
	data[length]
	
QTagWalkRead
	tag[2]
	ntag[2]		can reuse a tag to do an implict clunk
	index[2]
	type[1]
	length[2]
RTagWalkRead
	length[2]
	data[length]

RTagClunk
	tag[2]
TTagClunk

============================

Types of blocks

Data

Root
	name[128]
	type[128]
	score[20]	- DirBlock

Pointer
	score[20]*	the number of hashes can be less than fanout when the
			tree is not full
DirBlock
	DirEntry[32]*

DirEntry	
	pointersize[2]	- pointer block size
	datasize[2]	- data blocks size
	flag[1]		directory
	size[7]		in bytes - determines pointer depth - intermidate truncated block count as full
	score[20]	root of pointer blocks or data block 

============================

mode flags
	(1<<0)	ModeOtherExec
	(1<<1)	ModeOtherWrite
	(1<<2)	ModeOtherRead
	(1<<3)	ModeGroupExec
	(1<<4)	ModeGroupWrite
	(1<<5)	ModeGroupRead
	(1<<6)	ModeOwnerExec
	(1<<7)	ModeOwnerWrite
	(1<<8)	ModeOwnerRead
	(1<<9)	ModeSticky
	(1<<10)	ModeSetUid
	(1<<11)	ModeSetGid
	(1<<12)	ModeAppend
	(1<<13)	ModeExclusive
	(1<<14)	ModeLink
	(1<<15)	ModeDir	- duplicates dir entry
	(1<<16) ModeHidden
	(1<<17) ModeSystem
	(1<<18) ModeArchive
	(1<<19) ModeTemporary
	(1<<18) ModeCompressed
	(1<<19) ModeEncrypted

extraType
	2	Plan9
	version[4]
	muid: string

	3 NT Time
	createTime[8];
	modifyTime[8];
	accessTime[8]
	

MetaEntry
	name: string	/* must be first */
	direntry[4]

	id[8]

	uid: string
	gui: string
	mtime[4]
	ctime[4]
	atime[4]
	
	mode[4] 
	
	extratype;
	extrasize[2]
	extra:[nextra]

MetaEntry Block
	magic[4]
	size[2]
	free[2]	- used to determine if work compacting
	maxindex[2] - size of index table in bytes
	nindex[2]
	index[2*nindex]

per OS directory entries?

inode...



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].