diff options
Diffstat (limited to 'server/src/queryhandler.cc')
-rw-r--r-- | server/src/queryhandler.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/server/src/queryhandler.cc b/server/src/queryhandler.cc index cd96b03..573ce3a 100644 --- a/server/src/queryhandler.cc +++ b/server/src/queryhandler.cc @@ -153,7 +153,11 @@ std::string QueryHandler::exec() " xmlns:pentominos=\"http://www.aasimon.org/pentominos\"\n" " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" " xsi:schemaLocation=\"http://www.aasimon.org/pentominos schema.xsd\">\n"; +#ifndef WITHOUT_PENTOMINOS socket->write(header, strlen(header)); +#else + printf(header); +#endif/*WITHOUT_PENTOMINOS*/ sprintf(buf, " <pentominos:entry cpr=\"%s\"\n" " src_addr=\"%s\"\n" @@ -161,11 +165,20 @@ std::string QueryHandler::exec() " timestamp=\"%d\"\n" " uid=\"%s\"/>\n", cpr.c_str(), +#ifndef WITHOUT_PENTOMINOS socket->srcaddr().c_str(), socket->dstaddr().c_str(), +#else + "127.0.0.1", + "127.0.0.1", +#endif/*WITHOUT_PENTOMINOS*/ (unsigned int)timestamp, uid.c_str()); +#ifndef WITHOUT_PENTOMINOS socket->write(buf, strlen(buf)); +#else + printf(buf); +#endif/*WITHOUT_PENTOMINOS*/ std::vector< Query >::iterator j = queries.begin(); while(j != queries.end()) { @@ -179,27 +192,38 @@ std::string QueryHandler::exec() query.attributes["class"].c_str(), query.attributes["class"].c_str()); +#ifndef WITHOUT_PENTOMINOS socket->write(buf, strlen(buf)); +#else + printf(buf); +#endif/*WITHOUT_PENTOMINOS*/ j++; } sprintf(buf, "</artefact>\n"); - socket->write(buf, strlen(buf)); +#ifndef WITHOUT_PENTOMINOS + socket->write(buf, strlen(buf)); // Terminate char term[] = "\0"; socket->write(term, 1); +#else + printf(buf); +#endif/*WITHOUT_PENTOMINOS*/ + std::string answer; + +#ifndef WITHOUT_PENTOMINOS // Wait for answer char abuf[64]; int res; - std::string answer; do { memset(abuf, 0, sizeof(abuf)); res = socket->read(abuf, sizeof(abuf) - 1); answer += abuf; } while(res); +#endif/*WITHOUT_PENTOMINOS*/ return answer; } |