1 /* $OpenBSD: mio_priv.h,v 1.8 2011/11/15 08:05: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 /* 24 * private ``handle'' structure 25 */ 26 struct mio_hdl { 27 struct mio_ops *ops; 28 unsigned mode; /* MIO_IN | MIO_OUT */ 29 int nbio; /* true if non-blocking io */ 30 int eof; /* true if error occured */ 31 }; 32 33 /* 34 * operations every device should support 35 */ 36 struct mio_ops { 37 void (*close)(struct mio_hdl *); 38 size_t (*write)(struct mio_hdl *, const void *, size_t); 39 size_t (*read)(struct mio_hdl *, void *, size_t); 40 int (*pollfd)(struct mio_hdl *, struct pollfd *, int); 41 int (*revents)(struct mio_hdl *, struct pollfd *); 42 }; 43 44 struct mio_hdl *mio_rmidi_open(const char *, unsigned, int); 45 struct mio_hdl *mio_aucat_open(const char *, unsigned, int, unsigned); 46 void mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); 47 void mio_destroy(struct mio_hdl *); 48 49 #endif /* !defined(MIO_PRIV_H) */ 50