Changeset 3769:14c294155cad in roaraudio


Ignore:
Timestamp:
05/05/10 10:55:36 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support to accept on sockets

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/vio.h

    r3517 r3769  
    7474int     roar_vio_close   (struct roar_vio_calls * vio); 
    7575 
     76// specal commands: 
     77int     roar_vio_accept  (struct roar_vio_calls * calls, struct roar_vio_calls * dst); 
     78 
    7679// converters: 
    7780int     roar_vio_open_file     (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode); 
  • include/libroar/vio_ctl.h

    r3517 r3769  
    7676#define ROAR_VIO_CTL_SET_NOSYNC          (ROAR_VIO_CTL_GENERIC|0x0150) /* delete call of vio sync() from object */ 
    7777#define ROAR_VIO_CTL_GET_NAME            (ROAR_VIO_CTL_GENERIC|ROAR_VIO_CTL_GET|0x0160) /* get name of VIO */ 
     78#define ROAR_VIO_CTL_ACCEPT              (ROAR_VIO_CTL_GENERIC|0x0170) /* accept(), vio* */ 
    7879 
    7980// get or set data format used for read and write calls, see below 
  • libroar/vio.c

    r3517 r3769  
    174174} 
    175175 
     176// specal commands: 
     177int     roar_vio_accept  (struct roar_vio_calls * calls, struct roar_vio_calls * dst) { 
     178 if (dst == NULL || calls == NULL) 
     179  return -1; 
     180 
     181 return roar_vio_ctl(dst, ROAR_VIO_CTL_ACCEPT, calls); 
     182} 
     183 
    176184// converters: 
    177185int     roar_vio_open_file     (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode) { 
     
    331339 
    332340int     roar_vio_basic_ctl     (struct roar_vio_calls * vio, int cmd, void * data) { 
     341 int fh; 
    333342 
    334343 if ( vio == NULL || cmd == -1 ) 
     
    352361    return 0; 
    353362   break; 
     363  case ROAR_VIO_CTL_ACCEPT: 
     364    fh = accept(roar_vio_get_fh(vio), NULL, 0); 
     365    if ( fh == -1 ) 
     366     return -1; 
     367 
     368    // most proably a socket. 
     369    if ( roar_vio_open_fh_socket(data, fh) == -1 ) { 
     370#ifdef ROAR_TARGET_WIN32 
     371     closesocket(fh); 
     372#else 
     373     close(fh); 
     374#endif 
     375     return -1; 
     376    } 
     377 
     378    return 0; 
     379   break; 
    354380 } 
    355381 
Note: See TracChangeset for help on using the changeset viewer.