sACN
HEAD (unstable)
Implementation of ANSI E1.31 (Streaming ACN)
View other versions:
Loading...
Searching...
No Matches
opts.h
Go to the documentation of this file.
1
/******************************************************************************
2
* Copyright 2024 ETC Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
******************************************************************************
16
* This file is a part of sACN. For more information, go to:
17
* https://github.com/ETCLabs/sACN
18
*****************************************************************************/
19
27
#ifndef SACN_PRIVATE_OPTS_H_
28
#define SACN_PRIVATE_OPTS_H_
29
40
#if SACN_HAVE_CONFIG_H
41
/* User configuration options. Any non-defined ones will get their defaults in this file. */
42
#include "sacn_config.h"
43
#endif
44
45
#include "etcpal/thread.h"
46
47
/* Some option hints based on well-known compile definitions */
48
51
/* Are we being compiled for a full-featured OS? */
52
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) || defined(__unix__) || defined(_POSIX_VERSION)
53
#define SACN_FULL_OS_AVAILABLE_HINT 1
54
#else
55
#define SACN_FULL_OS_AVAILABLE_HINT 0
56
#endif
57
60
/*************************** sACN Global Options *****************************/
61
77
#ifndef SACN_DYNAMIC_MEM
78
#define SACN_DYNAMIC_MEM SACN_FULL_OS_AVAILABLE_HINT
79
#endif
80
87
#ifndef SACN_LOGGING_ENABLED
88
#define SACN_LOGGING_ENABLED 1
89
#endif
90
94
#ifndef SACN_LOG_MSG_PREFIX
95
#define SACN_LOG_MSG_PREFIX "sACN: "
96
#endif
97
109
bool
sacn_assert_verify_fail
(
const
char
* exp,
const
char
* file,
const
char
* func,
int
line);
110
117
#ifndef SACN_ASSERT_VERIFY
118
#define SACN_ASSERT_VERIFY(exp) ((exp) ? true : (sacn_assert_verify_fail(#exp, __FILE__, __func__, __LINE__) && false))
119
#endif
120
130
#ifndef SACN_ASSERT
131
#include <assert.h>
132
#define SACN_ASSERT(expr) assert(expr)
133
#endif
134
142
#ifndef SACN_ETC_PRIORITY_EXTENSION
143
#define SACN_ETC_PRIORITY_EXTENSION 1
144
#endif
145
152
#ifndef SACN_LOOPBACK
153
#define SACN_LOOPBACK 1
154
#endif
155
161
#ifndef SACN_MAX_NETINTS
162
#define SACN_MAX_NETINTS 2
163
#endif
164
169
/*************************** sACN Receive Options ****************************/
170
184
#ifndef SACN_RECEIVER_THREAD_PRIORITY
185
#define SACN_RECEIVER_THREAD_PRIORITY ETCPAL_THREAD_DEFAULT_PRIORITY
186
#endif
187
193
#ifndef SACN_RECEIVER_THREAD_STACK
194
#define SACN_RECEIVER_THREAD_STACK ETCPAL_THREAD_DEFAULT_STACK
195
#endif
196
202
#ifndef SACN_RECEIVER_THREAD_NAME
203
#define SACN_RECEIVER_THREAD_NAME "sACN Receive Thread"
204
#endif
205
206
/* Infinite read blocks are not supported due to the potential for hangs on shutdown. */
207
#if defined(SACN_RECEIVER_READ_TIMEOUT_MS) && SACN_RECEIVER_READ_TIMEOUT_MS < 0
208
#undef SACN_RECEIVER_READ_TIMEOUT_MS
/* It will get the default value below */
209
#endif
210
217
#ifndef SACN_RECEIVER_READ_TIMEOUT_MS
218
#define SACN_RECEIVER_READ_TIMEOUT_MS 100
219
#endif
220
229
#ifndef SACN_RECEIVER_MAX_UNIVERSES
230
#define SACN_RECEIVER_MAX_UNIVERSES 1
231
#endif
232
243
#ifndef SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE
244
#define SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE 4
245
#endif
246
260
#ifndef SACN_RECEIVER_TOTAL_MAX_SOURCES
261
#define SACN_RECEIVER_TOTAL_MAX_SOURCES (SACN_RECEIVER_MAX_UNIVERSES * SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE)
262
#endif
263
279
#ifndef SACN_RECEIVER_LIMIT_BIND
280
#define SACN_RECEIVER_LIMIT_BIND (!_WIN32 && !__APPLE__)
281
#endif
282
297
#ifdef SACN_RECEIVER_SOCKET_PER_NIC
298
#if !SACN_RECEIVER_SOCKET_PER_NIC && _WIN32
299
#error "Error: SACN_RECEIVER_SOCKET_PER_NIC was set to 0 on Windows, which is not supported due to performance issues."
300
#endif
301
#else
302
#define SACN_RECEIVER_SOCKET_PER_NIC (_WIN32)
303
#endif
304
312
#ifndef SACN_RECEIVER_MAX_SUBS_PER_SOCKET
313
#define SACN_RECEIVER_MAX_SUBS_PER_SOCKET 20
314
#endif
315
317
/* TODO investigate. Windows value was 110592 */
318
#ifndef SACN_RECEIVER_SOCKET_RCVBUF_SIZE
319
#define SACN_RECEIVER_SOCKET_RCVBUF_SIZE 32768
320
#endif
330
#ifndef SACN_RECEIVER_ENABLE_SO_REUSEPORT
331
#define SACN_RECEIVER_ENABLE_SO_REUSEPORT 1
332
#endif
333
341
#ifndef SACN_RECEIVER_ENABLE_SO_RCVBUF
342
#define SACN_RECEIVER_ENABLE_SO_RCVBUF 1
343
#endif
344
348
#undef SACN_RECEIVER_MAX_THREADS
349
#define SACN_RECEIVER_MAX_THREADS 1
350
354
#undef SACN_RECEIVER_MAX_FOOTPRINT
355
#define SACN_RECEIVER_MAX_FOOTPRINT 512
356
361
/***************************** sACN Send Options *****************************/
362
376
#ifndef SACN_SOURCE_THREAD_PRIORITY
377
#define SACN_SOURCE_THREAD_PRIORITY ETCPAL_THREAD_DEFAULT_PRIORITY
378
#endif
379
385
#ifndef SACN_SOURCE_THREAD_STACK
386
#define SACN_SOURCE_THREAD_STACK ETCPAL_THREAD_DEFAULT_STACK
387
#endif
388
394
#ifndef SACN_SOURCE_THREAD_NAME
395
#define SACN_SOURCE_THREAD_NAME "sACN Source Thread"
396
#endif
397
399
/* TODO investigate. Windows value was 20 */
400
#ifndef SACN_SOURCE_MULTICAST_TTL
401
#define SACN_SOURCE_MULTICAST_TTL 64
402
#endif
415
#ifndef SACN_SOURCE_SOCKET_SNDBUF_SIZE
416
#define SACN_SOURCE_SOCKET_SNDBUF_SIZE 115000
417
#endif
418
426
#ifndef SACN_SOURCE_MAX_SOURCES
427
#define SACN_SOURCE_MAX_SOURCES 1
428
#endif
429
437
#ifndef SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE
438
#define SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE 4
439
#endif
440
446
#ifndef SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE
447
#define SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE 4
448
#endif
449
454
/***************************** sACN DMX Merger Options *****************************/
455
464
#ifndef DOXYGEN
// Internal define
465
#ifdef SACN_DMX_MERGER_MAX_MERGERS
466
#define SACN_DMX_MERGER_DEFAULT_MAX_MERGERS 0
467
#else
// SACN_DMX_MERGER_MAX_MERGERS
468
#define SACN_DMX_MERGER_DEFAULT_MAX_MERGERS 1
469
#endif
// SACN_DMX_MERGER_MAX_MERGERS
470
#endif
// DOXYGEN
471
479
#ifndef SACN_DMX_MERGER_MAX_MERGERS
480
#define SACN_DMX_MERGER_MAX_MERGERS SACN_RECEIVER_MAX_UNIVERSES
481
#endif
482
490
#ifndef SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER
491
#define SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE
492
#endif
493
497
#ifdef SACN_DMX_MERGER_MAX_SLOTS
498
#if (SACN_DMX_MERGER_MAX_SLOTS < 1)
499
#error "Error: SACN_DMX_MERGER_MAX_SLOTS must be >= 1."
500
#endif
501
#else
502
#define SACN_DMX_MERGER_MAX_SLOTS 512
503
#endif
504
511
#ifndef SACN_DMX_MERGER_DISABLE_INTERNAL_PAP_BUFFER
512
#define SACN_DMX_MERGER_DISABLE_INTERNAL_PAP_BUFFER 0
513
#endif
514
521
#ifndef SACN_DMX_MERGER_DISABLE_INTERNAL_OWNER_BUFFER
522
#define SACN_DMX_MERGER_DISABLE_INTERNAL_OWNER_BUFFER 0
523
#endif
524
529
/***************************** sACN Merge Receiver Options *****************************/
530
547
#ifndef SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE
548
#define SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE \
549
((SACN_RECEIVER_MAX_UNIVERSES > 0) && (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE > 0) && \
550
(SACN_RECEIVER_TOTAL_MAX_SOURCES > 0) && (SACN_DMX_MERGER_MAX_MERGERS > 0) && \
551
(SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER > 0))
552
#endif
553
554
#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE && \
555
((SACN_RECEIVER_MAX_UNIVERSES <= 0) || (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE <= 0) || \
556
(SACN_RECEIVER_TOTAL_MAX_SOURCES <= 0))
557
#error "Error: SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE was set to 1, but the sACN Receiver API is disabled!"
558
#endif
559
560
#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE && \
561
((SACN_DMX_MERGER_MAX_MERGERS <= 0) || (SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER <= 0))
562
#error "Error: SACN_MERGE_RECEIVER_ENABLE_IN_STATIC_MEMORY_MODE was set to 1, but the sACN DMX Merger API is disabled!"
563
#endif
564
573
#ifndef SACN_MERGE_RECEIVER_ENABLE_SAMPLING_MERGER
574
#define SACN_MERGE_RECEIVER_ENABLE_SAMPLING_MERGER 1
575
#endif
576
577
#if SACN_MERGE_RECEIVER_ENABLE_SAMPLING_MERGER && SACN_DMX_MERGER_DEFAULT_MAX_MERGERS
578
#undef SACN_DMX_MERGER_MAX_MERGERS
579
#define SACN_DMX_MERGER_MAX_MERGERS (SACN_RECEIVER_MAX_UNIVERSES * 2)
580
#endif
581
586
/***************************** sACN Source Detector Options *****************************/
587
606
#ifndef SACN_SOURCE_DETECTOR_MAX_SOURCES
607
#define SACN_SOURCE_DETECTOR_MAX_SOURCES 5
608
#endif
609
620
#ifndef SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE
621
#define SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE 5
622
#endif
623
628
#endif
/* SACN_PRIVATE_OPTS_H_ */
sacn_assert_verify_fail
bool sacn_assert_verify_fail(const char *exp, const char *file, const char *func, int line)
The assertion failure handler function used by the sACN library.
Definition
common.c:637
include
sacn
opts.h
Generated by
1.11.0