cfsnet-protocol-buffers
v0.1.11
Published
CFSNet Protocol Buffers
Downloads
193
Readme
cfsnet-protocol-buffers
Protocol buffers for CFSNET
Table of Contents
Status
Stable
Dependencies
- Protocol Buffer compiler protoc
- protoc-c
- protoc-gen-doc to generate docs optional
Installation
$ npm install
$ make all
Usage
- TODO
Messages
- AccessFile
- Boolean
- Buffer
- Close
- DownloadDirectory
- DownloadFile
- Handshake
- KeyPair
- List
- ListDirectory
- MakeDirectory
- Number
- Open
- Read
- ReadFile
- RemoveDirectory
- RemoveDirectoryPath
- Request
- Resolve
- Response
- Stat
- StatFile
- String
- TouchFile
- UnlinkFile
- WriteFile
AccessFile
Implements AccessFile(path, [mode])
operation. Send this message to check the access of a file.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | filepath | | mode | FileMode | One of the FileMode enum values |
Boolean
Protobuf message wrapping Bool
.
| Field | Type | Description | | ----- | ---- | ----------- | | value | bool | boolean |
Buffer
Protobuf message wrapping generic byte buffer.
| Field | Type | Description | | ----- | ---- | ----------- | | value | bytes | TODO | | length | uint64 | Size of value |
Close
Implements Open(fd)
operation. Send this message to open a file and get a file descriptor.
| Field | Type | Description | | ----- | ---- | ----------- | | fileDescriptor | unit32 | TODO |
DownloadDirectory
Implements DownloadDirectory(path)
operation. Send this message to download a directory.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of directory to download |
DownloadFile
Implements DownloadFile(path)
operation. Send this message to download a file.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of file to download |
Drive
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | id | bytes | TODO | | key | bytes | TODO | | secretKey | bytes | TODO |
Handshake
A Handshake
message is used between client (Alice) and server (Bob) to capture a handshake prior to a request message exchange. This should be the first payload sent in request to initiate a connection handshake.
| Field | Type | Description | | ----- | ---- | ----------- | | nonce | bytes | One time use nonce value; should be SHA256 hash of output from a pseudo random number generator | | key | bytes | BLAKE2b hash of the concatenation of "CFSNET1" and nonce | | ack | bool | indicates the handshake was acknowledged by receiver |
KeyPair
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | seed | bytes | TODO | | publicKey | bytes | TODO | | secretKey | bytes | TODO |
List
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | values | repeated bytes | TODO | | length | uint64 | TODO |
ListDirectory
Implements ListDirectory(path)
operation. Send this message to list a directory.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of directory to list |
MakeDirectory
Implements MakeDirectory(path)
operation. Send this message to make a directory. Parent directory should already exist.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of where to create directory |
MakeDirectoryPath
Implements MakeDirectory(path)
operation. Send this message to make a directory. Parent directories will be made if they do not already exist in the path.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of where to create directory |
Number
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | value | double | TODO |
Open
Implements Open(path)
operation. Send this message to open a file and get a file descriptor.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath to file to open | | flags | string | TODO |
Read
Implements Read(fd, start, end)
operation. Send this message to read a range from an open file descriptor.
| Field | Type | Description | | ----- | ---- | ----------- | | fileDescriptor | uint32 | TODO | | start | uint32 | Offset to start reading from | | end | uint32 | Offset to stop reading from |
ReadFile
Implements ReadFile(path, [start], [end])
operation. Send this message to read a range from an open file descriptor.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Path to file to read | | start | uint32 | Offset to start reading from | | end | uint32 | Offset to stop reading from |
RemoveDirectory
Implements RemoveDirectory(path)
operation. Send this message to remove a directory. The directory should already exist and be empty.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of directory to remove |
RemoveDirectoryPath
Implements RemoveDirectoryPath(path)
operation. Send this message to remove a directory. The directory does not have to exist or be empty.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath of where to create directory |
Request
Represents a request payload for an operation on a CFSNet drive instance.
| Field | Type | Description | | ----- | ---- | ----------- | | nonce | bytes | Number used once | | drive | Drive | Drive | | operation | Operation | Operation | | buffer | bytes | TODO |
Resolve
Implements Resolve(path)
operation. Send this message to resolve a given file path to a fully qualified file name by resolving relative paths (./
) and special tokens (~
).
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath to resolve |
Response
Represents a response payload for an operation on a CFSNet drive instance.
| Field | Type | Description |
| ----- | ---- | ----------- |
| nonce | bytes | matches Request.nonce
|
| drive | Drive | Drive |
| operation | Operation | Operation |
| request | Request | Request |
| errorCode | ErrorCode | ErrorCode |
| buffer | bytes | TODO |
Stat
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | uid | uint32 | TODO | | gid | uint32 | TODO | | mode | uint32 | TODO | | size | uint64 | TODO | | atime | uint64 | TODO | | ctime | uint64 | TODO | | mtime | uint64 | TODO | | blocks | uint64 | TODO |
StatFile
Implements StatFile(path)
operation.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | TODO |
String
TODO
| Field | Type | Description | | ----- | ---- | ----------- | | value | string | TODO |
TouchFile
Implements TouchFile(path)
operation.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath to touch |
UnlinkFile
Implements UnlinkFile(path)
operation.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | Filepath to unlink |
WriteFile
Implements WriteFile(path, buffer, [start], [end])
operation.
| Field | Type | Description | | ----- | ---- | ----------- | | path | string | TODO | | buffer | bytes | TODO | | start | uint32 | TODO | | end | uint32 | TODO |
Enums
FileMode
File mode constants for determining file access.
| Constant | Value |Description | | ----- | ----- |----------- | | F_OK | 0 | TODO | | X_OK | 1 | File is executable | | W_OK | 2 | File is writable | | R_OK | 4 | File is readable |
ErrorCode
Error codes that indicate client or remote errors.
| Constant | Value |Description | | ----- | ----- |----------- | | NoError | 0 | TODO | | BadRequestError | 400 | TODO | | AccessDeniedError | 403 | TODO | | NotFoundError | 404 | TODO | | NotSupportedError | 405 | TODO | | NotOpenedError | 410 | TODO | | InternalError | 500 | TODO | | NotImplementedError | 501 | TODO |
Operation
TODO
| Constant | Value |Description | | ----- | ----- |----------- | | NoOperation | 0 | TODO | | ResolveOperation | 1 | TODO | | KeyPairOperation | 2 | TODO | | OpenOperation | 10 | TODO | | CloseOperation | 11 | TODO | | ReadOperation | 12 | TODO | | WriteOperation | 13 | TODO | | ReadFileOperation | 20 | TODO | | WriteFileOperation | 21 | TODO | | StatFileOperation | 22 | TODO | | UnlinkFileOperation | 23 | TODO | | AccessFileOperation | 24 | TODO | | TouchFileOperation | 25 | TODO | | DownloadFileOperation | 26 | TODO | | DownloadDirectoryOperation | 30 | TODO | | MakeDirectoryOperation | 31 | TODO | | MakeDirectoryPathOperation | 32 | TODO | | RemoveDirectoryOperation | 33 | TODO | | RemoveDirectoryPathOperation | 34 | TODO | | ListDirectoryOperation | 35 | TODO |
Contributing
Releases follow Semantic Versioning
See Also
License
LGPL-3.0