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