PageRenderTime 33ms CodeModel.GetById 9ms RepoModel.GetById 1ms app.codeStats 0ms

/liblo-0.26/lo/lo_types.h

#
C++ Header | 141 lines | 28 code | 17 blank | 96 comment | 0 complexity | 892cfeb84c649e67080f087dbc060394 MD5 | raw file
Possible License(s): LGPL-2.1
  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. #ifndef LO_TYPES_H
  17. #define LO_TYPES_H
  18. /**
  19. * \file lo_types.h The liblo headerfile defining types used by this API.
  20. */
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #ifdef WIN32
  25. #include <winsock2.h>
  26. #include <ws2tcpip.h>
  27. #else
  28. #include <netdb.h>
  29. #endif
  30. #include <pthread.h>
  31. #include "lo/lo_osc_types.h"
  32. /**
  33. * \brief A reference to an OSC service.
  34. *
  35. * Created by calls to lo_address_new() or lo_address_new_from_url().
  36. */
  37. typedef void *lo_address;
  38. /**
  39. * \brief A object to store an opaque binary data object.
  40. *
  41. * Can be passed over OSC using the 'b' type. Created by calls to lo_blob_new().
  42. */
  43. typedef void *lo_blob;
  44. /**
  45. * \brief A low-level object used to represent messages passed over OSC.
  46. *
  47. * Created by calls to lo_message_new(), arguments can be added with calls to
  48. * lo_message_add_*().
  49. */
  50. typedef void *lo_message;
  51. /**
  52. * \brief A low-level object used to represent bundles of messages passed over
  53. * OSC.
  54. *
  55. * Created by calls to lo_bundle_new(), messages can be added with calls to
  56. * lo_bundle_add_message().
  57. */
  58. typedef void *lo_bundle;
  59. /**
  60. * \brief An object representing an method on a server.
  61. *
  62. * Returned by calls to lo_server_thread_add_method() and
  63. * lo_server_add_method().
  64. */
  65. typedef void *lo_method;
  66. /**
  67. * \brief An object representing an instance of an OSC server.
  68. *
  69. * Created by calls to lo_server_new(). If you with the library to take care of
  70. * the threading as well you can just use server threads instead.
  71. */
  72. typedef void *lo_server;
  73. /**
  74. * \brief An object representing a thread containing an OSC server.
  75. *
  76. * Created by calls to lo_server_thread_new().
  77. */
  78. typedef void *lo_server_thread;
  79. /**
  80. * \brief A callback function to receive notifcation of an error in a server or
  81. * server thread.
  82. *
  83. * On callback the paramters will be set to the following values:
  84. *
  85. * \param num An error number that can be used to identify this condition.
  86. * \param msg An error message describing the condidtion.
  87. * \param where A string describing the place the error occured - typically
  88. * either a function call or method path.
  89. */
  90. typedef void (*lo_err_handler)(int num, const char *msg, const char *where);
  91. /**
  92. * \brief A callback function to receive notifcation of matching message
  93. * arriving in the server or server thread.
  94. *
  95. * The return value tells the method dispatcher whether this handler
  96. * has dealt with the message correctly: a return value of 0 indicates
  97. * that it has been handled, and it should not attempt to pass it on
  98. * to any other handlers, non-0 means that it has not been handled and
  99. * the dispatcher will attempt to find more handlers that match the
  100. * path and types of the incoming message.
  101. *
  102. * On callback the paramters will be set to the following values:
  103. *
  104. * \param path That path that the incoming message was sent to
  105. * \param types If you specided types in your method creation call then this
  106. * will match those and the incoming types will have been coerced to match,
  107. * otherwise it will be the types of the arguments of the incoming message.
  108. * \param argv An array of lo_arg types containing the values, e.g. if the
  109. * first argument of the incoming message is of type 'f' then the vlaue will be
  110. * found in argv[0]->f.
  111. * \param argc The number of argumets received.
  112. * \param msg A structure containing the original raw message as received. No
  113. * type coercion will have occured and the data will be in OSC byte order
  114. * (bigendian).
  115. * \param user_data This contains the user_data value passed in the call to
  116. * lo_server_thread_add_method.
  117. */
  118. typedef int (*lo_method_handler)(const char *path, const char *types,
  119. lo_arg **argv, int argc, lo_message msg,
  120. void *user_data);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif