summaryrefslogtreecommitdiffstats
path: root/test/rctest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/rctest.c')
-rw-r--r--test/rctest.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/rctest.c b/test/rctest.c
index 1ee4827b..2e366c72 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -79,6 +79,7 @@ static int encrypt = 0;
static int secure = 0;
static int socktype = SOCK_STREAM;
static int linger = 0;
+static int timestamp = 0;
static float tv2fl(struct timeval tv)
{
@@ -100,6 +101,17 @@ static int do_connect(char *svr)
return -1;
}
+ /* Enable SO_TIMESTAMP */
+ if (timestamp) {
+ int t = 1;
+
+ if (setsockopt(sk, SOL_SOCKET, SO_TIMESTAMP, &t, sizeof(t)) < 0) {
+ syslog(LOG_ERR, "Can't enable SO_TIMESTAMP: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+ }
+
/* Enable SO_LINGER */
if (linger) {
struct linger l = { .l_onoff = 1, .l_linger = linger };
@@ -254,6 +266,17 @@ static void do_listen(void (*handler)(int sk))
ba, conn.hci_handle,
conn.dev_class[2], conn.dev_class[1], conn.dev_class[0]);
+ /* Enable SO_TIMESTAMP */
+ if (timestamp) {
+ int t = 1;
+
+ if (setsockopt(sk, SOL_SOCKET, SO_TIMESTAMP, &t, sizeof(t)) < 0) {
+ syslog(LOG_ERR, "Can't enable SO_TIMESTAMP: %s (%d)",
+ strerror(errno), errno);
+ goto error;
+ }
+ }
+
/* Enable SO_LINGER */
if (linger) {
struct linger l = { .l_onoff = 1, .l_linger = linger };
@@ -448,7 +471,8 @@ static void usage(void)
"\t[-A] request authentication\n"
"\t[-E] request encryption\n"
"\t[-S] secure connection\n"
- "\t[-M] become master\n");
+ "\t[-M] become master\n"
+ "\t[-T] enable timestamps\n");
}
int main(int argc, char *argv[])
@@ -458,7 +482,7 @@ int main(int argc, char *argv[])
bacpy(&bdaddr, BDADDR_ANY);
- while ((opt=getopt(argc,argv,"rdscuwmnb:i:P:B:N:MAESL:C:D:")) != EOF) {
+ while ((opt=getopt(argc,argv,"rdscuwmnb:i:P:B:N:MAESL:C:D:T")) != EOF) {
switch (opt) {
case 'r':
mode = RECV;
@@ -548,6 +572,10 @@ int main(int argc, char *argv[])
delay = atoi(optarg) * 1000;
break;
+ case 'T':
+ timestamp = 1;
+ break;
+
default:
usage();
exit(1);