blob: 097c23547a491e2d5090551d3c3e813aaf81fb5b [file] [log] [blame]
Radek Krejcid0d19522015-09-02 13:49:25 +02001/**
2 * \file config.h
3 * \author Radek Krejci <rkrejci@cesnet.cz>
4 * \brief libnetconf2 various configuration settings.
5 *
6 * Copyright (c) 2015 CESNET, z.s.p.o.
7 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +01008 * This source code is licensed under BSD 3-Clause License (the "License").
9 * You may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
Michal Vaskoafd416b2016-02-25 14:51:46 +010011 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +010012 * https://opensource.org/licenses/BSD-3-Clause
Radek Krejcid0d19522015-09-02 13:49:25 +020013 */
14
15#ifndef NC_CONFIG_H_
16#define NC_CONFIG_H_
17
18/*
19 * Mark all objects as hidden and export only objects explicitly marked to be part of the public API.
20 */
21#define API __attribute__((visibility("default")))
22
Michal Vasko05ba9df2016-01-13 14:40:27 +010023#ifdef __GNUC__
24# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
25#else
26# define UNUSED(x) UNUSED_ ## x
27#endif
28
Radek Krejci14b14032015-10-21 15:19:43 +020029/*
Radek Krejci32898d52016-07-14 17:37:02 +020030 * Support for spinlocks
31 */
32#cmakedefine HAVE_SPINLOCK
33#ifndef HAVE_SPINLOCK
34# define pthread_spinlock_t pthread_mutex_t
35# define pthread_spin_init(s, opt) pthread_mutex_init(s, NULL)
36# define pthread_spin_lock pthread_mutex_lock
37# define pthread_spin_trylock pthread_mutex_trylock
38# define pthread_spin_unlock pthread_mutex_unlock
39# define pthread_spin_destroy pthread_mutex_destroy
40#endif
41
42/*
Radek Krejci28472922016-07-15 11:51:16 +020043 * support for pthread_mutex_timedlock
44 */
45#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDLOCK
46
47/*
Radek Krejci14b14032015-10-21 15:19:43 +020048 * Location of installed basic YIN/YANG schemas
49 */
Michal Vaskoed6e0d32016-02-24 13:28:58 +010050#define SCHEMAS_DIR "@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@"
Radek Krejci14b14032015-10-21 15:19:43 +020051
Michal Vasko6b7c42e2016-03-02 15:46:41 +010052/*
Michal Vaskobe86fe32016-04-07 10:43:03 +020053 * Partial message read timeout in seconds (also used as nc_pollsession lock timeout)
Michal Vasko6b7c42e2016-03-02 15:46:41 +010054 */
55#define NC_READ_TIMEOUT @READ_TIMEOUT@
56
Radek Krejcid0d19522015-09-02 13:49:25 +020057#endif /* NC_CONFIG_H_ */