-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolidSyslogTunablesDefaults.h
More file actions
708 lines (639 loc) · 26.9 KB
/
Copy pathSolidSyslogTunablesDefaults.h
File metadata and controls
708 lines (639 loc) · 26.9 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
#ifndef SOLIDSYSLOG_TUNABLES_DEFAULTS_H
#define SOLIDSYSLOG_TUNABLES_DEFAULTS_H
// IWYU pragma: private, include "SolidSyslogTunables.h"
// Defaults are reached through the SolidSyslogTunables.h umbrella so the optional
// SOLIDSYSLOG_USER_TUNABLES_FILE override gets a chance to win first.
/*
* Pool-size tunables are named by ROLE, not by platform or vendor.
*
* A build links exactly one implementation of each platform/vendor-selected
* role (one TCP stream backend, one datagram backend, one mutex, one crypto
* vendor, ...), so a single role tunable serves whichever implementation is
* compiled in — the integrator reasons about "how many TCP streams", never
* "how many POSIX streams". SOLIDSYSLOG_ADDRESS_POOL_SIZE established this
* pattern; the role blocks below follow it.
*
* The pool counts INSTANCES, not implementations. If a future build ever
* wires two implementations of the same role into one executable (e.g. a
* numeric AND a DNS resolver, or two crypto vendors), size that role's pool
* to the SUM of the concurrent instances.
*/
/*
* Maximum bytes the library will format for a single syslog message.
*
* Caps the per-Log Formatter buffer (stack-allocated inside SolidSyslog_Log),
* the FileStore record size, and the minimum BlockStore block size. Per
* RFC 5424 section 6.1, receivers SHOULD accept up to 2048 bytes; transports
* may impose lower limits beyond which truncation kicks in. Lower values save
* stack and store footprint; higher values reduce truncation.
*
* Floor: smallest size that can hold a meaningful RFC 5424 security event.
* A legal all-NILVALUE message is 16 bytes; this allows enough headroom
* for a real PRI, hostname, MSGID, and short payload.
* Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_MAX_MESSAGE_SIZE
#define SOLIDSYSLOG_MAX_MESSAGE_SIZE 2048U /* RFC 5424 section 6.1 SHOULD value */
#endif
#if SOLIDSYSLOG_MAX_MESSAGE_SIZE < 64
#error "SOLIDSYSLOG_MAX_MESSAGE_SIZE must be >= 64"
#endif
/*
* Maximum bytes the library will format for a single on-disk path
* produced by SolidSyslogFileBlockDevice (path prefix + two-digit
* sequence number + ".log" + null terminator). Caps both the per-call
* Formatter storage and the bounded prefix copy.
*
* Floor: smallest size that still leaves room for a meaningful prefix
* after subtracting the 6-byte filename suffix and null terminator.
* 32 leaves 24 characters for the prefix — enough for any sane
* filesystem location. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_MAX_PATH_SIZE
#define SOLIDSYSLOG_MAX_PATH_SIZE 128U
#endif
#if SOLIDSYSLOG_MAX_PATH_SIZE < 32
#error "SOLIDSYSLOG_MAX_PATH_SIZE must be >= 32"
#endif
/*
* Maximum bytes of integrity-tag the library will reserve per record.
* Drives the RecordStore per-record buffer width — every record carries
* a tag this wide regardless of the active SolidSyslogSecurityPolicy.
* Default 32 is large enough for HMAC-SHA256; CRC-16 uses 2 of those
* bytes; the rest is unused slack the integrator can recover by
* dropping this in their tunables override.
*
* Floor: 4. Enough for CRC-32 or a truncated MAC. Sub-floor values
* rejected at compile time.
*/
#ifndef SOLIDSYSLOG_MAX_INTEGRITY_SIZE
#define SOLIDSYSLOG_MAX_INTEGRITY_SIZE 32U
#endif
#if SOLIDSYSLOG_MAX_INTEGRITY_SIZE < 4
#error "SOLIDSYSLOG_MAX_INTEGRITY_SIZE must be >= 4"
#endif
/*
* Default per-block capacity (bytes) for file-backed block devices
* (SolidSyslogFileBlockDevice and any FatFs / FreeRTOS-Plus-FAT-backed
* equivalent). Supplied to SolidSyslogFileBlockDevice_Create when the
* integrator has no specific size in mind; passing 0 to _Create selects
* this default. A larger block holds more records before rotating to a
* fresh file; a smaller block rotates (and fsyncs) more often.
*
* Floor: one worst-case record — the RFC 5424 max message plus the widest
* integrity tag plus the 5-byte record framing (2 magic + 2 length +
* 1 sent-flag). Below that a block could not hold a single record, so the
* default must clear it for every SecurityPolicy. Sub-floor values
* rejected at compile time.
*/
#ifndef SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZE
#define SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZE 8192U
#endif
#if SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZE < (SOLIDSYSLOG_MAX_MESSAGE_SIZE + SOLIDSYSLOG_MAX_INTEGRITY_SIZE + 5)
#error \
"SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZE must hold one worst-case record (MAX_MESSAGE_SIZE + MAX_INTEGRITY_SIZE + 5 framing bytes)"
#endif
/*
* Number of SolidSyslog instances the library's internal static pool
* can simultaneously hold. Each instance is a small bookkeeping struct
* (collaborator pointers + SD array pointer + count).
*
* Most integrators only ever create one SolidSyslog per process; default 1.
* Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if the integrator needs multiple
* concurrent SolidSyslog instances.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_POOL_SIZE
#define SOLIDSYSLOG_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_POOL_SIZE < 1
#error "SOLIDSYSLOG_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogCircularBuffer instances the library's internal
* static pool can simultaneously hold. Each instance is a small
* bookkeeping struct (vtable, mutex pointer, ring pointer, head/tail/wrap)
* — roughly 64 bytes on a 64-bit target, 32 on a 32-bit target. The
* caller's ring memory is separate (passed to _Create).
*
* Most integrators only ever create one CircularBuffer per process;
* default 1. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if the integrator
* needs multiple concurrent buffer instances.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_CIRCULAR_BUFFER_POOL_SIZE
#define SOLIDSYSLOG_CIRCULAR_BUFFER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_CIRCULAR_BUFFER_POOL_SIZE < 1
#error "SOLIDSYSLOG_CIRCULAR_BUFFER_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: Mutex. Number of mutex instances the library's internal static
* pool can simultaneously hold, across whichever implementation is compiled
* in — SolidSyslogPosixMutex (pthread_mutex_t), SolidSyslogWindowsMutex
* (CRITICAL_SECTION), or SolidSyslogFreeRtosMutex (StaticSemaphore_t).
*
* Default 1 — most integrators wire a single mutex into a CircularBuffer or
* other thread-safe primitive. Targets that need more (e.g. a separate
* lifecycle mutex alongside a buffer mutex) bump this via
* SOLIDSYSLOG_USER_TUNABLES_FILE.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_MUTEX_POOL_SIZE
#define SOLIDSYSLOG_MUTEX_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_MUTEX_POOL_SIZE < 1
#error "SOLIDSYSLOG_MUTEX_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: Datagram (UDP transport). Number of datagram instances the
* library's internal static pool can simultaneously hold, across whichever
* implementation is compiled in — SolidSyslogPosixDatagram,
* SolidSyslogWinsockDatagram, SolidSyslogPlusTcpDatagram, or
* SolidSyslogLwipRawDatagram.
*
* Default 1 — almost all integrators wire a single datagram into a UdpSender.
* Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than one is genuinely
* needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_DATAGRAM_POOL_SIZE
#define SOLIDSYSLOG_DATAGRAM_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_DATAGRAM_POOL_SIZE < 1
#error "SOLIDSYSLOG_DATAGRAM_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: Resolver. Number of resolver instances the library's internal
* static pool can simultaneously hold, across whichever implementation is
* compiled in — SolidSyslogGetAddrInfoResolver, SolidSyslogWinsockResolver,
* SolidSyslogPlusTcpResolver, SolidSyslogLwipRawResolver, or
* SolidSyslogLwipRawDnsResolver.
*
* Default 1 — almost all integrators wire a single resolver shared across
* their Senders. If a build wires two resolver implementations into one
* executable (e.g. the lwIP numeric AND DNS resolver), set this to the sum
* via SOLIDSYSLOG_USER_TUNABLES_FILE.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_RESOLVER_POOL_SIZE
#define SOLIDSYSLOG_RESOLVER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_RESOLVER_POOL_SIZE < 1
#error "SOLIDSYSLOG_RESOLVER_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: File. Number of file instances the library's internal static
* pool can simultaneously hold, across whichever implementation is compiled
* in — SolidSyslogPosixFile, SolidSyslogWindowsFile, or SolidSyslogFatFsFile.
*
* Default 1 — almost all integrators wire a single file into a
* FileBlockDevice. Integrators using FileBlockDevice with BlockStore may
* want to bump this in line with SOLIDSYSLOG_BLOCK_STORE_POOL_SIZE via
* SOLIDSYSLOG_USER_TUNABLES_FILE.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_FILE_POOL_SIZE
#define SOLIDSYSLOG_FILE_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_FILE_POOL_SIZE < 1
#error "SOLIDSYSLOG_FILE_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: TCP stream. Number of TCP stream instances the library's
* internal static pool can simultaneously hold, across whichever
* implementation is compiled in — SolidSyslogPosixTcpStream,
* SolidSyslogWinsockTcpStream, SolidSyslogPlusTcpTcpStream, or
* SolidSyslogLwipRawTcpStream.
*
* Default 2 — common multi-transport wirings combine a plain TCP stream with
* a second TCP stream that underlies a TLS stream (TLS wraps an injected
* Stream as its byte transport), so a pool of 1 would silently fall the
* second Create back to NullStream. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE
* for wirings that need more.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_TCP_STREAM_POOL_SIZE
#define SOLIDSYSLOG_TCP_STREAM_POOL_SIZE 2U
#endif
#if SOLIDSYSLOG_TCP_STREAM_POOL_SIZE < 1
#error "SOLIDSYSLOG_TCP_STREAM_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogPosixMessageQueueBuffer instances the library's
* internal static pool can simultaneously hold. Each instance carries
* an mqd_t plus the per-process queue name (Formatter storage).
*
* Default 1 — almost all integrators wire a single MQ-backed buffer.
* The queue name derives from the process ID, so bumping above 1 in
* the same process would race multiple slots onto the same
* `/solidsyslog_<pid>` name; an integrator needing N > 1 must
* additionally distinguish the names (out of scope today).
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_POSIX_MESSAGE_QUEUE_BUFFER_POOL_SIZE
#define SOLIDSYSLOG_POSIX_MESSAGE_QUEUE_BUFFER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_POSIX_MESSAGE_QUEUE_BUFFER_POOL_SIZE < 1
#error "SOLIDSYSLOG_POSIX_MESSAGE_QUEUE_BUFFER_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogPassthroughBuffer instances the library's
* internal static pool can simultaneously hold. Each instance is
* tiny (vtable + a Sender pointer).
*
* PassthroughBuffer is the single-task "direct-send, no buffering"
* configuration — every integrator typically creates one. Default 1.
* Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than one process or
* task needs its own passthrough Buffer instance.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_PASSTHROUGH_BUFFER_POOL_SIZE
#define SOLIDSYSLOG_PASSTHROUGH_BUFFER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_PASSTHROUGH_BUFFER_POOL_SIZE < 1
#error "SOLIDSYSLOG_PASSTHROUGH_BUFFER_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogUdpSender instances the library's internal
* static pool can simultaneously hold. Each instance carries its
* config (resolver/datagram/endpoint pointers), the resolved address
* storage, and connection state.
*
* Default 1 — almost all integrators wire a single UDP sender into
* either SolidSyslogConfig directly or as one branch of a
* SwitchingSender. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more
* than one is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_UDP_SENDER_POOL_SIZE
#define SOLIDSYSLOG_UDP_SENDER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_UDP_SENDER_POOL_SIZE < 1
#error "SOLIDSYSLOG_UDP_SENDER_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogSwitchingSender instances the library's
* internal static pool can simultaneously hold.
*
* Default 1 — a SwitchingSender wraps several inner senders, so one
* per process is the typical pattern. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE
* if more than one is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_SWITCHING_SENDER_POOL_SIZE
#define SOLIDSYSLOG_SWITCHING_SENDER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_SWITCHING_SENDER_POOL_SIZE < 1
#error "SOLIDSYSLOG_SWITCHING_SENDER_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogStreamSender instances the library's internal
* static pool can simultaneously hold. Each instance carries its
* config (resolver/stream/endpoint pointers) and connection state.
*
* Default 2 — common multi-transport wirings combine a plain TCP
* stream sender with a TLS stream sender behind a SwitchingSender so
* a TLS failure can fall back to plain TCP (or vice-versa). A pool of
* 1 would starve the second branch and silently resolve it to the
* shared SolidSyslogNullSender. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE
* for wirings that need more.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_STREAM_SENDER_POOL_SIZE
#define SOLIDSYSLOG_STREAM_SENDER_POOL_SIZE 2U
#endif
#if SOLIDSYSLOG_STREAM_SENDER_POOL_SIZE < 1
#error "SOLIDSYSLOG_STREAM_SENDER_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogBlockStore instances the library's internal
* static pool can simultaneously hold. Sizes three pools 1:1 — the
* BlockStore slot itself, plus the TU-internal RecordStore and
* BlockSequence pools that each BlockStore composes. The 1:1
* invariant means a BlockStore slot is guaranteed a free RecordStore
* and BlockSequence on Create; if any inner Create returns its
* fallback under normal use, the BlockStore as a whole resolves to
* SolidSyslogNullStore.
*
* Default 1 — almost all integrators wire a single store-and-forward
* BlockStore. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than
* one is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_BLOCK_STORE_POOL_SIZE
#define SOLIDSYSLOG_BLOCK_STORE_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_BLOCK_STORE_POOL_SIZE < 1
#error "SOLIDSYSLOG_BLOCK_STORE_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogFileBlockDevice instances the library's internal
* static pool can simultaneously hold. Each instance carries the cached
* open-file handle plus the path-prefix pointer.
*
* Default 1 — almost all integrators wire a single FileBlockDevice as
* the backing store for one BlockStore. Bump via
* SOLIDSYSLOG_USER_TUNABLES_FILE if more than one is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_FILE_BLOCK_DEVICE_POOL_SIZE
#define SOLIDSYSLOG_FILE_BLOCK_DEVICE_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_FILE_BLOCK_DEVICE_POOL_SIZE < 1
#error "SOLIDSYSLOG_FILE_BLOCK_DEVICE_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogMetaSd instances the library's internal
* static pool can simultaneously hold. Default 1 — meta SD is typically
* wired into SolidSyslogConfig.Sd[] once per process.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_META_SD_POOL_SIZE
#define SOLIDSYSLOG_META_SD_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_META_SD_POOL_SIZE < 1
#error "SOLIDSYSLOG_META_SD_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogTimeQualitySd instances the library's internal
* static pool can simultaneously hold. Default 1.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_TIME_QUALITY_SD_POOL_SIZE
#define SOLIDSYSLOG_TIME_QUALITY_SD_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_TIME_QUALITY_SD_POOL_SIZE < 1
#error "SOLIDSYSLOG_TIME_QUALITY_SD_POOL_SIZE must be >= 1"
#endif
/*
* Number of SolidSyslogOriginSd instances the library's internal
* static pool can simultaneously hold. Each instance carries the
* pre-formatted static-prefix Formatter storage (software, swVersion,
* enterpriseId) so the per-message Format only splices in the IP
* params. Larger per-slot footprint than the other SDs.
*
* Default 1.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_ORIGIN_SD_POOL_SIZE
#define SOLIDSYSLOG_ORIGIN_SD_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_ORIGIN_SD_POOL_SIZE < 1
#error "SOLIDSYSLOG_ORIGIN_SD_POOL_SIZE must be >= 1"
#endif
/*
* Period (milliseconds) the SolidSyslogLwipRawTcpStream bounded-connect
* spin loop sleeps between polls of the lwIP-side connected_cb flag.
* Each iteration calls the integrator-injected SolidSyslogSleepFunction
* so the loop never busy-waits — under NO_SYS=1 the integrator's Sleep
* implementation ticks sys_check_timeouts and drives RX; under NO_SYS=0
* it yields to the tcpip thread (vTaskDelay or equivalent).
*
* Default 10 ms gives 20 polls inside the default 200 ms connect deadline.
*
* Floor: 1 ms. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_LWIP_RAW_TCP_CONNECT_POLL_MS
#define SOLIDSYSLOG_LWIP_RAW_TCP_CONNECT_POLL_MS 10U
#endif
#if SOLIDSYSLOG_LWIP_RAW_TCP_CONNECT_POLL_MS < 1
#error "SOLIDSYSLOG_LWIP_RAW_TCP_CONNECT_POLL_MS must be >= 1"
#endif
/*
* Bounded deadline (milliseconds) the SolidSyslogLwipRawDnsResolver waits for
* an async dns_gethostbyname lookup to complete before giving up and reporting
* a failed resolution. The synchronous Resolve() contract bridges lwIP's async
* DNS by spinning on the caller's thread (sleeping via the injected
* SolidSyslogSleepFunction) until the dns_found_callback fires or this deadline
* elapses.
*
* Default 5000 ms — DNS is markedly slower than the 200 ms TCP connect: a cold
* lookup may traverse a recursive resolver and the network round-trip dominates.
* There is deliberately no per-instance runtime getter (unlike the TCP connect
* timeout); DNS timeout rarely needs live tuning. Override at build time via
* SOLIDSYSLOG_USER_TUNABLES_FILE if a deployment's resolver is slower.
*
* Floor: 1 ms. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_DNS_RESOLVE_TIMEOUT_MS
#define SOLIDSYSLOG_DNS_RESOLVE_TIMEOUT_MS 5000U
#endif
#if SOLIDSYSLOG_DNS_RESOLVE_TIMEOUT_MS < 1
#error "SOLIDSYSLOG_DNS_RESOLVE_TIMEOUT_MS must be >= 1"
#endif
/*
* Period (milliseconds) the SolidSyslogLwipRawDnsResolver bounded-resolve spin
* loop sleeps between polls of the lwIP-side dns_found_callback done flag.
* Each iteration calls the integrator-injected SolidSyslogSleepFunction so the
* loop never busy-waits — under NO_SYS=1 the integrator's Sleep ticks
* sys_check_timeouts and drives the DNS retransmit timer; under NO_SYS=0 it
* yields to the tcpip thread (vTaskDelay or equivalent). Mirrors
* SOLIDSYSLOG_LWIP_RAW_TCP_CONNECT_POLL_MS.
*
* Default 10 ms gives 500 polls inside the default 5000 ms resolve deadline.
*
* Floor: 1 ms. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_LWIP_RAW_DNS_RESOLVE_POLL_MS
#define SOLIDSYSLOG_LWIP_RAW_DNS_RESOLVE_POLL_MS 10U
#endif
#if SOLIDSYSLOG_LWIP_RAW_DNS_RESOLVE_POLL_MS < 1
#error "SOLIDSYSLOG_LWIP_RAW_DNS_RESOLVE_POLL_MS must be >= 1"
#endif
/*
* Maximum number of struct pbuf* the SolidSyslogLwipRawTcpStream RX queue
* holds before backpressuring lwIP. Bounds the *count* of queued pbufs,
* not their byte volume — lwIP's TCP_WND and MEMP_NUM_PBUF cap upstream
* receive bytes; this knob caps how many segment-sized pbufs can pile up
* behind a slow Stream_Read drain before the tcp_recv callback returns
* non-ERR_OK so lwIP retains the pbuf and replays the callback later.
*
* Default 8 — sized for the typical mTLS handshake flight (ServerHello +
* Certificate + ServerKeyExchange + ServerHelloDone is 2-4 segments; 8
* leaves margin for cert chains and renegotiation traffic).
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_LWIP_RAW_TCP_RX_QUEUE_SIZE
#define SOLIDSYSLOG_LWIP_RAW_TCP_RX_QUEUE_SIZE 8U
#endif
#if SOLIDSYSLOG_LWIP_RAW_TCP_RX_QUEUE_SIZE < 1
#error "SOLIDSYSLOG_LWIP_RAW_TCP_RX_QUEUE_SIZE must be >= 1"
#endif
/*
* Role pool: AtomicCounter. Number of atomic-counter instances the library's
* internal static pool can simultaneously hold, across whichever
* implementation is compiled in — SolidSyslogStdAtomicCounter (C11
* <stdatomic.h>) or SolidSyslogWindowsAtomicCounter (legacy MSVC
* InterlockedCompareExchange). Each instance carries a single counter word
* (the sequenceId counter).
*
* Default 1 — RFC 5424 sequenceIds are scoped per SolidSyslog instance, and
* almost all integrators run a single SolidSyslog instance per process. Bump
* via SOLIDSYSLOG_USER_TUNABLES_FILE if more than one is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_ATOMIC_COUNTER_POOL_SIZE
#define SOLIDSYSLOG_ATOMIC_COUNTER_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_ATOMIC_COUNTER_POOL_SIZE < 1
#error "SOLIDSYSLOG_ATOMIC_COUNTER_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: TLS stream. Number of TLS stream instances the library's
* internal static pool can simultaneously hold, across whichever crypto
* vendor is compiled in — SolidSyslogTlsStream (OpenSSL) or
* SolidSyslogMbedTlsStream (Mbed TLS). Each instance carries the vendor's
* session/context handles and the integrator's TLS config.
*
* Default 1 — TLS senders are scoped per destination and almost all
* integrators wire a single TLS sender per process. Bump via
* SOLIDSYSLOG_USER_TUNABLES_FILE if more than one is genuinely needed
* (e.g. multi-destination egress with separate TLS sessions per peer).
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_TLS_STREAM_POOL_SIZE
#define SOLIDSYSLOG_TLS_STREAM_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_TLS_STREAM_POOL_SIZE < 1
#error "SOLIDSYSLOG_TLS_STREAM_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: HMAC-SHA256 SecurityPolicy. Number of keyed HMAC policy
* instances the library's internal static pool can simultaneously hold,
* across whichever crypto vendor is compiled in —
* SolidSyslogMbedTlsHmacSha256Policy or SolidSyslogOpenSslHmacSha256Policy.
* Each instance carries the integrator's key-accessor callback
* (SolidSyslogKeyFunction) and its context — the policy fetches the key on
* demand and never stores it.
*
* Default 1 — a single at-rest store with one integrity policy is the common
* case. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than one store with
* an independent key is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_HMAC_SHA256_POLICY_POOL_SIZE
#define SOLIDSYSLOG_HMAC_SHA256_POLICY_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_HMAC_SHA256_POLICY_POOL_SIZE < 1
#error "SOLIDSYSLOG_HMAC_SHA256_POLICY_POOL_SIZE must be >= 1"
#endif
/*
* Role pool: AES-256-GCM SecurityPolicy. Number of keyed AEAD policy instances
* the library's internal static pool can simultaneously hold. Each instance
* carries the integrator's key-accessor callback (SolidSyslogKeyFunction) and
* its context — the policy fetches the 32-byte key on demand and never stores
* it.
*
* Default 1 — a single at-rest store with one confidentiality policy is the
* common case. Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than one store
* with an independent key is genuinely needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_AES_GCM_POLICY_POOL_SIZE
#define SOLIDSYSLOG_AES_GCM_POLICY_POOL_SIZE 1U
#endif
#if SOLIDSYSLOG_AES_GCM_POLICY_POOL_SIZE < 1
#error "SOLIDSYSLOG_AES_GCM_POLICY_POOL_SIZE must be >= 1"
#endif
/*
* Maximum HMAC key length, in bytes, a keyed SecurityPolicy will fetch from
* its SolidSyslogKeyFunction into a transient on-stack buffer (wiped after
* each use). Sized for the SHA-256 HMAC block (64 bytes): RFC 2104 keys up to
* the hash block size are used directly; longer keys are pre-hashed by the
* HMAC itself, so 64 covers the recommended range. Bump via
* SOLIDSYSLOG_USER_TUNABLES_FILE only if an integrator's GetKey returns a
* longer key verbatim.
*
* Floor: 32 (the SHA-256 output size, the RFC-recommended minimum key length).
*/
#ifndef SOLIDSYSLOG_MAX_HMAC_KEY_SIZE
#define SOLIDSYSLOG_MAX_HMAC_KEY_SIZE 64U
#endif
#if SOLIDSYSLOG_MAX_HMAC_KEY_SIZE < 32
#error "SOLIDSYSLOG_MAX_HMAC_KEY_SIZE must be >= 32"
#endif
/*
* Number of SolidSyslog{Posix,Winsock,FreeRtos}Address instances the
* library's internal static pool can simultaneously hold. Each instance
* carries one platform sockaddr (struct sockaddr_in on POSIX/Windows,
* struct freertos_sockaddr on FreeRTOS) — ~16 bytes per slot.
*
* Default 3 — matches the canonical BDD multi-transport wiring
* (UDP + plain-TCP + TLS-stream, one Address per Sender) so common
* integrators are spared an override. Same trade-off as
* SOLIDSYSLOG_TCP_STREAM_POOL_SIZE / _STREAM_SENDER_POOL_SIZE:
* single-transport integrators pay ~32 bytes of unused slots per platform;
* multi-transport integrators get the canonical wiring out of the box.
* Bump via SOLIDSYSLOG_USER_TUNABLES_FILE if more than three concurrent
* senders are needed.
*
* Floor: 1. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_ADDRESS_POOL_SIZE
#define SOLIDSYSLOG_ADDRESS_POOL_SIZE 3U
#endif
#if SOLIDSYSLOG_ADDRESS_POOL_SIZE < 1
#error "SOLIDSYSLOG_ADDRESS_POOL_SIZE must be >= 1"
#endif
/*
* Default bounded-connect deadline applied by every TCP Stream backend
* (POSIX, Winsock, FreeRTOS) when the integrator does not install a
* SolidSyslogTcpConnectTimeoutFunction on the config struct. 200 ms is
* comfortable for loopback / LAN and short enough that ten failing attempts
* cost 2 s; raise it for WAN deployments behind a high-RTT link.
*
* Runtime override: install GetConnectTimeoutMs on the per-Stream config —
* the getter is invoked on every connect attempt so live tuning takes effect
* without rebuilding or recreating the stream.
*
* Floor: 1 ms. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_TCP_CONNECT_TIMEOUT_MS
#define SOLIDSYSLOG_TCP_CONNECT_TIMEOUT_MS 200U
#endif
#if SOLIDSYSLOG_TCP_CONNECT_TIMEOUT_MS < 1
#error "SOLIDSYSLOG_TCP_CONNECT_TIMEOUT_MS must be >= 1"
#endif
/*
* Default bounded TLS handshake deadline applied by every TLS Stream backend
* (OpenSSL, Mbed TLS) when the integrator does not install a
* SolidSyslogTlsHandshakeTimeoutFunction on the config struct. 5 s covers a
* full TLS 1.2 / 1.3 exchange on a healthy LAN with cert validation; raise
* it for WAN deployments or constrained MCUs that handshake slowly.
*
* Runtime override: install GetHandshakeTimeoutMs on the per-Stream config —
* the getter is invoked on every handshake attempt so live tuning takes
* effect without rebuilding or recreating the stream.
*
* Floor: 1 ms. Sub-floor values rejected at compile time.
*/
#ifndef SOLIDSYSLOG_TLS_HANDSHAKE_TIMEOUT_MS
#define SOLIDSYSLOG_TLS_HANDSHAKE_TIMEOUT_MS 5000U
#endif
#if SOLIDSYSLOG_TLS_HANDSHAKE_TIMEOUT_MS < 1
#error "SOLIDSYSLOG_TLS_HANDSHAKE_TIMEOUT_MS must be >= 1"
#endif
#endif /* SOLIDSYSLOG_TUNABLES_DEFAULTS_H */