aboutsummaryrefslogtreecommitdiffstats
path: root/man/psmq_building.7
blob: a2785807b41eb11b36ccd38f35440256ac9cb82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.TH "psmq_building" "7" "19 May 2021 (v9999)" "bofc.pl"
.SH NAME
.PP
.B psmq_building
- information about building
.B psmq
library.
.SH DESCRIPTION
.PP
.B psmq
is targeted mainly for small embedded systems which do not have advanced IPC
like unix domain sockets.
It doesn't have much usecases (if any) on big OSes like
.B Linux
- there are far more advanced solutions for such systems.
.B psmq
library cares mainly about memory and runtime safety.
It can be build and run on every
.B UNIX
though to make application developemt and testing much easier - you can write
and test your app on
.B UNIX
system and then just move it to embedded posix-compliant system without changes.
.PP
To avoid dynamic memory allocation as much as possible, most options are set
during compile time, and since this is mainly for embedded systems - it's not a
problem.
.SH "PASSING SETTINGS"
.PP
Depending on how you want to compile this software, there are a few ways to
define settings.
.SS AUTOTOOLS
.PP
If you build for
.B UNIX
system, it's the easiest and best way to install
.B psmq
library and programs.
Settings are passed to
.I configure
script as environment variables like that
.PP
.nf
    PSMQ_MAX_CLIENTS=128 PSMQ_MSG_MAX=64 ./configure
.fi
.PP
And of course after that, there is standard "make" and "make install".
You're done.
.SS "COMPILER DEFINITIONS"
.PP
If you integrate
.B psmq
into bare metal embedded system without OS, you can just define options.
How you do it heavily depends on your build system.
For cmake, you could use
.PP
.nf
    add_definitions(-DPSMQ_MAX_CLIENTS=128 -DPSMQ_MSG_MAX=32)
.fi
.PP
If you are using "make" based build system, you would use something along the
lines
.PP
.nf
    CFLAGS += -DPSMQ_MAX_CLIENTS=128
    CFLAGS += -DPSMQ_MSG_MAX=64
.fi
.SS "CONFIG FILE"
.PP
You can also define all of those values in
.B psmq-config.h
file.
That file should be directly accessible by compiler - every source file includes
this file this way:
.PP
.nf
    #ifdef HAVE_CONFIG_H
    #   include "psmq-config.h"
    #endif
.fi
.PP
You also must define
.BR HAVE_CONFIG_H .
To define options, you just do classic
.B C
definitions
.PP
.nf
    #define PSMQ_MAX_CLIENTS 128
    #define PSMQ_MSG_MAX 64
.fi
.SH "COMPILATION OPTIONS"
.TP
.BR PSMQ_MAX_CLIENTS\  (int)
This defines how many clients single broker process will support.
Broker will return error for clients that want to register to it and there are
already max clients connected.
.B psmqd
will alocate client array with static storage duration that is about 12 bytes
(may vary depending on architecture) for each client.
.TP
.BR PSMQ_MSG_MAX\  (int)
Defines maximum size of topic + payload that can be sent via
.BR psmq .
Topic and payload are sent in a single buffer, so they share memory.
This allows for some flexibility, as you can send one message with big
topic name, but no payload data and another message can have short topic,
but much more payload.
This option has direct impact on memory usage of broker and library.
But even if you set this to high value, only actual payload will be sent.
So you could set
.B PSMQ_MSG_MAX
to 1024 bytes, send message on topic "/t" and one byte of payload, and then
only 4 bytes and not 1024 will be copied over mqueue.
.PP
.TP
.BR PSMQ_NO_SIGNALS\  (bool)
Signals were implemented mainly for full-fledged UNIXes, but many embedded
simply does not implement signals. If you want to use
.B psmq
on such system, define this to 1. It is not possible to set this when building
with autotools. C'mon, if you can use autotools you surely have signals.
.SH DEPENDENCIES
.PP
Broker needs
.B >=embedlog-v9999
for logging.
It can be downloaded from
.B https://embedlog.bofc.pl
.SH "SEE ALSO"
.PP
.BR psmqd (1),
.BR psmq-pub (1),
.BR psmq-sub (1),
.BR psmq_cleanup (3),
.BR psmq_init (3),
.BR psmq_publish (3),
.BR psmq_receive (3),
.BR psmq_subscribe (3),
.BR psmq_timedreceive (3),
.BR psmq_timedreceive_ms (3),
.BR psmq_unsubscribe (3),
.BR psmq_building (7),
.BR psmq_overview (7).