source: roaraudio/include/roaraudio.h @ 704:25764dfdef62

Last change on this file since 704:25764dfdef62 was 704:25764dfdef62, checked in by phi, 16 years ago

added COPYING.lgplv3

File size: 4.6 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#include <roaraudio/proto.h>
70#include <roaraudio/audio.h>
71#include <roaraudio/stream.h>
72#include <roaraudio/client.h>
73#include <roaraudio/sample.h>
74#include <roaraudio/meta.h>
75#include <roaraudio/acl.h>
76
77#include <libroar/libroar.h>
78
79// IP
80#define ROAR_DEFAULT_PORT        16002
81#define ROAR_DEFAULT_HOST        "localhost"
82
83// UNIX Domain Sockets
84#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
85#define ROAR_DEFAULT_SOCK_USER   ".roar"
86
87// DECnet
88#define ROAR_DEFAULT_OBJECT      "roar"
89#define ROAR_DEFAULT_NUM         0
90#define ROAR_DEFAULT_LISTEN_OBJECT "::" ROAR_DEFAULT_OBJECT
91
92#define ROAR_DEFAULT_SOCKGRP     "audio"
93
94#define ROAR_LIBS                "-lroar"
95#define ROAR_CFLAGS              ""
96
97//some basic macros:
98#define ROAR_STDIN  0
99#define ROAR_STDOUT 1
100#define ROAR_STDERR 2
101
102#define ROAR_DEBUG_OUTFH stderr
103
104#ifdef ROAR_DBG_PREFIX
105#undef ROAR_DBG_PREFIX
106#endif
107#define ROAR_DBG_PREFIX "roaraudio"
108
109#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
110
111#if __GNUC__ < 3
112 #define ROAR_DBG(format, args...)
113 #define ROAR_ERR(format, args...)
114 #define ROAR_WARN(format, args...)
115#else
116
117#ifdef DEBUG
118 #define ROAR_DBG(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args)
119#else
120 #define ROAR_DBG(format, args...)
121#endif
122
123#define ROAR_ERR(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: "   format "\n", __LINE__, ## args)
124#define ROAR_WARN(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Warning: " format "\n", __LINE__, ## args)
125
126#endif
127
128#ifdef ROAR_HAVE_SAFE_OVERFLOW
129#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
130#else
131#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
132#endif
133
134#ifdef ROAR_HAVE_MLOCK
135#ifdef __linux__
136#define ROAR_MLOCK(p,s) mlock((p), (s))
137#else
138int _ROAR_MLOCK(const void *addr, size_t len);
139#define ROAR_MLOCK _ROAR_MLOCK
140#endif
141#endif
142
143
144#if BYTE_ORDER == BIG_ENDIAN
145
146#define ROAR_NET2HOST32(x) (x)
147#define ROAR_HOST2NET32(x) (x)
148#define ROAR_NET2HOST16(x) (x)
149#define ROAR_HOST2NET16(x) (x)
150
151#ifdef ROAR_HAVE_LIBDNET
152#define ROAR_dn_ntohs(x) ((((x)&0x0ff)<<8) | (((x)&0xff00)>>8))
153#define ROAR_dn_ntohl(x) ( ((dn_ntohs((x)&0xffff))<<16) |\
154                           ((dn_ntohs(((x)>>16)))) )
155#define ROAR_dn_htonl(x) ROAR_dn_ntohl(x)
156#define ROAR_dn_htons(x) ROAR_dn_ntohs(x)
157#endif
158
159//#elif BYTE_ORDER == LITTLE_ENDIAN
160#else
161
162#define ROAR_NET2HOST32(x) ntohl((x))
163#define ROAR_HOST2NET32(x) htonl((x))
164#define ROAR_NET2HOST16(x) ntohs((x))
165#define ROAR_HOST2NET16(x) htons((x))
166
167#ifdef ROAR_HAVE_LIBDNET
168#if BYTE_ORDER == LITTLE_ENDIAN
169#define ROAR_dn_ntohs(x) (x)
170#define ROAR_dn_htons(x) (x)
171
172#define ROAR_dn_ntohl(x) (x)
173#define ROAR_dn_htonl(x) (x)
174#else
175#error can not build on this architecture with DECnet support enabled
176#endif
177#endif
178
179#endif
180
181#endif
182
183//ll
Note: See TracBrowser for help on using the repository browser.