CSL  5.2
lo_types_internal.h
Go to the documentation of this file.
1 #ifndef LO_TYPES_H
2 #define LO_TYPES_H
3 
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7 
8 #ifdef HAVE_SYS_SOCKET_H
9 #include <sys/socket.h>
10 #endif
11 
12 #ifdef HAVE_POLL
13 #include <poll.h>
14 #endif
15 
16 #ifdef WIN32
17 #include <winsock2.h>
18 #include <ws2tcpip.h>
19 #else
20 #include <netdb.h>
21 #endif
22 
23 #ifdef _MSC_VER
24 typedef SSIZE_T ssize_t;
25 typedef unsigned __int64 uint64_t;
26 typedef unsigned __int32 uint32_t;
27 typedef __int64 int64_t;
28 typedef __int32 int32_t;
29 #endif
30 
31 #include <pthread.h>
32 
33 #include "lo/lo_osc_types.h"
34 
35 typedef void (*lo_err_handler)(int num, const char *msg, const char *path);
36 
37 struct _lo_method;
38 
39 typedef struct _lo_address {
40  char *host;
41  int socket;
42  char *port;
43  int protocol;
44  struct addrinfo *ai;
45  int errnum;
46  const char *errstr;
47  int ttl;
48 } *lo_address;
49 
50 typedef struct _lo_blob {
51  uint32_t size;
52  char *data;
53 } *lo_blob;
54 
55 typedef struct _lo_message {
56  char *types;
57  size_t typelen;
58  size_t typesize;
59  void *data;
60  size_t datalen;
61  size_t datasize;
64  /* timestamp from bundle (LO_TT_IMMEDIATE for unbundled messages) */
66 } *lo_message;
67 
68 typedef int (*lo_method_handler)(const char *path, const char *types,
69  lo_arg **argv, int argc, struct _lo_message
70  *msg, void *user_data);
71 
72 typedef struct _lo_method {
73  const char *path;
74  const char *typespec;
76  char *user_data;
77  struct _lo_method *next;
78 } *lo_method;
79 
80 typedef struct _lo_server {
81  struct addrinfo *ai;
84  int port;
85  char *hostname;
86  char *path;
87  int protocol;
88  void *queued;
89  struct sockaddr_storage addr;
90  socklen_t addr_len;
93 #ifdef HAVE_POLL
94  struct pollfd *sockets;
95 #else
96  struct { int fd; } *sockets;
97 #endif
98 } *lo_server;
99 
100 typedef struct _lo_server_thread {
102  pthread_t thread;
103  volatile int active;
104  volatile int done;
106 
107 typedef struct _lo_bundle {
108  size_t size;
109  size_t len;
112  char **paths;
113 } *lo_bundle;
114 
115 typedef struct _lo_strlist {
116  char *str;
117  struct _lo_strlist *next;
118 } lo_strlist;
119 
120 typedef union {
121  int32_t i;
122  float f;
123  char c;
124  uint32_t nl;
125 } lo_pcast32;
126 
127 typedef union {
128  int64_t i;
129  double f;
130  uint64_t nl;
132 } lo_pcast64;
133 
134 extern struct lo_cs {
135  int udp;
136  int tcp;
138 
139 #endif