summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2011-04-16 11:24:18 +0000
committerratchov <ratchov@openbsd.org>2011-04-16 11:24:18 +0000
commit629f51aff4008d0268428759a116cf83c6d00cab (patch)
tree32c02e423e9ce19d29001a165fe4fac909dc5081
parentMake aucat audio and midi backends share the same code to communicate (diff)
downloadwireguard-openbsd-629f51aff4008d0268428759a116cf83c6d00cab.tar.xz
wireguard-openbsd-629f51aff4008d0268428759a116cf83c6d00cab.zip
Since aucat supports any parameter combination sio_getcap() doesn't
need to query the server for supported parameters. So stop using the AMSG_GETCAP message, and remove it completely from the aucat protocol.
-rw-r--r--lib/libsndio/sio_aucat.c16
-rw-r--r--usr.bin/aucat/amsg.h14
-rw-r--r--usr.bin/aucat/sock.c31
3 files changed, 4 insertions, 57 deletions
diff --git a/lib/libsndio/sio_aucat.c b/lib/libsndio/sio_aucat.c
index 3d1f1b177ca..42e86a0727e 100644
--- a/lib/libsndio/sio_aucat.c
+++ b/lib/libsndio/sio_aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_aucat.c,v 1.2 2011/04/16 10:52:22 ratchov Exp $ */
+/* $OpenBSD: sio_aucat.c,v 1.3 2011/04/16 11:24:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -317,23 +317,9 @@ sio_aucat_getpar(struct sio_hdl *sh, struct sio_par *par)
static int
sio_aucat_getcap(struct sio_hdl *sh, struct sio_cap *cap)
{
- struct sio_aucat_hdl *hdl = (struct sio_aucat_hdl *)sh;
unsigned i, bps, le, sig, chan, rindex, rmult;
static unsigned rates[] = { 8000, 11025, 12000 };
- AMSG_INIT(&hdl->aucat.wmsg);
- hdl->aucat.wmsg.cmd = AMSG_GETCAP;
- hdl->aucat.wtodo = sizeof(struct amsg);
- if (!aucat_wmsg(&hdl->aucat, &hdl->sio.eof))
- return 0;
- hdl->aucat.rtodo = sizeof(struct amsg);
- if (!aucat_rmsg(&hdl->aucat, &hdl->sio.eof))
- return 0;
- if (hdl->aucat.rmsg.cmd != AMSG_GETCAP) {
- DPRINTF("sio_aucat_getcap: protocol err\n");
- hdl->sio.eof = 1;
- return 0;
- }
bps = 1;
sig = le = 0;
cap->confs[0].enc = 0;
diff --git a/usr.bin/aucat/amsg.h b/usr.bin/aucat/amsg.h
index 5a358887e8a..78a8c4b0f3e 100644
--- a/usr.bin/aucat/amsg.h
+++ b/usr.bin/aucat/amsg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amsg.h,v 1.19 2011/04/16 10:52:22 ratchov Exp $ */
+/* $OpenBSD: amsg.h,v 1.20 2011/04/16 11:24:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -38,7 +38,6 @@ struct amsg {
#define AMSG_DATA 5 /* data block */
#define AMSG_POS 6 /* initial position */
#define AMSG_MOVE 7 /* position changed */
-#define AMSG_GETCAP 8 /* get capabilities */
#define AMSG_SETVOL 9 /* set volume */
#define AMSG_HELLO 10 /* say hello, check versions and so ... */
#define AMSG_BYE 11 /* ask server to drop connection */
@@ -62,15 +61,6 @@ struct amsg {
uint32_t appbufsz; /* client side bufsz */
uint32_t _reserved[1]; /* for future use */
} par;
- struct amsg_cap {
- uint32_t rate; /* native rate */
- uint32_t _reserved2[1]; /* for future use */
- uint16_t rchan; /* native rec channels */
- uint16_t pchan; /* native play channels */
- uint8_t bits; /* native bits per sample */
- uint8_t bps; /* native ytes per sample */
- uint8_t _reserved[10]; /* for future use */
- } cap;
struct amsg_data {
#define AMSG_DATAMAX 0x1000
uint32_t size;
@@ -83,7 +73,7 @@ struct amsg {
} vol;
struct amsg_hello {
uint16_t mode; /* bitmap of MODE_XXX */
-#define AMSG_VERSION 4
+#define AMSG_VERSION 5
uint8_t version; /* protocol version */
uint8_t reserved1[5]; /* for future use */
char opt[12]; /* profile name */
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index 0f9624306d9..a8db9ec6793 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.55 2011/04/16 10:52:22 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.56 2011/04/16 11:24:18 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -1286,35 +1286,6 @@ sock_execmsg(struct sock *f)
f->rstate = SOCK_RRET;
f->rtodo = sizeof(struct amsg);
break;
- case AMSG_GETCAP:
-#ifdef DEBUG
- if (debug_level >= 3) {
- sock_dbg(f);
- dbg_puts(": GETCAP message\n");
- }
-#endif
- if (f->pstate != SOCK_INIT) {
-#ifdef DEBUG
- if (debug_level >= 1) {
- sock_dbg(f);
- dbg_puts(": GETCAP, bad state\n");
- }
-#endif
- aproc_del(f->pipe.file.rproc);
- return 0;
- }
- AMSG_INIT(m);
- m->cmd = AMSG_GETCAP;
- m->u.cap.rate = f->dev->rate;
- m->u.cap.pchan = (f->opt->mode & MODE_PLAY) ?
- (f->opt->rpar.cmax - f->opt->rpar.cmin + 1) : 0;
- m->u.cap.rchan = (f->opt->mode & (MODE_PLAY | MODE_REC)) ?
- (f->opt->wpar.cmax - f->opt->wpar.cmin + 1) : 0;
- m->u.cap.bits = ADATA_BITS;
- m->u.cap.bps = sizeof(adata_t);
- f->rstate = SOCK_RRET;
- f->rtodo = sizeof(struct amsg);
- break;
case AMSG_SETVOL:
#ifdef DEBUG
if (debug_level >= 3) {