sACN  2.0.2
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 2022 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
104#ifndef SACN_ASSERT
105#include <assert.h>
106#define SACN_ASSERT(expr) assert(expr)
107#endif
108
116#ifndef SACN_ETC_PRIORITY_EXTENSION
117#define SACN_ETC_PRIORITY_EXTENSION 1
118#endif
119
126#ifndef SACN_LOOPBACK
127#define SACN_LOOPBACK 1
128#endif
129
135#ifndef SACN_MAX_NETINTS
136#define SACN_MAX_NETINTS 2
137#endif
138
143/*************************** sACN Receive Options ****************************/
144
158#ifndef SACN_RECEIVER_THREAD_PRIORITY
159#define SACN_RECEIVER_THREAD_PRIORITY ETCPAL_THREAD_DEFAULT_PRIORITY
160#endif
161
167#ifndef SACN_RECEIVER_THREAD_STACK
168#define SACN_RECEIVER_THREAD_STACK ETCPAL_THREAD_DEFAULT_STACK
169#endif
170
176#ifndef SACN_RECEIVER_THREAD_NAME
177#define SACN_RECEIVER_THREAD_NAME "sACN Receive Thread"
178#endif
179
180/* Infinite read blocks are not supported due to the potential for hangs on shutdown. */
181#if defined(SACN_RECEIVER_READ_TIMEOUT_MS) && SACN_RECEIVER_READ_TIMEOUT_MS < 0
182#undef SACN_RECEIVER_READ_TIMEOUT_MS /* It will get the default value below */
183#endif
184
191#ifndef SACN_RECEIVER_READ_TIMEOUT_MS
192#define SACN_RECEIVER_READ_TIMEOUT_MS 100
193#endif
194
203#ifndef SACN_RECEIVER_MAX_UNIVERSES
204#define SACN_RECEIVER_MAX_UNIVERSES 1
205#endif
206
217#ifndef SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE
218#define SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE 4
219#endif
220
234#ifndef SACN_RECEIVER_TOTAL_MAX_SOURCES
235#define SACN_RECEIVER_TOTAL_MAX_SOURCES (SACN_RECEIVER_MAX_UNIVERSES * SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE)
236#endif
237
253#ifndef SACN_RECEIVER_LIMIT_BIND
254#define SACN_RECEIVER_LIMIT_BIND (!_WIN32 && !__APPLE__)
255#endif
256
264#ifndef SACN_RECEIVER_MAX_SUBS_PER_SOCKET
265#define SACN_RECEIVER_MAX_SUBS_PER_SOCKET 20
266#endif
267
269/* TODO investigate. Windows value was 110592 */
270#ifndef SACN_RECEIVER_SOCKET_RCVBUF_SIZE
271#define SACN_RECEIVER_SOCKET_RCVBUF_SIZE 32768
272#endif
278#undef SACN_RECEIVER_MAX_THREADS
279#define SACN_RECEIVER_MAX_THREADS 1
280
284#undef SACN_RECEIVER_MAX_FOOTPRINT
285#define SACN_RECEIVER_MAX_FOOTPRINT 512
286
291/***************************** sACN Send Options *****************************/
292
306#ifndef SACN_SOURCE_THREAD_PRIORITY
307#define SACN_SOURCE_THREAD_PRIORITY ETCPAL_THREAD_DEFAULT_PRIORITY
308#endif
309
315#ifndef SACN_SOURCE_THREAD_STACK
316#define SACN_SOURCE_THREAD_STACK ETCPAL_THREAD_DEFAULT_STACK
317#endif
318
324#ifndef SACN_SOURCE_THREAD_NAME
325#define SACN_SOURCE_THREAD_NAME "sACN Source Thread"
326#endif
327
329/* TODO investigate. Windows value was 20 */
330#ifndef SACN_SOURCE_MULTICAST_TTL
331#define SACN_SOURCE_MULTICAST_TTL 64
332#endif
342#ifndef SACN_SOURCE_MAX_SOURCES
343#define SACN_SOURCE_MAX_SOURCES 1
344#endif
345
353#ifndef SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE
354#define SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE 4
355#endif
356
362#ifndef SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE
363#define SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE 4
364#endif
365
370/***************************** sACN DMX Merger Options *****************************/
371
387#ifndef SACN_DMX_MERGER_MAX_MERGERS
388#define SACN_DMX_MERGER_MAX_MERGERS SACN_RECEIVER_MAX_UNIVERSES
389#endif
390
398#ifndef SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER
399#define SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE
400#endif
401
405#undef SACN_DMX_MERGER_MAX_SLOTS
406#define SACN_DMX_MERGER_MAX_SLOTS 512
407
412/***************************** sACN Merge Receiver Options *****************************/
413
430#ifndef SACN_MERGE_RECEIVER_ENABLE
431#define SACN_MERGE_RECEIVER_ENABLE \
432 ((SACN_RECEIVER_MAX_UNIVERSES > 0) && (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE > 0) && \
433 (SACN_RECEIVER_TOTAL_MAX_SOURCES > 0) && (SACN_DMX_MERGER_MAX_MERGERS > 0) && \
434 (SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER > 0))
435#endif
436
437#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE && \
438 ((SACN_RECEIVER_MAX_UNIVERSES <= 0) || (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE <= 0) || \
439 (SACN_RECEIVER_TOTAL_MAX_SOURCES <= 0))
440#error "Error: SACN_MERGE_RECEIVER_ENABLE was set to 1, but the sACN Receiver API is disabled!"
441#endif
442
443#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE && \
444 ((SACN_DMX_MERGER_MAX_MERGERS <= 0) || (SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER <= 0))
445#error "Error: SACN_MERGE_RECEIVER_ENABLE was set to 1, but the sACN DMX Merger API is disabled!"
446#endif
447
452/***************************** sACN Source Detector Options *****************************/
453
472#ifndef SACN_SOURCE_DETECTOR_MAX_SOURCES
473#define SACN_SOURCE_DETECTOR_MAX_SOURCES 5
474#endif
475
486#ifndef SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE
487#define SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE 5
488#endif
489
494#endif /* SACN_PRIVATE_OPTS_H_ */