source: roaraudio/include/roaraudio.h @ 874:fdb9418acb60

Last change on this file since 874:fdb9418acb60 was 874:fdb9418acb60, checked in by phi, 16 years ago

use *_DECLS

File size: 4.8 KB
Line 
1//roaraudio.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008
5 *
6 *  This file is part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU Lesser General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU Lesser General Public License for more details.
18 *
19 *  You should have received a copy of the GNU Lesser General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 *  NOTE: Even though this file is LGPLed it (may) include GPLed files
24 *  so the license of this file is/may therefore downgraded to GPL.
25 *  See HACKING for details.
26 */
27
28#ifndef _ROARAUDIO_H_
29#define _ROARAUDIO_H_
30
31#include <stdlib.h>
32#include <unistd.h>
33#include <stdio.h>
34#include <string.h>
35#include <errno.h>
36#include <sys/types.h>
37#include <limits.h>
38#include <sys/mman.h>
39
40// TODO: can we move the next block into roard specific includes?
41#include <grp.h>
42#include <pwd.h>
43#include <sys/stat.h>
44
45#include <arpa/inet.h>
46
47#include <sys/socket.h>
48#include <netinet/in.h>
49#include <netinet/tcp.h>
50#include <sys/un.h>
51
52#ifdef __NetBSD__
53#include <netinet/in_systm.h>
54#endif
55
56#include <netdb.h>
57
58#include <roaraudio/config.h>
59
60// NOTE: we need this macro in some of our header files.
61#if INT_MAX >= 32767
62#define roar_intm16  int
63#define roar_uintm16 unsigned int
64#else
65#define roar_intm16  int16_t
66#define roar_uintm16 uint16_t
67#endif
68
69#ifndef __BEGIN_DECLS
70#ifdef __cplusplus
71# define __BEGIN_DECLS extern "C" {
72# define __END_DECLS }
73#else
74# define __BEGIN_DECLS
75# define __END_DECLS
76#endif
77#endif
78
79__BEGIN_DECLS
80
81#include <roaraudio/proto.h>
82#include <roaraudio/error.h>
83#include <roaraudio/audio.h>
84#include <roaraudio/stream.h>
85#include <roaraudio/client.h>
86#include <roaraudio/sample.h>
87#include <roaraudio/meta.h>
88#include <roaraudio/acl.h>
89
90#include <libroar/libroar.h>
91
92// IP
93#define ROAR_DEFAULT_PORT        16002
94#define ROAR_DEFAULT_HOST        "localhost"
95
96// UNIX Domain Sockets
97#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
98#define ROAR_DEFAULT_SOCK_USER   ".roar"
99
100// DECnet
101#define ROAR_DEFAULT_OBJECT      "roar"
102#define ROAR_DEFAULT_NUM         0
103#define ROAR_DEFAULT_LISTEN_OBJECT "::" ROAR_DEFAULT_OBJECT
104
105#define ROAR_DEFAULT_SOCKGRP     "audio"
106
107#define ROAR_LIBS                "-lroar"
108#define ROAR_CFLAGS              ""
109
110//some basic macros:
111#define ROAR_STDIN  0
112#define ROAR_STDOUT 1
113#define ROAR_STDERR 2
114
115#define ROAR_DEBUG_OUTFH stderr
116
117#ifdef ROAR_DBG_PREFIX
118#undef ROAR_DBG_PREFIX
119#endif
120#define ROAR_DBG_PREFIX "roaraudio"
121
122#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
123
124#if __GNUC__ < 3
125 #define ROAR_DBG(format, args...)
126 #define ROAR_ERR(format, args...)
127 #define ROAR_WARN(format, args...)
128#else
129
130#ifdef DEBUG
131 #define ROAR_DBG(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args)
132#else
133 #define ROAR_DBG(format, args...)
134#endif
135
136#define ROAR_ERR(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: "   format "\n", __LINE__, ## args)
137#define ROAR_WARN(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Warning: " format "\n", __LINE__, ## args)
138
139#endif
140
141#ifdef ROAR_HAVE_SAFE_OVERFLOW
142#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
143#else
144#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
145#endif
146
147#ifdef ROAR_HAVE_MLOCK
148#ifdef __linux__
149#define ROAR_MLOCK(p,s) mlock((p), (s))
150#else
151int _ROAR_MLOCK(const void *addr, size_t len);
152#define ROAR_MLOCK _ROAR_MLOCK
153#endif
154#endif
155
156
157#if BYTE_ORDER == BIG_ENDIAN
158
159#define ROAR_NET2HOST32(x) (x)
160#define ROAR_HOST2NET32(x) (x)
161#define ROAR_NET2HOST16(x) (x)
162#define ROAR_HOST2NET16(x) (x)
163
164#ifdef ROAR_HAVE_LIBDNET
165#define ROAR_dn_ntohs(x) ((((x)&0x0ff)<<8) | (((x)&0xff00)>>8))
166#define ROAR_dn_ntohl(x) ( ((dn_ntohs((x)&0xffff))<<16) |\
167                           ((dn_ntohs(((x)>>16)))) )
168#define ROAR_dn_htonl(x) ROAR_dn_ntohl(x)
169#define ROAR_dn_htons(x) ROAR_dn_ntohs(x)
170#endif
171
172//#elif BYTE_ORDER == LITTLE_ENDIAN
173#else
174
175#define ROAR_NET2HOST32(x) ntohl((x))
176#define ROAR_HOST2NET32(x) htonl((x))
177#define ROAR_NET2HOST16(x) ntohs((x))
178#define ROAR_HOST2NET16(x) htons((x))
179
180#ifdef ROAR_HAVE_LIBDNET
181#if BYTE_ORDER == LITTLE_ENDIAN
182#define ROAR_dn_ntohs(x) (x)
183#define ROAR_dn_htons(x) (x)
184
185#define ROAR_dn_ntohl(x) (x)
186#define ROAR_dn_htonl(x) (x)
187#else
188#error can not build on this architecture with DECnet support enabled
189#endif
190#endif
191
192#endif
193
194__END_DECLS
195
196#endif
197
198//ll
Note: See TracBrowser for help on using the repository browser.