/usr/include/lo/lo_serverthread.h is in liblo-dev 0.28-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*
* Copyright (C) 2014 Steve Harris et al. (see AUTHORS)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* $Id$
*/
#ifndef LO_SERVERTHREAD_H
#define LO_SERVERTHREAD_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file lo_serverthread.h The liblo headerfile declaring thread-related functions.
*/
/**
* \brief Create a new server thread to handle incoming OSC
* messages.
*
* Server threads take care of the message reception and dispatch by
* transparently creating a system thread to handle incoming messages.
* Use this if you do not want to handle the threading yourself.
*
* \param port If NULL is passed then an unused port will be chosen by the
* system, its number may be retrieved with lo_server_thread_get_port()
* so it can be passed to clients. Otherwise a decimal port number, service
* name or UNIX domain socket path may be passed.
* \param err_h A function that will be called in the event of an error being
* raised. The function prototype is defined in lo_types.h
*/
lo_server_thread lo_server_thread_new(const char *port, lo_err_handler err_h);
/**
* \brief Create a new server thread to handle incoming OSC
* messages, and join a UDP multicast group.
*
* Server threads take care of the message reception and dispatch by
* transparently creating a system thread to handle incoming messages.
* Use this if you do not want to handle the threading yourself.
*
* \param group The multicast group to join. See documentation on IP
* multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html
* \param port If NULL is passed then an unused port will be chosen by the
* system, its number may be retrieved with lo_server_thread_get_port()
* so it can be passed to clients. Otherwise a decimal port number, service
* name or UNIX domain socket path may be passed.
* \param err_h A function that will be called in the event of an error being
* raised. The function prototype is defined in lo_types.h
*/
lo_server_thread lo_server_thread_new_multicast(const char *group, const char *port,
lo_err_handler err_h);
/**
* \brief Create a new server thread to handle incoming OSC
* messages, specifying protocol.
*
* Server threads take care of the message reception and dispatch by
* transparently creating a system thread to handle incoming messages.
* Use this if you do not want to handle the threading yourself.
*
* \param port If NULL is passed then an unused port will be chosen by the
* system, its number may be retrieved with lo_server_thread_get_port()
* so it can be passed to clients. Otherwise a decimal port number, service
* name or UNIX domain socket path may be passed.
* \param proto The protocol to use, should be one of LO_UDP, LO_TCP or LO_UNIX.
* \param err_h A function that will be called in the event of an error being
* raised. The function prototype is defined in lo_types.h
*/
lo_server_thread lo_server_thread_new_with_proto(const char *port, int proto,
lo_err_handler err_h);
/**
* \brief Create a new server thread, taking port and the optional
* multicast group IP from an URL string.
*
* \param url The URL to specify the server parameters.
* \param err_h An error callback function that will be called if there is an
* error in messge reception or server creation. Pass NULL if you do not want
* error handling.
* \return A new lo_server_thread instance.
*/
lo_server_thread lo_server_thread_new_from_url(const char *url,
lo_err_handler err_h);
/**
* \brief Free memory taken by a server thread
*
* Frees the memory, and, if currently running will stop the associated thread.
*/
void lo_server_thread_free(lo_server_thread st);
/**
* \brief Add an OSC method to the specifed server thread.
*
* \param st The server thread the method is to be added to.
* \param path The OSC path to register the method to. If NULL is passed the
* method will match all paths.
* \param typespec The typespec the method accepts. Incoming messages with
* similar typespecs (e.g. ones with numerical types in the same position) will
* be coerced to the typespec given here.
* \param h The method handler callback function that will be called it a
* matching message is received
* \param user_data A value that will be passed to the callback function, h,
* when its invoked matching from this method.
*/
lo_method lo_server_thread_add_method(lo_server_thread st, const char *path,
const char *typespec, lo_method_handler h,
void *user_data);
/**
* \brief Delete an OSC method from the specifed server thread.
*
* \param st The server thread the method is to be removed from.
* \param path The OSC path of the method to delete. If NULL is passed the
* method will match the generic handler.
* \param typespec The typespec the method accepts.
*/
void lo_server_thread_del_method(lo_server_thread st, const char *path,
const char *typespec);
/**
* \brief Start the server thread
*
* \param st the server thread to start.
* \return Less than 0 on failure, 0 on success.
*/
int lo_server_thread_start(lo_server_thread st);
/**
* \brief Stop the server thread
*
* \param st the server thread to start.
* \return Less than 0 on failure, 0 on success.
*/
int lo_server_thread_stop(lo_server_thread st);
/**
* \brief Return the port number that the server thread has bound to.
*/
int lo_server_thread_get_port(lo_server_thread st);
/**
* \brief Return a URL describing the address of the server thread.
*
* Return value must be free()'d to reclaim memory.
*/
char *lo_server_thread_get_url(lo_server_thread st);
/**
* \brief Return the lo_server for a lo_server_thread
*
* This function is useful for passing a thread's lo_server
* to lo_send_from().
*/
lo_server lo_server_thread_get_server(lo_server_thread st);
/** \brief Return true if there are scheduled events (eg. from bundles) waiting
* to be dispatched by the thread */
int lo_server_thread_events_pending(lo_server_thread st);
void lo_server_thread_set_error_context(lo_server_thread st, void *user_data);
/** \brief Pretty-print a lo_server_thread object. */
void lo_server_thread_pp(lo_server_thread st);
#ifdef __cplusplus
}
#endif
#endif
|