sACN  2.0.1
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
232#ifndef SACN_RECEIVER_TOTAL_MAX_SOURCES
233#define SACN_RECEIVER_TOTAL_MAX_SOURCES (SACN_RECEIVER_MAX_UNIVERSES * SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE)
234#endif
235
251#ifndef SACN_RECEIVER_LIMIT_BIND
252#define SACN_RECEIVER_LIMIT_BIND (!_WIN32 && !__APPLE__)
253#endif
254
262#ifndef SACN_RECEIVER_MAX_SUBS_PER_SOCKET
263#define SACN_RECEIVER_MAX_SUBS_PER_SOCKET 20
264#endif
265
267/* TODO investigate. Windows value was 110592 */
268#ifndef SACN_RECEIVER_SOCKET_RCVBUF_SIZE
269#define SACN_RECEIVER_SOCKET_RCVBUF_SIZE 32768
270#endif
276#undef SACN_RECEIVER_MAX_THREADS
277#define SACN_RECEIVER_MAX_THREADS 1
278
282#undef SACN_RECEIVER_MAX_FOOTPRINT
283#define SACN_RECEIVER_MAX_FOOTPRINT 512
284
289/***************************** sACN Send Options *****************************/
290
304#ifndef SACN_SOURCE_THREAD_PRIORITY
305#define SACN_SOURCE_THREAD_PRIORITY ETCPAL_THREAD_DEFAULT_PRIORITY
306#endif
307
313#ifndef SACN_SOURCE_THREAD_STACK
314#define SACN_SOURCE_THREAD_STACK ETCPAL_THREAD_DEFAULT_STACK
315#endif
316
322#ifndef SACN_SOURCE_THREAD_NAME
323#define SACN_SOURCE_THREAD_NAME "sACN Source Thread"
324#endif
325
327/* TODO investigate. Windows value was 20 */
328#ifndef SACN_SOURCE_MULTICAST_TTL
329#define SACN_SOURCE_MULTICAST_TTL 64
330#endif
340#ifndef SACN_SOURCE_MAX_SOURCES
341#define SACN_SOURCE_MAX_SOURCES 1
342#endif
343
351#ifndef SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE
352#define SACN_SOURCE_MAX_UNIVERSES_PER_SOURCE 4
353#endif
354
360#ifndef SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE
361#define SACN_MAX_UNICAST_DESTINATIONS_PER_UNIVERSE 4
362#endif
363
368/***************************** sACN DMX Merger Options *****************************/
369
385#ifndef SACN_DMX_MERGER_MAX_MERGERS
386#define SACN_DMX_MERGER_MAX_MERGERS SACN_RECEIVER_MAX_UNIVERSES
387#endif
388
396#ifndef SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER
397#define SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE
398#endif
399
403#undef SACN_DMX_MERGER_MAX_SLOTS
404#define SACN_DMX_MERGER_MAX_SLOTS 512
405
410/***************************** sACN Merge Receiver Options *****************************/
411
428#ifndef SACN_MERGE_RECEIVER_ENABLE
429#define SACN_MERGE_RECEIVER_ENABLE \
430 ((SACN_RECEIVER_MAX_UNIVERSES > 0) && (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE > 0) && \
431 (SACN_RECEIVER_TOTAL_MAX_SOURCES > 0) && (SACN_DMX_MERGER_MAX_MERGERS > 0) && \
432 (SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER > 0))
433#endif
434
435#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE && \
436 ((SACN_RECEIVER_MAX_UNIVERSES <= 0) || (SACN_RECEIVER_MAX_SOURCES_PER_UNIVERSE <= 0) || \
437 (SACN_RECEIVER_TOTAL_MAX_SOURCES <= 0))
438#error "Error: SACN_MERGE_RECEIVER_ENABLE was set to 1, but the sACN Receiver API is disabled!"
439#endif
440
441#if !SACN_DYNAMIC_MEM && SACN_MERGE_RECEIVER_ENABLE && \
442 ((SACN_DMX_MERGER_MAX_MERGERS <= 0) || (SACN_DMX_MERGER_MAX_SOURCES_PER_MERGER <= 0))
443#error "Error: SACN_MERGE_RECEIVER_ENABLE was set to 1, but the sACN DMX Merger API is disabled!"
444#endif
445
450/***************************** sACN Source Detector Options *****************************/
451
470#ifndef SACN_SOURCE_DETECTOR_MAX_SOURCES
471#define SACN_SOURCE_DETECTOR_MAX_SOURCES 5
472#endif
473
484#ifndef SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE
485#define SACN_SOURCE_DETECTOR_MAX_UNIVERSES_PER_SOURCE 5
486#endif
487
492#endif /* SACN_PRIVATE_OPTS_H_ */