[3315] | 1 | //vio_winsock.c: |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2010 |
---|
| 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 |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[3315] | 23 | * |
---|
| 24 | * NOTE for everyone want's to change something and send patches: |
---|
| 25 | * read README and HACKING! There a addition information on |
---|
| 26 | * the license of this document you need to read before you send |
---|
| 27 | * any patches. |
---|
| 28 | * |
---|
| 29 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 30 | * or libpulse*: |
---|
| 31 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 32 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 33 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | #include "libroar.h" |
---|
| 37 | |
---|
| 38 | #ifdef ROAR_TARGET_WIN32 |
---|
| 39 | ssize_t roar_vio_winsock_read (struct roar_vio_calls * vio, void *buf, size_t count) { |
---|
| 40 | return recv(roar_vio_get_fh(vio), buf, count, 0); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | ssize_t roar_vio_winsock_write (struct roar_vio_calls * vio, void *buf, size_t count) { |
---|
| 44 | return send(roar_vio_get_fh(vio), buf, count, 0); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | int roar_vio_winsock_nonblock(struct roar_vio_calls * vio, int state) { |
---|
| 48 | return -1; |
---|
| 49 | } |
---|
| 50 | int roar_vio_winsock_sync (struct roar_vio_calls * vio) { |
---|
| 51 | return 0; |
---|
| 52 | } |
---|
[3436] | 53 | |
---|
[3315] | 54 | int roar_vio_winsock_ctl (struct roar_vio_calls * vio, int cmd, void * data) { |
---|
[3436] | 55 | if ( vio == NULL || cmd == -1 ) |
---|
| 56 | return -1; |
---|
| 57 | |
---|
| 58 | ROAR_DBG("roar_vio_winsock_ctl(vio=%p, cmd=0x%.8x, data=%p) = ?", vio, cmd, data); |
---|
| 59 | |
---|
| 60 | switch (cmd) { |
---|
| 61 | case ROAR_VIO_CTL_GET_SELECT_FH: |
---|
| 62 | case ROAR_VIO_CTL_GET_SELECT_READ_FH: |
---|
| 63 | case ROAR_VIO_CTL_GET_SELECT_WRITE_FH: |
---|
| 64 | ROAR_DBG("roar_vio_winsock_ctl(vio=%p, cmd=ROAR_VIO_CTL_GET_SELECT_*FH(0x%.8x), data=%p) = 0 // fh=%i", vio, cmd, data, roar_vio_get_fh(vio)); |
---|
| 65 | *(int*)data = roar_vio_get_fh(vio); |
---|
| 66 | return 0; |
---|
| 67 | break; |
---|
| 68 | case ROAR_VIO_CTL_SET_NOSYNC: |
---|
| 69 | vio->sync = NULL; |
---|
| 70 | return 0; |
---|
| 71 | break; |
---|
| 72 | } |
---|
| 73 | |
---|
[3315] | 74 | return -1; |
---|
| 75 | } |
---|
[3436] | 76 | |
---|
[3315] | 77 | int roar_vio_winsock_close (struct roar_vio_calls * vio) { |
---|
| 78 | |
---|
| 79 | closesocket(roar_vio_get_fh(vio)); |
---|
| 80 | |
---|
| 81 | return 0; |
---|
| 82 | } |
---|
| 83 | #endif |
---|
| 84 | |
---|
| 85 | //ll |
---|