summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-04-27 21:20:37 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-04-27 21:20:37 +0000
commit9491636254186651db93c19f61db8ec10bb16dfe (patch)
tree917eb2e0bdae7678112c5e546318e00696e4cd50 /usr.bin
parent6c680bdf200957b0ebc81425047938eed9603414 (diff)
move amsg.h containing protocol defs from aucat side to libsndio side.
requested by deraadt
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/aucat/Makefile4
-rw-r--r--usr.bin/aucat/amsg.h98
-rw-r--r--usr.bin/aucat/aucat.c3
-rw-r--r--usr.bin/aucat/conf.h9
4 files changed, 5 insertions, 109 deletions
diff --git a/usr.bin/aucat/Makefile b/usr.bin/aucat/Makefile
index fa6270b335f..ee125d29e39 100644
--- a/usr.bin/aucat/Makefile
+++ b/usr.bin/aucat/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.14 2010/07/31 08:48:01 ratchov Exp $
+# $OpenBSD: Makefile,v 1.15 2011/04/27 21:20:36 ratchov Exp $
PROG= aucat
SRCS= aucat.c abuf.c aparams.c aproc.c dev.c midi.c file.c headers.c \
siofile.c miofile.c sock.c pipe.c listen.c opt.c wav.c dbg.c
MAN= aucat.1 midicat.1
LINKS= ${BINDIR}/aucat ${BINDIR}/midicat
-CFLAGS+= -Wall -Wstrict-prototypes -Wundef -DDEBUG
+CFLAGS+= -Wall -Wstrict-prototypes -Wundef -DDEBUG -I${.CURDIR}/../../lib/libsndio
LDADD+= -lsndio
.include <bsd.prog.mk>
diff --git a/usr.bin/aucat/amsg.h b/usr.bin/aucat/amsg.h
deleted file mode 100644
index 2125c20abf2..00000000000
--- a/usr.bin/aucat/amsg.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $OpenBSD: amsg.h,v 1.21 2011/04/27 20:33:40 deraadt Exp $ */
-/*
- * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#ifndef AMSG_H
-#define AMSG_H
-
-#include <stdint.h>
-#include <sys/signal.h>
-#include "conf.h"
-
-/*
- * WARNING: since the protocol may be simultaneously used by static
- * binaries or by different versions of a shared library, we are not
- * allowed to change the packet binary representation in a backward
- * incompatible way.
- *
- * Especially, make sure the amsg_xxx structures are not larger
- * than 32 bytes.
- */
-struct amsg {
-#define AMSG_ACK 0 /* ack for START/STOP */
-#define AMSG_GETPAR 1 /* get the current parameters */
-#define AMSG_SETPAR 2 /* set the current parameters */
-#define AMSG_START 3 /* request the server to start the stream */
-#define AMSG_STOP 4 /* request the server to stop the stream */
-#define AMSG_DATA 5 /* data block */
-#define AMSG_POS 6 /* initial position */
-#define AMSG_MOVE 7 /* position changed */
-#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 */
- uint32_t cmd;
- uint32_t __pad;
- union {
- struct amsg_par {
- uint8_t legacy_mode; /* compat for old libs */
- uint8_t xrun; /* one of above */
- uint8_t bps; /* bytes per sample */
- uint8_t bits; /* actually used bits */
- uint8_t msb; /* 1 if MSB justified */
- uint8_t le; /* 1 if little endian */
- uint8_t sig; /* 1 if signed */
- uint8_t __pad1;
- uint16_t pchan; /* play channels */
- uint16_t rchan; /* record channels */
- uint32_t rate; /* frames per second */
- uint32_t bufsz; /* total buffered frames */
- uint32_t round;
- uint32_t appbufsz; /* client side bufsz */
- uint32_t _reserved[1]; /* for future use */
- } par;
- struct amsg_data {
-#define AMSG_DATAMAX 0x1000
- uint32_t size;
- } data;
- struct amsg_ts {
- int32_t delta;
- } ts;
- struct amsg_vol {
- uint32_t ctl;
- } vol;
- struct amsg_hello {
- uint16_t mode; /* bitmap of MODE_XXX */
-#define AMSG_VERSION 5
- uint8_t version; /* protocol version */
- uint8_t reserved1[5]; /* for future use */
- char opt[12]; /* profile name */
- char who[12]; /* hint for leases */
- } hello;
- } u;
-};
-
-/*
- * Initialize an amsg structure: fill all fields with 0xff, so the read
- * can test which fields were set.
- */
-#define AMSG_INIT(m) do { memset((m), 0xff, sizeof(struct amsg)); } while (0)
-
-/*
- * Since the structure is memset to 0xff, the MSB can be used to check
- * if any field was set.
- */
-#define AMSG_ISSET(x) (((x) & (1 << (8 * sizeof(x) - 1))) == 0)
-
-#endif /* !defined(AMSG_H) */
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index c03d41611fe..2f59d1eac6d 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.111 2011/04/27 17:58:43 deraadt Exp $ */
+/* $OpenBSD: aucat.c,v 1.112 2011/04/27 21:20:36 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -32,6 +32,7 @@
#include <unistd.h>
#include "abuf.h"
+#include "amsg.h"
#include "aparams.h"
#include "aproc.h"
#include "conf.h"
diff --git a/usr.bin/aucat/conf.h b/usr.bin/aucat/conf.h
index 3d70a2b8de9..f0d03aa9e0d 100644
--- a/usr.bin/aucat/conf.h
+++ b/usr.bin/aucat/conf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.h,v 1.20 2011/04/27 17:58:43 deraadt Exp $ */
+/* $OpenBSD: conf.h,v 1.21 2011/04/27 21:20:36 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -31,13 +31,6 @@ extern volatile sig_atomic_t debug_level;
#endif
/*
- * socket and option names
- */
-#define AUCAT_PATH "aucat"
-#define MIDICAT_PATH "midicat"
-#define DEFAULT_OPT "default"
-
-/*
* MIDI buffer size
*/
#define MIDI_BUFSZ 3125 /* 1 second at 31.25kbit/s */