source: roaraudio/include/roaraudio.h @ 701:51495a826510

Last change on this file since 701:51495a826510 was 701:51495a826510, checked in by phi, 16 years ago

fixed some gcc warnings, no bugs

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