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