summaryrefslogtreecommitdiff
path: root/doc/protocol.md
blob: b804df750f8d76608204b4992f5c8ec58f2f7c99 (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
Next File Transfer Protocol
===========================

Introduction
------------

Next File Transfer uses a simple protocol where a single character defines
a message type. 

The following are standard compents of a message:

> <NNNNN>	5 ASCII digits making up a zero-padded number.
> <N bytes>	A stream of N bytes.


Put File
--------

The format of the message from the client is:

> A		Put file command
> <NNNNN>	Length of filename
> <N bytes>	The filename
> <NNNNN>	Length of the data for the file.
> <N bytes>	The data.

The server responds with either:

> OK		The command completed OK

or:

> !E		There was an error writing the file.


Get File
--------

The format of the message from the client is:

> B		Put file command
> <NNNNN>	Length of filename
> <N bytes>	The filename

The server responds with either:

> OK		The command completed OK.  The file contents will follow.
> <NNNNN>	The length of the following data.
> <N bytes>	The data frin from the file.

or:

> !E		There was an error reading the file.


Change Directory
----------------

The format of the message from the client is:

> C		Change directory command
> NNNNN		Length of pathname
> <N bytes>	The pathname

The server responds with either:

> OK		The command completed OK

or:

> !E		There was an error changing to the directory


Create Directory
----------------

The format of the message from the client is:

> D		Create directory command
> NNNNN		Length of pathname
> <N bytes>	The pathname

The server responds with either:

> OK		The command completed OK

or:

> !E		There was an error creating the directory