source: roaraudio/include/roaraudio.h @ 56:2f8c23a10120

Last change on this file since 56:2f8c23a10120 was 56:2f8c23a10120, checked in by phi, 16 years ago

added some mlock support code

File size: 2.1 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
14#include <arpa/inet.h>
15
16#include <sys/socket.h>
17#include <netinet/in.h>
18#include <netinet/tcp.h>
19#include <sys/un.h>
20
21#include <netdb.h>
22
23#include <roaraudio/config.h>
24
25// NOTE: we need this macro in some of our header files.
26#if INT_MAX >= 32767
27#define roar_intm16  int
28#define roar_uintm16 unsigned int
29#else
30#define roar_intm16  int16_t
31#define roar_uintm16 uint16_t
32#endif
33
34#include <roaraudio/proto.h>
35#include <roaraudio/audio.h>
36#include <roaraudio/stream.h>
37#include <roaraudio/client.h>
38#include <roaraudio/sample.h>
39
40#include <libroar/libroar.h>
41
42#define ROAR_DEFAULT_PORT        16002
43#define ROAR_DEFAULT_HOST        "localhost"
44
45#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
46#define ROAR_DEFAULT_SOCK_USER   ".roar"
47
48
49//some basic macros:
50#define ROAR_STDIN  0
51#define ROAR_STDOUT 1
52#define ROAR_STDERR 2
53
54#define ROAR_DEBUG_OUTFH stderr
55
56#ifdef ROAR_DBG_PREFIX
57#undef ROAR_DBG_PREFIX
58#endif
59#define ROAR_DBG_PREFIX "roaraudio"
60
61#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
62
63#ifdef DEBUG
64 #define ROAR_DBG(format, args...)  fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "DEBUG: " format "\n", __LINE__, ## args)
65#else
66 #define ROAR_DBG(format, args...)
67#endif
68
69#define ROAR_ERR(format, args...)   fprintf(ROAR_DEBUG_OUTFH, ROAR_DBG_FULLPREFIX "Error: " format "\n", __LINE__, ## args)
70
71
72#ifdef ROAR_HAVE_SAFE_OVERFLOW
73#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
74#else
75#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
76#endif
77
78#ifdef ROAR_HAVE_MLOCK
79#define ROAR_MLOCK(p,s) mlook((p) - (p) % sysconf(_SC_PAGESIZE), (s))
80#endif
81
82
83#if BYTE_ORDER == BIG_ENDIAN
84
85#define ROAR_NET2HOST32(x) (x)
86#define ROAR_HOST2NET32(x) (x)
87#define ROAR_NET2HOST16(x) (x)
88#define ROAR_HOST2NET16(x) (x)
89
90//#elif BYTE_ORDER == LITTLE_ENDIAN
91#else
92
93#define ROAR_NET2HOST32(x) ntohl((x))
94#define ROAR_HOST2NET32(x) htonl((x))
95#define ROAR_NET2HOST16(x) ntohs((x))
96#define ROAR_HOST2NET16(x) htons((x))
97
98#endif
99
100#endif
101
102//ll
Note: See TracBrowser for help on using the repository browser.