[sr-dev] git:master: modules_k/siptrace: Add time to x-headers

Daniel-Constantin Mierla miconda at gmail.com
Sat Aug 13 23:24:37 CEST 2011


Module: sip-router
Branch: master
Commit: 0e384ed123deb82f9ddaee6bace4dd5aa76845ec
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0e384ed123deb82f9ddaee6bace4dd5aa76845ec

Author: Tristan Bruns <bruns at decoit.de>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Aug  5 09:30:53 2011 +0200

modules_k/siptrace: Add time to x-headers

Signed-off-by: Tristan Bruns <bruns at decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda at gmail.com>

---

 modules_k/siptrace/siptrace.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules_k/siptrace/siptrace.c b/modules_k/siptrace/siptrace.c
index fc63e22..5869e27 100644
--- a/modules_k/siptrace/siptrace.c
+++ b/modules_k/siptrace/siptrace.c
@@ -526,10 +526,12 @@ static int sip_trace_xheaders_write(struct _siptrace_data *sto)
 	int bytes_written = snprintf(eoh, XHEADERS_BUFSIZE,
 		"X-Siptrace-Fromip: %.*s\r\n"
 		"X-Siptrace-Toip: %.*s\r\n"
+		"X-Siptrace-Time: %llu %llu\r\n"
 		"X-Siptrace-Method: %.*s\r\n"
 		"X-Siptrace-Dir: %s\r\n",
 		sto->fromip.len, sto->fromip.s,
 		sto->toip.len, sto->toip.s,
+		(unsigned long long)sto->tv.tv_sec, (unsigned long long)sto->tv.tv_usec,
 		sto->method.len, sto->method.s,
 		sto->dir);
 	if (bytes_written >= XHEADERS_BUFSIZE) {
@@ -594,12 +596,15 @@ static int sip_trace_xheaders_read(struct _siptrace_data *sto)
 	}
 
 	// Parse the x-headers: scanf()
+	long long unsigned int tv_sec, tv_usec;
 	if (sscanf(xheaders, "\r\n"
 			"X-Siptrace-Fromip: %50s\r\n"
 			"X-Siptrace-Toip: %50s\r\n"
+			"X-Siptrace-Time: %llu %llu\r\n"
 			"X-Siptrace-Method: %50s\r\n"
 			"X-Siptrace-Dir: %3s",
 			sto->fromip.s, sto->toip.s,
+			&tv_sec, &tv_usec,
 			sto->method.s,
 			sto->dir) == EOF) {
 		LM_ERR("sip_trace_xheaders_read: malformed x-headers\n");
@@ -607,6 +612,8 @@ static int sip_trace_xheaders_read(struct _siptrace_data *sto)
 	}
 	sto->fromip.len = strlen(sto->fromip.s);
 	sto->toip.len = strlen(sto->toip.s);
+	sto->tv.tv_sec = (time_t)tv_sec;
+	sto->tv.tv_usec = (suseconds_t)tv_usec;
 	sto->method.len = strlen(sto->method.s);
 
 	// Remove the x-headers: the message body is shifted towards the beginning




More information about the sr-dev mailing list