[0] | 1 | //basic.c: |
---|
| 2 | |
---|
[690] | 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008 |
---|
| 5 | * |
---|
| 6 | * This file is part of libroar a part of RoarAudio, |
---|
| 7 | * a cross-platform sound system for both, home and professional use. |
---|
| 8 | * See README for details. |
---|
| 9 | * |
---|
| 10 | * This file is free software; you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroar is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this software; see the file COPYING. If not, write to |
---|
| 21 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 22 | * |
---|
| 23 | * NOTE for everyone want's to change something and send patches: |
---|
| 24 | * read README and HACKING! There a addition information on |
---|
| 25 | * the license of this document you need to read before you send |
---|
| 26 | * any patches. |
---|
| 27 | * |
---|
| 28 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 29 | * or libpulse*: |
---|
| 30 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 31 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 32 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 33 | */ |
---|
| 34 | |
---|
[0] | 35 | #include "libroar.h" |
---|
| 36 | |
---|
| 37 | int roar_connect_raw (char * server) { |
---|
| 38 | char user_sock[80]; |
---|
| 39 | char * roar_server; |
---|
[701] | 40 | int i = 0; |
---|
[0] | 41 | int port = 0; |
---|
| 42 | int fh = -1; |
---|
[501] | 43 | int is_decnet = 0; |
---|
[516] | 44 | char * obj = NULL; |
---|
[1475] | 45 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[1026] | 46 | struct passwd * pwd; |
---|
[1393] | 47 | #endif |
---|
[828] | 48 | #ifdef ROAR_HAVE_LIBDNET |
---|
| 49 | struct stat decnet_stat; |
---|
| 50 | #endif |
---|
[0] | 51 | |
---|
[807] | 52 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 53 | |
---|
[2567] | 54 | if ( server == NULL ) |
---|
| 55 | server = roar_libroar_get_server(); |
---|
| 56 | |
---|
[61] | 57 | if ( server == NULL && (roar_server = getenv("ROAR_SERVER")) != NULL ) |
---|
[0] | 58 | server = roar_server; |
---|
| 59 | |
---|
[1436] | 60 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[448] | 61 | if ( server == NULL && (i = readlink("/etc/roarserver", user_sock, 79)) != -1 ) { |
---|
| 62 | user_sock[i] = 0; |
---|
| 63 | server = user_sock; |
---|
| 64 | } |
---|
[1093] | 65 | #endif |
---|
[448] | 66 | |
---|
[61] | 67 | if ( server == NULL || *server == 0 ) { |
---|
[0] | 68 | /* connect via defaults */ |
---|
| 69 | |
---|
[1764] | 70 | #ifdef ROAR_HAVE_UNIX |
---|
[1436] | 71 | #ifndef ROAR_TARGET_MICROCONTROLLER |
---|
[1026] | 72 | roar_server = getenv("HOME"); |
---|
[1435] | 73 | #else |
---|
| 74 | roar_server = NULL; |
---|
| 75 | #endif |
---|
[1026] | 76 | |
---|
| 77 | if ( roar_server == NULL ) { |
---|
[1436] | 78 | #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER) |
---|
[1026] | 79 | if ( (pwd = getpwuid(getuid())) == NULL ) { |
---|
| 80 | roar_server = "/NX-HOME-DIR"; |
---|
| 81 | } else { |
---|
| 82 | roar_server = pwd->pw_dir; |
---|
| 83 | } |
---|
[1078] | 84 | #else |
---|
| 85 | roar_server = "/WIN32-SUCKS"; |
---|
| 86 | #endif |
---|
[1026] | 87 | } |
---|
| 88 | |
---|
| 89 | snprintf(user_sock, 79, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER); |
---|
[0] | 90 | |
---|
| 91 | if ( (fh = roar_socket_connect(user_sock, 0)) != -1 ) |
---|
| 92 | return fh; |
---|
| 93 | |
---|
[237] | 94 | if ( (fh = roar_socket_connect(ROAR_DEFAULT_SOCK_GLOBAL, 0)) != -1 ) |
---|
| 95 | return fh; |
---|
[1764] | 96 | #endif |
---|
[237] | 97 | |
---|
[0] | 98 | if ( (fh = roar_socket_connect(ROAR_DEFAULT_HOST, ROAR_DEFAULT_PORT)) != -1 ) |
---|
| 99 | return fh; |
---|
| 100 | |
---|
[828] | 101 | #ifdef ROAR_HAVE_LIBDNET |
---|
| 102 | if ( stat(ROAR_PROC_NET_DECNET, &decnet_stat) == 0 ) { |
---|
| 103 | if ( roar_socket_get_local_nodename() ) { |
---|
| 104 | snprintf(user_sock, 79, "%s::%s", roar_socket_get_local_nodename(), ROAR_DEFAULT_OBJECT); |
---|
[2010] | 105 | if ( (fh = roar_socket_connect(user_sock, ROAR_DEFAULT_NUM)) != -1 ) |
---|
| 106 | return fh; |
---|
[828] | 107 | } |
---|
[522] | 108 | } |
---|
[828] | 109 | #endif |
---|
[2007] | 110 | |
---|
| 111 | #ifdef ROAR_HAVE_LIBSLP |
---|
[2014] | 112 | if ( (server = roar_slp_find_roard(0)) != NULL ) |
---|
| 113 | if ( (fh = roar_connect_raw(server)) != -1 ) |
---|
| 114 | return fh; |
---|
| 115 | |
---|
| 116 | /* in case we can not connect to the server given this may be a cache problem, |
---|
| 117 | we do a new lookup with the cache disabled in this case */ |
---|
| 118 | ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); |
---|
| 119 | if ( (server = roar_slp_find_roard(1)) != NULL ) |
---|
| 120 | if ( (fh = roar_connect_raw(server)) != -1 ) |
---|
| 121 | return fh; |
---|
[2007] | 122 | #endif |
---|
[522] | 123 | |
---|
[2014] | 124 | return -1; |
---|
| 125 | |
---|
[0] | 126 | } else { |
---|
| 127 | /* connect via (char*)server */ |
---|
[501] | 128 | // find a port: |
---|
| 129 | if ( *server != '/' ) { // don't test AF_UNIX sockets for ports |
---|
| 130 | for (i = 0; server[i] != 0; i++) { |
---|
| 131 | if ( server[i] == ':' ) { |
---|
| 132 | if ( server[i+1] == ':' ) { // DECnet, leave unchanged |
---|
| 133 | is_decnet = 1; |
---|
[516] | 134 | obj = &server[i+2]; |
---|
[501] | 135 | break; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | port = atoi(server+i+1); |
---|
| 139 | server[i] = 0; |
---|
| 140 | break; |
---|
| 141 | } |
---|
[0] | 142 | } |
---|
| 143 | } |
---|
| 144 | |
---|
[521] | 145 | if ( is_decnet ) { |
---|
| 146 | *user_sock = 0; |
---|
| 147 | if ( *server == ':' ) { |
---|
| 148 | if ( roar_socket_get_local_nodename() ) |
---|
[1066] | 149 | strncat(user_sock, roar_socket_get_local_nodename(), 6); |
---|
[521] | 150 | } |
---|
| 151 | |
---|
[1066] | 152 | strncat(user_sock, server, 79); |
---|
[516] | 153 | server = user_sock; |
---|
[521] | 154 | if ( *obj == 0 ) { |
---|
[1066] | 155 | #ifdef DN_MAXOBJL |
---|
| 156 | strncat(user_sock, ROAR_DEFAULT_OBJECT, DN_MAXOBJL+2); |
---|
| 157 | #else |
---|
| 158 | ROAR_ERR("roar_connect_raw(*): size of DECnet object unknown."); |
---|
| 159 | #endif |
---|
[521] | 160 | } |
---|
[516] | 161 | } |
---|
| 162 | |
---|
[501] | 163 | if ( port || is_decnet ) { |
---|
[0] | 164 | fh = roar_socket_connect(server, port); |
---|
| 165 | // restore the original string |
---|
| 166 | server[i] = ':'; |
---|
| 167 | } else { |
---|
| 168 | fh = roar_socket_connect(server, ROAR_DEFAULT_PORT); |
---|
| 169 | } |
---|
| 170 | } |
---|
| 171 | |
---|
[807] | 172 | if ( fh == -1 ) |
---|
| 173 | roar_errno = ROAR_ERROR_CONNREFUSED; |
---|
| 174 | |
---|
[0] | 175 | ROAR_DBG("roar_connect_raw(*) = %i", fh); |
---|
| 176 | |
---|
| 177 | return fh; |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | int roar_connect (struct roar_connection * con, char * server) { |
---|
[1315] | 181 | int fh; |
---|
| 182 | |
---|
| 183 | if ( con == NULL ) { |
---|
| 184 | roar_errno = ROAR_ERROR_INVAL; |
---|
| 185 | return -1; |
---|
| 186 | } |
---|
| 187 | |
---|
[807] | 188 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
[1315] | 189 | fh = roar_connect_raw(server); |
---|
[0] | 190 | |
---|
[1315] | 191 | if ( fh == -1 ) |
---|
[0] | 192 | return -1; |
---|
| 193 | |
---|
[1315] | 194 | return roar_connect_fh(con, fh); |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | int roar_connect_fh (struct roar_connection * con, int fh) { |
---|
| 198 | |
---|
| 199 | if ( con == NULL || fh == -1 ) { |
---|
| 200 | roar_errno = ROAR_ERROR_INVAL; |
---|
| 201 | return -1; |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | // specal hack to set an ilegal value used internaly in libroar: |
---|
| 205 | if ( fh == -2 ) |
---|
| 206 | fh = -1; |
---|
| 207 | |
---|
| 208 | memset(con, 0, sizeof(struct roar_connection)); |
---|
| 209 | |
---|
[1660] | 210 | con->__fh = fh; |
---|
[1315] | 211 | |
---|
[807] | 212 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 213 | return 0; |
---|
| 214 | } |
---|
| 215 | |
---|
[1660] | 216 | int roar_get_connection_fh (struct roar_connection * con) { |
---|
[2809] | 217 | roar_debug_warn_sysio("roar_get_connection_fh", "roar_get_connection_vio", NULL); |
---|
| 218 | |
---|
[2043] | 219 | if ( con == NULL ) |
---|
| 220 | return -1; |
---|
| 221 | |
---|
[1660] | 222 | return con->__fh; |
---|
| 223 | } |
---|
| 224 | |
---|
[2043] | 225 | int roar_get_connection_vio (struct roar_connection * con, struct roar_vio_calls * vio) { |
---|
| 226 | if ( con == NULL || vio == NULL ) |
---|
| 227 | return -1; |
---|
| 228 | |
---|
[2809] | 229 | return roar_vio_open_fh_socket(vio, con->__fh); |
---|
[2043] | 230 | } |
---|
| 231 | |
---|
[0] | 232 | int roar_disconnect (struct roar_connection * con) { |
---|
[2809] | 233 | struct roar_vio_calls vio; |
---|
[0] | 234 | struct roar_message m; |
---|
| 235 | |
---|
| 236 | m.datalen = 0; |
---|
| 237 | m.stream = 0; |
---|
[133] | 238 | m.pos = 0; |
---|
[0] | 239 | m.cmd = ROAR_CMD_QUIT; |
---|
| 240 | |
---|
| 241 | roar_req(con, &m, NULL); |
---|
| 242 | |
---|
[2809] | 243 | if ( roar_get_connection_vio(con, &vio) != -1 ) { |
---|
| 244 | roar_vio_close(&vio); |
---|
| 245 | } |
---|
[0] | 246 | |
---|
[1660] | 247 | roar_connect_fh(con, -2); |
---|
[0] | 248 | |
---|
[807] | 249 | roar_errno = ROAR_ERROR_NONE; |
---|
| 250 | |
---|
[0] | 251 | return 0; |
---|
| 252 | } |
---|
| 253 | |
---|
| 254 | int roar_identify (struct roar_connection * con, char * name) { |
---|
| 255 | struct roar_message mes; |
---|
| 256 | pid_t pid; |
---|
| 257 | int max_len; |
---|
| 258 | |
---|
[807] | 259 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 260 | |
---|
[0] | 261 | ROAR_DBG("roar_identify(*): try to identify myself..."); |
---|
| 262 | |
---|
| 263 | mes.cmd = ROAR_CMD_IDENTIFY; |
---|
| 264 | mes.stream = 0; |
---|
| 265 | mes.pos = 0; |
---|
| 266 | |
---|
| 267 | ROAR_DBG("roar_identify(*): name=%p", name); |
---|
| 268 | |
---|
| 269 | if ( name == NULL ) |
---|
| 270 | name = "libroar client"; |
---|
| 271 | |
---|
| 272 | ROAR_DBG("roar_identify(*): name=%p", name); |
---|
| 273 | |
---|
| 274 | max_len = strlen(name); |
---|
| 275 | ROAR_DBG("roar_identify(*): strlen(name) = %i", max_len); |
---|
| 276 | |
---|
| 277 | if ( max_len > (LIBROAR_BUFFER_MSGDATA - 5) ) |
---|
| 278 | max_len = LIBROAR_BUFFER_MSGDATA - 5; |
---|
| 279 | |
---|
| 280 | mes.datalen = 5 + max_len; |
---|
| 281 | mes.data[0] = 1; |
---|
| 282 | |
---|
| 283 | pid = getpid(); |
---|
| 284 | *(uint32_t*)(mes.data+1) = ROAR_HOST2NET32(pid); |
---|
| 285 | ROAR_DBG("roar_identify(*): pid = %i", pid); |
---|
| 286 | |
---|
| 287 | strncpy(mes.data+5, name, max_len); |
---|
| 288 | |
---|
| 289 | return roar_req(con, &mes, NULL); |
---|
| 290 | } |
---|
| 291 | |
---|
[8] | 292 | #define _ROAR_MESS_BUF_LEN (1 /* version */ + 1 /* cmd */ + 2 /* stream */ + 4 /* pos */ + 2 /* datalen */) |
---|
[0] | 293 | int roar_send_message (struct roar_connection * con, struct roar_message * mes, char * data) { |
---|
[1319] | 294 | struct roar_vio_calls vio; |
---|
| 295 | |
---|
[2809] | 296 | if ( roar_get_connection_vio(con, &vio) == -1 ) |
---|
[1319] | 297 | return -1; |
---|
| 298 | |
---|
| 299 | return roar_vsend_message(&vio, mes, data); |
---|
| 300 | } |
---|
| 301 | |
---|
| 302 | int roar_vsend_message(struct roar_vio_calls * vio, struct roar_message * mes, char * data) { |
---|
[0] | 303 | char buf[_ROAR_MESS_BUF_LEN]; |
---|
| 304 | |
---|
[807] | 305 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 306 | |
---|
[0] | 307 | ROAR_DBG("roar_send_message(*): try to send an request..."); |
---|
| 308 | |
---|
[8] | 309 | buf[0] = _ROAR_MESSAGE_VERSION; |
---|
| 310 | buf[1] = (unsigned char) mes->cmd; |
---|
| 311 | *(uint16_t*)(buf+2) = ROAR_HOST2NET16(mes->stream); |
---|
| 312 | *(uint32_t*)(buf+4) = ROAR_HOST2NET32(mes->pos); |
---|
| 313 | *(uint16_t*)(buf+8) = ROAR_HOST2NET16(mes->datalen); |
---|
[0] | 314 | |
---|
[1319] | 315 | if ( roar_vio_write(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) { |
---|
[807] | 316 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 317 | return -1; |
---|
[807] | 318 | } |
---|
[0] | 319 | |
---|
[807] | 320 | if ( mes->datalen != 0 ) { |
---|
[1319] | 321 | if ( roar_vio_write(vio, data == NULL ? mes->data : data, mes->datalen) != mes->datalen ) { |
---|
[807] | 322 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 323 | return -1; |
---|
[807] | 324 | } |
---|
| 325 | } |
---|
| 326 | |
---|
| 327 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 328 | |
---|
| 329 | ROAR_DBG("roar_send_message(*) = 0"); |
---|
| 330 | return 0; |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | int roar_recv_message (struct roar_connection * con, struct roar_message * mes, char ** data) { |
---|
[1319] | 334 | struct roar_vio_calls vio; |
---|
| 335 | |
---|
[2809] | 336 | if ( roar_get_connection_vio(con, &vio) == -1 ) |
---|
[1319] | 337 | return -1; |
---|
| 338 | |
---|
| 339 | return roar_vrecv_message(&vio, mes, data); |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | int roar_vrecv_message(struct roar_vio_calls * vio, struct roar_message * mes, char ** data) { |
---|
[0] | 343 | char buf[_ROAR_MESS_BUF_LEN]; |
---|
| 344 | |
---|
[807] | 345 | roar_errno = ROAR_ERROR_UNKNOWN; |
---|
| 346 | |
---|
[0] | 347 | ROAR_DBG("roar_recv_message(*): try to get a response form the server..."); |
---|
| 348 | |
---|
| 349 | if ( data ) |
---|
| 350 | *data = NULL; |
---|
| 351 | |
---|
[1319] | 352 | if ( roar_vio_read(vio, buf, _ROAR_MESS_BUF_LEN) != _ROAR_MESS_BUF_LEN ) { |
---|
[807] | 353 | roar_errno = ROAR_ERROR_PROTO; |
---|
[0] | 354 | return -1; |
---|
[807] | 355 | } |
---|
[0] | 356 | |
---|
| 357 | ROAR_DBG("roar_recv_message(*): Got a header"); |
---|
| 358 | |
---|
[807] | 359 | if ( buf[0] != _ROAR_MESSAGE_VERSION ) { |
---|
| 360 | roar_errno = ROAR_ERROR_PROTO; |
---|
[8] | 361 | return -1; |
---|
[807] | 362 | } |
---|
[8] | 363 | |
---|
| 364 | mes->cmd = (unsigned char)buf[1]; |
---|
| 365 | mes->stream = ROAR_NET2HOST16(*(uint16_t*)(buf+2)); |
---|
| 366 | mes->pos = ROAR_NET2HOST32(*(uint32_t*)(buf+4)); |
---|
| 367 | mes->datalen = ROAR_NET2HOST16(*(uint16_t*)(buf+8)); |
---|
[0] | 368 | |
---|
| 369 | ROAR_DBG("roar_recv_message(*): command=%i(%s)", mes->cmd, |
---|
| 370 | mes->cmd == ROAR_CMD_OK ? "OK" : (mes->cmd == ROAR_CMD_ERROR ? "ERROR" : "UNKNOWN")); |
---|
| 371 | |
---|
[104] | 372 | if ( mes->datalen == 0 ) { |
---|
| 373 | ROAR_DBG("roar_recv_message(*): no data in this pkg"); |
---|
| 374 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 375 | roar_errno = ROAR_ERROR_NONE; |
---|
[104] | 376 | return 0; |
---|
| 377 | } |
---|
| 378 | |
---|
[0] | 379 | if ( mes->datalen <= LIBROAR_BUFFER_MSGDATA ) { |
---|
[1319] | 380 | if ( roar_vio_read(vio, mes->data, mes->datalen) == mes->datalen ) { |
---|
[0] | 381 | ROAR_DBG("roar_recv_message(*): Got data!"); |
---|
| 382 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 383 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 384 | return 0; |
---|
| 385 | } |
---|
[807] | 386 | |
---|
| 387 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 388 | return -1; |
---|
| 389 | } else { |
---|
[807] | 390 | if ( data == NULL ) { |
---|
| 391 | roar_errno = ROAR_ERROR_MSGSIZE; |
---|
[0] | 392 | return -1; |
---|
[807] | 393 | } |
---|
[0] | 394 | |
---|
[807] | 395 | if ( (*data = malloc(mes->datalen)) == NULL ) { |
---|
| 396 | roar_errno = ROAR_ERROR_NOMEM; |
---|
[0] | 397 | return -1; |
---|
[807] | 398 | } |
---|
[0] | 399 | |
---|
[807] | 400 | if ( mes->datalen == 0 ) { |
---|
| 401 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 402 | return 0; |
---|
[807] | 403 | } |
---|
[0] | 404 | |
---|
[1319] | 405 | if ( roar_vio_read(vio, *data, mes->datalen) == mes->datalen ) { |
---|
[0] | 406 | ROAR_DBG("roar_recv_message(*): Got data!"); |
---|
| 407 | ROAR_DBG("roar_recv_message(*) = 0"); |
---|
[807] | 408 | roar_errno = ROAR_ERROR_NONE; |
---|
[0] | 409 | return 0; |
---|
| 410 | } |
---|
[807] | 411 | |
---|
| 412 | roar_errno = ROAR_ERROR_PIPE; |
---|
[0] | 413 | return -1; |
---|
| 414 | } |
---|
| 415 | |
---|
[807] | 416 | // what happened here? |
---|
[0] | 417 | return -1; |
---|
| 418 | } |
---|
| 419 | |
---|
| 420 | int roar_req (struct roar_connection * con, struct roar_message * mes, char ** data) { |
---|
[1319] | 421 | struct roar_vio_calls vio; |
---|
| 422 | |
---|
[2809] | 423 | if ( roar_get_connection_vio(con, &vio) == -1 ) |
---|
[1319] | 424 | return -1; |
---|
| 425 | |
---|
| 426 | return roar_vreq(&vio, mes, data); |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | int roar_vreq (struct roar_vio_calls * vio, struct roar_message * mes, char ** data) { |
---|
| 430 | if ( roar_vsend_message(vio, mes, data ? *data : NULL) != 0 ) |
---|
[0] | 431 | return -1; |
---|
| 432 | |
---|
| 433 | if ( data ) |
---|
| 434 | free(*data); |
---|
| 435 | |
---|
[2053] | 436 | roar_vio_sync(vio); // we need to do this becasue of ssl/compressed links |
---|
| 437 | |
---|
[1319] | 438 | return roar_vrecv_message(vio, mes, data); |
---|
[0] | 439 | } |
---|
| 440 | |
---|
| 441 | int roar_debug_message_print (struct roar_message * mes) { |
---|
| 442 | if ( mes == NULL ) |
---|
| 443 | return -1; |
---|
| 444 | |
---|
| 445 | ROAR_DBG("roar_debug_message_print(*): Command: %i", mes->cmd); |
---|
| 446 | ROAR_DBG("roar_debug_message_print(*): Stream : %u", mes->stream); |
---|
| 447 | ROAR_DBG("roar_debug_message_print(*): Pos : %u", mes->pos); |
---|
| 448 | ROAR_DBG("roar_debug_message_print(*): Datalen: %i", mes->datalen); |
---|
| 449 | |
---|
| 450 | ROAR_DBG("roar_debug_message_print(*) = 0"); |
---|
| 451 | return 0; |
---|
| 452 | } |
---|
| 453 | |
---|
| 454 | int roar_debug_audio_info_print (struct roar_audio_info * info) { |
---|
| 455 | if ( info == NULL ) |
---|
| 456 | return -1; |
---|
| 457 | |
---|
| 458 | ROAR_DBG("roar_debug_audio_info_print(*): Rate : %i", info->rate); |
---|
| 459 | ROAR_DBG("roar_debug_audio_info_print(*): Channels: %i", info->channels); |
---|
| 460 | ROAR_DBG("roar_debug_audio_info_print(*): Bits : %i", info->bits); |
---|
| 461 | ROAR_DBG("roar_debug_audio_info_print(*): Codec : %i", info->codec); |
---|
| 462 | |
---|
| 463 | ROAR_DBG("roar_debug_audio_info_print(*) = 0"); |
---|
| 464 | return 0; |
---|
| 465 | } |
---|
| 466 | |
---|
| 467 | //ll |
---|