1
0
mirror of https://github.com/deavminet/dnetd synced 2024-09-21 09:43:37 +02:00
dnetd_old/protocol.md

214 lines
2.8 KiB
Markdown
Raw Normal View History

2020-09-23 09:37:18 +02:00
dnet protocol specification
===========================
2020-09-23 10:33:19 +02:00
## Preamble
Every command starts with a 1 byte code specifying the command.
```
|-- command (1 byte) --|-- dependant on command (n bytes) --|
```
## Command listing (client/server->server)
1. `auth` - authenticate a new client
2. `link` - authenticate a new server
## Client/Server types (server->server/client)
1. `msg` - new message
## Commands
### `auth`
2020-09-23 13:14:55 +02:00
Request format:
2020-09-23 10:33:19 +02:00
```
2020-09-23 10:52:00 +02:00
|-- 0 --|-- usernameLength (1 byte) --|-- username --|-- password --|
2020-09-23 10:33:19 +02:00
```
2020-09-23 13:14:55 +02:00
Reply format:
```
2020-09-24 12:31:53 +02:00
|-- status (1 byte) --|
2020-09-23 13:14:55 +02:00
```
2020-09-23 10:33:19 +02:00
### `link`
```
2020-09-24 12:31:53 +02:00
|-- 1 --|-- todo
2020-09-23 10:33:19 +02:00
```
2020-09-23 09:37:18 +02:00
2020-09-24 12:31:53 +02:00
### `reg`
2
### `join`
Request format:
TODO: Allow multiple joins
```
|-- 3 --|-- channelToJoin(CSV) --|
```
Reply format:
```
|-- status (1 byte) --|
```
TODO: Support redirects?
### `part`
Request format:
```
|-- 4 --|-- channelToPart(CSV) --|
```
Reply format:
```
|-- status (1 byte) --|
```
### `msg`
2020-09-27 16:58:44 +02:00
Request format:
```
2020-09-28 13:58:29 +02:00
|-- 5 --|-- type (1 byte) --|-- locationSize (1 byte) --|-- location (n-bytes) --|-- message (n-bytes) --|
2020-09-27 16:58:44 +02:00
```
* The `type` field specifies whether the message is to be sent to a user or channel
1. `0` - this is for a **user** as the destination
2. `1` - this is for a **channel** as the destination
Reply format:
```
|-- status (1 byte) --|
```
2020-09-24 12:31:53 +02:00
### `list`
Request format:
```
|-- 6 --|
```
Reply format:
```
|-- status (1 byte) --|-- channelnames(CSV) --|
```
2020-09-24 13:28:17 +02:00
### `msg`
Request format:
```
|-- 7 --|-- type (1 byte) --|-- channel/person name (null terminated) --|-- message --|
```
* `type`, `0` - to user, `1` to channel
2020-09-25 22:15:58 +02:00
Reply format *TODO*
2020-09-29 14:29:51 +02:00
### `membercount`
Request format:
```
|-- 8 --|-- channel --|
```
2020-09-30 10:15:22 +02:00
Reply format:
2020-09-29 14:29:51 +02:00
```
|-- status (1 byte) --|-- member count (4 bytes - big endian) --|
```
2020-09-30 10:15:22 +02:00
### `memberlist`
Request format:
```
|-- 9 --|-- channel --|
```
Reply format:
```
|-- status (1 byte) --|-- channel members (CSV) --|
```
2020-09-29 14:29:51 +02:00
### `serverinfo`
Request format:
```
|-- 10 --|
```
Reply format:
```
|-- status (1 byte) --|-- server info(CSV) --|
```
#### Format of server info (CSV)
```
<serverName>,<networkName>,<userCount>,<channelCount>
```
### `motd`
Request format:
```
|-- 11 --|
```
Reply format:
```
|-- status (1 byte) --|-- motd --|
```
2020-09-24 12:31:53 +02:00
### `chanprop`
2020-09-25 19:32:06 +02:00
---
Anything that isn't a command above will return with `2` which means _unknown command_.
2020-09-25 22:15:58 +02:00
`1` generally means that everything went well but commands can send more data after it,
it depends, and `0` means error - also more data may follow.
2020-09-25 19:32:06 +02:00
## notifications
We know as tristanable tag 1, but then _types_ of notifications is the important factor described here.
```
|-- notifyTYpe (1 byte) --|-- ..
2020-09-28 13:58:29 +02:00
```
### TODO: message receive format (`notifyType=0`)
For a normal channel message or direct message
TODO
### TODO: channel status message (`notifyType=1`)
types within:
1. `0` - 1 byte: Member leave
2. `1` - 1 byte: Member join