#include <pulsecore/queue.h>
#include <pulsecore/log.h>
#include <pulsecore/core-scache.h>
+#include <pulsecore/creds.h>
#include "pstream.h"
/* packet info */
pa_packet *packet;
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
int with_creds;
- struct ucred creds;
+ pa_creds creds;
#endif
};
pa_memblock_stat *memblock_stat;
-#ifdef SCM_CREDENTIALS
- struct ucred read_creds, write_creds;
+#ifdef HAVE_CREDS
+ pa_creds read_creds, write_creds;
int read_creds_valid, send_creds_now;
#endif
};
pa_iochannel_socket_set_rcvbuf(io, 1024*8);
pa_iochannel_socket_set_sndbuf(io, 1024*8);
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
p->send_creds_now = 0;
p->read_creds_valid = 0;
#endif
pa_xfree(p);
}
-void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const struct ucred *creds) {
+void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_creds *creds) {
struct item_info *i;
assert(p && packet && p->ref >= 1);
i = pa_xnew(struct item_info, 1);
i->type = PA_PSTREAM_ITEM_PACKET;
i->packet = pa_packet_ref(packet);
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
if ((i->with_creds = !!creds))
i->creds = *creds;
#endif
i->channel = channel;
i->offset = offset;
i->seek_mode = seek_mode;
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
i->with_creds = 0;
#endif
p->write.descriptor[PA_PSTREAM_DESCRIPTOR_SEEK] = htonl(p->write.current->seek_mode);
}
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
if ((p->send_creds_now = p->write.current->with_creds))
p->write_creds = p->write.current->creds;
l = ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->write.index - PA_PSTREAM_DESCRIPTOR_SIZE);
}
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
if (p->send_creds_now) {
if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_creds)) < 0)
l = ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) - (p->read.index - PA_PSTREAM_DESCRIPTOR_SIZE);
}
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
{
int b = 0;
assert(p->read.packet);
if (p->recieve_packet_callback)
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
p->recieve_packet_callback(p, p->read.packet, p->read_creds_valid ? &p->read_creds : NULL, p->recieve_packet_callback_userdata);
#else
p->recieve_packet_callback(p, p->read.packet, NULL, p->recieve_packet_callback_userdata);
}
p->read.index = 0;
-#ifdef SCM_CREDENTIALS
+#ifdef HAVE_CREDS
p->read_creds_valid = 0;
#endif
}