cannam@94: /* cannam@94: * Copyright (C) 2004 Steve Harris cannam@94: * cannam@94: * This program is free software; you can redistribute it and/or cannam@94: * modify it under the terms of the GNU Lesser General Public License cannam@94: * as published by the Free Software Foundation; either version 2.1 cannam@94: * of the License, or (at your option) any later version. cannam@94: * cannam@94: * This program is distributed in the hope that it will be useful, cannam@94: * but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@94: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@94: * GNU Lesser General Public License for more details. cannam@94: * cannam@94: * $Id$ cannam@94: */ cannam@94: cannam@94: #ifndef LO_MACROS_H cannam@94: #define LO_MACROS_H cannam@94: cannam@94: /* macros that have to be defined after function signatures */ cannam@94: cannam@94: #ifdef __cplusplus cannam@94: extern "C" { cannam@94: #endif cannam@94: cannam@94: /* \brief Maximum length of UDP messages in bytes cannam@94: */ cannam@94: #define LO_MAX_MSG_SIZE 32768 cannam@94: cannam@94: /* \brief A set of macros to represent different communications transports cannam@94: */ cannam@94: #define LO_DEFAULT 0x0 cannam@94: #define LO_UDP 0x1 cannam@94: #define LO_UNIX 0x2 cannam@94: #define LO_TCP 0x4 cannam@94: cannam@94: /* an internal value, ignored in transmission but check against LO_MARKER in the cannam@94: * argument list. Used to do primitive bounds checking */ cannam@94: #define LO_MARKER_A 0xdeadbeef cannam@94: #define LO_MARKER_B 0xf00baa23 cannam@94: #define LO_ARGS_END LO_MARKER_A, LO_MARKER_B cannam@94: cannam@94: #define lo_message_add_varargs(msg, types, list) \ cannam@94: lo_message_add_varargs_internal(msg, types, list, __FILE__, __LINE__) cannam@94: cannam@94: #ifdef __GNUC__ cannam@94: cannam@94: #define lo_message_add(msg, types...) \ cannam@94: lo_message_add_internal(msg, __FILE__, __LINE__, types, \ cannam@94: LO_MARKER_A, LO_MARKER_B) cannam@94: cannam@94: #define lo_send(targ, path, types...) \ cannam@94: lo_send_internal(targ, __FILE__, __LINE__, path, types, \ cannam@94: LO_MARKER_A, LO_MARKER_B) cannam@94: cannam@94: #define lo_send_timestamped(targ, ts, path, types...) \ cannam@94: lo_send_timestamped_internal(targ, __FILE__, __LINE__, ts, path, \ cannam@94: types, LO_MARKER_A, LO_MARKER_B) cannam@94: cannam@94: #define lo_send_from(targ, from, ts, path, types...) \ cannam@94: lo_send_from_internal(targ, from, __FILE__, __LINE__, ts, path, \ cannam@94: types, LO_MARKER_A, LO_MARKER_B) cannam@94: cannam@94: #else cannam@94: cannam@94: /* In non-GCC compilers, there is no support for variable-argument cannam@94: * macros, so provide "internal" vararg functions directly instead. */ cannam@94: cannam@94: int lo_message_add(lo_message msg, const char *types, ...); cannam@94: int lo_send(lo_address targ, const char *path, const char *types, ...); cannam@94: int lo_send_timestamped(lo_address targ, lo_timetag ts, const char *path, const char *types, ...); cannam@94: int lo_send_from(lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *types, ...); cannam@94: cannam@94: #endif cannam@94: cannam@94: #ifdef __cplusplus cannam@94: } cannam@94: #endif cannam@94: cannam@94: #endif