Skip to content

Commit ce66178

Browse files
committed
protocol doc
1 parent a1bc97c commit ce66178

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

protocol_doc/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ for the development of future client applications.
1717
- [3. Authentication](#3-authentication)
1818
- [3.1. Possible responses to an authentication request](#31-possible-responses-to-an-authentication-request)
1919
- [3.2. The Merovingian redirect](#32-the-merovingian-redirect)
20+
- [3.3. Connecting through a Unix domain socket](#33-connecting-through-a-unix-domain-socket)
2021
- [4. Commands and queries in a nutshell](#4-commands-and-queries-in-a-nutshell)
2122
- [5. Response types](#5-response-types)
2223
- [5.1. Redirect - **^**](#51-redirect---)
@@ -46,7 +47,8 @@ started by the main.
4647

4748
If the client application is connecting through a UNIX domain socket, then monetdbd
4849
will try to redirect the connection to mserver5 so that the client then talks directly
49-
to mserver5 and monetdbd is no longer involved.
50+
to mserver5 and monetdbd is no longer involved. See the [specific chapter](#33-connecting-through-a-unix-domain-socket)
51+
for more information.
5052

5153
If the client is connecting through TCP/IP, then by default monetdbd will act
5254
as a proxy, transferring data packages between the client and the mserver5 processs.
@@ -101,6 +103,11 @@ which has the header:
101103

102104
(0x10E1 << 1) | 0x0001 = 0x21C3
103105

106+
Be aware that there are two kinds of bit shifts: the [logical](https://en.wikipedia.org/wiki/Logical_shift)
107+
and the [arithmetic](https://en.wikipedia.org/wiki/Arithmetic_shift). The arithmetic might
108+
bring ones in from the left or right instead of zeros, therefore it should be avoided.
109+
Many languages will do a logical shift on unsigned types, and arithmetic on unsigned.
110+
104111
If the message contains 12345 bytes, then there are two packages. The first
105112
contains 8190 bytes, while the second the remaining 4155. The `is_last` bit
106113
is only set for the second:
@@ -227,6 +234,16 @@ the client reads twice.
227234
If the redirect happens more than 10 times, then throw an error in the client application,
228235
because this shows an error on the server side.
229236

237+
## 3.3. Connecting through a Unix domain socket
238+
239+
This case is the same as the TCP/IP connection, with a tiny difference at the very
240+
beginning. When connecting to a Unix domain socket, then the client has to first
241+
write a single byte (without any packet frame!) with value 0x30 or the chracter
242+
zero '0'.
243+
244+
After that, the server will respond with the `server challenge` and everything is the
245+
same as in the TCP/IP case.
246+
230247
# 4. Commands and queries in a nutshell
231248

232249
After a successful authentication, the client can start to send requests to the server

protocol_doc/monet-explorer/ServerChallenge.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
namespace MonetExplorer {
2727
/**
2828
* @brief Parse a "server challenge" line, which
29-
* can be received multiple time from the server
29+
* can be received multiple times from the server
3030
* during authentication.
3131
*/
3232
class ServerChallenge {

0 commit comments

Comments
 (0)