summaryrefslogtreecommitdiffstats
path: root/src/pstream-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-06-23 23:17:30 +0000
committerLennart Poettering <lennart@poettering.net>2004-06-23 23:17:30 +0000
commitacb25b35102dfca08f66e155560f6c99cb8fa841 (patch)
tree2ae84c77727548a15eabbe5ad624dc1fd29af30b /src/pstream-util.c
parenteecf602476ff5b51bdc08f8fd0e4aa70d2b0ef5a (diff)
main part of the native protocol
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@31 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pstream-util.c')
-rw-r--r--src/pstream-util.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pstream-util.c b/src/pstream-util.c
new file mode 100644
index 00000000..2fab2b61
--- /dev/null
+++ b/src/pstream-util.c
@@ -0,0 +1,35 @@
+#include <assert.h>
+
+#include "protocol-native-spec.h"
+#include "pstream-util.h"
+
+void pstream_send_tagstruct(struct pstream *p, struct tagstruct *t) {
+ size_t length;
+ uint8_t *data;
+ struct packet *packet;
+ assert(p && t);
+
+ data = tagstruct_free_data(t, &length);
+ assert(data && length);
+ packet = packet_new_dynamic(data, length);
+ assert(packet);
+ pstream_send_packet(p, packet);
+ packet_unref(packet);
+}
+
+void pstream_send_error(struct pstream *p, uint32_t tag, uint32_t error) {
+ struct tagstruct *t = tagstruct_new(NULL, 0);
+ assert(t);
+ tagstruct_putu32(t, PA_COMMAND_ERROR);
+ tagstruct_putu32(t, tag);
+ tagstruct_putu32(t, error);
+ pstream_send_tagstruct(p, t);
+}
+
+void pstream_send_simple_ack(struct pstream *p, uint32_t tag) {
+ struct tagstruct *t = tagstruct_new(NULL, 0);
+ assert(t);
+ tagstruct_putu32(t, PA_COMMAND_REPLY);
+ tagstruct_putu32(t, tag);
+ pstream_send_tagstruct(p, t);
+}