6 #include <lo/lo_throw.h> 12 #include <unordered_map> 15 #include <initializer_list> 40 #define LO_ADD_METHOD_RT(ht, argtypes, args, rt, r, r1, r2) \ 41 template <typename H> \ 42 Method add_method(const string_type path, const string_type types, \ 43 H&& h, rt* _unused=0) \ 45 std::string key(path.s() + "," + types.s()); \ 46 _handlers[key].push_front( \ 47 std::unique_ptr<handler>(new handler_type<r ht>(h))); \ 48 lo_method m = _add_method(path, types, \ 49 [](const char *path, const char *types, \ 50 lo_arg **argv, int argc, void *msg, \ 53 r1 (*static_cast<handler_type<r ht>*>(data)) args; \ 55 }, _handlers[key].front().get()); \ 56 _handlers[key].front()->method = m; \ 60 #define RT_INT(argtypes) \ 61 typename std::enable_if<std::is_same<decltype(h argtypes), int>::value, void>::type 62 #define RT_VOID(argtypes) \ 63 typename std::enable_if<std::is_same<decltype(h argtypes), void>::value, void>::type 65 #define LO_ADD_METHOD(ht, argtypes, args) \ 66 LO_ADD_METHOD_RT(ht, argtypes, args, \ 67 RT_INT(argtypes), int, return,); \ 68 LO_ADD_METHOD_RT(ht, argtypes, args, \ 69 RT_VOID(argtypes), void, , return 0) 77 string_type(
const char *s=0) { _s = s; }
78 string_type(
const std::string &s) { _s = s.c_str(); }
79 operator const char*()
const {
return _s; }
80 std::string s()
const {
return _s?_s:
""; }
84 class num_string_type :
public string_type {
86 num_string_type(
const char *s) : string_type(s) {}
87 num_string_type(
const std::string &s) : string_type(s) {}
88 num_string_type(
int n) { std::ostringstream ss; ss << n;
89 _p.reset(
new std::string(ss.str())); _s = _p->c_str(); }
90 std::unique_ptr<std::string> _p;
111 Address(
const string_type &host,
const num_string_type &port,
115 Address(
const string_type &url)
119 { address = a; owned=_owned; }
125 void swap(
Address& b)
throw () { std::swap(this->address, b.address); }
130 void set_ttl(
int ttl)
133 int send(
const string_type &path)
const 134 {
return lo_send(address, path,
""); }
139 int send(
const string_type &path,
const string_type type, ...)
const 144 std::string t = type.s() +
"$$";
151 int send(
lo_timetag ts,
const string_type &path,
152 const string_type type, ...)
const 157 std::string t = std::string(type) +
"$$";
166 int send(
const string_type &path,
lo_message m)
const 173 const string_type type, ...)
const;
175 int send_from(
lo_server from,
const string_type &path,
176 const string_type type, ...)
const 181 std::string t = std::string(type) +
"$$";
189 const string_type &path,
190 const string_type type, ...)
const 195 std::string t = std::string(type) +
"$$";
212 int get_errno()
const 215 std::string errstr()
const 218 std::string hostname()
const 221 std::string port()
const 227 std::string url()
const 230 std::string result(s?s:
"");
235 std::string iface()
const 238 void set_iface(
const string_type &iface,
const string_type &ip)
241 int set_tcp_nodelay(
int enable)
244 int set_stream_slip(
int enable)
266 : message(m.message) {
if (m.message)
269 Message(
const string_type types, ...)
275 std::string t(std::string(types)+
"$$");
276 add_varargs(t.c_str(), q);
283 void swap(
Message& m)
throw () { std::swap(this->message, m.message); }
285 int add(
const string_type types, ...)
289 std::string t(std::string(types)+
"$$");
290 return add_varargs(t.c_str(), q);
293 int add_varargs(
const string_type &types, va_list ap)
296 int add_int32(int32_t a)
299 int add_float(
float a)
302 int add_string(
const string_type &a)
308 int add_int64(int64_t a)
314 int add_double(
double a)
317 int add_symbol(
const string_type &a)
323 int add_midi(uint8_t a[4])
369 int add(uint8_t a[4])
384 std::string types()
const 393 size_t length(
const string_type &path)
const 396 void *serialise(
const string_type &path,
void *to,
size_t *size)
const 399 typedef std::pair<int, Message> maybe;
402 maybe deserialise(
void *data,
size_t size)
405 return maybe(result, m); }
428 template <
typename E>
429 Server(
const num_string_type &port, E&& e)
431 [](int num, const char *msg, const char *where){
432 auto h =
static_cast<handler_error*
>(lo_error_get_context());
433 if (h) (*h)(num, msg, where);
437 lo_server_set_error_context(server,
438 (_error_handler = std::unique_ptr<handler>(
439 new handler_error(e))).
get());
444 template <
typename E>
445 Server(
const num_string_type &port,
int proto, E&& e=0)
447 [](int num, const char *msg, const char *where){
448 auto h =
static_cast<handler_error*
>(lo_error_get_context());
449 (*h)(num, msg, where);
453 lo_server_set_error_context(server,
454 (_error_handler = std::unique_ptr<handler>(
455 new handler_error(e))).
get());
461 template <
typename E>
462 Server(
const string_type &group,
const num_string_type &port,
463 const string_type &iface=0,
const string_type &ip=0, E&& e=0)
464 :
Server((!iface._s || !ip._s)
466 [](int num, const char *msg, const char *where){
467 auto h =
static_cast<handler_error*
>(lo_error_get_context());
468 (*h)(num, msg, where);
471 [](
int num,
const char *msg,
const char *where){
472 auto h =
static_cast<handler_error*
>(lo_error_get_context());
473 (*h)(num, msg, where);
477 lo_server_set_error_context(server,
478 (_error_handler = std::unique_ptr<handler>(
479 new handler_error(e))).
get());
493 Server(
const string_type &group,
const num_string_type &port,
494 const string_type &iface=
"",
const string_type &ip=
"",
lo_err_handler err_h=0)
495 :
Server((iface._s || ip._s)
504 bool is_valid()
const {
return server!=
nullptr; }
512 {
return _add_method(path, types, h, data); }
518 LO_ADD_METHOD( (
const char*,
const char*,
lo_arg**,
int),
519 ((
char*)0, (
char*)0, (
lo_arg**)0, (
int)0),
520 (path, types, argv, argc) );
524 LO_ADD_METHOD( (
const char*,
lo_arg**,
int),
525 ((
char*)0, (
lo_arg**)0, (
int)0),
526 (types, argv, argc) );
529 (types, argv, argc,
Message(msg)) );
530 LO_ADD_METHOD( (
const char*,
const Message&),
533 LO_ADD_METHOD( (
lo_arg**,
int), ((
lo_arg**)0, (
int)0), (argv, argc) )
537 LO_ADD_METHOD( (
const Message&),
540 LO_ADD_METHOD( (), (), () );
542 int del_method(
const string_type &path,
const string_type &typespec)
544 _handlers.erase(path.s() +
"," + typespec.s());
551 for (
auto &i : _handlers) {
552 std::remove_if(i.second.begin(), i.second.end(),
553 [&](std::unique_ptr<handler>& h){
return h->method == m;});
558 int dispatch_data(
void *data,
size_t size)
561 int wait(
int timeout)
567 int recv(
int timeout)
577 template <
typename S,
typename E>
578 int add_bundle_handlers(S&& s, E&& e)
580 _bundle_handlers.reset(
new std::pair<handler_bundle_start,
582 handler_bundle_start(s),
583 handler_bundle_end(e)));
587 auto h = (std::pair<handler_bundle_start,
588 handler_bundle_end>*) user_data;
592 [](
void *user_data)->
int{
593 auto h = (std::pair<handler_bundle_start,
594 handler_bundle_end>*) user_data;
598 _bundle_handlers.get());
601 int socket_fd()
const 610 std::string url()
const 613 std::string result(s?s:
"");
618 int enable_queue(
int queue_enabled,
619 int dispatch_remaining=1)
622 dispatch_remaining); }
624 int events_pending()
const 627 double next_event_delay()
const 638 struct handler {
Method method; handler(
Method m):method(m){} };
639 template <
typename T>
640 class handler_type :
public handler,
public std::function<T> {
641 public:
template<
typename H>handler_type(H&& h,
Method m=0)
642 : handler(m), std::function<T>(h) {}
644 typedef handler_type<void(int, const char *, const char *)> handler_error;
645 typedef handler_type<void(int, const std::string&, const std::string&)> handler_error_s;
646 typedef handler_type<void(lo_timetag)> handler_bundle_start;
647 typedef handler_type<void()> handler_bundle_end;
650 std::unordered_map<std::string,
651 std::list<std::unique_ptr<handler>>> _handlers;
652 std::unique_ptr<handler> _error_handler;
653 std::unique_ptr<std::pair<handler_bundle_start,
654 handler_bundle_end>> _bundle_handlers;
656 virtual Method _add_method(
const char *path,
const char *types,
673 template <
typename E>
678 [](
int num,
const char *msg,
const char *where){
679 auto h =
static_cast<handler_error*
>(lo_error_get_context());
682 if (h) (*h)(num, msg, where);});
685 auto h =
new handler_error(e);
686 _error_handler.reset(h);
687 lo_server_thread_set_error_context(server_thread, h);
688 lo_server_set_error_context(server,
689 (_error_handler = std::unique_ptr<handler>(
690 new handler_error(e))).
get());
700 template <
typename E>
701 ServerThread(
const num_string_type &port,
int proto, E&& e)
705 [](
int num,
const char *msg,
const char *where){
706 auto h =
static_cast<handler_error*
>(lo_error_get_context());
709 if (h) (*h)(num, msg, where);});
712 auto h =
new handler_error(e);
713 _error_handler.reset(h);
714 lo_server_thread_set_error_context(server_thread, h);
715 lo_server_set_error_context(server,
716 (_error_handler = std::unique_ptr<handler>(
717 new handler_error(e))).
get());
721 ServerThread(
const string_type &group,
const num_string_type &port,
722 const string_type &iface,
const string_type &ip,
724 {
if (iface._s || ip._s)
736 template <
typename I,
typename C>
737 auto set_callbacks(I&& init, C&& cleanup)
738 ->
typename std::enable_if<
739 std::is_same<decltype(init()), int>::value,
void>::type
742 _cb_handlers.reset(
new handler_cb_pair(init, cleanup));
745 auto cb = (handler_cb_pair*)c;
746 return (cb->first)();
749 auto cb = (handler_cb_pair*)c;
751 }, _cb_handlers.get());
755 template <
typename I,
typename C>
756 auto set_callbacks(I&& init, C&& cleanup)
757 ->
typename std::enable_if<
758 std::is_same<decltype(init()), void>::value,
void>::type
762 (handler_cb_pair*)
new handler_cb_pair_void(init, cleanup));
765 auto cb = (handler_cb_pair_void*)c;
766 (cb->first)();
return 0;
769 auto cb = (handler_cb_pair_void*)c;
771 }, _cb_handlers.get());
779 {
return server_thread; }
784 typedef std::pair<handler_type<int()>,handler_type<void()>> handler_cb_pair;
785 typedef std::pair<handler_type<void()>,handler_type<void()>> handler_cb_pair_void;
786 std::unique_ptr<handler_cb_pair> _cb_handlers;
789 virtual Method _add_method(
const char *path,
const char *types,
801 const string_type type, ...)
const 806 std::string t = std::string(type) +
"$$";
825 Blob(int32_t size,
const void *data=0)
828 template <
typename T>
830 : blob(
lo_blob_new(t.size()*
sizeof(t[0]), &t[0])) {}
835 Blob& operator=(
Blob b) { b.swap(*
this);
return *
this; }
836 void swap(
Blob& b)
throw () { std::swap(this->blob, b.blob); }
838 uint32_t datasize()
const 841 void *dataptr()
const 844 uint32_t size()
const 859 : path(_path), msg(_msg) {}
868 template <
typename T>
873 ElementT(
const string_type _path,
const Message& _msg)
877 ElementT(
const T& _bundle)
883 typedef ElementT<Bundle> Element;
901 Bundle(
const std::initializer_list<Element> &elements,
906 for (
auto const &e : elements) {
922 Bundle& operator=(
Bundle b) { b.swap(*
this);
return *
this; }
923 void swap(
Bundle& b)
throw () { std::swap(this->bundle, b.bundle); }
925 int add(
const string_type &path,
lo_message m)
931 size_t length()
const 934 unsigned int count()
const 937 lo_message get_message(
int index,
const char **path=0)
const 940 Message get_message(
int index, std::string &path)
const 946 PathMsg get_message(
int index)
const 951 Bundle get_bundle(
int index)
const 954 Element get_element(
int index,
const char **path=0)
const 960 return Element(p, m);
972 void *serialise(
void *to,
size_t *size)
const 989 return std::string(str);
1001 #endif // _LO_CPP_H_ Class representing an OSC method, proxy for lo_method.
lo_server lo_server_new_multicast(const char *group, const char *port, lo_err_handler err_h)
Create a new server instance, and join a UDP multicast group.
lo_message lo_bundle_get_message(lo_bundle b, int index, const char **path)
Gets a message contained within a bundle.
Class representing an OSC message, proxy for lo_message.
void lo_bundle_free_messages(lo_bundle b)
Obsolete, use lo_bundle_free_recursive instead.
int lo_message_add_char(lo_message m, char a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
lo_timetag lo_bundle_get_timestamp(lo_bundle b)
Get the timestamp associated with a bundle.
lo_timetag lo_message_get_timestamp(lo_message m)
Returns the timestamp (lo_timetag *) of a bundled incoming message.
int lo_message_add_nil(lo_message m)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
lo_server_thread lo_server_thread_new(const char *port, lo_err_handler err_h)
Create a new server thread to handle incoming OSC messages.
int lo_message_add_blob(lo_message m, lo_blob a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
lo_message lo_message_clone(lo_message m)
Create a new lo_message object by cloning an already existing one.
lo_server lo_server_new(const char *port, lo_err_handler err_h)
Create a new server instance.
void lo_server_thread_set_callbacks(lo_server_thread st, lo_server_thread_init_callback init, lo_server_thread_cleanup_callback cleanup, void *user_data)
Set an init and/or a cleanup function to the specifed server thread.
Class representing an OSC blob, proxy for lo_blob.
int lo_message_get_argc(lo_message m)
Return the message argument count.
Union used to read values from incoming messages.
int lo_server_add_bundle_handlers(lo_server s, lo_bundle_start_handler sh, lo_bundle_end_handler eh, void *user_data)
Add bundle notification handlers to the specified server.
lo_element_type
An enumeration of bundle element types liblo can handle.
lo_element_type lo_bundle_get_type(lo_bundle b, int index)
Gets the element type contained within a bundle.
int lo_bundle_add_message(lo_bundle b, const char *path, lo_message m)
Adds an OSC message to an existing bundle.
void lo_bundle_incref(lo_bundle b)
Add one to a bundle's reference count.
lo_server_thread lo_server_thread_new_multicast_iface(const char *group, const char *port, const char *iface, const char *ip, lo_err_handler err_h)
Create a new server thread instance, and join a UDP multicast group, optionally specifying which netw...
const char * lo_address_errstr(lo_address a)
Return the error string from the last failed lo_send() or lo_address_new() call.
int lo_server_enable_queue(lo_server s, int queue_enabled, int dispatch_remaining)
Toggle event queue. If queueing is enabled, timetagged messages that are sent in advance of the curre...
int lo_send_bundle(lo_address targ, lo_bundle b)
Send a lo_bundle object to address targ.
int lo_message_add_timetag(lo_message m, lo_timetag a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
int lo_server_thread_start(lo_server_thread st)
Start the server thread.
int lo_message_add_string(lo_message m, const char *a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
int lo_message_add_infinitum(lo_message m)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
void lo_server_del_method(lo_server s, const char *path, const char *typespec)
Delete an OSC method from the specified server.
Server(const num_string_type &port, int proto, E &&e=0)
Class representing a server thread, proxy for lo_server_thread.
lo_address lo_message_get_source(lo_message m)
Returns the source (lo_address) of an incoming message.
int lo_send_bundle_from(lo_address targ, lo_server serv, lo_bundle b)
Send a lo_bundle object to address targ from address of serv.
int lo_send_message_from(lo_address targ, lo_server serv, const char *path, lo_message msg)
Send a lo_message object to target targ from address of serv.
Method add_method(const string_type &path, const string_type &types, lo_method_handler h, void *data) const
void lo_blob_free(lo_blob b)
Free the memory taken by a blob.
void lo_message_free(lo_message m)
Free memory allocated by lo_message_new() and any subsequent lo_message_add_int32 lo_message_add*() c...
Server(const num_string_type &port, int proto, lo_err_handler err_h=0)
lo_bundle lo_bundle_new(lo_timetag tt)
Create a new bundle object.
int lo_message_add_double(lo_message m, double a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
void lo_server_free(lo_server s)
Free up memory used by the lo_server object.
lo_timetag now()
Return the current time in lo_timetag format.
Server(const num_string_type &port, lo_err_handler err_h=0)
int(* lo_bundle_start_handler)(lo_timetag time, void *user_data)
A callback function to receive notification of a bundle being dispatched by the server or server thre...
Server(const string_type &group, const num_string_type &port, const string_type &iface=0, const string_type &ip=0, E &&e=0)
lo_arg ** lo_message_get_argv(lo_message m)
Return the message arguments. Do not free the returned data.
lo_timetag immediate()
Return the OSC timetag representing "immediately".
lo_address lo_address_new_from_url(const char *url)
Create a lo_address object from an OSC URL.
#define LO_TT_IMMEDIATE
A timetag constant representing "now".
void lo_bundle_pp(lo_bundle b)
Pretty-print a lo_bundle object.
lo_address lo_address_new_with_proto(int proto, const char *host, const char *port)
Declare an OSC destination, given IP address and port number, specifying protocol.
lo_message lo_message_new(void)
Create a new lo_message object.
Class representing an OSC destination address, proxy for lo_address.
const char * lo_address_get_port(lo_address a)
Return the port/service name of a lo_address object.
int lo_address_get_protocol(lo_address a)
Return the protocol of a lo_address object.
lo_method lo_server_thread_add_method(lo_server_thread st, const char *path, const char *typespec, lo_method_handler h, const void *user_data)
Add an OSC method to the specifed server thread.
size_t lo_message_length(lo_message m, const char *path)
Return the length of a message in bytes.
lo_server lo_server_new_multicast_iface(const char *group, const char *port, const char *iface, const char *ip, lo_err_handler err_h)
Create a new server instance, and join a UDP multicast group, optionally specifying which network int...
int lo_send_message(lo_address targ, const char *path, lo_message msg)
Send a lo_message object to target targ.
int lo_message_add_int64(lo_message m, int64_t a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
void * lo_bundle_serialise(lo_bundle b, void *to, size_t *size)
Serialise the bundle object to an area of memory and return a pointer to the serialised form...
int(* lo_method_handler)(const char *path, const char *types, lo_arg **argv, int argc, lo_message msg, void *user_data)
A callback function to receive notification of matching message arriving in the server or server thre...
int lo_message_add_int32(lo_message m, int32_t a)
Append a data item and typechar of the specified type to a message.
int lo_address_set_stream_slip(lo_address t, int enable)
Set outgoing stream connections (e.g., TCP) to be transmitted using the SLIP packetizing protocol...
lo_bundle lo_bundle_get_bundle(lo_bundle b, int index)
Gets a nested bundle contained within a bundle.
const char * lo_address_get_iface(lo_address t)
Get the name of the network interface assigned to an OSC address.
int lo_address_set_tcp_nodelay(lo_address t, int enable)
Set the TCP_NODELAY flag on outgoing TCP connections.
lo_message lo_message_deserialise(void *data, size_t size, int *result)
Deserialise a raw OSC message and return a new lo_message object. Opposite of lo_message_serialise()...
Class representing an OSC path (std::string) and lo::Message pair.
int lo_address_get_ttl(lo_address t)
Get the Time-to-Live value for a given target address.
const char * lo_address_get_hostname(lo_address a)
Return the hostname of a lo_address object.
int lo_message_add_true(lo_message m)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
int lo_server_recv_noblock(lo_server s, int timeout)
Look for an OSC message waiting to be received.
int lo_bundle_add_bundle(lo_bundle b, lo_bundle n)
Adds an OSC bundle to an existing bundle.
void * lo_blob
A object to store an opaque binary data object.
char * lo_server_get_url(lo_server s)
Return an OSC URL that can be used to contact the server.
void * lo_address
A reference to an OSC service.
lo_server lo_server_new_with_proto(const char *port, int proto, lo_err_handler err_h)
Create a new server instance, specifying protocol.
int lo_server_get_port(lo_server s)
Return the port number that the server has bound to.
Class representing a local OSC server, proxy for lo_server.
void lo_address_set_ttl(lo_address t, int ttl)
Set the Time-to-Live value for a given target address.
double lo_server_next_event_delay(lo_server s)
Return the time in seconds until the next scheduled event.
lo_server lo_server_thread_get_server(lo_server_thread st)
Return the lo_server for a lo_server_thread.
size_t lo_bundle_length(lo_bundle b)
Return the length of a bundle in bytes.
int lo_message_add_midi(lo_message m, uint8_t a[4])
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
int lo_message_add_varargs(lo_message m, const char *types, va_list ap)
Append a varargs list to a message.
char * lo_address_get_url(lo_address a)
Return a URL representing an OSC address.
Class representing an OSC bundle, proxy for lo_bundle.
int lo_server_get_socket_fd(lo_server s)
Return the file descriptor of the server socket.
lo_server_thread lo_server_thread_new_with_proto(const char *port, int proto, lo_err_handler err_h)
Create a new server thread to handle incoming OSC messages, specifying protocol.
int lo_server_dispatch_data(lo_server s, void *data, size_t size)
Dispatch a raw block of memory containing an OSC message.
void * lo_server_thread
An object representing a thread containing an OSC server.
void * lo_message
A low-level object used to represent messages passed over OSC.
void lo_address_free(lo_address t)
Free the memory used by the lo_address object.
int lo_server_del_lo_method(lo_server s, lo_method m)
Delete a specific OSC method from the specified server.
lo_server_thread lo_server_thread_new_multicast(const char *group, const char *port, lo_err_handler err_h)
Create a new server thread to handle incoming OSC messages, and join a UDP multicast group...
int lo_server_events_pending(lo_server s)
Return true if there are scheduled events (eg. from bundles) waiting to be dispatched by the server...
Server(const num_string_type &port, E &&e)
void lo_bundle_free_recursive(lo_bundle b)
Frees the memory taken by a bundle object and its messages and nested bundles recursively.
void(* lo_err_handler)(int num, const char *msg, const char *where)
A callback function to receive notification of an error in a server or server thread.
int lo_server_get_protocol(lo_server s)
Return the protocol that the server is using.
int lo_server_thread_stop(lo_server_thread st)
Stop the server thread.
lo_blob lo_blob_new(int32_t size, const void *data)
Create a new OSC blob type.
uint32_t lo_blob_datasize(lo_blob b)
Return the amount of valid data in a lo_blob object.
int lo_server_recv(lo_server s)
Block, waiting for an OSC message to be received.
Server(const string_type &group, const num_string_type &port, const string_type &iface="", const string_type &ip="", lo_err_handler err_h=0)
void * lo_server
An object representing an instance of an OSC server.
void lo_message_incref(lo_message m)
Add one to a message's reference count.
int(* lo_bundle_end_handler)(void *user_data)
A callback function to receive notification of a bundle dispatch being completed by the server or ser...
void lo_timetag_now(lo_timetag *t)
Return a timetag for the current time.
int lo_address_set_iface(lo_address t, const char *iface, const char *ip)
Set the network interface to use for a given target address.
int lo_message_add_symbol(lo_message m, const char *a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
char * lo_message_get_types(lo_message m)
Return the message type tag string.
void lo_version(char *verstr, int verstr_size, int *major, int *minor, char *extra, int extra_size, int *lt_major, int *lt_minor, int *lt_bug)
Get information on the version of liblo current in use.
lo_method lo_server_add_method(lo_server s, const char *path, const char *typespec, lo_method_handler h, const void *user_data)
Add an OSC method to the specifed server.
void * lo_message_serialise(lo_message m, const char *path, void *to, size_t *size)
Serialise the lo_message object to an area of memory and return a pointer to the serialised form...
unsigned int lo_bundle_count(lo_bundle b)
Return the number of top-level elements in a bundle.
int lo_message_add_false(lo_message m)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
int lo_server_wait(lo_server s, int timeout)
Wait for an OSC message to be received.
int lo_address_errno(lo_address a)
Return the error number from the last failed lo_send() or lo_address_new() call.
int lo_send(lo_address targ, const char *path, const char *type,...)
Send a OSC formatted message to the address specified.
void * lo_blob_dataptr(lo_blob b)
Return a pointer to the start of the blob data to allow contents to be changed.
uint32_t lo_blobsize(lo_blob b)
A function to calculate the amount of OSC message space required by a lo_blob object.
void lo_server_thread_free(lo_server_thread st)
Free memory taken by a server thread.
void * lo_method
An object representing an method on a server.
void * lo_bundle
A low-level object used to represent bundles of messages passed over OSC.
int lo_message_add_float(lo_message m, float a)
Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for de...
void lo_message_pp(lo_message m)
Pretty-print a lo_message object.
std::string version()
Return the library version as an std::string.