Skip to content
Snippets Groups Projects
Commit 75b0c028 authored by Ruben Otto's avatar Ruben Otto :crab:
Browse files

docs: add userspace communication to readme

parent 23f42481
No related branches found
No related tags found
No related merge requests found
......@@ -20,3 +20,28 @@ The binaries will be in:
- `build/daemon/daemon`
- `build/clients/*`
## Communication
### Userspace
The client programs that aggregate the desired system data may send them to the daemon process.
This is done via a simple packet, `daemon_measurement_t` which is defined in [`common/include/protocol.h`](common/include/protocol.h):
```c
#define MAX_DAEMON_PACKET_SIZE PIPE_BUF
#define DAEMON_PACKET_HEADER_SIZE sizeof(u_int8_t) + sizeof(u_int16_t)
#define MAX_DAEMON_PACKET_DATA_SIZE MAX_DAEMON_PACKET_SIZE - DAEMON_PACKET_HEADER_SIZE
typedef struct {
uint8_t measurement_id;
uint16_t size;
uint8_t data[MAX_DAEMON_PACKET_DATA_SIZE];
} daemon_measurement_t;
```
The packet size equals to the size of `PIPE_BUF` (4096).
The communication to the deamon is implemented via a named pipe, the size ensure that the packet is atomic, i.e. it is written to the pipe in one go.
- The first byte contains the measurement id, so the maximum number of different measurements client is 255.
- The second and third bytes contain the size of the data in the packet.
- All following bytes contain the data.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment