1 /* $OpenBSD: mio_priv.h,v 1.10 2013/11/13 22:38:22 ratchov Exp $ */ 2 /* 3 * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 #ifndef MIO_PRIV_H 18 #define MIO_PRIV_H 19 20 #include <sys/param.h> 21 #include "sndio.h" 22 23 #define MIO_MAXNFDS 16 24 25 /* 26 * private ``handle'' structure 27 */ 28 struct mio_hdl { 29 struct mio_ops *ops; 30 unsigned mode; /* MIO_IN | MIO_OUT */ 31 int nbio; /* true if non-blocking io */ 32 int eof; /* true if error occured */ 33 }; 34 35 /* 36 * operations every device should support 37 */ 38 struct mio_ops { 39 void (*close)(struct mio_hdl *); 40 size_t (*write)(struct mio_hdl *, const void *, size_t); 41 size_t (*read)(struct mio_hdl *, void *, size_t); 42 int (*nfds)(struct mio_hdl *); 43 int (*pollfd)(struct mio_hdl *, struct pollfd *, int); 44 int (*revents)(struct mio_hdl *, struct pollfd *); 45 }; 46 47 struct mio_hdl *_mio_rmidi_open(const char *, unsigned, int); 48 struct mio_hdl *_mio_aucat_open(const char *, unsigned, int, unsigned); 49 void _mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); 50 void _mio_destroy(struct mio_hdl *); 51 52 #endif /* !defined(MIO_PRIV_H) */ 53