From 0c998ea23f2962dc46be556fde138724bfc7cd6d Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Fri, 30 Oct 2009 23:30:34 +0000 Subject: [PATCH] sample code responding to statistics requests git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@270 e5f2f494-b856-4b98-b285-d166d9295462 --- src/bin/parkinglot/ccsession.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/bin/parkinglot/ccsession.cc b/src/bin/parkinglot/ccsession.cc index cfb8d20241..1c4e5546bb 100644 --- a/src/bin/parkinglot/ccsession.cc +++ b/src/bin/parkinglot/ccsession.cc @@ -58,3 +58,21 @@ CommandSession::getCommand() { return std::pair("unknown", ""); } + +void +handleStatRequest() +{ + ISC::Data::ElementPtr ep, routing, data; + + session.group_recvmsg(routing, data, false); + ep = data->get("command"); + if (ep != NULL && ep->string_value() == "getstat") { + struct timeval now; + ElementPtr resp = Element::create(std::map()); + gettimeofday(&now, NULL); + resp->set("sent", Element::create(now.tv_sec + + (double)now.tv_usec / 1000000)); + resp->set("counter", Element::create(++counter)); + session.group_sendmsg(resp, "statistics"); + } +}