Merge branch 'master' of github.com:tildearrow/furnace

This commit is contained in:
tildearrow 2023-07-10 04:33:09 -05:00
commit a32c706c8f

View file

@ -29,13 +29,13 @@ two usernames are reserved:
some characters are not allowed in usernames: 0x00-0x1f, `@`, 0x7f-0x9f, 0xd800-0xdfff, 0xfeff, 0xfffe and 0xffff. some characters are not allowed in usernames: 0x00-0x1f, `@`, 0x7f-0x9f, 0xd800-0xdfff, 0xfeff, 0xfffe and 0xffff.
# header # header
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
3 | "fur" header 3 | "fur" header
1 | packet type 1 | packet type
4 | sequence number 4 | sequence number
```
the sequence number always starts at 0. the sequence number always starts at 0.
# client to server packets (init) # client to server packets (init)
@ -48,7 +48,7 @@ if the client does not receive any packets during 30 seconds, it will disconnect
likewise, if the server does not receive any packets during 30 seconds, it will disconnect the client. likewise, if the server does not receive any packets during 30 seconds, it will disconnect the client.
## 0x01: start connection ## 0x01: start connection
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | reason 1 | reason
@ -57,17 +57,17 @@ size | description
3 | padding 3 | padding
4 | client version 4 | client version
STR | host name (may be blank) STR | host name (may be blank)
```
after sending, you will receive a packet of type 0x01 (information), 0x02 (disconnect) or 0x03 (authenticate). after sending, you will receive a packet of type 0x01 (information), 0x02 (disconnect) or 0x03 (authenticate).
## 0x02: disconnect ## 0x02: disconnect
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
STR | reason STR | reason
```
## 0x03: auth response ## 0x03: auth response
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | type 1 | type
@ -84,7 +84,7 @@ size | description
??? | password ??? | password
--- | **token response** --- | **token response**
STR | token STR | token
```
# server to client packets (init) # server to client packets (init)
## 0x00: keep-alive ## 0x00: keep-alive
@ -92,7 +92,7 @@ size | description
this packet keeps a connection alive. it is a response to a client's keep-alive packet. this packet keeps a connection alive. it is a response to a client's keep-alive packet.
## 0x01: information ## 0x01: information
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | server version 4 | server version
@ -104,35 +104,35 @@ size | description
STR | server name STR | server name
STR | server description STR | server description
STR | project name STR | project name
```
the client may send a 0x00 (keep-alive) packet after receiving this one within 5 seconds. the client may send a 0x00 (keep-alive) packet after receiving this one within 5 seconds.
connection is then closed. connection is then closed.
## 0x02: disconnect ## 0x02: disconnect
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
STR | reason STR | reason
```
after being sent, the connection is closed. after being sent, the connection is closed.
## 0x03: authenticate ## 0x03: authenticate
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | authentication type 1 | authentication type
| - 0: open | - 0: open
| - 1: password | - 1: password
| - 2: token | - 2: token
```
## 0x04: authentication success ## 0x04: authentication success
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | player ID 4 | player ID
STR | username STR | username
CFG | properties CFG | properties
```
# client to server packets (session) # client to server packets (session)
## 0x10: request project ## 0x10: request project
@ -140,27 +140,27 @@ size | description
the client may only send this once every minute. the client may only send this once every minute.
## 0x11: participate ## 0x11: participate
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | status 1 | status
| - 0: spectate | - 0: spectate
| - 1: join | - 1: join
```
## 0x12: send chat message ## 0x12: send chat message
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
STR | message STR | message
```
## 0x13: send command ## 0x13: send command
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
STR | command STR | command
2 | number of arguments 2 | number of arguments
S?? | arguments S?? | arguments
```
## 0x14: get player list ## 0x14: get player list
no other information required. no other information required.
@ -170,51 +170,51 @@ no other information required.
no other information required no other information required
## 0x16: project submission information ## 0x16: project submission information
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | project size 4 | project size
32 | SHA-256 sum of project 32 | SHA-256 sum of project
STR | project name STR | project name
```
this is followed by several 0x17 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. this is followed by several 0x17 (project data) packets representing a Furnace song. see [format.md](format.md) for more information.
## 0x17: project submission data ## 0x17: project submission data
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | offset 4 | offset
4 | length 4 | length
??? | data... ??? | data...
```
the client will send a packet with project size as offset and 0 as length to indicate end of data. the client will send a packet with project size as offset and 0 as length to indicate end of data.
the server subsequently loads the project. the server subsequently loads the project.
# server to client packets (session) # server to client packets (session)
## 0x10: project information ## 0x10: project information
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | project size 4 | project size
32 | SHA-256 sum of project 32 | SHA-256 sum of project
STR | project name STR | project name
```
this is followed by several 0x13 (project data) packets representing a Furnace song. see [format.md](format.md) for more information. this is followed by several 0x13 (project data) packets representing a Furnace song. see [format.md](format.md) for more information.
## 0x11: project data ## 0x11: project data
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | offset 4 | offset
4 | length 4 | length
??? | data... ??? | data...
```
the server will send a packet with project size as offset and 0 as length to indicate end of data. the server will send a packet with project size as offset and 0 as length to indicate end of data.
the client subsequently loads the project. the client subsequently loads the project.
## 0x12: participate status ## 0x12: participate status
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | status 1 | status
@ -222,7 +222,7 @@ size | description
| - 1: allowed | - 1: allowed
## 0x13: message ## 0x13: message
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | player ID 4 | player ID
@ -236,23 +236,23 @@ size | description
| - 3: notification, warning | - 3: notification, warning
| - 4: notification, urgent | - 4: notification, urgent
STR | message STR | message
```
## 0x14: system message ## 0x14: system message
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
STR | message STR | message
```
## 0x15: chat message edited ## 0x15: chat message edited
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | message ID 4 | message ID
STR | message STR | message
| - an empty message means deleted. | - an empty message means deleted.
```
## 0x16: player list ## 0x16: player list
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
2 | number of players 2 | number of players
@ -269,42 +269,42 @@ size | description
STR | name STR | name
STR | IP address STR | IP address
| - if empty, then server is not disclosing IP addresses. | - if empty, then server is not disclosing IP addresses.
```
this is sent after receiving 0x14 (get player list). this is sent after receiving 0x14 (get player list).
## 0x17: project submission request status ## 0x17: project submission request status
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | status 1 | status
| - 0: denied | - 0: denied
| - 1: allowed | - 1: allowed
```
this is sent after a project submission request is accepted. this is sent after a project submission request is accepted.
if the status is 1, the client shall submit a project. if the status is 1, the client shall submit a project.
## 0x18: project submission complete ## 0x18: project submission complete
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | status 1 | status
| - 0: error | - 0: error
| - 1: success | - 1: success
STR | additional information STR | additional information
```
## 0x19: player joined ## 0x19: player joined
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | ID 4 | ID
STR | name STR | name
```
## 0x1a: player left ## 0x1a: player left
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | ID 4 | ID
```
# client to server packets (project) # client to server packets (project)
## 0x20: request orders ## 0x20: request orders
@ -328,11 +328,11 @@ size | description
## 0x29: request grooves ## 0x29: request grooves
## 0x30: alter orders ## 0x30: alter orders
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
4 | transaction ID 4 | transaction ID
```
## 0x31: alter instrument ## 0x31: alter instrument
## 0x32: alter wavetable ## 0x32: alter wavetable
@ -378,7 +378,7 @@ size | description
## 0x29: grooves ## 0x29: grooves
## 0x30: transaction response ## 0x30: transaction response
```
size | description size | description
-----|------------------------------------ -----|------------------------------------
1 | status 1 | status
@ -386,7 +386,7 @@ size | description
| - 1: success | - 1: success
| - 2: success but request again | - 2: success but request again
STR | additional information STR | additional information
```
# client to server packets (interact) # client to server packets (interact)
## 0x40: engine command ## 0x40: engine command