[−][src]Module bailamos::rpc
Remote procedure call (RPC)
Notes
Message are encoded in Binn format. Rust projects can use Binn-IR crate.
Server
The server works via TCP, over TLS streams. It accepts raw binary data. However it sends xz compressed data to clients.
It uses a self-signed PKCS #12 certificate to encrypt data.
Limits:
- It's not designed with asynchronous I/O. This might be changed if future Rust would support asynchronous I/O natively (built-in).
- It's not designed to defend against Denial of service attacks.
Client
- Maximum request size:
MAX_REQUEST_SIZE
.
Specification
Specification will be made when the project reaches stable release.
Currently, you can:
-
Use
make_request()
to make requests (as plain bytes) and send them to server. Then useread_response()
to read responses. -
A response consists of:
RESPONSE_PARAM_STATUS_CODE
: always available.RESPONSE_PARAM_MSG
: always available.RESPONSE_PARAM_DATA
: optional.
-
Details of responses depend on what you request. For example, to parse unread notifications, check documentation of
REQUEST_FOR_GETTING_UNREAD_NOTIFICATIONS
.
Constants
DEFAULT_SERVER_PORT | Default server port |
MAX_REQUEST_SIZE | Maximum request size |
MAX_RESPONSE_SIZE | Maximum response size |
REQUEST_FOR_DELETING_NOTIFICATIONS_VIA_RANGE_OF_DATES | Request for deleting notifications via range of dates |
REQUEST_FOR_GETTING_UNREAD_NOTIFICATIONS | Request for getting unread notifications |
REQUEST_FOR_INSERTING_NEW_NOTIFICATION | Request for inserting new notification |
REQUEST_FOR_MARKING_NOTIFICATIONS_AS_READ | Request for marking notifications as read |
REQUEST_METHOD_DELETE | Request method: |
REQUEST_METHOD_GET | Request method: |
REQUEST_METHOD_POST | Request method: |
REQUEST_PARAM_DATA | Request parameter: data |
REQUEST_PARAM_METHOD | Request parameter: method |
REQUEST_PARAM_PASSPHRASE | Request parameter: passphrase |
REQUEST_PARAM_USER_NAME | Request parameter: user name |
REQUEST_PARAM_WHAT | Request parameter: what |
RESPONSE_PARAM_DATA | Response parameter: data |
RESPONSE_PARAM_MSG | Response parameter: message |
RESPONSE_PARAM_STATUS_CODE | Response parameter: status code |
STATUS_INVALID_INPUT | Status: invalid input from client |
STATUS_OK | Status: OK |
STATUS_SERVER_ERROR | Status: server error |
Functions
make_request | Makes request |
make_response | Makes response |
read_request | Reads request |
read_response | Reads response |
Type Definitions
Content | Content |
DataSize | Data size |
RequestId | Request ID |
RequestMethod | Request method |
RequestParam | Request parameter |
ResponseParam | Response parameter |
StatusCode | Status code |
What | What |