blob: 51b722e389ed7adecd5d4245742e882e71d9bb0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
import java.util.Optional
/*
TODO:
- add arguments to methods
*/
/**
* The [NinePTranslator] interface provides methods that coincide 1:1 with each request and response type in the 9P
* protocol, except for `Rerror` which is handled at occurrence.
*
* Trivia: comments for each method are taken from each message type's manual page in section 5.
*/
interface NinePTranslator {
/**
* Negotiate protocol version.
*
* This must be the first message sent on the 9P connection and no other requests can be issued until a response has
* been received.
* Tag should be NOTAG ((ushort)~0).
*
* @param tag Should be NOTAG ((ushort)~0).
* @param msize The maximum length, in bytes, that the client will ever generate or expect to receive in a single
* 9P message.
* @param version Should be "9P2000", which is the only defined value.
* @return a possible error.
*/
fun version(tag: SizedMessageField, msize: SizedMessageField, version: String): String?
/**
* Perform authentication.
*/
fun auth()
/**
* Abort a message.
*/
fun flush()
/**
* Establish a connection.
*/
fun attach()
/**
* Descend a directory hierarchy.
*/
fun walk(path: String)
/**
* Prepare an FID for I/O on an existing file.
*/
fun open(path: String)
/**
* Prepare an FID for I/O on a new file.
*/
fun create(path: String)
/**
* Transfer data from file.
*/
fun read(path: String)
/**
* Transfer data to file.
*/
fun write(path: String)
/**
* Forget about an FID.
*/
fun clunk(path: String)
/**
* Remove a file from a server.
*/
fun remove(path: String)
/**
* Inquire file attributes.
*/
fun stat(path: String)
/**
* Change file attributes.
*/
fun wstat(path: String)
}
|