[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.4

1.4     ! ratchov     1: /*     $OpenBSD: sock.h,v 1.3 2008/11/16 16:30:22 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:
                     20: #include "pipe.h"
                     21: #include "aparams.h"
                     22: #include "amsg.h"
                     23:
                     24: struct sock {
                     25:        struct pipe pipe;
                     26:        /*
                     27:         * socket and protocol specific stuff, mainly used
                     28:         * to decode/encode messages in the stream.
                     29:         */
                     30:        struct amsg rmsg, wmsg;         /* messages being sent/received */
                     31:        unsigned rtodo;                 /* input bytes not read yet */
                     32:        unsigned wtodo;                 /* output bytes not written yet */
                     33: #define SOCK_RDATA     0               /* data chunk being read */
                     34: #define SOCK_RMSG      1               /* amsg query being processed */
                     35: #define SOCK_RRET      2               /* amsg reply being returned */
                     36:        unsigned rstate;                /* state of the read-end FSM */
                     37: #define SOCK_WIDLE     0               /* nothing to do */
                     38: #define SOCK_WMSG      1               /* amsg being written */
                     39: #define SOCK_WDATA     2               /* data chunk being written */
                     40:        unsigned wstate;                /* state of the write-end FSM */
                     41: #define SOCK_INIT      0               /* parameter negotiation */
                     42: #define SOCK_START     1               /* filling play buffers */
                     43: #define SOCK_RUN       2               /* attached to the mix / sub */
                     44:        unsigned pstate;                /* one of the above */
                     45:        unsigned mode;                  /* a set of AMSG_PLAY, AMSG_REC */
                     46:        struct aparams rpar;            /* read (ie play) parameters */
                     47:        struct aparams wpar;            /* write (ie rec) parameters */
                     48:        int idelta;                     /* input (rec) pos. change to send */
                     49:        int odelta;                     /* output (play) pos. change to send */
                     50:        unsigned bufsz;                 /* total buffer size */
                     51:        unsigned round;                 /* block size */
                     52:        unsigned xrun;                  /* one of AMSG_IGNORE, ... */
1.3       ratchov    53:        int vol;                        /* requested volume */
                     54:        int maxweight;                  /* max dynamic range */
1.4     ! ratchov    55:        struct aparams templ_rpar;      /* template for rpar */
        !            56:        struct aparams templ_wpar;      /* template for wpar */
1.1       ratchov    57: };
                     58:
1.4     ! ratchov    59: struct sock *sock_new(struct fileops *, int fd, char *,
        !            60:     struct aparams *, struct aparams *, int);
1.1       ratchov    61: extern struct fileops sock_ops;
                     62:
                     63: #endif /* !defined(SOCK_H) */