source: roaraudio/include/roaraudio.h @ 480:6ea556bf812e

Last change on this file since 480:6ea556bf812e was 480:6ea556bf812e, checked in by phi, 16 years ago

needed within NetBSD

File size: 2.8 KB
Line 
1//roaraudio.h:
2
3#ifndef _ROARAUDIO_H_
4#define _ROARAUDIO_H_
5
6#include <stdlib.h>
7#include <unistd.h>
8#include <stdio.h>
9#include <string.h>
10#include <errno.h>
11#include <sys/types.h>
12#include <limits.h>
13#include <sys/mman.h>
14
15// TODO: can we move the next block into roard specific includes?
16#include <grp.h>
17#include <pwd.h>
18#include <sys/stat.h>
19
20#include <arpa/inet.h>
21
22#include <sys/socket.h>
23#include <netinet/in.h>
24#include <netinet/tcp.h>
25#include <sys/un.h>
26
27#ifdef __NetBSD__
28#include <netinet/in_systm.h>
29#endif
30
31#include <netdb.h>
32
33#include <roaraudio/config.h>
34
35// NOTE: we need this macro in some of our header files.
36#if INT_MAX >= 32767
37#define roar_intm16  int
38#define roar_uintm16 unsigned int
39#else
40#define roar_intm16  int16_t
41#define roar_uintm16 uint16_t
42#endif
43
44#include <roaraudio/proto.h>
45#include <roaraudio/audio.h>
46#include <roaraudio/stream.h>
47#include <roaraudio/client.h>
48#include <roaraudio/sample.h>
49#include <roaraudio/meta.h>
50#include <roaraudio/acl.h>
51
52#include <libroar/libroar.h>
53
54#define ROAR_DEFAULT_PORT        16002
55#define ROAR_DEFAULT_HOST        "localhost"
56
57#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
58#define ROAR_DEFAULT_SOCK_USER   ".roar"
59
60#define ROAR_DEFAULT_SOCKGRP     "audio"
61
62#define ROAR_LIBS                "-lroar"
63#define ROAR_CFLAGS              ""
64
65//some basic macros:
66#define ROAR_STDIN  0
67#define ROAR_STDOUT 1
68#define ROAR_STDERR 2
69
70#define ROAR_DEBUG_OUTFH stderr
71
72#ifdef ROAR_DBG_PREFIX
73#undef ROAR_DBG_PREFIX
74#endif
75#define ROAR_DBG_PREFIX "roaraudio"
76
77#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
78
79#if __GNUC__ < 3
80 #define ROAR_DBG(format, args...)
81 #define ROAR_ERR(format, args...)
82 #define ROAR_WARN(format, args...)
83#else
84
85#ifdef DEBUG
86 #define ROAR_DBG(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args)
87#else
88 #define ROAR_DBG(format, args...)
89#endif
90
91#define ROAR_ERR(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: "   format "\n", __LINE__, ## args)
92#define ROAR_WARN(format, args...) fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Warning: " format "\n", __LINE__, ## args)
93
94#endif
95
96#ifdef ROAR_HAVE_SAFE_OVERFLOW
97#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
98#else
99#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
100#endif
101
102#ifdef ROAR_HAVE_MLOCK
103#ifdef __linux__
104#define ROAR_MLOCK(p,s) mlock((p), (s))
105#else
106#undef ROAR_HAVE_MLOCK
107#define ROAR_MLOCK(p,s)
108#warning No working mlock() support for this platform
109#endif
110#endif
111
112
113#if BYTE_ORDER == BIG_ENDIAN
114
115#define ROAR_NET2HOST32(x) (x)
116#define ROAR_HOST2NET32(x) (x)
117#define ROAR_NET2HOST16(x) (x)
118#define ROAR_HOST2NET16(x) (x)
119
120//#elif BYTE_ORDER == LITTLE_ENDIAN
121#else
122
123#define ROAR_NET2HOST32(x) ntohl((x))
124#define ROAR_HOST2NET32(x) htonl((x))
125#define ROAR_NET2HOST16(x) ntohs((x))
126#define ROAR_HOST2NET16(x) htons((x))
127
128#endif
129
130#endif
131
132//ll
Note: See TracBrowser for help on using the repository browser.