1 /* $OpenBSD: mio_priv.h,v 1.12 2015/11/22 12:01:23 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 "sndio.h" 21 22 #define MIO_MAXNFDS 16 23 24 /* 25 * private ``handle'' structure 26 */ 27 struct mio_hdl { 28 struct mio_ops *ops; 29 unsigned mode; /* MIO_IN | MIO_OUT */ 30 int nbio; /* true if non-blocking io */ 31 int eof; /* true if error occured */ 32 }; 33 34 /* 35 * operations every device should support 36 */ 37 struct mio_ops { 38 void (*close)(struct mio_hdl *); 39 size_t (*write)(struct mio_hdl *, const void *, size_t); 40 size_t (*read)(struct mio_hdl *, void *, size_t); 41 int (*nfds)(struct mio_hdl *); 42 int (*pollfd)(struct mio_hdl *, struct pollfd *, int); 43 int (*revents)(struct mio_hdl *, struct pollfd *); 44 }; 45 46 struct mio_hdl *_mio_rmidi_open(const char *, unsigned, int); 47 struct mio_hdl *_mio_aucat_open(const char *, unsigned, int); 48 void _mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int); 49 void _mio_destroy(struct mio_hdl *); 50 51 #endif /* !defined(MIO_PRIV_H) */ 52