2004-07-16 19:16:42 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-06-23 23:17:30 +00:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2004-07-16 18:58:23 +00:00
|
|
|
#include "native-common.h"
|
2004-06-23 23:17:30 +00:00
|
|
|
#include "pstream-util.h"
|
|
|
|
|
|
2004-07-03 23:35:12 +00:00
|
|
|
void pa_pstream_send_tagstruct(struct pa_pstream *p, struct pa_tagstruct *t) {
|
2004-06-23 23:17:30 +00:00
|
|
|
size_t length;
|
|
|
|
|
uint8_t *data;
|
2004-07-03 23:35:12 +00:00
|
|
|
struct pa_packet *packet;
|
2004-06-23 23:17:30 +00:00
|
|
|
assert(p && t);
|
|
|
|
|
|
2004-07-03 23:35:12 +00:00
|
|
|
data = pa_tagstruct_free_data(t, &length);
|
2004-06-23 23:17:30 +00:00
|
|
|
assert(data && length);
|
2004-07-03 23:35:12 +00:00
|
|
|
packet = pa_packet_new_dynamic(data, length);
|
2004-06-23 23:17:30 +00:00
|
|
|
assert(packet);
|
2004-07-03 23:35:12 +00:00
|
|
|
pa_pstream_send_packet(p, packet);
|
|
|
|
|
pa_packet_unref(packet);
|
2004-06-23 23:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-03 23:35:12 +00:00
|
|
|
void pa_pstream_send_error(struct pa_pstream *p, uint32_t tag, uint32_t error) {
|
|
|
|
|
struct pa_tagstruct *t = pa_tagstruct_new(NULL, 0);
|
2004-06-23 23:17:30 +00:00
|
|
|
assert(t);
|
2004-07-03 23:35:12 +00:00
|
|
|
pa_tagstruct_putu32(t, PA_COMMAND_ERROR);
|
|
|
|
|
pa_tagstruct_putu32(t, tag);
|
|
|
|
|
pa_tagstruct_putu32(t, error);
|
|
|
|
|
pa_pstream_send_tagstruct(p, t);
|
2004-06-23 23:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-03 23:35:12 +00:00
|
|
|
void pa_pstream_send_simple_ack(struct pa_pstream *p, uint32_t tag) {
|
|
|
|
|
struct pa_tagstruct *t = pa_tagstruct_new(NULL, 0);
|
2004-06-23 23:17:30 +00:00
|
|
|
assert(t);
|
2004-07-03 23:35:12 +00:00
|
|
|
pa_tagstruct_putu32(t, PA_COMMAND_REPLY);
|
|
|
|
|
pa_tagstruct_putu32(t, tag);
|
|
|
|
|
pa_pstream_send_tagstruct(p, t);
|
2004-06-23 23:17:30 +00:00
|
|
|
}
|