diff --git a/test/rctest.c b/test/rctest.c
index 9754f52..b8acfb7 100644
--- a/test/rctest.c
+++ b/test/rctest.c
static int linger = 0;
static int timestamp = 0;
static int defer_setup = 0;
+static int priority = -1;
static float tv2fl(struct timeval tv)
{
//goto error;
}
- syslog(LOG_INFO, "Connected [handle %d, class 0x%02x%02x%02x]",
- conn.hci_handle,
- conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
+ if (priority > 0 && setsockopt(sk, SOL_SOCKET, SO_PRIORITY, &priority,
+ sizeof(priority)) < 0) {
+ syslog(LOG_ERR, "Can't set socket priority: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
+ if (getsockopt(sk, SOL_SOCKET, SO_PRIORITY, &opt, &optlen) < 0) {
+ syslog(LOG_ERR, "Can't get socket priority: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
+ syslog(LOG_INFO, "Connected [handle %d, class 0x%02x%02x%02x, "
+ "priority %d]", conn.hci_handle, conn.dev_class[2],
+ conn.dev_class[1], conn.dev_class[0], opt);
return sk;
goto error;
}
+ if (priority > 0 && setsockopt(sk, SOL_SOCKET, SO_PRIORITY, &priority,
+ sizeof(priority)) < 0) {
+ syslog(LOG_ERR, "Can't set socket priority: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
/* Listen for connections */
if (listen(sk, 10)) {
syslog(LOG_ERR,"Can not listen on the socket: %s (%d)",
//goto error;
}
+ optlen = sizeof(priority);
+ if (getsockopt(nsk, SOL_SOCKET, SO_PRIORITY, &opt, &optlen) < 0) {
+ syslog(LOG_ERR, "Can't get socket priority: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+
ba2str(&addr.rc_bdaddr, ba);
- syslog(LOG_INFO, "Connect from %s [handle %d, class 0x%02x%02x%02x]",
- ba, conn.hci_handle,
- conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
+ syslog(LOG_INFO, "Connect from %s [handle %d, "
+ "class 0x%02x%02x%02x, priority %d]",
+ ba, conn.hci_handle, conn.dev_class[2],
+ conn.dev_class[1], conn.dev_class[0], opt);
#if 0
/* Enable SO_TIMESTAMP */
"\t[-N num] number of frames to send\n"
"\t[-C num] send num frames before delay (default = 1)\n"
"\t[-D milliseconds] delay after sending num frames (default = 0)\n"
+ "\t[-Y priority] socket priority\n"
"\t[-A] request authentication\n"
"\t[-E] request encryption\n"
"\t[-S] secure connection\n"
bacpy(&bdaddr, BDADDR_ANY);
- while ((opt=getopt(argc,argv,"rdscuwmnb:i:P:U:B:N:MAESL:W:C:D:T")) != EOF) {
+ while ((opt=getopt(argc,argv,"rdscuwmnb:i:P:U:B:N:MAESL:W:C:D:Y:T")) != EOF) {
switch (opt) {
case 'r':
mode = RECV;
delay = atoi(optarg) * 1000;
break;
+ case 'Y':
+ priority = atoi(optarg);
+ break;
+
case 'T':
timestamp = 1;
break;