[BACK]Return to sock.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / aucat

Annotation of src/usr.bin/aucat/sock.h, Revision 1.21

1.21    ! ratchov     1: /*     $OpenBSD: sock.h,v 1.20 2012/04/11 06:05:43 ratchov Exp $       */
1.1       ratchov     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 SOCK_H
                     18: #define SOCK_H
                     19:
1.8       ratchov    20: #include "amsg.h"
                     21: #include "aparams.h"
1.1       ratchov    22: #include "pipe.h"
                     23:
1.7       ratchov    24: struct opt;
                     25:
1.1       ratchov    26: struct sock {
                     27:        struct pipe pipe;
                     28:        /*
1.8       ratchov    29:         * Socket and protocol specific stuff, mainly used
1.1       ratchov    30:         * to decode/encode messages in the stream.
                     31:         */
                     32:        struct amsg rmsg, wmsg;         /* messages being sent/received */
1.20      ratchov    33:        unsigned int wmax;              /* max frames we're allowed to write */
                     34:        unsigned int rmax;              /* max frames we're allowed to read */
                     35:        unsigned int rtodo;             /* input bytes not read yet */
                     36:        unsigned int wtodo;             /* output bytes not written yet */
1.1       ratchov    37: #define SOCK_RDATA     0               /* data chunk being read */
                     38: #define SOCK_RMSG      1               /* amsg query being processed */
                     39: #define SOCK_RRET      2               /* amsg reply being returned */
1.20      ratchov    40:        unsigned int rstate;            /* state of the read-end FSM */
1.1       ratchov    41: #define SOCK_WIDLE     0               /* nothing to do */
                     42: #define SOCK_WMSG      1               /* amsg being written */
                     43: #define SOCK_WDATA     2               /* data chunk being written */
1.20      ratchov    44:        unsigned int wstate;            /* state of the write-end FSM */
1.19      ratchov    45: #define SOCK_AUTH      0               /* waiting for AUTH message */
                     46: #define SOCK_HELLO     1               /* waiting for HELLO message */
                     47: #define SOCK_INIT      2               /* parameter negotiation */
                     48: #define SOCK_START     3               /* filling play buffers */
                     49: #define SOCK_READY     4               /* play buffers full */
                     50: #define SOCK_RUN       5               /* attached to the mix / sub */
                     51: #define SOCK_STOP      6               /* draining rec buffers */
                     52: #define SOCK_MIDI      7               /* raw byte stream (midi) */
1.20      ratchov    53:        unsigned int pstate;            /* one of the above */
                     54:        unsigned int mode;              /* bitmask of MODE_XXX */
1.1       ratchov    55:        struct aparams rpar;            /* read (ie play) parameters */
                     56:        struct aparams wpar;            /* write (ie rec) parameters */
1.5       ratchov    57:        int delta;                      /* pos. change to send */
                     58:        int tickpending;                /* delta waiting to be transmitted */
1.21    ! ratchov    59:        int fillpending;                /* pending buffer fill request */
1.20      ratchov    60:        unsigned int walign;            /* align data packets to this */
                     61:        unsigned int bufsz;             /* total buffer size */
                     62:        unsigned int round;             /* block size */
                     63:        unsigned int xrun;              /* one of AMSG_IGNORE, ... */
1.3       ratchov    64:        int vol;                        /* requested volume */
1.10      ratchov    65:        int lastvol;                    /* last volume */
1.9       ratchov    66:        int slot;                       /* mixer ctl slot number */
1.7       ratchov    67:        struct opt *opt;                /* "subdevice" definition */
1.16      ratchov    68:        struct dev *dev;                /* actual hardware device */
1.11      ratchov    69:        char who[12];                   /* label, mostly for debugging */
1.1       ratchov    70: };
                     71:
1.7       ratchov    72: struct sock *sock_new(struct fileops *, int fd);
1.1       ratchov    73: extern struct fileops sock_ops;
                     74:
                     75: #endif /* !defined(SOCK_H) */