matthiasm@27
|
1 /*
|
matthiasm@27
|
2 * Copyright (C) 2004 Steve Harris
|
matthiasm@27
|
3 *
|
matthiasm@27
|
4 * This program is free software; you can redistribute it and/or
|
matthiasm@27
|
5 * modify it under the terms of the GNU Lesser General Public License
|
matthiasm@27
|
6 * as published by the Free Software Foundation; either version 2.1
|
matthiasm@27
|
7 * of the License, or (at your option) any later version.
|
matthiasm@27
|
8 *
|
matthiasm@27
|
9 * This program is distributed in the hope that it will be useful,
|
matthiasm@27
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
matthiasm@27
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
matthiasm@27
|
12 * GNU Lesser General Public License for more details.
|
matthiasm@27
|
13 *
|
matthiasm@27
|
14 * $Id$
|
matthiasm@27
|
15 */
|
matthiasm@27
|
16
|
matthiasm@27
|
17 #ifndef LO_MACROS_H
|
matthiasm@27
|
18 #define LO_MACROS_H
|
matthiasm@27
|
19
|
matthiasm@27
|
20 /* macros that have to be defined after function signatures */
|
matthiasm@27
|
21
|
matthiasm@27
|
22 #ifdef __cplusplus
|
matthiasm@27
|
23 extern "C" {
|
matthiasm@27
|
24 #endif
|
matthiasm@27
|
25
|
matthiasm@27
|
26 /* \brief Maximum length of UDP messages in bytes
|
matthiasm@27
|
27 */
|
matthiasm@27
|
28 #define LO_MAX_MSG_SIZE 32768
|
matthiasm@27
|
29
|
matthiasm@27
|
30 /* \brief A set of macros to represent different communications transports
|
matthiasm@27
|
31 */
|
matthiasm@27
|
32 #define LO_DEFAULT 0x0
|
matthiasm@27
|
33 #define LO_UDP 0x1
|
matthiasm@27
|
34 #define LO_UNIX 0x2
|
matthiasm@27
|
35 #define LO_TCP 0x4
|
matthiasm@27
|
36
|
matthiasm@27
|
37 /* an internal value, ignored in transmission but check against LO_MARKER in the
|
matthiasm@27
|
38 * argument list. Used to do primitive bounds checking */
|
matthiasm@27
|
39 #define LO_MARKER_A 0xdeadbeef
|
matthiasm@27
|
40 #define LO_MARKER_B 0xf00baa23
|
matthiasm@27
|
41 #define LO_ARGS_END LO_MARKER_A, LO_MARKER_B
|
matthiasm@27
|
42
|
matthiasm@27
|
43 #define lo_message_add_varargs(msg, types, list) \
|
matthiasm@27
|
44 lo_message_add_varargs_internal(msg, types, list, __FILE__, __LINE__)
|
matthiasm@27
|
45
|
matthiasm@27
|
46 #ifdef __GNUC__
|
matthiasm@27
|
47
|
matthiasm@27
|
48 #define lo_message_add(msg, types...) \
|
matthiasm@27
|
49 lo_message_add_internal(msg, __FILE__, __LINE__, types, \
|
matthiasm@27
|
50 LO_MARKER_A, LO_MARKER_B)
|
matthiasm@27
|
51
|
matthiasm@27
|
52 #define lo_send(targ, path, types...) \
|
matthiasm@27
|
53 lo_send_internal(targ, __FILE__, __LINE__, path, types, \
|
matthiasm@27
|
54 LO_MARKER_A, LO_MARKER_B)
|
matthiasm@27
|
55
|
matthiasm@27
|
56 #define lo_send_timestamped(targ, ts, path, types...) \
|
matthiasm@27
|
57 lo_send_timestamped_internal(targ, __FILE__, __LINE__, ts, path, \
|
matthiasm@27
|
58 types, LO_MARKER_A, LO_MARKER_B)
|
matthiasm@27
|
59
|
matthiasm@27
|
60 #define lo_send_from(targ, from, ts, path, types...) \
|
matthiasm@27
|
61 lo_send_from_internal(targ, from, __FILE__, __LINE__, ts, path, \
|
matthiasm@27
|
62 types, LO_MARKER_A, LO_MARKER_B)
|
matthiasm@27
|
63
|
matthiasm@27
|
64 #else
|
matthiasm@27
|
65
|
matthiasm@27
|
66 /* In non-GCC compilers, there is no support for variable-argument
|
matthiasm@27
|
67 * macros, so provide "internal" vararg functions directly instead. */
|
matthiasm@27
|
68
|
matthiasm@27
|
69 int lo_message_add(lo_message msg, const char *types, ...);
|
matthiasm@27
|
70 int lo_send(lo_address targ, const char *path, const char *types, ...);
|
matthiasm@27
|
71 int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, const char *types, ...);
|
matthiasm@27
|
72 int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *types, ...);
|
matthiasm@27
|
73
|
matthiasm@27
|
74 #endif
|
matthiasm@27
|
75
|
matthiasm@27
|
76 #ifdef __cplusplus
|
matthiasm@27
|
77 }
|
matthiasm@27
|
78 #endif
|
matthiasm@27
|
79
|
matthiasm@27
|
80 #endif
|