feat: changes to proto (read commit msg)
- remove sizes from command data; these can be inferenced from data size. - refactored errors to be more logical - reworded minor things
This commit is contained in:
parent
e47da1e991
commit
acde76c0f4
1 changed files with 19 additions and 20 deletions
33
doc/proto.md
33
doc/proto.md
|
@ -5,7 +5,6 @@
|
|||
# Prelude
|
||||
|
||||
Version 1 has zero security on itself.
|
||||
This can be changed with something like TLS but that's up to the implementer.
|
||||
|
||||
# Structure
|
||||
|
||||
|
@ -147,25 +146,26 @@ Send a packet to state an error occurred.
|
|||
#### Command data
|
||||
|
||||
| offset | size | name | description | example |
|
||||
| ------ | ----------------------------- | ----------------- | ------------------------------- | -------- |
|
||||
| ------ | ----------------------------- | ------------ | ------------------------------- | ------- |
|
||||
| `0x14` | 1 byte | `error_code` | error code; check 'Error codes' | `0x00` |
|
||||
| `0x15` | 2 bytes | `metadata_length` | metadata length | `0x0000` |
|
||||
| `0x17` | `<0x14-0x15:metadata_length>` | `metadata` | metadata | |
|
||||
| `0x15` | `<0x14-0x15:metadata_length>` | `metadata` | metadata | |
|
||||
|
||||
#### Error codes
|
||||
|
||||
| `status_code` | name | description | recoverable |
|
||||
| ------------- | ---------------------- | -------------------------------------------------------------------------------------------- | --------------------------------- |
|
||||
| `0x1*` | `net_*` | **Network errors** | |
|
||||
| `0x00` | `net_duplicate_packet` | `reply_to` packet is invalid because another packet was sent recently with same `packet_id`. | resend with different `packet_id` |
|
||||
| `0x01` | `net_broken_packet` | recent packet was broken. | resend packet |
|
||||
| `0x02` | `net_invalid_packet` | the packet sent is not valid | send packet with proper values |
|
||||
| `0x03` | `net_addr_in_use` | the addr requested is in use already | register with another id or `0` |
|
||||
| `0x04` | `net_dest_unreachable` | the destination could not be reached | no |
|
||||
| `0x1*` | `errc_*` | **Client errors** | |
|
||||
| `0x10` | `errc_not_registered` | client is not registered | register client |
|
||||
| `0x2*` | `errs_*` | **Server errors** | |
|
||||
| `0x20` | `errs_not_delivered` | server could not deliver packet. | depends on situation |
|
||||
| ------------- | ----------------------- | --------------------------------------------------------------------- | --------------------------------- |
|
||||
| `0x0*` | `net_*` | **Network errors** | |
|
||||
| `0x00` | `net_broken_packet` | recent packet was broken; this packet's data did not arrive properly. | resend packet |
|
||||
| `0x01` | `net_invalid_packet` | the packet sent is not valid; this packet's data does not make sense. | send packet with proper values |
|
||||
| `0x02` | `net_dest_unreachable` | the destination could not be reached | no |
|
||||
| `0x1*` | `mgmt_*` | **Management errors** | |
|
||||
| `0x10` | `mgmt_duplicate_packet` | `packet_id` was used recently. | resend with different `packet_id` |
|
||||
| `0x11` | `mgmt_addr_in_use` | the addr requested is in use already | register with another id or `0` |
|
||||
| `0x12` | `mgmt_not_registered` | the src addr is not registered with the master node | register with another id or `0` |
|
||||
| `0x13` | `mgmt_not_delivered` | the sent packet could not be delivered | register with another id or `0` |
|
||||
| `0x2*` | `node_*` | **Node errors** | |
|
||||
| `0x20` | `node_invalid_property` | the property specified is invalid | no |
|
||||
| `0x21` | `node_failed_request` | the request could not be completed. | consult metadata |
|
||||
|
||||
## `0x1*` - Properties control
|
||||
|
||||
|
@ -238,5 +238,4 @@ The `sequence_number` is added for redundancy, all data sent will always reply t
|
|||
| offset | size | name | description | example |
|
||||
| ------ | -------- | ----------------- | ------------------------------- | ------------ |
|
||||
| `0x14` | 4 bytes | `sequence_number` | the sequence number of the data | `0x00000000` |
|
||||
| `0x18` | 4 bytes | `size` | size of this slice of data | `0x00000000` |
|
||||
| `0x1c` | `<size>` | `data` | the data | |
|
||||
| `0x18` | `<size>` | `data` | the data | |
|
||||
|
|
Loading…
Reference in a new issue