93e98e5b909124b009cc543d9b7486022c5a8368
[tlb/tomd.git] / src / common / PROTOCOL_DESIGN
1 tomd socket protocol design specification
2
3 This documents the intended design of the protocol used by tomd and
4 its client applications.
5
6 Socket type:
7 We are using PF_LOCAL (protocol family local, IE unix sockets, bound
8 to files) sockets to facilitate communication. The libc implementation
9 is used, see the libc texinfo manual for details. This protocol family
10 was chosen because it offers the best performance locally, and there
11 is no current intention to allow for the daemon to be used remotely.
12
13 Datagram (udp packets) vs socket streams (byte streams):
14 With byte streams, I would need to delicately encode all of the
15 transitions between commands - however, it is much easier to keep the
16 clients individual, with separate accept calls per connection. with
17 datagrams we would need to encoded the sender, with callback
18 information to send status information on requests back to the
19 client. Weighing these pros and cons, I have gone with datagrams so
20 that the individual packets are easier to work with.