CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

lo_types.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2004 Steve Harris
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * $Id$
15 */
16
17 #ifndef LO_TYPES_H
18 #define LO_TYPES_H
19
20 /**
21 * \file lo_types.h The liblo headerfile defining types used by this API.
22 */
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #ifdef WIN32
29 #include <winsock2.h>
30 #include <ws2tcpip.h>
31 #else
32 #include <netdb.h>
33 #endif
34
35 #include <pthread.h>
36
37 #include "lo/lo_osc_types.h"
38
39 /**
40 * \brief A reference to an OSC service.
41 *
42 * Created by calls to lo_address_new() or lo_address_new_from_url().
43 */
44 typedef void *lo_address;
45
46 /**
47 * \brief A object to store an opaque binary data object.
48 *
49 * Can be passed over OSC using the 'b' type. Created by calls to lo_blob_new().
50 */
51 typedef void *lo_blob;
52
53 /**
54 * \brief A low-level object used to represent messages passed over OSC.
55 *
56 * Created by calls to lo_message_new(), arguments can be added with calls to
57 * lo_message_add_*().
58 */
59 typedef void *lo_message;
60
61 /**
62 * \brief A low-level object used to represent bundles of messages passed over
63 * OSC.
64 *
65 * Created by calls to lo_bundle_new(), messages can be added with calls to
66 * lo_bundle_add_message().
67 */
68 typedef void *lo_bundle;
69
70 /**
71 * \brief An object representing an method on a server.
72 *
73 * Returned by calls to lo_server_thread_add_method() and
74 * lo_server_add_method().
75 */
76 typedef void *lo_method;
77
78 /**
79 * \brief An object representing an instance of an OSC server.
80 *
81 * Created by calls to lo_server_new(). If you with the library to take care of
82 * the threading as well you can just use server threads instead.
83 */
84 typedef void *lo_server;
85
86 /**
87 * \brief An object representing a thread containing an OSC server.
88 *
89 * Created by calls to lo_server_thread_new().
90 */
91 typedef void *lo_server_thread;
92
93 /**
94 * \brief A callback function to receive notifcation of an error in a server or
95 * server thread.
96 *
97 * On callback the paramters will be set to the following values:
98 *
99 * \param num An error number that can be used to identify this condition.
100 * \param msg An error message describing the condidtion.
101 * \param where A string describing the place the error occured - typically
102 * either a function call or method path.
103 */
104 typedef void (*lo_err_handler)(int num, const char *msg, const char *where);
105
106 /**
107 * \brief A callback function to receive notifcation of matching message
108 * arriving in the server or server thread.
109 *
110 * The return value tells the method dispatcher whether this handler
111 * has dealt with the message correctly: a return value of 0 indicates
112 * that it has been handled, and it should not attempt to pass it on
113 * to any other handlers, non-0 means that it has not been handled and
114 * the dispatcher will attempt to find more handlers that match the
115 * path and types of the incoming message.
116 *
117 * On callback the paramters will be set to the following values:
118 *
119 * \param path That path that the incoming message was sent to
120 * \param types If you specided types in your method creation call then this
121 * will match those and the incoming types will have been coerced to match,
122 * otherwise it will be the types of the arguments of the incoming message.
123 * \param argv An array of lo_arg types containing the values, e.g. if the
124 * first argument of the incoming message is of type 'f' then the vlaue will be
125 * found in argv[0]->f.
126 * \param argc The number of argumets received.
127 * \param msg A structure containing the original raw message as received. No
128 * type coercion will have occured and the data will be in OSC byte order
129 * (bigendian).
130 * \param user_data This contains the user_data value passed in the call to
131 * lo_server_thread_add_method.
132 */
133 typedef int (*lo_method_handler)(const char *path, const char *types,
134 lo_arg **argv, int argc, lo_message msg,
135 void *user_data);
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif