- Getting nonce - Send client nonce and receives server nonce
- Authentication - Authenticate user
- Hello - Hello
- Hello return - Hello return
- First procedure invocation - First procedure invocation
- First procedure return - First procedure invocation return
- Next procedure invocation - Next procedure invocation
- Next procedure return - Nxt procedure invocation return
- Client -> Server: Getting nonce
- Server -> Client: Getting nonce return
- [wait 3 * TCP RTT or 3 seconds] Server disconnects the connection
- Client -> Server: Authentication
- Server -> Server: Authentication return
- [authentication fails] Server disconnects the connection
- [If client invocates server procedure] 1. Client -> Server: First procedure invocation 1. Server -> Client: First procedure return 1. Client -> Server: Next procedure invocation 1. Server -> Client: Next procedure return 1. Client -> Server: Next procedure invocation 1. Server -> Client: Next procedure return 1. ...
- [If server invocates client procedure] 1. Server -> Client: First procedure return 1. Client -> Server: First procedure invocation 1. Server -> Client: Next procedure return 1. Client -> Server: Next procedure invocation 1. Server -> Client: Next procedure return 1. Client -> Server: Next procedure invocation 1. ...
- [every 10 seconds from client if there is no invocations b/w client and server] 1. Client -> Server: Hello 1. Server -> Client: Hello return
- [after 20 seconds no message exchanges b/w client and server] 1. Server disconnections the connection
{ magic: uint32 // MAGIC, ver, endianess type: uint16 // type id: uint32 // message ID. Same ID for same invocation and return size: uint16 // total size including header }
User can parse magic header and RPC protocol version and endianess
Magic header (Big endian) |--||--| 40c049
Magic header (Little endian) |--||--| 49c040
Protocol version (Big endian) |--||--| 01
Protocol version (Little endian) |--||--| 01
- 0 - Getting nonce
- 1 - Authentication
- 2 - Hello
- 3 - Hello return
- 4 - First procedure invocation
- 5 - First procedure return
- 6 - Next procedure invocation
- 7 - Next procedure return
- 8 - Error return
{ RPC_HEADER nonce: uint8[16] // Client side nonce hash: uint8[8] // hashing algorithm name }
Below is types of hashing algorithms
- " sha256" - SHA 256
- " sha51.2" - SHA 512
{ RPC_HEADER nonce: uint8[16] // Server side nonce }
{ RPC_HEADER username: string password: uint8[...] // related to hashing algorithm }
This is how password is calculated salted_password = hash(RPC_MAGIC + password) password = hash(client_nonce + salted_password + server_nonce)
{ RPC_HEADER result: bool // Login succeed or not }
If authentication fails server will disconnect the connection just after send "Authentication return" message.
{ RPC_HEADER }
{ RPC_HEADER }
{ RPC_HEADER interface_name: char[RPC_MAX_NAME] interface_ver: uint32 procedure_name: char[RPC_MAX_NAME] return_type: uint8 argc: uint8 types: uint8[argc] args: ... // length depends on types }
{ RPC_HEADER interface_and_procedure_id: uint32 result: ... // length depends on return_type }
{ RPC_HEADER interface_and_procedure_id: uint32 args: ... // length depends on types }
{ RPC_HEADER result: ... // length depends on return_type }
{ RPC_HEADER code: uint32 message: string }
- 1 - There is no such interface named: xxx
- 2 - The version is not supported: nnn
- 3 - There is no such method named: xxx(a, b, c, d):r
data size: 0 bytes
true: 1 false: 0 data size: 1 byte
data size: 1 byte
data size: 2 bytes
data size: 4 bytes
data size: 8 bytes
data size: 1 byte
data size: 2 bytes
data size: 4 bytes
data size: 8 bytes
data size: 4 bytes
data size: 8 bytes
size: uint16 (including \0) data size: size
size: uint16 data size: primitive data size x size
GPL2 and Proprietary