summaryrefslogtreecommitdiff
path: root/server/src/queryhandlerpentominos.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/queryhandlerpentominos.cc')
-rw-r--r--server/src/queryhandlerpentominos.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/server/src/queryhandlerpentominos.cc b/server/src/queryhandlerpentominos.cc
index 4b98768..9d39407 100644
--- a/server/src/queryhandlerpentominos.cc
+++ b/server/src/queryhandlerpentominos.cc
@@ -26,6 +26,8 @@
*/
#include "queryhandlerpentominos.h"
+#include "debug.h"
+
#include <config.h>
// For time
@@ -63,7 +65,6 @@ typedef struct {
unsigned short int count;
} UID;
-
#define SIOCGIFCONF 0x8912 // get iface list
static in_addr_t getIP(const char *interface)
@@ -157,9 +158,7 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
socket->write(header, strlen(header));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(header);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(queryhandler, header);
sprintf(buf, " <pentominos:entry cpr=\"%s\"\n"
" src_addr=\"%s\"\n"
@@ -180,9 +179,7 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(queryhandler, buf);
sprintf(buf, " <pentominos:query format=\"pracroxml\"\n"
" device_id=\"%s\"\n"
@@ -196,9 +193,7 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(queryhandler, buf);
sprintf(buf, "</artefact>");
@@ -206,10 +201,7 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
- fflush(stdout);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(queryhandler, buf);
QueryResult result;
@@ -220,14 +212,14 @@ QueryResult QueryHandlerPentominos::exec(Query &query)
// Read until we've got the entire result.
while((size = socket->read(buf, sizeof(buf))) > 0) {
- fwrite(buf, size, 1, stdout); fflush(stdout);
+ // fwrite(buf, size, 1, stdout); fflush(stdout);
if(parser.parse(buf, size)) break;
}
result = parser.result;
#endif/*WITHOUT_PENTOMINOS*/
- printf("Done handling query\n");
+ PRACRO_INFO(queryhandler, "Done handling query\n");
result.print();